Add initial code
This commit is contained in:
18
src/core/messages.py
Normal file
18
src/core/messages.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import discord
|
||||
|
||||
from core.commands import dispatch_command
|
||||
|
||||
async def handle_message(bot: discord.Client, config: dict, message: discord.Message):
|
||||
"""
|
||||
Handle messages received from Discord
|
||||
"""
|
||||
if message.author == bot.user:
|
||||
# Ignore messages from the bot!
|
||||
return
|
||||
|
||||
# Ping!
|
||||
if message.content == "ping":
|
||||
await message.reply("pong!")
|
||||
|
||||
if message.content[0] == config.get("command_prefix"):
|
||||
await dispatch_command(bot, config, message)
|
||||
Reference in New Issue
Block a user