-
-
Notifications
You must be signed in to change notification settings - Fork 39
Emoji Support
Using emoji in your bot tends to make things a bit less robotic. Here is how you can accomplish that with Tourmaline.
Of course one of the best ways to include emojis in your messages is to just use an emoji keyboard and paste the raw emoji into your messages. Crystal is UTF8 compatible and won't freak out.
send_message(message.chat.id, "Hello world 🌎")
Luckily there is also a great port of Emoji for Python called emoji.cr. With it you can easily use the same emoji shortcodes Github uses to include emoji in your messages.
require "emoji"
# bot definition...
send_message(message.chat.id, Emoji.emojize("Hello world :earth_americas:"))
Since emoji.cr
uses regex to find and replace shortcodes with emoji, it would be a good idea to put any emoji messages into a constant so that it's not finding and replacing that shortcode every time.
Tourmaline (and many other projects) was written by watzon. It is free software, but if you feel so inclined you could sponsor its development on Patreon. Thank you for using my projects!
- Webhooks
- Inline Actions
- Reply Keyboards
- Games (coming soon)
- Stickers (coming soon)
- Payments