23 lines
644 B
Python
23 lines
644 B
Python
# cmd_discord/funfact.py
|
|
|
|
import discord
|
|
from discord.ext import commands
|
|
import cmd_common.common_commands as cc
|
|
|
|
class FunfactCog(commands.Cog):
|
|
"""Cog for the '!funfact' command."""
|
|
|
|
def __init__(self, bot):
|
|
self.bot = bot
|
|
|
|
@commands.command(name='funfact', aliases=['fun-fact'])
|
|
async def funfact_command(self, ctx, *keywords):
|
|
"""
|
|
Fetches a fun fact based on provided keywords and replies to the user.
|
|
"""
|
|
fact = cc.get_fun_fact(list(keywords))
|
|
await ctx.reply(fact)
|
|
|
|
# Required for loading the cog dynamically
|
|
async def setup(bot):
|
|
await bot.add_cog(FunfactCog(bot)) |