Preface#
Can you help me write?
Important
The behavior of UserBot may be abused by Telegram officials, please consider the potential risks carefully.
Preparation#
- Telegram Bot Token
- Telegram API Key
- One Telegram account
- One server (recommended 2c2g)
Note
Please select the DC location for Player and Bot based on the location of your server, otherwise it may result in a poor experience.
- One smart brain
- One nimble hand
Environment Preparation#
- Ubuntu Server 22.04
- MongoDB 7.0
- Python 3.9
Environment Installation#
MongoDB#
Please refer to the MongoDB official website for installation.
After installation, you need to manually start it.
systemctl start mongod
systemctl enable mongod
Python#
Please refer to the internet for instructions on installing Python 3.9 on Ubuntu 20.04. You can search on Baidu, Google, Bing, Sogou, or 360.
Get TG API Key#
As mentioned before, directly refer to the previous tutorial for instructions.
Note
If you already have the API ID and API Hash, please skip this step.
First, open the Telegram official website.
Enter the phone number associated with your Telegram account (in international format, such as +8618911451919).
Then enter the verification code you received to log in.
Then click on "API development tools".
Then come to this page and fill in the information as required.
Then we will get this string.
Take note of it and we will use it later.
Note
If you encounter an ERROR when clicking "Create application", it may be due to bad luck. It is recommended to try different nodes or devices. If it still doesn't work, you can beg others for help. (When I wrote this tutorial in August 2022, APIs could be easily obtained. Today, I couldn't get it even after changing two accounts wwwww)
Start Installation#
Get#
First, clone the repository.
git clone https://github.com/TeamYukki/YukkiMusicBot.git
cd YukkiMusicBot
Accounts#
Here, you need a Bot and a normal Telegram account.
Add them to the same group as the log group and set them as administrators (give them full control). Then, take note of the group ID (with a "-" sign).
In this group, turn on video chat (after turning it on, you can exit without clicking "End").
Get String Session#
Find @MaybexSessionBot.
After entering, click on "Pyrogram".
Then enter your API ID and API HASH as prompted.
Then enter the phone number of the prepared account.
Then you will receive a verification code.
When sending the code, leave a space before the code.
When you see this, it means it was successful.
Open the "Saved Message" of the account and take note of this string. We will use it later.
Configuration#
Go back to the server.
cp sample.env .env
Open .env
with your favorite editor.
Then fill in the information according to my comments.
After filling in, save and exit.
Of course, you can also fill in the Spotify API according to this.
For more parameters, see here.
Installation#
cp .env .env.bak
./setup
When prompted, enter "y" and press Enter.
When you reach this step, press Ctrl + C
.
After that, enter the following commands.
rm .env
cp .env.bak .env
Then enter ./start
to start!
If you see this, it means it started successfully. You can use screen or similar tools to keep it running persistently.
By the way, if you encounter an error after pressing Ctrl + C to stop the Bot,
Delete YukkiMusicBot.session
and run it again.
Go ahead and give it a try!
Conclusion#
In addition, here is a list of reference commands (you can set Bot Commands in BotFather).
start - Start
play - Play audio
vplay - Play video
cplay - Play in all channels
playlist - Show playlist
skip - Skip the current track
stop - Stop playing
loop - Loop (number of times)
ping - Are you alive?
speedtest - One-click show-off (only for Sudo users)
reboot - Reboot (only for Sudo users)
This concludes the tutorial. If it has been helpful to you, feel free to share it with others~