summaryrefslogtreecommitdiff
path: root/src/teawie_bot/bot.py
diff options
context:
space:
mode:
authorseth <[email protected]>2023-01-24 18:28:18 -0500
committerseth <[email protected]>2023-01-24 22:03:37 -0500
commit5deaf0cc1580e13c48f3dbc7ff4c76d35640fcfc (patch)
tree5c015a1a43bb6fc79c5ec4e264111abc006c8dd4 /src/teawie_bot/bot.py
parent95961b27a88230a22a74ae9de6cdd60d3beda95d (diff)
feat: moyaiBot -> teawieBot
Diffstat (limited to 'src/teawie_bot/bot.py')
-rw-r--r--src/teawie_bot/bot.py95
1 files changed, 95 insertions, 0 deletions
diff --git a/src/teawie_bot/bot.py b/src/teawie_bot/bot.py
new file mode 100644
index 0000000..cb90804
--- /dev/null
+++ b/src/teawie_bot/bot.py
@@ -0,0 +1,95 @@
+import discord
+from discord import app_commands
+from discord.ext import commands
+
+from teawie_bot.apis import guzzle
+from teawie_bot import utils
+
+SERVER_ID = discord.Object(id=1055663552679137310)
+intents = discord.Intents.default()
+intents.message_content = True # pylint: disable=assigning-non-slot
+bot = commands.Bot(command_prefix="m!",
+ description="teawie time",
+ intents=intents)
+
+
+async def on_ready():
+ print(f"logged in as {bot.user}")
+ await bot.tree.sync(guild=SERVER_ID)
+ print("ready!")
+
+
+async def on_message(message: discord.Message):
+ if message.author == bot.user:
+ return
+
+ echo_messages = [
+ "🗿",
+ ]
+ echo_messages = echo_messages + utils.Teawies(bot).emojis
+ try:
+ index = echo_messages.index(message.content.lower())
+ await message.channel.send(echo_messages[index])
+ except ValueError:
+ pass
+
+ await bot.process_commands(message)
+
+
+async def ask(ctx: commands.Context):
+ await ctx.send(utils.get_random_response(bot, utils.Teawies(bot)))
+
+
+ name="ask",
+ description="ask lord teawie a question and they shall respond",
+ guild=SERVER_ID)
+async def ask_slash_command(interaction: discord.Interaction):
+ msg = utils.get_random_response(bot, utils.Teawies(bot))
+ while not msg:
+ msg = utils.get_random_response(bot, utils.Teawies(bot))
+ await interaction.response.send_message(msg)
+
+
+async def teawiespam(ctx: commands.Context):
+ if not discord.utils.get(bot.emojis, name="teawiesmile"):
+ return
+ msg = str()
+ for _ in range(50):
+ msg += str(discord.utils.get(bot.emojis, name="teawiesmile"))
+
+ await ctx.send(msg)
+
+
[email protected](name="copypasta",
+ description="send funni copypasta",
+ guild=SERVER_ID)
+@app_commands.choices(choices=[
+ app_commands.Choice(name="happymeal", value="happymeal"),
+ app_commands.Choice(name="ismah", value="ismah"),
+ app_commands.Choice(name="sus", value="sus"),
+ app_commands.Choice(name="ticktock", value="ticktock"),
+ app_commands.Choice(name="amongus_sus", value="amongus_sus"),
+ app_commands.Choice(name="egrill", value="egrill"),
+ app_commands.Choice(name="dvd", value="dvd"),
+])
+async def copypasta(interaction: discord.Interaction,
+ choices: app_commands.Choice[str]):
+ msgs = utils.get_copypasta(choices.value)
+ for i, msg in enumerate(msgs):
+ if i == 0:
+ await interaction.response.send_message(msg)
+ else:
+ await interaction.channel.send(msg)
+
+
[email protected](name="random_teawie",
+ description="get a random teawie!",
+ guild=SERVER_ID)
+async def random_teawie(interaction: discord.Interaction):
+ msg = guzzle.get_random_teawie()
+ await interaction.response.send_message(msg)