Discord bot with python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Discord bot with python

Can you code discord bot with python ON MOBILE?

10th Mar 2022, 4:27 PM
Yug
Yug - avatar
8 Answers
+ 4
Yeeeeeees..... on mobile. 1. Use repl.it 2. repl.it has opportunities to hide the key 3. you have to code it as a webserver. Repl.it has opportunities to create the webserver but stops it after being passive for more than 1 hour. Therefore 4. U need a service to ping the server let's say every 20 minutes. (Google it)
10th Mar 2022, 6:05 PM
Oma Falk
Oma Falk - avatar
+ 4
A simple code on repl.it stops after closing it. That's why u need the webserver, it will be online after closing repl.it or shut down your mobile. But also that webserver will shut down after being inactive for more than one hour. That's why u need to ping it periodically.
10th Mar 2022, 6:12 PM
Oma Falk
Oma Falk - avatar
+ 3
yes you can code using libraries like discord.py (depreciated), disnake, nextcord etc.
10th Mar 2022, 4:30 PM
Blank
Blank - avatar
+ 3
Yug repl.it makes the bot active forever if you have the hacker plan
11th Mar 2022, 4:22 PM
iTachi
iTachi - avatar
+ 1
Oma Falk what's web server? Is repl.it makes the bot active forever or we have to do something for it?
10th Mar 2022, 6:08 PM
Yug
Yug - avatar
+ 1
But repl.it lags on android, what I do is that I code my bot in "pydroid" app from play store and then if it works good, I host it on replit
16th Mar 2022, 4:06 PM
Blank
Blank - avatar
0
Blank on mobile?
10th Mar 2022, 5:29 PM
Yug
Yug - avatar
0
Using Termux is worth it if you follow instructions. Maybe perform pkg commands before pip commands. Using Termux on phone. These instructions an attempt to avoid pydroid stopping when ads pop up and screen is off copy ur bot code and the font.ttf file to the Alarms folder, and the apikey.json file. Open keyboard settings and DISABLE all auto-complete stuff!!! pkg full-upgrade pkg install python3 pip install --upgrade pip pip install wheel pkg install libjpeg-turbo pkg install freetype pip3 install discord.py pip3 install requests pip3 install colour pkg install coreutils pkg install nodejs termux-setup-storage npm install -g nodemon pkg install zstd ****notes, i got lost trying to make Pillow work, this should be the correct command below LDFLAGS="-L/system/lib/" CFLAGS="-I/data/data/com.termux/files/usr/include/" pip3 install Pillow ***Note: If you are using an aarch64 device, set the LDFLAGS flag to "-L/system/lib64/" pkg install python make wget termux-exec clang libjpeg-turbo freetype -y env INCLUDE="$PREFIX/include" LDFLAGS=" -lm" pip install Pillow pkg install build-essential clang make pkg-config MATHLIB="m" pip install pandas ****the pandas takes a LONG time******** pkg install libxml2 pkg install libxslt pkg install lxml ****yfinance might also take a long time***** pip3 install yfinance ********should be ready to run the bot then any time u open termux u can run bot by cd /storage/emulated/0/Alarms python3 stock.py server or /storage/emulated/0/Alarms/python3 stock.py server **** dont purge ur pip unless u mess up and need to reinstall stuff pip3 cache dir <-- displays location to pip3 cache folder, cd there and clear it if u need to reinstall something pip3 cache remove pillow pip3 cache purge *****this stuff keeps it on when screen is off termux-wake-lock termux-wake-unlock can be used to trigger a wakelock which causes Android not to go into deep sleep. Since the default login shell is bash;
7th Dec 2022, 9:52 PM
S May
S May - avatar