summaryrefslogtreecommitdiff
path: root/bot.py
diff options
context:
space:
mode:
authorJoe Robinson <joe@lc8n.com>2021-11-28 18:44:32 +0000
committerJoe Robinson <joe@lc8n.com>2021-11-28 18:44:32 +0000
commitc0f2547db8deaad2520ecb1a055f2545e1f3ecd6 (patch)
tree7f0e3aba8a9935f7677daed00de1002077712ada /bot.py
parent54b564a8788ca2fd29203331c1532deaf557f621 (diff)
Handle exp on message, add rank shop and inventory commands
Diffstat (limited to 'bot.py')
-rw-r--r--bot.py10
1 files 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"])