2.0 update for discordpy

This commit is contained in:
2022-10-26 14:50:36 +02:00
parent 952d30c667
commit f724bb39c2
+8 -2
View File
@@ -6,15 +6,21 @@ import configparser
from discord.ext import commands from discord.ext import commands
bot = commands.Bot(command_prefix=commands.when_mentioned_or('!'), description='Hourglass, bot that does timers', pm_help=True) async def add_cogs(bot):
await bot.add_cog(Timer.Timer(bot))
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix=commands.when_mentioned_or('!'), description='Hourglass, bot that does timers', intents=intents, pm_help=True)
#Read configuration file: #Read configuration file:
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read('settings.ini') config.read('settings.ini')
bot.add_cog(Timer.Timer(bot))
@bot.event @bot.event
async def on_ready(): async def on_ready():
await add_cogs(bot)
print('Logged in as:\n{0} (ID: {0.id})'.format(bot.user)) print('Logged in as:\n{0} (ID: {0.id})'.format(bot.user))
bot.run(config["tokens"]["bot"]) bot.run(config["tokens"]["bot"])