Changed b -> 🅱️ to b -> 🅱️, increased amout of messages checked, andd added force_registration=True

This commit is contained in:
TheScriptPony 2020-12-14 16:51:26 -05:00
parent 32bf258895
commit 261e45f054

View file

@ -8,19 +8,24 @@ class Memeify(commands.Cog):
def __init__(self, bot): def __init__(self, bot):
super().__init__() super().__init__()
self.config = Config.get_conf(self, identifier=2934875294) self.config = Config.get_conf(self, identifier=2934875294, force_registration=True)
self.bot = bot self.bot = bot
@commands.command() @commands.command()
async def b(self, ctx, *, content: str = None): async def b(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:
# gets above message msg_c = ""
msg = (await ctx.channel.history(limit=2).flatten())[1].clean_content # gets previous messages
if msg: msg = await ctx.channel.history(limit=5).flatten()
await ctx.send(self.__bify(msg, False)) for i in msg[1:]:
if i.clean_content:
msg_c = i.clean_content
break
if msg_c:
await ctx.send(self.__bify(msg_c, False))
else: else:
await ctx.send("Where's the :b:essage?") await ctx.send("Where's the 🅱️essage?")
else: else:
await ctx.send(self.__bify(ctx.message.clean_content, True)) await ctx.send(self.__bify(ctx.message.clean_content, True))
@ -57,4 +62,4 @@ class Memeify(commands.Cog):
elif len(bif) > 1: elif len(bif) > 1:
# replaces first letter with b # replaces first letter with b
bif = "b" + bif[1:] bif = "b" + bif[1:]
return bif.replace("b", ":b:") return bif.replace("b", "🅱️")