Beispiel #1
0
    async def work(self, ctx):
        isSuccessful = random.choice([True, False, True, False, True, False])
        amount = int(random.randint(15, 50) * random.uniform(0.95, 2.95))

        embed = libneko.Embed(
            title=
            f"Work {'Successful <:le:808638475229986876>' if isSuccessful else 'Failed <:nogis:808638474646978560>'}"
        )

        if isSuccessful:
            embed.color = random.choice(
                [Color.green(), Color.blue(),
                 Color.blurple()])
            embed.add_field(name="Outcome:",
                            value=random.choice(
                                workOutcome[isSuccessful]).format(
                                    ctx.author, amount))
            await self.bot.eco.edit_money(ctx.author.id, amount, "wallet",
                                          "add")
        else:
            embed.color = random.choice(
                [Color.red(), Color.orange(), 0xffff00])
            embed.add_field(name="Outcome:",
                            value=random.choice(
                                workOutcome[isSuccessful]).format(ctx.author))
        embed.set_footer(icon_url=str(ctx.author.avatar_url),
                         text=f"Invoked by {ctx.author}")

        try:
            await ctx.send(f"{ctx.author.mention}", embed=embed)
        except discord.errors.Forbidden:
            await ctx.send(
                f"{ctx.author.mention}, I am unable to send the requested data! Please grant the bot the \"Embed Links\" permission or ask an admin / moderator to do so."
            )
Beispiel #2
0
COLORMSG = 789281035657412619
SDMSG = 789241290411868170
WELCOME = 694552494172536833

Color_Emoji = {
    "<:invisible:789271633343807488>": ["invisible",
                                        Color.dark_theme()],
    "<:greyple:789271633352589352>": ["greyple", Color.greyple()],
    "<:white:789271633360977960>": ["white",
                                    Color.from_rgb(255, 255, 255)],
    "<:teal:789271633373298718>": ["teal", Color.teal()],
    "<:darkteal:789271633356521473>": ["darkteal",
                                       Color.dark_teal()],
    "<:darkgreen:789271633336205342>": ["darkgreen",
                                        Color.dark_green()],
    "<:blurple:789271633356783666>": ["blurple", Color.blurple()],
    "<:darkblue:789271633373954048>": ["darkblue",
                                       Color.dark_blue()],
    "<:darkpurple:789271633386405908>": ["darkpurple",
                                         Color.dark_purple()],
    "<:purple:789271633436737586>": ["purple", Color.purple()],
    "<:darkorange:789271633332142091>": ["darkorange",
                                         Color.dark_orange()],
    "<:gold:789271633415503902>": ["gold", Color.gold()],
}

SD_Emoji = {
    "<:SD0:789240178191368212>": "SD0",
    "<:SD1:789240178077466644>": "SD1",
    "<:SD2:789240178198970448>": "SD2"
}
Beispiel #3
0
    async def ticket(self, ctx):
        await ctx.message.delete()
        emoji = ["1️⃣", "2️⃣", "3️⃣", "❌"]

        def checkValid(reaction, user):
            return (ctx.message.author == user and q.id == reaction.message.id
                    and reaction.emoji in emoji)

        def checkRep(message):
            return (message.author == ctx.message.author
                    and ctx.message.channel == message.channel)

        embed = discord.Embed(title="Menu des tickets", color=Color.blurple())
        embed.add_field(
            name="1️⃣ - Création",
            value="Créer un nouveau créateur de ticket.",
            inline=False,
        )
        embed.add_field(
            name="2️⃣ - Modification",
            value="Modifier un créateur de ticket.",
            inline=False,
        )
        embed.add_field(
            name="3️⃣ - Liste",
            value="Afficher la liste des paramètres d'un ticket.",
            inline=False,
        )
        embed.set_footer(
            text=
            "Cliquez sur la réaction pour choisir !\n❌ Permet de quitter le menu."
        )
        q = await ctx.send(embed=embed)
        await q.add_reaction("1️⃣")
        await q.add_reaction("2️⃣")
        await q.add_reaction("3️⃣")
        await q.add_reaction("❌")
        reaction, user = await self.bot.wait_for("reaction_add",
                                                 timeout=300,
                                                 check=checkValid)
        if reaction.emoji == "1️⃣":
            await q.delete()
            await cfg.create_ticket(self, ctx, self.bot)
        elif reaction.emoji == "2️⃣":
            await q.delete()
            q = await ctx.send("Merci de donner l'ID du créateur à modifier.")
            rep = await self.bot.wait_for("message",
                                          timeout=300,
                                          check=checkRep)
            if rep.content.lower() == "stop":
                await q.delete()
                await ctx.send("Annulation", delete_after=30)
                await rep.delete()
                return
            elif rep.content.isnumeric():
                idM = int(rep.content)
                db = sqlite3.connect("src/owlly.db", timeout=3000)
                c = db.cursor()
                sql = "SELECT idM FROM TICKET where idM=?"
                c.execute(sql, (idM, ))
                check = c.fetchone()
                if check is not None:
                    await edit.edit_ticket(ctx, idM, self.bot)
                else:
                    await q.delete()
                    await rep.delete()
                    await ctx.send(
                        "Il y a une erreur : Cet ID n'existe pas dans la base de donnée.",
                        delete_after=30,
                    )
                    return
            else:
                await q.delete()
                await rep.delete()
                await ctx.send(
                    "Il y a une erreur : La valeur n'est pas numérique",
                    delete_after=30)
                return
        elif reaction.emoji == "3️⃣":
            await q.delete()
            affichage = listing.list_ticket(ctx)
            await ctx.send(affichage)
        elif reaction.emoji == "❌":
            await q.delete()
            await ctx.send("Annulation", delete_after=30)
            return