Update 'buttons/bot.py'
Signed-off-by: Mitsuo Makuda <mitsuo_makuda@bdsmhypnosisbasement.com>
This commit is contained in:
1 parent
c4681a413d
commit
858c56dda0
1 file changed
+7
-2
+7
-2
@@ -4,10 +4,15 @@ bot = hikari.GatewayBot(token="...")
|
|||||||
|
|
||||||
@bot.listen()
|
@bot.listen()
|
||||||
async def ping(event: hikari.GuildMessageCreateEvent) -> None:
|
async def ping(event: hikari.GuildMessageCreateEvent) -> None:
|
||||||
if event.is_bot or not event.content:
|
"""If a non-bot user mentions your bot, respond with 'Pong!'."""
|
||||||
|
|
||||||
|
# Do not respond to bots nor webhooks pinging us, only user accounts
|
||||||
|
if not event.is_human:
|
||||||
return
|
return
|
||||||
|
|
||||||
if event.content.startswith("hk.ping"):
|
me = bot.get_me()
|
||||||
|
|
||||||
|
if me.id in event.message.user_mentions_ids:
|
||||||
await event.message.respond("Pong!")
|
await event.message.respond("Pong!")
|
||||||
|
|
||||||
bot.run()
|
bot.run()
|
||||||
|
|||||||
Reference in new issue
Block a user