Skip to content

Commit

Permalink
fix the greeting thing
Browse files Browse the repository at this point in the history
also reformat with black
  • Loading branch information
HugeBrain16 committed Dec 24, 2022
1 parent 851416f commit b335805
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ async def on_started(self, event: hikari.StartedEvent):

if not hasattr(cmd, "PREFIX"):
warnmsg = f"The command module has been found, but no prefix is defined: {command}"
warnmsg += f"\n The module contains {len(cmd.group.commands)} command(s)"
warnmsg += (
f"\n The module contains {len(cmd.group.commands)} command(s)"
)
warnmsg += "\nTo load the command module, define the PREFIX variable in the global scope."
logging.warning(warnmsg)
else:
Expand Down Expand Up @@ -412,9 +414,11 @@ async def on_message(self, event: hikari.GuildMessageCreateEvent):
if event.is_human:
message = event.message

if re.search(r"funny\s*coffee", message.content, flags=re.IGNORECASE):
await message.respond(random.choice(["hello", "yo", "hi", "hey"]))
elif message.content.strip() == f"<@!{self.get_me().id}>":
if re.search(
rf"^(funny\s*coffee|<@{self.get_me().id}>)$",
message.content,
flags=re.IGNORECASE,
):
await message.respond(random.choice(["hello", "yo", "hi", "hey"]))
else:
for cmd in self.commands:
Expand Down

0 comments on commit b335805

Please sign in to comment.