Giter Club home page Giter Club logo

doggoreportbot's Introduction

๐Ÿถ 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.

  1. Read Dev Infos below (do not skip this step)
  2. If you don't have git, install it
  3. Clone the repo executing: git clone https://github.com/Croluy/DoggoReportBot (check this for troubleshooting)
  4. Create a .env file inside the root directory of the bot
  5. Insert your infos in your local .env file
  6. Set bot_test to false in your local index.js file
  7. In your terminal, navigate to the root directory of the bot
  8. 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:

  1. Stop the bot execution if it's currently running;
  2. Delete both blacklist.json and admins.json files;
  3. Make sure bot_test variable in "index.js" is set to false;
  4. 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.

    Click Me for an Example ๐Ÿ‘‡๐Ÿป

    Ban Example GIF


  • ๐Ÿ‘ฎโ€โ™€๏ธ 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.

    Click Me for an Example ๐Ÿ‘‡๐Ÿป

    Unban Example GIF


  • ๐Ÿ‘ฎโ€โ™€๏ธ 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.

    Click Me for an Example ๐Ÿ‘‡๐Ÿป

    Blacklist Example GIF


  • ๐Ÿ’Ž 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.

    Click Me for an Example ๐Ÿ‘‡๐Ÿป

    Adminlist Example GIF


  • ๐Ÿ’Ž Admin: promote a normal user to Admininistrator.
    You can run Admin only by replying to user's message.

    Click Me for an Example ๐Ÿ‘‡๐Ÿป

    Admin Example GIF


  • ๐Ÿ’Ž 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.

    Click Me for an Example ๐Ÿ‘‡๐Ÿป

    Demote Example GIF


  • ๐Ÿ’Ž 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.

    Click Me for an Example ๐Ÿ‘‡๐Ÿป

    Info Example GIF


  • ๐Ÿ’Ž 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.

    Click Me for an Example ๐Ÿ‘‡๐Ÿป

    SetUsername Example GIF


  • ๐Ÿ‘‘ Promote OR Superior: grant an Administrator the Superior Administrator rank.
    You can run this command followed by Admin's ID.

    Click Me for an Example ๐Ÿ‘‡๐Ÿป

    Promote Example GIF


  • ๐Ÿ‘‘ 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.

    Click Me for an Example ๐Ÿ‘‡๐Ÿป

    ResetAdmins Example GIF


๐Ÿ“„ Credits:

๐Ÿš€ Created and Maintained by Croluy

doggoreportbot's People

Contributors

croluy avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

vikas-841

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.