Giter VIP home page Giter VIP logo

currybot's Introduction

CurryBot

A telegram bot that replies with stickers to commands or certain messages.
These stickers are selected randomly from given stickerpacks.

Usage

python3 src/main.py example_config.json

Note that if you want the bot to reply to messages matching a given regex, 'privacy mode' should be disabled.

Initial Config

The bot has two types of configurations. The first is is stored in a JSON-file that is provided when the bot is launched. This file contains the essential information that is needed to Initialize the bot.

In this file 3 required fields must be specified:

  • The Telegram API token of the bot
  • The directory where the bot will store its configuration and cache
  • The encryption key used for encrypting certain secret information (like API-keys) when writing to disk Optionally a Telegram chat can be configured to be the admin chat of the bot. Members of this chat can be assigned to update the configuration of global actions and the bot will post errors directly to this chat.
{
  "API-token": "<API-Token here>",
  "cache-dir": "cache",
  "encryption-key": "VerySecretKey",
  "admin-chat": <chat-id>
}

Configuring the bot

Adding actions to the bot is done by starting a conversation with the bot in a private chat. This conversation is initiated by sending the /config-command. In this conversation the bot gives you the choice to add, remove or edit an action in a chat where you are assigned admin of the bot. When adding the bot to a chat, you are automatically assigned admin and are therefore able to configure the behaviour of the bot in that chat. A new admin is added when a user that is already an admin replies /makeadmin to a message from the user this will be added.

An action is created by constructing a tree of handlers where each handler could filter on the content of the message or perform an action like sending a message. A handler can propagate a message to its children, creating more complex behaviour (for example: message is a reply and message is a command and today is a Monday then send a sticker). Possible filters and actions include (among others):

  • Matching the message with a regex
  • Filtering based on the current time
  • Monitoring user or chat activity
  • Filtering on inactivity
  • Sending a picture from a Flickr album
  • Sending a sticker
  • Forwarding a message
  • Adding a video to a Youtube playlist
  • Voting on messages
  • Sending items from RSS feeds

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.