A Telegram bot that generates animated stickers of Ingress glyphs. Start a chat with @adaRMXbot and type in any glyph or sequence to get your sticker.
Since this bot is a learning and practicing tool, you can experiment with any glyph or sequence — even ones not available in the scanner. You can also create your own custom glyphs! To draw a custom glyph, simply type the sequence of numbered nodes from the calibration grid below, as if you're sketching a line through them:
0
5 1
9 6
a
8 7
4 2
3
For example, the glyph Complex
could also be entered as 8a96
or 69a8
:
Have fun exploring and creating your unique glyphs!
-
Caches users' glyphs for faster responses.
-
Adds captions with the glyph name at the top-middle, right above the calibration grid. As Telegram does not support Lottie text layers, captions are rendered using shape layers to work around this limitation.
-
/static
command to generate stickers without the connect-the-dots animation. -
/sequence
command to explore sequences using inline keyboards. Type/sequence initial-glyph-or-partial-sequence
and the bot will generate the glyph sticker with buttons to navigate back and forth through the sequence. -
Mentioning or tagging the bot in any chat group will get you the glyphs (or sequence) you queried, plus the top 5 most similar sequences for easy reference.
⚠️ End your query with a period (.) so the bot knows you're done typing and can generate your sticker. -
Corrects misspelled glyphs using string similarity algorithms (when possible).
This bot runs as a webhook on Cloudflare Workers, a serverless computing platform that handles everything for you without needing to manage infrastructure. This section covers the basics to get your own Telegram bot up and running on Cloudflare Workers.
-
Create a new bot. Keep the authentication token handy for later.
-
Set up a Cloudflare account if you don't already have one.
-
Install Wrangler and log in with your Cloudflare account.
-
Open a terminal and run this command to create your Worker project:
npm create cloudflare@latest new-project-name -- --template https://github.com/ninjaburger/ingress-glyph-sticker-bot
-
Create a new KV namespace for storage:
npx wrangler kv namespace create cache
🌀 Creating namespace with title "new-project-name-cache" ✨ Success! Add the following to your configuration file in your kv_namespaces array: [[kv_namespaces]] binding = "cache" id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
- Write the initial KV values for
stickerCache
andglyphSequence
cache objects:
npx wrangler kv key put stickerCache '{"userQueries":[],"recentUsers":[]}' --namespace-id xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx npx wrangler kv key put glyphSequence "[]" --namespace-id xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
glyphSequence
will store aMap<string, string>
where the key is the glyph-sequence and the value is the sticker file_id, like:[["abandon,fear,defend,future","CAACAgEAA..."],["abandon,fear,together","CAACAgEAA..."]]
. - Write the initial KV values for
-
Create a secret variable to store your Telegram authentication token (generated in Step 1)
npx wrangler secret put TELEGRAM_BOT_TOKEN
✔ Enter a secret value: … ************* 🌀 Creating the secret for the Worker "new-project-name" ✨ Success! Uploaded secret TELEGRAM_BOT_TOKEN
-
Review and adjust the
wrangler.toml
configuration file -
Deploy your Worker:
npx wrangler deploy
Total Upload: 0.19 KiB / gzip: 0.16 KiB Worker Startup Time: 1 ms Your worker has access to the following bindings: - KV Namespaces: - cache: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - Vars: - MAINTENANCE_CHAT_ID: "REDACTED" - LRU_USERLIMIT: 50 - LRU_QUERYLIMIT: 50 Uploaded new-project-name (2.57 sec) Published new-project-name (3.81 sec) https://new-project-name.ninjaburger-at-cloudflare.workers.dev Current Deployment ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx Current Version ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Your Worker URL will look something like https://new-project-name.ninjaburger-at-cloudflare.workers.dev. You'll need this URL for the next step.
-
Set the Telegram Webhook using your Worker URL.
And that's it! Your bot should be up and running. :-)
Update the following settings in your wrangler.toml
file
#:schema node_modules/wrangler/config-schema.json
#your worker name
name = "new-project-name"
main = "src/index.js"
compatibility_date = "2024-08-06"
compatibility_flags = ["nodejs_compat"]
[vars]
# Where to dump stickers generated from Inline Queries (it can be chat group or channel)
MAINTENANCE_CHAT_ID = "YOUR-CHAT-ID"
# How many users to cache
LRU_USERLIMIT = 50
# How many queries (stickers) per user to cache
LRU_QUERYLIMIT = 50
[[kv_namespaces]]
binding = "cache"
id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
The bot builds Lottie animations from scratch. To customize or generate the Lottie animation JSON data, check out the buildGlyphSticker
function.
import { buildGlyphSticker } from './modules/lottie.mjs';l
const input = 'xm, grow, creativity',
animated = true,
showCaption = true;
const lottieData = buildGlyphSticker(input, { animated, showCaption });
console.log(JSON.stringify(lottieData));
Here's a quick rundown of the parameters:
Name | Type | Description | Default |
---|---|---|---|
input |
string |
A required string representing the glyph or sequence of glyphs to be processed into a sticker. | N/A |
options |
object |
An optional object to configure the sticker generation. | {} |
options.animated |
boolean |
Specifies whether the sticker should be animated. If true , the resulting sticker will include animation; if false , the sticker will be static. |
true |
options.showCaption |
boolean |
Determines whether to display a caption on the sticker. If true , a caption will be shown; if false , no caption will be displayed. |
true |
Lottie animations can be used on various platforms, including wearables. Some folks have even turned their favorite glyphs into cool animations for their smartwatches. Pretty cool, huh?
If you have ideas or want to make bigger changes, just open an issue so we can chat about it. Pull requests are always welcome!