From c0f2547db8deaad2520ecb1a055f2545e1f3ecd6 Mon Sep 17 00:00:00 2001 From: Joe Robinson Date: Sun, 28 Nov 2021 18:44:32 +0000 Subject: Handle exp on message, add rank shop and inventory commands --- bot.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index 4d828b4..3cbe4a4 100644 --- a/bot.py +++ b/bot.py @@ -4,6 +4,7 @@ import datetime from discord_slash import SlashContext, SlashCommand from discord.ext.commands import Bot from models.user import User +from exp import Exp with open("config.yaml", "r") as yamlfile: @@ -18,6 +19,7 @@ intents.members = True bot = Bot(command_prefix="!", self_bot=True, intents=intents) slash = SlashCommand(bot, sync_commands=True) +bot_channel = None # Runs once bot has connected to discord @@ -32,14 +34,15 @@ async def on_ready(): for channel in guild.channels: if channel.name == config["discord_channel"]: print(f"{time_now}: Found channel {channel.name}!") + bot_channel = channel @bot.event async def on_message(message): print(message.author.id) user = User.get(User.discord_id == message.author.id) - user.add_message() - print(user.display_name) + exp = Exp(user, message.channel) + await exp.calculate_exp() @slash.slash( @@ -54,4 +57,7 @@ async def test(ctx: SlashContext): bot.load_extension("commands.economy") bot.load_extension("commands.basic_games") +bot.load_extension("commands.rank") +bot.load_extension("commands.shop") +bot.load_extension("commands.inventory") bot.run(config["discord_token"]) -- cgit v1.2.3