From 0807a6b8179898f0af73ac399a66f68cc108ca99 Mon Sep 17 00:00:00 2001 From: Paillat Date: Fri, 16 Dec 2022 12:50:52 +0100 Subject: [PATCH] added right intents --- code/code.py | 36 +++++++++++------------------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/code/code.py b/code/code.py index 5673744..b4d9771 100644 --- a/code/code.py +++ b/code/code.py @@ -1,12 +1,16 @@ #coucou c'est fives # wesh wesh ici latouff import discord # pip install pycord +from discord import Intents import asyncio # pip install asyncio import cogs # import the cogs import datetime # pip install datetime from config import debug, conn, c # import the debug function and the database connection import apsw # pip install apsw. ApSW is a Python interface to SQLite 3 -bot = discord.Bot(intents=discord.Intents.all(), help_command=None) +#add the message content intent to the bot, aka discord.Intents.default() and discord.Intents.message_content +intents = discord.Intents.default() +intents.message_content = True +bot = discord.Bot(intents=intents, help_command=None) # create the bot bot.add_cog(cogs.Setup(bot)) bot.add_cog(cogs.Settings(bot)) @@ -14,32 +18,14 @@ bot.add_cog(cogs.Help(bot)) bot.add_cog(cogs.Chat(bot)) bot.add_cog(cogs.ManageChat(bot)) -''' -def reset_uses_count_today(): - c.execute("UPDATE data SET uses_count_today = 0") - conn.commit() -#get the current date and save it in the previous_date variable -#if the day number is different from the previous day number, reset the uses count today -def check_day(): - global previous_date - if datetime.datetime.now().day != previous_date.day: - previous_date = datetime.datetime.now() - previous_date = datetime.datetime.now() - return True - else: - previous_date = datetime.datetime.now() - return False -#run check_day every 10 seconds -async def check_day_task(): - while True: - check_day() - await asyncio.sleep(60) -#add a task to the bot that runs check_day every 1 minute -bot.loop.create_task(check_day_task()) -''' #run the bot # Replace the following with your bot's token with open("./key.txt") as f: key = f.read() -bot.run(key) \ No newline at end of file +bot.run(key) +#set the bot's watching status to watcing your messages to answer you +@bot.event +async def on_ready(): + await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="your messages to answer you")) + debug("Bot is ready") \ No newline at end of file