doggoreportbot
v5.0.3
Published
Telegram bot
Downloads
4
Readme
🐶 DoggoReportBot 🐾
A Telegram bot coded in NodeJS, which allows admins of a channel to communicate with several users by using the bot as an intermediary.
⚙️ How to run the bot
Requirements to run the bot: NodeJS. If you are unsure which version to choose, you should probably stick with the LTS version.
- Read Dev Infos below (do not skip this step)
- If you don't have git, install it
- Clone the repo executing:
git clone https://github.com/Croluy/DoggoReportBot
(check this for troubleshooting) - Create a
.env
file inside the root directory of the bot - Insert your infos in your local
.env
file - Set
bot_test
tofalse
in your localindex.js
file - In your terminal, navigate to the root directory of the bot
- Execute
npm start
If you have set up the bot correctly you should get a message from it asking you if the channel name is correct. You should also see that the bot sent a message to the log channel informing you it is online.
💻 Dev Infos
⚠️ IMPORTANT I have excluded some files when uploading the project to GitHub. Those include data I won't disclose publicly for obvious reasons. You will have to manually create and insert that data inside the ".env" file. I have prepared a template file that you can copy-paste inside your .env file and down below you have a description of each line so you know how it has to be edited.
- Bot Token: It is the token of the bot provided to you by BotFather on Telegram. It is a secret code that gives full access to the bot. Has to be in quotes (or double quotes):
"
. - Creator ID: Your Telegram ID. You can get your ID with this tutorial or just Google "get personal telegram id".
- Creator Name: It is your Telegram name/username. Has to be in quotes (or double quotes):
"
. - Log Channel: ID of the channel where the bot will log its more important actions. You have to be creator of this channel and to get its ID you can use this tutorial or just Google "get telegram channel id".
- Channel Name: It is the name of the channel linked to your bot. NOT the log channel but the channel this bot is linked. Has to be in quotes (or double quotes):
"
.
When running the bot be sure to set the variable bot_test
to false
in "index.js". That will deny the bot from skipping some initial steps that I've preferred ignoring during development process.
This will also create 2 JSON files on your local machine:
- blacklist.json --> it saves a list of all users banned from the bot;
- admins.json --> this file saves a list of all the admins of the bot.
Do NOT delete or manually modify these files unless you know what you're doing!
If you have messed up any of those files and can't restore them, you will have to fully reset them:
- Stop the bot execution if it's currently running;
- Delete both
blacklist.json
andadmins.json
files; - Make sure
bot_test
variable in "index.js" is set tofalse
; - Run the bot again.
After executing this steps the two files will be restored, but all the previous saved infos (such as admin or banned users) will be lost. You will have to promote again all the users you want as admins and ban again all users you have previously banned.
All the messages that the bot sends to users and admins are stored in "BotReplies.json".
The JSON is organized following a Tree Structure where the roots are functions
and index
and each of them represents a JS file ("index.js" and "functions.js").
Both roots have a list of children named the same as that file's functions where messages are sent from the bot to anyone. This allows the project to be more organized.
If you wish to edit some of those messages, ideally you should only be editing BotReplies.json
avoiding to create bugs inside the other files where functions are implemented.
🧬 Features
When an user sends any message to the bot, that message will be forwarded to all the current Administrators. That's right! This bot supports multiple admins. Not only that, but there are 3 diffent ranks of Administrators:
- 👑 Bot's Owner (also mentioned as Creator) is the highest rank and has access to ALL the commands, there can only be 1 Bot Owner;
- 💎 Superior Administrator it's the max rank any user (who isn't Bot's Owner) can aspire to, it has a high amount of available commands;
- 👮♀️ Administrator is a user who has Ban power over normal users.
Administrators can reply to users by simply using the reply function of Telegram. When that happens, said reply will be forwarded to all the other Administrators of the bot also.
If users restrict their forwarding privacy setting, the bot has to use some tricks to get around the problem as some functions might work slightly diffentely than normal. Having this said, at the moment, ALL of the features and commands of this bot are usable even with this category of users.
If any errors occour during the use of the bot, it will log those errors on a log channel you've chosen, which is different from the channel this bot is supposed to be linked with. The Telegram log channel has to be created manually by you and it should only be visible to people you have granted Administrator permission to.
💡 Commands
You can get a list of all the commmands available to you by running /commands
in the bot chat.
I have listed the most useful commands below and I've used emojis to also show what kind of rank is required for that command to work.
Obviously all lower ranked commands can be executed by higher ranked Administrators too.
👮♀️ Ban OR Terminate: ban any user who texts the bot and their messages will be completely ignored until you choose to Unban said user. You can Ban only by replying to user's message.
👮♀️ Unban: unban an user that has previously been banned from using the bot. It allows said user to be able to use the bot again. You can Unban by either replying to user's message OR by using the user's ID.
👮♀️ Blacklist: show a list of all users who are Banned from the bot. You can run Blacklist command only by typing it in bot's chat as a normal message.
💎 Adminlist: show a list of all Administrators of the bot. You can run Adminlist command only by typing it in bot's chat as a normal message.
💎 Admin: promote a normal user to Admininistrator. You can run Admin only by replying to user's message.
💎 Unadmin OR Demote: demote users of their current Administrator rank to the lower rank. Obviously if you are a Superior Admin you can only demote Admins back to users, but you can't demote other Superior Admins. You can Demote by either replying to user's message OR by using the user's ID.
💎 Info: gather some infos about a specific user. Those include: ID, Full Name, Username (if any) and Language code. You can run Info only by replying to user's message.
💎 SetUsername: set the username of the channel this bot is linked to. You can run this command followed by the new username of the linked channel.
👑 Promote OR Superior: grant an Administrator the Superior Administrator rank. You can run this command followed by Admin's ID.
👑 ResetAdmins: resets the list of ALL the admins by removing every single one of them except the Bot's Owner. You can run Blacklist command only by typing it in bot's chat as a normal message.
📄 Credits:
:rocket: Created and Maintained by Croluy