From 163eae41623cb19fa245db5706e08825f11c88e5 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Wed, 12 Jun 2024 12:50:07 +0200 Subject: [PATCH] Lower probas, add possibility to tag everyone or here --- botbotbot/__main__.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/botbotbot/__main__.py b/botbotbot/__main__.py index 73b87ae..85f5f9f 100644 --- a/botbotbot/__main__.py +++ b/botbotbot/__main__.py @@ -45,10 +45,18 @@ async def on_ready(): async def reply(message): - if random.random() < 1 / 2: - await message.reply(f"<@{message.author.id}>, {random.choice(word_list)}") - else: - await message.reply(f"{random.choice(word_list)}") + content = random.choice( + ( + f"<@{message.author.id}>, {random.choice(word_list)}", + f"{random.choice(word_list)}", + ) + ) + if random.random() < 1 / 96: + mention = random.choice(("@everyone", "@here")) + content = f"{mention}, {random.choice(word_list)}" + fct = random.choice((message.reply, message.channel.send)) + + await fct(content) async def ai_reply(message): @@ -76,19 +84,16 @@ async def on_message(message): if message.flags.ephemeral: return - if random.random() < 1 / 6: + if random.random() < 1 / 12: await reply(message) - elif random.random() < 1 / 24: + elif random.random() < 1 / 48: await ai_reply(message) if random.random() < 1 / 6: await react(message) if message.author != bot.user and bot.user in message.mentions: - if random.random() < 1 / 2: - await reply(message) - else: - await react(message) + await random.choice((reply, react))(message) @bot.listen("on_reaction_add") @@ -99,7 +104,8 @@ async def add_more_reaction(reaction, user): @bot.listen("on_message_edit") async def react_message_edit(before, after): - await after.add_reaction("👀") + if after.author != bot.user: + await after.add_reaction("👀") @bot.listen("on_message")