summaryrefslogtreecommitdiff
path: root/cogs/8Ball.py
blob: 82d152b0b1011de13eaf78d3f8e7e72199d9e486 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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]")