2020-04-28 18:25:27 +00:00
|
|
|
import random
|
|
|
|
|
2020-04-28 19:03:35 +00:00
|
|
|
import discord
|
2020-04-28 18:25:27 +00:00
|
|
|
from discord.ext.commands import Cog, command, Context, Bot
|
|
|
|
|
|
|
|
from src.constants import *
|
|
|
|
|
|
|
|
|
|
|
|
class MiscCog(Cog, name="Divers"):
|
2020-04-28 19:03:35 +00:00
|
|
|
def __init__(self, bot: Bot):
|
|
|
|
self.bot = bot
|
|
|
|
|
2020-04-28 18:25:27 +00:00
|
|
|
@command(
|
|
|
|
name="choose",
|
|
|
|
usage='choix1 choix2 "choix 3"...',
|
|
|
|
aliases=["choice", "choix", "ch"],
|
|
|
|
)
|
|
|
|
async def choose(self, ctx: Context, *args):
|
|
|
|
"""
|
|
|
|
Choisit une option parmi tous les arguments.
|
|
|
|
|
|
|
|
Pour les options qui contiennent une espace,
|
|
|
|
il suffit de mettre des guillemets (`"`) autour.
|
|
|
|
"""
|
|
|
|
|
|
|
|
choice = random.choice(args)
|
|
|
|
await ctx.send(f"J'ai choisi... **{choice}**")
|
|
|
|
|
|
|
|
@command(name="joke", aliases=["blague"], hidden=True)
|
|
|
|
async def joke_cmd(self, ctx):
|
2020-04-28 19:03:35 +00:00
|
|
|
await ctx.message.delete()
|
2020-04-28 18:25:27 +00:00
|
|
|
with open(JOKES_FILE) as f:
|
|
|
|
jokes = f.read().split("\n\n\n")
|
|
|
|
|
|
|
|
msg = random.choice(jokes)
|
|
|
|
await ctx.send(msg)
|
|
|
|
|
2020-04-28 19:03:35 +00:00
|
|
|
@command(
|
|
|
|
name="help-test", hidden=True,
|
|
|
|
)
|
|
|
|
async def help_test(self, ctx: Context, *args):
|
|
|
|
if not args:
|
|
|
|
await self.send_bot_help(ctx)
|
|
|
|
else:
|
|
|
|
pass
|
|
|
|
|
|
|
|
embed = discord.Embed(
|
|
|
|
title="Help for `!draw`",
|
|
|
|
description="Groupe qui continent des commande pour les tirages",
|
|
|
|
color=0xFFA500,
|
|
|
|
)
|
|
|
|
# embed.set_author(name="*oooo*")
|
|
|
|
embed.add_field(name="zoulou", value="okokok", inline=True)
|
|
|
|
embed.add_field(name="lklk", value="mnmn", inline=True)
|
|
|
|
embed.set_footer(text="thankss!")
|
|
|
|
await ctx.send(embed=embed)
|
|
|
|
|
|
|
|
async def send_bot_help(self, ctx: Context):
|
|
|
|
embed = discord.Embed(title="Aide pour le bot du TFJM²",)
|
|
|
|
|
2020-04-28 18:25:27 +00:00
|
|
|
|
|
|
|
def setup(bot: Bot):
|
2020-04-28 19:03:35 +00:00
|
|
|
bot.add_cog(MiscCog(bot))
|