Update code formatting

This commit is contained in:
Edgar P. Burkhart 2024-06-12 14:41:18 +02:00
parent 163eae4162
commit 8639ed50d7
Signed by: edpibu
GPG Key ID: 9833D3C5A25BD227
1 changed files with 19 additions and 17 deletions

View File

@ -18,6 +18,7 @@ guild_ids = config.get("guild_ids")
delay = config.get("delay", 60)
system_prompt = """Tu es une intelligence artificelle qui répond en français.
Tu dois faire un commentaire pertinent en lien avec ce qui te sera dit.
Ta réponse doit être très courte.
Ta réponse doit être une seule phrase.
TA RÉPONSE DOIT ÊTRE EN FRANÇAIS !!!"""
@ -45,15 +46,15 @@ async def on_ready():
async def reply(message):
mention = random.choices(
[f"<@{message.author.id}>", "@everyone", "@here"], weights=(98, 1, 1)
)[0]
content = random.choice(
(
f"<@{message.author.id}>, {random.choice(word_list)}",
f"{mention}, {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)
@ -84,33 +85,34 @@ async def on_message(message):
if message.flags.ephemeral:
return
if random.random() < 1 / 12:
await reply(message)
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:
await random.choice((reply, react))(message)
return
probas = [10, 2, 20]
func = random.choices(
(reply, ai_reply, react, None), weights=probas + [100 - sum(probas)]
)[0]
if func is not None:
await func(message)
@bot.listen("on_reaction_add")
async def add_more_reaction(reaction, user):
if random.random() < 1 / 2:
if random.random() < 50 / 100:
await reaction.message.add_reaction(reaction.emoji)
@bot.listen("on_message_edit")
async def react_message_edit(before, after):
if after.author != bot.user:
if after.author != bot.user and random.random() < 50 / 100:
await after.add_reaction("👀")
@bot.listen("on_message")
async def rando_shuffle(message):
if not message.flags.ephemeral and random.random() < 1 / 24 and message.guild:
if not message.flags.ephemeral and random.random() < 5 / 100 and message.guild:
await try_shuffle(message.guild)
@ -191,13 +193,13 @@ async def alea(ctx):
@bot.listen("on_voice_state_update")
async def voice_random_nicks(member, before, after):
if before.channel is None and random.random() < 1 / 24:
if before.channel is None and random.random() < 5 / 100:
await try_shuffle(member.guild)
if (
before.channel is None
and after.channel is not None
and random.random() < 1 / 96
and random.random() < 1 / 100
and bot not in after.channel.members
):
await asyncio.sleep(random.randrange(60))