/telegram-senko-bot

A bot that greets new members on telegram groups with a cute, personalised gif.

Primary LanguageGoMIT LicenseMIT

Telegram-senko-bot

MIT License Telegram Demo build-shield

UwU! An example!

About The Bot

This bot greets new members on telegram groups with a cute, personalised gif with Senko-san.

In case you're wondering, Senko-san is an adorable 800-year old fox goddess from the anime The Helpful Fox Senko-san (jp. 世話やきキツネの仙狐さん).

Getting Started

Follow these steps to set up your own version of this bot.

Prerequisites

For both development and runtime environments:

  • Go 1.13 (see instructions)
  • FFmpeg
    sudo apt install ffmpeg -y

Set up using Google Cloud Functions

  1. Download and install the Google Cloud SDK, for example with Snap:
    snap install google-cloud-sdk --classic
    gcloud init
  2. Clone the repo:
    git clone https://github.com/4Kaze/telegram-senko-bot.git
  3. Download NotoSansCJKjp-Black.otf font into the project folder:
    wget https://noto-website-2.storage.googleapis.com/pkgs/NotoSansCJKjp-hinted.zip -O fonts.zip
    unzip fonts.zip NotoSansCJKjp-Black.otf
    rm fonts.zip
  4. Deploy the bot to Google Cloud Functions replacing [YOUR TOKEN] with your bot token from BotFather:
    gcloud functions deploy SenkoSan --entry-point=HandleRequest --runtime go113 --trigger-http --allow-unauthenticated --set-env-vars TOKEN=[YOUR TOKEN]
  5. If everything went well, there should be a trigger url in the output in your terminal:
    HttpsTrigger:
        url: https://us-central1-bot-tele-002137.cloudfunctions.net/SenkoSan
    
    Set this url as a webhook for your bot:
    curl https://api.telegram.org/bot[YOUR TOKEN]/setWebhook?url=[YOUR URL]

Usage

The bot simply sends a gif with new member's name when they join a group.

In private messages, it supports the following commands:

  • /start - a standard command that displays the description
  • /genewate [name] - a command that generates a new gif with given name
  • /wepo - a command that sends the link to this repo

All names are stripped from emojis, symbols and are truncated to be at maximum 20 characters.

Contributing

I'm open for contributions. Feel free to fork the project to use it for your own means or to create a PR with new features / fixes.

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Chat on Telegram

Acknowledgements