Files
Botator/code/code.py

47 lines
1.4 KiB
Python
Raw Normal View History

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-15 18:59:21 +01:00
from config import debug, connp, cp # import the debug function and the database connection
2022-12-12 09:40:49 +01:00
import apsw # pip install apsw. ApSW is a Python interface to SQLite 3
2022-12-08 22:21:53 +01:00
bot = discord.Bot(intents=discord.Intents.all(), help_command=None)
2022-11-26 17:59:08 +01:00
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-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-12-15 18:59:21 +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:
key = f.read()
2022-12-08 12:37:21 +01:00
bot.run(key)