- Disable battery optimization for termux
- Install termux:widgets plugin from GitHub (optional)
- Install python and git using
pkg i python git
- Install virtualenv using system pip
- Clone your bot's code or copy it from your device storage
by first setting up file access using
termux-setup-storage
. - Create a venv for your project
- Install all dependencies including hikari using the venv pip
Do not install uvloop as that doesn't work well with termux.
- Now, try running your bot. If it works, then you can follow the optional instructions.
Make sure that termux:widgets is installed.
Look up the relevant linux commands by yourself. You should atleast know basic shell navigation and how ton use a console based text editor to use termux.
- Create a
.shortcuts
folder andicons
folder inside it. - Copy your bot's discord avatar and place it in icons folder (by copying from storage/downloads).
- Now, make a shell script with the name of your bot alone and make it executable by chmod.
Here, add initialization code for the bot with the shebang at the top of file as
#!/data/data/com.termux/files/usr/bin/sh
- Now go to your home screen and long press to add a widget -> Select termux:widgets -> Select your shell script for bot init.
Now you have a custom icon on homescreen which you can tap on to turn on your bot with a single tap. This is extremely useful in case of aggressive app killers like Samsung. (even with battery opt off for termux)
Good