1
0
mirror of https://gitlab.com/ddorn/tfjm-discord-bot.git synced 2025-07-28 00:25:24 +02:00

misc cog + joke command

This commit is contained in:
ddorn
2020-04-28 20:25:27 +02:00
parent 3b55bd0399
commit 63deb17723
6 changed files with 47 additions and 22 deletions

View File

@ -60,7 +60,7 @@ class DevCog(Cog, name="Dev tools"):
MAP = {"d": "dev", "ts": "teams", "t": "tirages"}
name = MAP.get(name, name)
if name in ("dev", "teams", "tirages"):
if not "." in name:
name = f"src.cogs.{name}"
try:

35
src/cogs/misc.py Normal file
View File

@ -0,0 +1,35 @@
import random
from discord.ext.commands import Cog, command, Context, Bot
from src.constants import *
class MiscCog(Cog, name="Divers"):
@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):
with open(JOKES_FILE) as f:
jokes = f.read().split("\n\n\n")
msg = random.choice(jokes)
await ctx.send(msg)
def setup(bot: Bot):
bot.add_cog(MiscCog())

View File

@ -657,10 +657,6 @@ class TirageCog(Cog, name="Tirages"):
async def draw_group(self, ctx: Context) -> None:
"""Groupe de commandes pour les tirages. Détails: `!help draw`"""
help = self.bot.get_command("help")
await help.callback(ctx, "draw")
await ctx.send("wtf man")
@draw_group.command(
name="start", usage="équipe1 équipe2 équipe3 (équipe4)",
)