2022-11-30 18:29:09 +01:00
|
|
|
#coucou c'est fives
|
2022-12-08 22:21:53 +01:00
|
|
|
# wesh wesh ici latouff
|
2022-11-26 17:59:08 +01:00
|
|
|
import discord # pip install pycord
|
2022-11-27 12:28:02 +01:00
|
|
|
import asyncio # pip install asyncio
|
2022-12-08 22:21:53 +01:00
|
|
|
import cogs # import the cogs
|
2022-11-29 14:34:04 +01:00
|
|
|
import datetime # pip install datetime
|
2022-12-08 22:21:53 +01:00
|
|
|
from config import debug, conn, c # import the debug function and the database connection
|
2022-12-13 08:27:25 +01:00
|
|
|
intents = discord.Intents.default()
|
|
|
|
|
intents.message_content = True
|
2022-12-13 09:46:26 +01:00
|
|
|
intents.members = True
|
2022-12-13 08:27:25 +01:00
|
|
|
bot = discord.Bot(intents=intents, help_command=None) # create the bot
|
2022-12-08 22:21:53 +01:00
|
|
|
bot.add_cog(cogs.Setup(bot))
|
|
|
|
|
bot.add_cog(cogs.Settings(bot))
|
|
|
|
|
bot.add_cog(cogs.Help(bot))
|
|
|
|
|
bot.add_cog(cogs.Chat(bot))
|
|
|
|
|
bot.add_cog(cogs.ManageChat(bot))
|
2022-12-13 21:36:29 +01:00
|
|
|
@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")
|
2022-11-26 17:59:08 +01:00
|
|
|
|
2022-11-29 15:07:10 +01:00
|
|
|
'''
|
2022-11-29 14:34:04 +01:00
|
|
|
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())
|
2022-11-29 15:07:10 +01:00
|
|
|
'''
|
2022-11-26 17:59:08 +01:00
|
|
|
#run the bot
|
|
|
|
|
# Replace the following with your bot's token
|
2022-12-10 00:53:33 +01:00
|
|
|
with open("./key.txt") as f:
|
2022-11-27 15:40:32 +01:00
|
|
|
key = f.read()
|
2022-12-08 12:37:21 +01:00
|
|
|
|
2022-12-13 08:27:25 +01:00
|
|
|
bot.run(key)
|