Skip to content
This repository has been archived by the owner on Nov 11, 2022. It is now read-only.
/ ImgMacroBot Public archive

Telegram inline bot who helps you generate your favourite image macros on the fly.

Notifications You must be signed in to change notification settings

madhead/ImgMacroBot

Repository files navigation

Telegram inline bot who helps you generate your favourite image macros on the fly.

Usage

ImgMacroBot is an inline bot. It means that it is triggered by a mention in any chat. To generate an image macro you should type a query, like @ImgMacroBot <query>. For the list of supported queries read Supported image macros.

Supported image macros

Ironic Palpatine

Triggered by a phrase containing "ironic" substring.

ironic palpatine
Ironic Palpatine (ru)

Triggered by a phrase containing "иронично" substring.

ironic palpatine ru
Good Palpatine

Triggered by a phrase containing "good" substring (more "o"s allowed).

good good
Good Palpatine (ru)

Triggered by a phrase containing "хорошо" substring (more "о"s allowed).

good good ru
Matrix Morpheus

Triggered by a pattern "What if I told you <what>" or by macro id: "morpheus: <what>"

matrix morpheus
Matrix Morpheus (ru)

Triggered by a pattern "Что если я скажу тебе <что-то>" or by macro id: "Морфеус: <что-то>"

matrix morpheus ru
I’m something of a scientist myself

Triggered by a pattern "I’m something of a <who> myself" or by macro id: "scientist: <who>"

i'm something of a scientist myself
I’m something of a scientist myself (ru)

Triggered by a pattern "Я и сам своего рода <кто-то>" or by macro id: "учёный: <кто-то>"

i'm something of a scientist myself ru
One does not simply walk into Mordor

Triggered by a pattern "One does not simply <do something>" or by macro id: "Boromir: <do something>"

one does not simply walk into mordor
One does not simply walk into Mordor (ru)

Triggered by a pattern "Нельзя просто так взять и <сделать что-то>" or by macro id: "Боромир: <сделать что-то>"

one does not simply walk into mordor ru
Водочки нам принеси!

Triggered by a macro ID "водочки" accepting 2 arguments separated with commas: top and bottom text

Like: "водочки: Водочки нам принеси, мы домой летим". If you’ve seen "Брат 2", you got the idea, if you haven’t — just pass by.

vodochki

Another way to use this macro is by a phrase matching pattern "<текст> принеси, <нижняя строка>". As you see, the key here is "принеси" word, and the bot will do its best to match top and bottom parts. If it fails — try using it by macro ID.

Here is an example of calling "@ImgMacroBot девочка, спиртику нам принеси, мы ручки дезинфицировать будем":

vodochki phrase
Shut Up And Take My Money!

Triggered by a pattern "shut up and take <something>" or by macro id: "take my money: <top text>, <bottom text>"

take my money
Say What Again!

Triggered by macro ids: "say what again, "I double dare you", or "I dare you" accepting two placeholders: top and bottom text. Here is an example: "@ImgMacroBot say what again: kotlin motherfucker, do you know it?":

say what again
[Artemon]

A meme from soviet Pinocchio movie adaptation, triggered by a macro id "artemon"". Here is an example: "@ImgMacroBot artemon: Артемон, отгрызи ноги этой суке":

artemon
Futurama Fry / Not Sure If

Triggered by a pattern "Not sure if <A>, or just <B>" or by macro ids: "not sure" and "not sure if", accepting two comma-separated arguments: top and bottom text:

not sure
First Time?

Triggered by a macro id: "first time", accepting one argument, bottom text:

first time

Running locally

  1. Define the required environment variables in .env file in the root of the project. The variables are:

    TELEGRAM_TOKEN

    Telegram Bot API token.

    TEMPLATES_DIR

    Absolute path to the templates directory of this project.

    FONTS_DIR

    Absolute path to the fonts directory of this project.

    IMGUR_CLIENT_ID

    Imgur API client ID.

    DB_TNSNAME

    This bot is intended to be deployed into Oracle’s Always Free Compute VM and use Oracle’s Always Free ATP database. This variable designates the TNS name for the database used to cache Imgur links.

    DB_TNSADMIN

    This bot is intended to be deployed into Oracle’s Always Free Compute VM and use Oracle’s Always Free ATP database. ATP connection are made using wallets. This variable points to a wallet directory.

    DB_USER

    This bot is intended to be deployed into Oracle’s Always Free Compute VM and use Oracle’s Always Free ATP database. This variable is for ATP user.

    DB_PASSWORD

    This bot is intended to be deployed into Oracle’s Always Free Compute VM and use Oracle’s Always Free ATP database. This variable is for ATP user’s password.

    IMGMACROBOT_LOG_THRESHOLD

    Optional. Logging threshold: logs with levels below given won’t be logged. DEBUG is a good value for development, INFO is used in production.

    PORT

    Optional. Port to bind to. If no value given, 5000 will be used.

  2. Start ngrok with the given port, like:

    ngrok http 5000
  3. Configure Telegram Bot API webhook with ngrok:

    curl --location --request POST 'https://api.telegram.org/bot${TELEGRAM_TOKEN}/setWebhook' \
    --header 'Content-Type: application/json' \
    --data-raw '{
    	"url": "https://${NGROK}.ngrok.io/${TELEGRAM_TOKEN}"
    }
    '

    Don’t forget to replace the placeholders.

  4. Start the bot:

    source .env && ./gradlew :runner:ktor:run
  5. The bot is running!