summaryrefslogtreecommitdiff
path: root/src/moyai_bot/bot.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/moyai_bot/bot.py')
-rw-r--r--src/moyai_bot/bot.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/moyai_bot/bot.py b/src/moyai_bot/bot.py
new file mode 100644
index 0000000..8a152a8
--- /dev/null
+++ b/src/moyai_bot/bot.py
@@ -0,0 +1,43 @@
+import discord
+from discord.ext import commands
+
+from moyai_bot.lib import get_random_response
+
+intents = discord.Intents.default()
+intents.message_content = True # pylint: disable=assigning-non-slot
+moyai = commands.Bot(command_prefix="m!", description="moyai", intents=intents)
+
+
+async def on_ready():
+ print(f"logged in as {moyai.user}")
+
+
+async def on_message(message):
+ if message.author == moyai.user:
+ return
+
+ echo_messages = [
+ "moyai", str(discord.utils.get(moyai.emojis, name="moyai"))
+ ]
+ try:
+ index = echo_messages.index(message.content.lower())
+ await message.channel.send(echo_messages[index])
+ except ValueError:
+ pass
+
+ await moyai.process_commands(message)
+
+
+async def ask(ctx):
+ await ctx.send(get_random_response(moyai))
+
+
+async def moyaispam(ctx):
+ msg = str()
+ for _ in range(30):
+ msg += str(discord.utils.get(moyai.emojis, name="moyai"))
+ await ctx.send(msg)