Giter Club home page Giter Club logo

robbot's Introduction

Maintainability Rating Quality Gate Pass Lines of Code License image image CodeSize image image image Image GitHub commits since latest release (by date) image

Robbot

IT/ENG

This Telegram bot has the same structure of this project which is an userbot I made for several features I needed.
So this bot has some commands in common with that userbot but also other new commands and obviously there aren't those commands that a bot can't execute but a userbot can.
So if you're interested you can also visit that repository.


Feel free to contribute and improve the project.
See more details on How to contribute here.

After the Italian section you will find an english version of the README. In doc folder you will find a bit of documentation of RobBot.

[IT]

Come impostare

Per un corretto funzionamento è necessario compilare a dovere il file config.json. Quindi è necessario essere in possesso dei seguenti dati:

  • Api keys di Telegram: api_id e api_hash. Puoi generarle da qui
  • Bot token: bot_token. Puoi generarlo da qui
  • Api url atm se si vogliono usare le loro api: api_url e api_get. (Non essendo pubbliche non le condividerò)
  • Api key di OpenWeatherMap: api_weather. Puoi generare la tua key dal sito principale di OpenWeatherMap
  • Api di OpenAI: api_openai. Puoi generare la tua key dal sito principale di OpenAI
  • I dati telegram dell'amministratore del bot: id_super_admin.
  • Il percorso dove si trova il file .db: path_db.
  • Nome della sessione: session_name.
  • I nomi dei comandi utente, admin e superadmin: user_commands, admin_commands e super_admin_commands.

I dati del super admin servono a colui che potrà usare le funzioni di interazione con il database e altre funzioni particolari. I nomi dei comandi da inserire nel config.json possono essere ricopiati dal codice oppure possono essere modificati sul codice e poi ricopiati nel file json.

Come funzionano i comandi utente del bot

Il funzionamento dei comandi utente è spiegato all'interno del file help.json. Si tratta del file che viene usato dal bot per rispondere al comando /helprob <nome comando>. Le spiegazioni sono in Italiano, ma volendo si possono tradurre in qualsiasi lingua sostituendo i campi della struttura dati oppure addirittura renderlo multilingua, ma in quel caso c'è da sviluppare la componente che rende possibile il cambio di lingua.

Come funzionano i comandi admin e super

  • registrare un nuovo utente: /setrobuser <id_utente>
  • registrare un nuovo admin: /setrobadmin <id_utente>
  • cancellare un utente: /delrobuser <id_utente>
  • revocare i privilegi admin: /delrobadmin <id_utente> (l'utente sarà comunque ancora tra i registrati ma senza i poteri admin)
  • mostrare tutti gli utenti registrati: /listrobuser
  • mostrare il numero di utenti registrati: /allrobuser
  • verificare se il bot è online: /pingrob
  • registrare un nuovo gruppo come unico autorizzato a ricevere un certo comando: /setgroup <id_gruppo>
  • cancellare un gruppo salvato: /delgroup <id_gruppo>
  • mostrare tutti i gruppi salvati: /listgroup
  • modificare un valore nelle statistiche di un utente per un certo comando: /updatestat <id_utente> <nuovo_valore>
  • cancellare un comando dalle statistiche di un utente: /delstat <id_utente>
  • Aggiornare i dati Telegram di un utente(nome e username): /updaterobuser <id_utente> (oppure dando lo username)

Dipendenze

  • Pyrogram
  • geopy
  • bs4
  • wikipedia
  • pandas
  • openai
  • urbandictionary

Progetti esterni usati

[ENG]

How to setup

The correct way to setup this bot is to compile the file config.json. So it's necessary to have these data:

  • Telegram api keys: api_id e api_hash. You can generate them here
  • Telegram bot token: bot_token. You can generate it from here
  • Atm api url if you wanna use their api: api_url e api_get. (The api are not public so I won't share them here)
  • OpenWeatherMap api key: api_weather. You can generate your key from the OpenWeatherMap website.
  • OpenAI api key: api_openai. You can generate your key from the OpenAI website.
  • Telegram data of the owner of the bot: id_super_admin.
  • The path where is the .db file: path_db.
  • The session name: session_name.
  • Name of user commands, admin commands and super admin commands: user_commands, admin_commands e super_admin_commands.

Data of super admin is needed because he's the only one who can use db functions and other special functions. Name of commands to put inside config.json can be copied from source code or renamed inside source code and then copied in json file.

How the user bot's commands works

The features of the user commands are explained inside help.json. It is the file which is used by the bot to reply at /helprob <command name>. This json file is only in Italian, but you can translate it in every languages by changing the correct fields with your translations or even making the bot multi-language but in that case you have to develop the component for change the language runtime.

How the admin/super commands works

  • register a new user: /setrobuser <id_user>
  • register a new admin: /setrobadmin <id_user>
  • delete a user: /delrobuser <id_user>
  • delete an admin: /delrobadmin <id_user> (it will just revoke the admin power, it doesn't delete the user)
  • How to list all user registered: /listrobuser
  • How to show ho many users are registered: /allrobuser
  • check if the bot is online: /pingrob
  • Save a new group to make it the only one authorized to receive a specific command: /setgroup <id_group>
  • Delete a saved group: /delgroup <id_group>
  • Show all saved groups: /listgroup
  • Update a value in a user's stat for a specific command: /updatestat <id_user> <new_value>
  • Delete a command from a user's stat: /delstat <id_user>
  • Update user's Telergam data(name and username): /updaterobuser <id_user> (or giving username)

Dependencies

  • Pyrogram
  • geopy
  • bs4
  • wikipedia
  • pandas
  • openai
  • urbandictionary

External projects used

robbot's People

Contributors

mastercruelty avatar

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.