Better lookup for rcauto

This commit is contained in:
Zeva Rose 2021-07-05 00:01:08 -06:00
parent 5e31f9c223
commit 09744a7493
3 changed files with 106 additions and 5 deletions

View file

@ -1,4 +1,5 @@
import asyncio
import re
from datetime import datetime, timedelta
from pathlib import Path

View file

@ -6,6 +6,7 @@ from discord_slash.utils.manage_commands import create_option
import jarvis
from jarvis import config, jarvis_self, logo
from jarvis.data.robotcamo import emotes, names
from jarvis.utils import build_embed, convert_bytesize, get_repo_hash
from jarvis.utils.field import Field
@ -87,11 +88,13 @@ class UtilCog(commands.Cog):
for letter in text.upper():
if letter == " ":
to_send += " "
elif re.match(r"^[A-Z0-9]$", letter):
to_send += f":rc{letter}:"
elif re.match(r"^[-()$@!?^'#.]$", letter):
to_send += lookup[letter]
await ctx.send(to_send)
elif re.match(r"^[A-Z0-9-()$@!?^'#.]$", letter):
id = emotes[letter]
to_send += f"<:{names[id]}:{id}>"
if len(to_send) > 2000:
await ctx.send("Too long.")
else:
await ctx.send(to_send)
def setup(bot):

97
jarvis/data/robotcamo.py Normal file
View file

@ -0,0 +1,97 @@
emotes = {
"A": 852317928572715038,
"B": 852317954975727679,
"C": 852317972424818688,
"D": 852317990238421003,
"E": 852318044503539732,
"F": 852318058353786880,
"G": 852318073994477579,
"H": 852318105832259614,
"I": 852318122278125580,
"J": 852318145074167818,
"K": 852318159952412732,
"L": 852318179358408704,
"M": 852318241555873832,
"N": 852318311115128882,
"O": 852318329951223848,
"P": 852318344643477535,
"Q": 852318358920757248,
"R": 852318385638211594,
"S": 852318401166311504,
"T": 852318421524938773,
"U": 852318435181854742,
"V": 852318453204647956,
"W": 852318470267731978,
"X": 852318484749877278,
"Y": 852318504564555796,
"Z": 852318519449092176,
"1": 860663352740151316,
"2": 860662785243348992,
"3": 860662950011469854,
"4": 860663423200657418,
"5": 860663002663092234,
"6": 860663041380581376,
"7": 860663460199137320,
"8": 860663077603508225,
"9": 860663502917074964,
"0": 860663119641968670,
"-": 860662676283850782,
"!": 860663278710685737,
"@": 860663240610414612,
"#": 861431799015800873,
"$": 860663206325911583,
"^": 861429793371455498,
"(": 860663162202357771,
")": 860663537671995412,
"?": 860663578343505930,
"'": 861486469914296360,
}
names = {
852317928572715038: "rcA",
852317954975727679: "rcB",
852317972424818688: "rcC",
852317990238421003: "rcD",
852318044503539732: "rcE",
852318058353786880: "rcF",
852318073994477579: "rcG",
852318105832259614: "rcH",
852318122278125580: "rcI",
852318145074167818: "rcJ",
852318159952412732: "rcK",
852318179358408704: "rcL",
852318241555873832: "rcM",
852318311115128882: "rcN",
852318329951223848: "rcO",
852318344643477535: "rcP",
852318358920757248: "rcQ",
852318385638211594: "rcR",
852318401166311504: "rcS",
852318421524938773: "rcT",
852318435181854742: "rcU",
852318453204647956: "rcV",
852318470267731978: "rcW",
852318484749877278: "rcX",
852318504564555796: "rcY",
852318519449092176: "rcZ",
860663352740151316: "rc1",
860662785243348992: "rc2",
860662950011469854: "rc3",
860663423200657418: "rc4",
860663002663092234: "rc5",
860663041380581376: "rc6",
860663460199137320: "rc7",
860663077603508225: "rc8",
860663502917074964: "rc9",
860663119641968670: "rc0",
860662676283850782: "rcDash",
860663278710685737: "rcEx",
860663240610414612: "rcAt",
861431799015800873: "rcHash",
860663206325911583: "rcDS",
861429793371455498: "rcThis",
860663162202357771: "rcPL",
860663537671995412: "rc",
860663578343505930: "rcQm",
861486469914296360: "rcApost",
}