Skip to content

dst212/dst212bot

Repository files navigation

dst212bot

Try this bot out at dst212bot.t.me. Updates and other bots at dst212botnews.t.me.

Note that this is just a random project which offers commands I often need when I'm using Telegram. Also, I don't like the snek, but pyrogram is cool.

Relevant commands

  • help - Get further info about command usage.
  • settings - Customize bot's preferences.
  • translate - Translate a message into another language.
  • tts - Text to speech.
  • qr - Create or read a qr code.
  • wordfor - Get a word by an input definition.
  • pokemon - Data about Pokémon.
  • encode - Encode input text from and into binary, base64 or simple text.
  • score - Manage the scores created in a chat.
  • counter - Manage the counters created in a chat.
  • random - Generate a random number.
  • pickrandom - Pick a random item from a list.
  • shuffle - Randomize input text.
  • say - Make the bot say something.
  • len - Get the length of a message.
  • imdumb - Raise your intelligence beyond all boundaries.
  • credits - Show credits.

Commands inherited from pyrogram-misc:

  • id - Retrieve ID of current chat, message, sender.
  • ping - Ping the bot.
  • inspect - Get a JSON format of the quoted message.
  • feedback - Contact the bot owner.
  • sudo - Manipulate the bot (admins only).

Setup

First, clone the repo recursively:

git clone --recursive https://github.com/dst212/dst212bot

Install the required python packages (maybe into a virtual environment):

python3 -m venv env
source env/bin/activate
python3 -m pip install -r requirements.txt

Ensure having a bot token provided by BotFather and an API key (required by pyrogram) which can be set at my.telegram.org.

Create a file named keys.py in the root folder of the repository and put the bot token and the API key in there, so as to make it look like this:

TOKEN = "0123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi"
API_ID = "12345678"
API_HASH = "c2306f38edaeb5694c37cdf52b7d573d"

The bot configuration is held in config.py:

BOTNAME = "dst212bot"  # You can put whatever name you want here
ADMINS = [448025569]  # Your Telegram ID here (you can get it with /id, until then you can leave this blank)
LOG_CHAT = -100123456789  # Chat you'd like to receive logs in
SUPPORT_CHAT = ADMINS[0]  # Chat where /feedback will forward messages

You can also use topics as log or support chats! Send /id on the desired topic and use the "Chat" ID and "Reply to" ID:

...
LOG_CHAT = [-100123456789, 54]  # The first number is a supergroup ID, the second one is the ID of the topic
...

To start the bot, just launch the main.py script:

# source env/bin/activate # Ensure you had already done this before
./main.py

Other notes

The TODO list is just there to make the project look professional (even though it isn't) and it serves as a common TODO list. You may want to check it out and you may suggest new features too (any constructive criticism is welcome, you can yell at me through any of my contacts available here) or directly on Telegram (@dst212) or via /feedback through the bot.

Credits

Used libraries:

Data sources: