Converting a javascript folder to python - python

So I know js2py is a thing but I'm not entirely sure if you can convert an entire folder? I only know how to use python and being able to convert the language would be extremely helpful for me, I'm trying to make a twitch chat bot however moderation commands and configuration is difficult for me and the destinygg chat bot is insanely good and being able to use it would be amazing. https://github.com/destinygg/chat-bot
If this is not possible I understand however its worth a shot to ask how/if I guess :)

No, it supports translating a file but not a folder.
But you can enumerate the files in your folder and translate them one-by-one, using:
js2py.translate_file('example.js', 'example.py')

Related

how can i make a database for pycord?

I'm currently programming a Discord Bot. I'm pretty new to pycord and I wanted to make a command that saves a str in a databasel
if anyone could show an example for it i`ll be so happy
i tried using SQlite but i couldnt find any good tutorials on it
Py-cord is pretty irrelevant in this question, as you can use pretty much any database that you want.
A good alternative to SQlite would be pymongo. It's very simple, and you can learn it pretty quickly. It's also free.
If you want something locally stored, just use JSON. It's the quickest way to develop a storage system.

Is there a way to use Pyhton in websites?

I need to make a very specific program to calculate text RPG results based on user inputs, currently Im making it in Python because thats what I know to use, but we play in a website and most players dont have any program to use Python and some even play on their phones, is there any way to play it on a website?
I've looked for ways and most sources said I need to convert it to HTML or another language like C or C++, but I dont even know how to do this and the auto-converters I've tried didnt worked. Jupyter Notebook also wouldnt work because some of the players doesnt know how to use it and it would be too hard to teach them all.
Is there ANY way to keep it in Python and use it on a website?
You can use any python web framework and host it.
If you are a beginner, I recommend you to use Flask framework and try hosting it in https://www.pythonanywhere.com/

Python Reading Specific Parts of the screen and Taking actions Based on them

i am kind of new to Python and trying to learn the language the best i can. Right now i am having a problem of trying to automate something. I dont know how i should
What i am trying to automate I was trying to make the Programm being able to Read the value of how much Food, Wood etc is in the Storage right now(maybe also know if the storage is full or not) If it is full, or has reached the value needed to upgrade the storage for Food for ecaple, then it should do so.
I was thinking at first of how it should know that the storage is full, should be done by using pyautogui using but i am unsure...i am sorry that this is such a long massage and i dont know if you guys understand what i am trying to explain,...if not so, just ask
Python does not recognize (nor know) the value of the characters for this type of automation it is recommended to use an image recognition library. (I Recommend Opencv) and for clicking on the screen you can use pyput.
Opencv Link: https://pypi.org/project/opencv-python/
Pyput Link: https://pypi.org/project/pynput/
and you can also watch the following project since it can help you get started.
https://www.youtube.com/watch?v=vXqKniVe6P8

Safety/Encryption for python script (bot)

I built a python script (bot) for a game and I do plan on building a GUI for it to make it more user friendly. However I wanted to add some sort of security along with it, something that would only give access to whoever I want, so maybe adding some kind of encryption key to it, I was thinking something along the lines of an encrypted key to unlock the files and with limited use(a few days for example). I am new when it comes to this specific 'security' topic, so I need help better understanding what my options are and what I can do or search for. Thank you for reading.
after days of searching and trying I figured the easiest way was to use a web API to check requests, you can use for example cryptolens web api or any other api and your encrypted file will work just fine.

python lib for facebook instagram

I'm using a raspberry b+ to create some files that i would like to post on FB and Instagram (my account or any account).
I have a good industrial computer bckground but not for the "cloud" stuff.
I seen the libs for python to connect to facebook and to instagram.
(facebook-sdk, python-instagram).
I understand the code of the examples etc...
I'm just missing the context of where should I put this code to be able to interact with these "social media" sites.
Could it work just with a UPLOADER.py ?
Or do I need to set up like a webserver ? Do i need the Json.simple/google and so on ?
I understand if it's a dumb question, but I'm a bit lost...
Few "architectural" directions will do :). I'll get to understand the technical parts bymyself...
Thanks in advance!
Cheers,
Mat
You can set them up on "any" OS. Just make sure you have an internet connection. Also note, that those libraries wan't do anything unless you write the code. So you need to create a lightweight wrapper, that would pass credentials and triggers necessary functions, in a certain order. And that's pretty much it.
Could it work just with a UPLOADER.py ?
Not sure what you referring to.
Or do I need to set up like a webserver ?
No. You dont. It's not a requirements for the library.
Do i need the Json.simple/google
Take a look at the file called requirements.txt it provides a set of libraries you need to have in addition to the standart/builtin libs.

Categories