Update rcauto to include special characters
This commit is contained in:
parent
d3610c42fc
commit
21979c88d7
1 changed files with 17 additions and 1 deletions
|
@ -1,3 +1,5 @@
|
|||
import re
|
||||
|
||||
from discord.ext import commands
|
||||
from discord_slash import SlashContext, cog_ext
|
||||
from discord_slash.utils.manage_commands import create_option
|
||||
|
@ -68,12 +70,26 @@ class UtilCog(commands.Cog):
|
|||
],
|
||||
)
|
||||
async def _rcauto(self, ctx: SlashContext, text: str):
|
||||
lookup = {
|
||||
"-": ":rcDash:",
|
||||
"(": ":rcPL:",
|
||||
")": ":rc:",
|
||||
"$": ":rcDS:",
|
||||
"@": ":rcAt:",
|
||||
"!": ":rcEx:",
|
||||
"?": ":rcQm:",
|
||||
"^": ":rcThis:",
|
||||
"'": ":rcApost:",
|
||||
"#": ":rcHash:",
|
||||
}
|
||||
to_send = ""
|
||||
for letter in text.upper():
|
||||
if letter == " ":
|
||||
to_send += " "
|
||||
else:
|
||||
elif re.match(r"^[A-Z0-9]$"):
|
||||
to_send += f":rc{letter}:"
|
||||
elif re.match(r"^[-()$@!?^'#]$"):
|
||||
to_send += lookup[letter]
|
||||
await ctx.send(to_send)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue