Skip to content

StableUnit/StablePenguinBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stable Penguin Bot

Link pre-moderation bot for StableUnit telegram chat

Runs on Python 3.5 and up. Install all dependencies by executing:

pip3 install -r requirements.txt

Installation and setup

  • Search for @BotFather in Telegram and start it
  • Create a new bot by sending command /newbot
  • Type and send your new bot's public name (StablePenguinBot for example)
  • Type and send your new bot's user name (StablePenguinBot for example)
  • BotFather will reply with a token like XXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  • Paste that token in your .bashrc like so:
export PINGUINO_BOT_TOKEN="PASTE:THETOKENHERE"

and restart bash

  • Alternatively, you can paste it raw in tokens.py on your local machine
  • Run the bot in debug mode: python3 bot.py --debug and add it to your chat
  • Send the /start command, bot will reply with your chat's ID
  • Paste it (with -!) to chat_id variable in config.py
  • Restart the bot in normal mode.

List of features

  • If a user joins this chat for the first time, the bot greets him/her and suggests to follow the rules
  • If a user comes back to the chat, the bots welcomes him/her back
  • If a user posts message with a link for the first time, the bot blocks it and sends to chat's admins for pre-moderation.

Please note, that the bot must have admin rights in order to function properly.

Admins can

  • accept user's message and add him to a whitelist;
  • decline user's message for this particular link if the user is not whitelisted;
  • add the user to a blacklist (permanently disable the user's ability to post any links to the chat);
  • permanently ban the user.

List of commands

  • /start: outputs id of a current chat
  • /get_admins: outputs the information about a current chat's and bot's administrators and updates it to the database (should be called after the setup)
  • /wl_add * (in reply to a user's message): adds the user to the whitelist
  • /wl_del * (in reply to a user's message): removes the user from the whitelist, so his future links will require pre-moderation
  • /bl_add * (in reply to a user's message): adds the user to the blacklist
  • /bl_del * (in reply to a user's message): removes the user from the blacklist, so his future links will require pre-moderation
  • /uid * (in reply to user's message): outputs the user's Telegram id number
  • /db_stat *: outputs the current state of a database of chat members, whitelisted and blacklisted members
  • /db_flush 'parameter' *: flushes any of the database's storages ('members'/'admins'/'whitelist'/'blacklist') or the entire database ('all')
  • /kek: outputs text and other memes
  • /kek_add * (in reply to a user's message): adds user's message (if it's a text, a sticker, a photo, an audio or a voice file) to list of available keks
  • /help: outputs help.

* = command is for chat's admins only.

Contributors

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages