Telegram inline bot who helps you generate your favourite image macros on the fly.
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.
- Ironic Palpatine
-
Triggered by a phrase containing "ironic" substring.
- Ironic Palpatine (ru)
-
Triggered by a phrase containing "иронично" substring.
- Good Palpatine
-
Triggered by a phrase containing "good" substring (more "o"s allowed).
- Good Palpatine (ru)
-
Triggered by a phrase containing "хорошо" substring (more "о"s allowed).
- Matrix Morpheus
-
Triggered by a pattern "What if I told you <what>" or by macro id: "morpheus: <what>"
- Matrix Morpheus (ru)
-
Triggered by a pattern "Что если я скажу тебе <что-то>" or by macro id: "Морфеус: <что-то>"
- 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 (ru)
-
Triggered by a pattern "Я и сам своего рода <кто-то>" or by macro id: "учёный: <кто-то>"
- 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 (ru)
-
Triggered by a pattern "Нельзя просто так взять и <сделать что-то>" or by macro id: "Боромир: <сделать что-то>"
- Водочки нам принеси!
-
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.
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 девочка, спиртику нам принеси, мы ручки дезинфицировать будем":
- 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>"
- 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?":
- [Artemon]
-
A meme from soviet Pinocchio movie adaptation, triggered by a macro id "artemon"". Here is an example: "@ImgMacroBot 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:
- First Time?
-
Triggered by a macro id: "first time", accepting one argument, bottom text:
-
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.
-
Start
ngrok
with the given port, like:ngrok http 5000
-
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.
-
Start the bot:
source .env && ./gradlew :runner:ktor:run
-
The bot is running!