Update ponderations, add reaction to reactions, add random voice channel connection
This commit is contained in:
parent
50f32a620f
commit
27138120a7
2 changed files with 31 additions and 3 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
||||||
/env
|
/env
|
||||||
|
/assets
|
||||||
/config.toml
|
/config.toml
|
||||||
/wordlist.pickle
|
/wordlist.pickle
|
||||||
__pycache__
|
__pycache__
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import asyncio
|
||||||
import pickle
|
import pickle
|
||||||
import random
|
import random
|
||||||
import tomllib
|
import tomllib
|
||||||
|
@ -18,7 +19,8 @@ delay = config.get("delay", 60)
|
||||||
|
|
||||||
system_prompt = """Tu es une intelligence artificelle qui répond en français.
|
system_prompt = """Tu es une intelligence artificelle qui répond en français.
|
||||||
Ta réponse doit être très courte.
|
Ta réponse doit être très courte.
|
||||||
Ta réponse doit être longue d'une phrase."""
|
Ta réponse doit être une seule phrase.
|
||||||
|
TA RÉPONSE DOIT ÊTRE EN FRANÇAIS !!!"""
|
||||||
aibot = AIBot(
|
aibot = AIBot(
|
||||||
config.get("mistral_api_key"),
|
config.get("mistral_api_key"),
|
||||||
model="open-mixtral-8x7b",
|
model="open-mixtral-8x7b",
|
||||||
|
@ -28,6 +30,7 @@ aibot = AIBot(
|
||||||
intents = discord.Intents.default()
|
intents = discord.Intents.default()
|
||||||
intents.members = True
|
intents.members = True
|
||||||
intents.message_content = True
|
intents.message_content = True
|
||||||
|
intents.reactions = True
|
||||||
intents.voice_states = True
|
intents.voice_states = True
|
||||||
|
|
||||||
bot = discord.Bot(description=description, intents=intents)
|
bot = discord.Bot(description=description, intents=intents)
|
||||||
|
@ -73,9 +76,9 @@ async def on_message(message):
|
||||||
if message.flags.ephemeral:
|
if message.flags.ephemeral:
|
||||||
return
|
return
|
||||||
|
|
||||||
if random.random() < 1 / 12:
|
if random.random() < 1 / 6:
|
||||||
await reply(message)
|
await reply(message)
|
||||||
elif random.random() < 1 / 48:
|
elif random.random() < 1 / 24:
|
||||||
await ai_reply(message)
|
await ai_reply(message)
|
||||||
|
|
||||||
if random.random() < 1 / 6:
|
if random.random() < 1 / 6:
|
||||||
|
@ -88,6 +91,17 @@ async def on_message(message):
|
||||||
await react(message)
|
await react(message)
|
||||||
|
|
||||||
|
|
||||||
|
@bot.listen("on_reaction_add")
|
||||||
|
async def add_more_reaction(reaction, user):
|
||||||
|
if random.random() < 1 / 2:
|
||||||
|
await reaction.message.add_reaction(reaction.emoji)
|
||||||
|
|
||||||
|
|
||||||
|
@bot.listen("on_message_edit")
|
||||||
|
async def react_message_edit(before, after):
|
||||||
|
await after.add_reaction("👀")
|
||||||
|
|
||||||
|
|
||||||
@bot.listen("on_message")
|
@bot.listen("on_message")
|
||||||
async def rando_shuffle(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() < 1 / 24 and message.guild:
|
||||||
|
@ -174,6 +188,19 @@ 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() < 1 / 24:
|
||||||
await try_shuffle(member.guild)
|
await try_shuffle(member.guild)
|
||||||
|
|
||||||
|
if (
|
||||||
|
before.channel is None
|
||||||
|
and after.channel is not None
|
||||||
|
and random.random() < 1 / 96
|
||||||
|
and bot not in after.channel.members
|
||||||
|
):
|
||||||
|
await asyncio.sleep(random.randrange(60))
|
||||||
|
vo = await after.channel.connect()
|
||||||
|
source = await discord.FFmpegOpusAudio.from_probe("assets/allo.ogg")
|
||||||
|
vo.play(source)
|
||||||
|
await asyncio.sleep(random.randrange(60))
|
||||||
|
await vo.disconnect()
|
||||||
|
|
||||||
|
|
||||||
@bot.slash_command(
|
@bot.slash_command(
|
||||||
name="indu", guild_ids=guild_ids, description="Poser une question à MistralAI"
|
name="indu", guild_ids=guild_ids, description="Poser une question à MistralAI"
|
||||||
|
|
Loading…
Reference in a new issue