mirror of
https://github.com/Paillat-dev/Botator.git
synced 2026-01-02 17:24:55 +00:00
added right intents
This commit is contained in:
34
code/code.py
34
code/code.py
@@ -1,12 +1,16 @@
|
|||||||
#coucou c'est fives
|
#coucou c'est fives
|
||||||
# wesh wesh ici latouff
|
# wesh wesh ici latouff
|
||||||
import discord # pip install pycord
|
import discord # pip install pycord
|
||||||
|
from discord import Intents
|
||||||
import asyncio # pip install asyncio
|
import asyncio # pip install asyncio
|
||||||
import cogs # import the cogs
|
import cogs # import the cogs
|
||||||
import datetime # pip install datetime
|
import datetime # pip install datetime
|
||||||
from config import debug, conn, c # import the debug function and the database connection
|
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
|
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.Setup(bot))
|
||||||
bot.add_cog(cogs.Settings(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.Chat(bot))
|
||||||
bot.add_cog(cogs.ManageChat(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
|
#run the bot
|
||||||
# Replace the following with your bot's token
|
# Replace the following with your bot's token
|
||||||
with open("./key.txt") as f:
|
with open("./key.txt") as f:
|
||||||
key = f.read()
|
key = f.read()
|
||||||
|
|
||||||
bot.run(key)
|
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")
|
||||||
Reference in New Issue
Block a user