1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 21:44:21 +00:00
royalnet/royalpack/commands/emojify.py

101 lines
3.2 KiB
Python
Raw Normal View History

2020-05-10 22:46:12 +00:00
from typing import *
2019-11-11 08:56:08 +00:00
import random
2020-05-10 22:46:12 +00:00
import royalnet.commands as rc
2019-11-11 08:56:08 +00:00
2020-05-10 22:46:12 +00:00
class EmojifyCommand(rc.Command):
2019-11-11 08:56:08 +00:00
name: str = "emojify"
description: str = "Converti un messaggio in emoji."
syntax = "{messaggio}"
2019-12-17 19:48:44 +00:00
# noinspection InvisibleCharacter
2019-11-11 08:56:08 +00:00
_emojis = {
"abcd": ["🔡", "🔠"],
"back": ["🔙"],
"cool": ["🆒"],
"free": ["🆓"],
2019-12-17 19:48:44 +00:00
"1234": ["🔢"],
2019-11-11 08:56:08 +00:00
"abc": ["🔤"],
"atm": ["🏧"],
"new": ["🆕"],
"sos": ["🆘"],
"top": ["🔝"],
"zzz": ["💤"],
"end": ["🔚"],
2019-12-17 19:48:44 +00:00
"777": ["🎰"],
"100": ["💯"],
2019-11-11 08:56:08 +00:00
"ab": ["🆎"],
"cl": ["🆑"],
"id": ["🆔"],
"ng": ["🆖"],
"no": ["♑️"],
"ok": ["🆗"],
"on": ["🔛"],
"sy": ["💱"],
"tm": ["™️"],
"wc": ["🚾"],
"up": ["🆙"],
2019-12-17 19:48:44 +00:00
"!!": ["‼️"],
"!?": ["⁉️"],
"69": ["♋️"],
"24": ["🏪"],
"18": ["🔞"],
"10": ["🙌", "🔟", "🤲"],
2019-11-11 08:56:08 +00:00
"a": ["🅰️"],
"b": ["🅱️"],
"c": ["☪️", "©", "🥐"],
"d": ["🇩"],
"e": ["📧", "💶"],
"f": ["🎏"],
"g": ["🇬"],
"h": ["🏨", "🏩", "🏋‍♀", "🏋‍♂"],
"i": ["", "♊️", "🕕"],
"j": ["⤴️"],
"k": ["🎋", "🦅", "💃"],
"l": ["🛴", "🕒"],
"m": ["♏️", "Ⓜ️", "〽️"],
"n": ["📈"],
"o": ["⭕️", "🅾️", "📯", "🌝", "🌚", "🌕", "🥯", "🙆‍♀", "🙆‍♂"],
"p": ["🅿️"],
"q": ["🔍", "🍀", "🍭"],
2019-11-11 08:56:08 +00:00
"r": ["®"],
"s": ["💰", "💵", "💸", "💲"],
"t": ["✝️", "⬆️", "☦️"],
"u": ["", "⚓️", "🍉", "🌙", "🐋"],
"v": ["", "🔽", "☑️", "✔️"],
"w": ["🤷‍♀", "🤷‍♂", "🤾‍♀", "🤾‍♂", "🤽‍♀", "🤽‍♂"],
"x": ["🙅‍♀", "🙅‍♂", "", ""],
"y": ["💴"],
"z": ["⚡️"],
2019-12-11 12:28:01 +00:00
"*": ["*️⃣"],
"!": ["❗️", "", "⚠️"],
"?": ["", ""],
2019-12-17 19:48:44 +00:00
"9": ["9"],
"8": ["🎱", "8"],
"7": ["7"],
"6": ["6"],
"5": ["", "🤚", "👋", "5"],
"4": ["4"],
"3": ["🥉", "3"],
"2": ["✌️", "🤘", "🥈", "2"],
"1": ["👆", "☝️", "🖕", "🥇", "1"],
"0": ["⭕️", "🅾️", "📯", "🌝", "🌚", "🌕", "🥯", "🙆‍♀", "🙆‍♂", "0"],
"+": ["🏥"],
"/": ["🏒", "🧪", "🧹"],
"\\": ["🍢", "🍡", "🥄", "🌂"],
2019-11-11 08:56:08 +00:00
}
@classmethod
def _emojify(cls, string: str):
new_string = string.lower()
for key in cls._emojis:
selected_emoji = random.sample(cls._emojis[key], 1)[0]
new_string = new_string.replace(key, selected_emoji)
return new_string
2020-05-10 22:46:12 +00:00
async def run(self, args: rc.CommandArgs, data: rc.CommandData) -> None:
2019-11-11 08:56:08 +00:00
string = args.joined(require_at_least=1)
await data.reply(self._emojify(string))