summaryrefslogtreecommitdiff
path: root/cogs/8Ball.py
diff options
context:
space:
mode:
authorlexicade <jasonnlelong@gmail.com>2023-01-27 21:06:30 +0000
committerlexicade <jasonnlelong@gmail.com>2023-01-27 21:06:30 +0000
commit52801b4de1d63cd01191acf7fcee137977140ec0 (patch)
tree08271a1f1e3e8060486b6651c67c9934867c648e /cogs/8Ball.py
parent8df873808c86805624851356f5dea76ec621de23 (diff)
Project initHEADmain
Diffstat (limited to 'cogs/8Ball.py')
-rw-r--r--cogs/8Ball.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/cogs/8Ball.py b/cogs/8Ball.py
new file mode 100644
index 0000000..82d152b
--- /dev/null
+++ b/cogs/8Ball.py
@@ -0,0 +1,56 @@
+from discord.ext import commands
+import discord
+import importlib
+import utils
+importlib.reload(utils)
+import random
+
+
+class Magic8Ball(commands.Cog):
+ def __init__(self, bot):
+ self.bot = bot
+
+ @commands.command(
+ name="8ball",
+ aliases=[],
+ application_command_meta=commands.ApplicationCommandMeta(
+ options=[
+ discord.ApplicationCommandOption(
+ name="question",
+ description="Ask the 8ball a question.",
+ type=discord.ApplicationCommandOptionType.string,
+ required=True,
+ )
+ ],
+ )
+ )
+ async def _8ball(self, ctx, question):
+ """Ask it a question."""
+ if hasattr(ctx, 'given_values'):
+ content = ctx.given_values['question']
+ else:
+ content = ctx.message.content
+
+ if content.endswith("?"):
+ lst_8_ball = ["It is certain.", "It is decidedly so.", "Without a doubt.", "Yes - definitely.",
+ "You may rely on it.", "As I see it, yes.", "Most likely.", "Outlook good.", "Yes.",
+ "Signs point to yes.", "Reply hazy, try again.", "Ask again later.",
+ "Better not tell you now.", "Cannot predict now.", "Concentrate and ask again.",
+ "Don't count on it.", "My reply is no.", "My sources say no.", "Outlook not so good.",
+ "Very doubtful."]
+ str_response = lst_8_ball[random.randint(0, len(lst_8_ball) - 1)]
+ emb = await utils.embed(ctx, "\🎱 8 Ball \🎱", f"\🇶: {question}\n\n\🇦: {str_response}")
+ await ctx.send(embed=emb)
+ else:
+ emb = await utils.embed(ctx, "8 Ball", "Ask a question!")
+ await ctx.send(embed=emb)
+
+
+def setup(bot):
+ print("INFO: Loading [8ball]... ", end="")
+ bot.add_cog(Magic8Ball(bot))
+ print("Done!")
+
+
+def teardown(bot):
+ print("INFO: Unloading [8ball]")