Fixed custom emojis, changed command name to [p]bify from [p]b

This commit is contained in:
TheScriptPony 2020-12-17 15:30:20 -05:00
parent 261e45f054
commit 0d0abcae30

View file

@ -12,7 +12,7 @@ class Memeify(commands.Cog):
self.bot = bot self.bot = bot
@commands.command() @commands.command()
async def b(self, ctx, *, content: str = None): async def bify(self, ctx, *, content: str = None):
"""Replaces all B's with :b:'s""" """Replaces all B's with :b:'s"""
if not content: if not content:
msg_c = "" msg_c = ""
@ -35,6 +35,7 @@ class Memeify(commands.Cog):
# emojis are a bit fucked tho # emojis are a bit fucked tho
def __bify(self, bify_str, cmd) -> str: def __bify(self, bify_str, cmd) -> str:
mention = re.compile("^@|^#|^&") mention = re.compile("^@|^#|^&")
custom_emoji = re.compile("<:[^:]+:\d{18}>")
bify = bify_str.split() bify = bify_str.split()
# remove first letter if it bifys the command message itself # remove first letter if it bifys the command message itself
if cmd: if cmd:
@ -44,7 +45,7 @@ class Memeify(commands.Cog):
# no code blocks >:( # no code blocks >:(
i = i.replace("`", "") i = i.replace("`", "")
# special cases for custom emojis and mentions # special cases for custom emojis and mentions
if i[0] == ":" and i[-1] == ":": if custom_emoji.search(i):
b.append(i + " ") b.append(i + " ")
continue continue
elif mention.match(i): elif mention.match(i):