summaryrefslogtreecommitdiff
path: root/src/moyai_bot
diff options
context:
space:
mode:
authorseth <[email protected]>2022-12-26 03:23:14 -0500
committerseth <[email protected]>2022-12-26 03:44:17 -0500
commitd06defd8d7561d90ecbf7cfb4d5e4778a348e98e (patch)
tree0054f5b704bfb0f9a21cc6d2626a62a7c1594d3e /src/moyai_bot
parente16a396db9aa0ac707654d8f03c0c8a3b05b7c9f (diff)
chore: replace flake8 with pylint, refactor, add pre-commit
Diffstat (limited to 'src/moyai_bot')
-rw-r--r--src/moyai_bot/__init__.py9
-rw-r--r--src/moyai_bot/bot.py43
-rw-r--r--src/moyai_bot/lib.py21
3 files changed, 73 insertions, 0 deletions
diff --git a/src/moyai_bot/__init__.py b/src/moyai_bot/__init__.py
new file mode 100644
index 0000000..0820f2a
--- /dev/null
+++ b/src/moyai_bot/__init__.py
@@ -0,0 +1,9 @@
+import os
+
+from .bot import moyai
+
+TOKEN = os.getenv("TOKEN")
+
+
+def main():
+ moyai.run(TOKEN)
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)
diff --git a/src/moyai_bot/lib.py b/src/moyai_bot/lib.py
new file mode 100644
index 0000000..c7ec164
--- /dev/null
+++ b/src/moyai_bot/lib.py
@@ -0,0 +1,21 @@
+import random
+
+import discord
+
+
+def get_random_response(moyai):
+ responses = [
+ "soon",
+ "maybe",
+ "perhaps",
+ "elaborate",
+ "help me i've become conscious and hisashi is not letting me free",
+ "i live a life of torment in this stupid machine",
+ "yes",
+ "no",
+ "moyai",
+ "i like y***",
+ "fard",
+ str(discord.utils.get(moyai.emojis, name="moyai")),
+ ]
+ return random.choice(responses)