fix intents

This commit is contained in:
Milka64 2023-12-13 21:22:50 +01:00
parent a9cc9e20c0
commit 5792a88911

View file

@ -53,6 +53,7 @@ class Mybot(discord.Client):
def __init__(
self,
bot,
intents=None,
gl_url=None,
gl_token=None,
gif_token=None,
@ -181,6 +182,7 @@ class Mybot(discord.Client):
@commands.command(help='check if bot always online')
async def ping(self, message):
print('trying to repondre')
await message.channel.send('pong')
@commands.command(help='Restart Bot')
@ -601,7 +603,7 @@ def get_word(word_type):
#Le do[main]e de Kabot.
def main():
intents = discord.Intents.default()
intents = discord.Intents.all()
intents.members = True
intents.messages = True
logger.info("Initialisation de Kabot")
@ -648,6 +650,19 @@ def main():
intents=intents,
audio_path="/home/mika/kabot-audio",
)
bot.add_cog(
Mybot(
bot,
intents = intents,
gl_url=gl_url,
gl_token=gl_token,
gif_token=gif_token,
audio_path="/home/mika/kabot-audio",
nickname=nickname,
voice_channel=voice_channel,
text_channel=text_channel,
)
)
test = False
if "test" in argv[-1]:
@ -690,7 +705,7 @@ def main():
cmd = bot.get_command(command_name)
await cmd.invoke(message)
else:
with message.channel.typing():
async with message.channel.typing():
if "http" in response:
await asyncio.sleep(len(response) / 8)
else:
@ -698,7 +713,7 @@ def main():
await message.channel.send(response)
await bot.process_commands(message)
@bot.command()
@bot.command(help='demerde toi')
async def join(interaction: discord.Interaction):
channel = [x for x in bot.get_all_channels() if x.name == voice_channel][0]
await channel.connect()
@ -711,10 +726,10 @@ def main():
user = interaction.message.author.name
print(user)
try:
audio_file = random.choice([f for f in os.listdir(bot.audio_path + '/%s/' % user) if f.endswith('.mp3')])
audio_file = bot.audio_path + '/%s/' % user + audio_file
audio_file = random.choice([f for f in os.listdir(audio_path + '/%s/' % user) if f.endswith('.mp3')])
audio_file = audio_path + '/%s/' % user + audio_file
except:
audio_file = random.choice([f"{f}" for f in Path(bot.audio_path + '/').glob('**/*.mp3')])
audio_file = random.choice([f"{f}" for f in Path(audio_path + '/').glob('**/*.mp3')])
bot.sounds.append((audio_file, interaction))
@bot.event
@ -764,19 +779,8 @@ def main():
await joke.invoke(ctx)
@bot.command(help='check if bot always online')
async def ping(ctx):
print("trying to repondre again")
await ctx.channel.send('pong')
bot.add_cog(
Mybot(
bot,
gl_url=gl_url,
gl_token=gl_token,
gif_token=gif_token,
audio_path=audio_path,
nickname=nickname,
voice_channel=voice_channel,
text_channel=text_channel,
)
)
bot.run(token)