diff options
author | Joe Robinson <joe@lc8n.com> | 2021-11-28 18:44:32 +0000 |
---|---|---|
committer | Joe Robinson <joe@lc8n.com> | 2021-11-28 18:44:32 +0000 |
commit | c0f2547db8deaad2520ecb1a055f2545e1f3ecd6 (patch) | |
tree | 7f0e3aba8a9935f7677daed00de1002077712ada /bot.py | |
parent | 54b564a8788ca2fd29203331c1532deaf557f621 (diff) |
Handle exp on message, add rank shop and inventory commands
Diffstat (limited to 'bot.py')
-rw-r--r-- | bot.py | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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"]) |