1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00
royalnet/royalpack/commands/emojify.py
2020-05-11 00:46:12 +02:00

100 lines
3.2 KiB
Python
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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