Skip to content

Commit

Permalink
Merge branch 'master' into unstable
Browse files Browse the repository at this point in the history
Signed-off-by: Blue <60958064+B1ue-Dev@users.noreply.github.com>
  • Loading branch information
B1ue-Dev authored May 7, 2023
2 parents 01414f1 + d1d7690 commit 97e42dd
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ async def get_latest_release_version() -> str:
return response["tag_name"]

if __name__ == "__main__":

logger = logging.getLogger()
logging.Formatter.converter = lambda *args: get_local_time().timetuple()
logging.basicConfig(
Expand All @@ -36,19 +37,6 @@ async def get_latest_release_version() -> str:
level=0,
)

client = interactions.Client(
activity=interactions.Activity(
name=f"for {VERSION}",
type=interactions.ActivityType.WATCHING,
),
basic_logging=True,
intents=interactions.Intents.DEFAULT
| interactions.Intents.MESSAGE_CONTENT
| interactions.Intents.GUILD_MEMBERS,
status=interactions.Status.ONLINE,
send_command_tracebacks=False,
)

setup(client, default_prefix="$")
PrefixedHelpCommand(
client,
Expand All @@ -69,6 +57,7 @@ async def on_startup() -> None:
log_time = (
datetime.datetime.utcnow() + datetime.timedelta(hours=7)
).strftime("%d/%m/%Y %H:%M:%S")

print(
"".join(
[
Expand Down Expand Up @@ -121,4 +110,25 @@ async def bot_mentions(_msg: interactions.events.MessageCreate) -> None:
)
await msg.channel.send(embeds=embed)

@client.listen(interactions.events.MessageCreate)
async def bot_mentions(_msg: interactions.events.MessageCreate) -> None:
"""Check for bot mentions."""
msg = _msg.message
if (
f"@{client.user.id}" in msg.content
or f"<@{client.user.id}>" in msg.content
):
embed = interactions.Embed(
title="It seems like you mentioned me",
description="".join(
[
f"I could not help much but noticed you mentioned me.",
f"You can type ``/`` and choose **{client.user.username}**",
f"to see a list of available commands.",
],
),
color=0x6AA4C1,
)
await msg.channel.send(embeds=embed)

client.start(TOKEN)

0 comments on commit 97e42dd

Please sign in to comment.