✨ reworking a bunch of stuff
This commit is contained in:
100
gwendolyn_old/cogs/misc_cog.py
Normal file
100
gwendolyn_old/cogs/misc_cog.py
Normal file
@ -0,0 +1,100 @@
|
||||
"""Contains the MiscCog, which deals with miscellaneous commands."""
|
||||
from discord.ext import commands # Has the cog class
|
||||
from interactions import cog_ext # Used for slash commands
|
||||
from interactions import SlashContext
|
||||
|
||||
from gwendolyn_old.utils import get_params # pylint: disable=import-error
|
||||
|
||||
params = get_params()
|
||||
|
||||
|
||||
class MiscCog(commands.Cog):
|
||||
"""Contains the miscellaneous commands."""
|
||||
|
||||
def __init__(self, bot):
|
||||
"""Initialize the cog."""
|
||||
self.bot = bot
|
||||
self.bot.remove_command("help")
|
||||
self.generators = bot.other.generators
|
||||
self.plex = bot.other.plex
|
||||
self.nerd_shit = bot.other.nerd_shit
|
||||
|
||||
@cog_ext.cog_slash(**params["ping"])
|
||||
async def ping(self, ctx: SlashContext):
|
||||
"""Send the bot's latency."""
|
||||
await ctx.send(f"Pong!\nLatency is {round(self.bot.latency * 1000)}ms")
|
||||
|
||||
@cog_ext.cog_slash(**params["stop"])
|
||||
async def stop(self, ctx: SlashContext):
|
||||
"""Stop the bot."""
|
||||
await self.bot.stop(ctx)
|
||||
|
||||
@cog_ext.cog_slash(**params["help"])
|
||||
async def help_command(self, ctx: SlashContext, command=""):
|
||||
"""Get help for commands."""
|
||||
await self.bot.other.help_func(ctx, command)
|
||||
|
||||
@cog_ext.cog_slash(**params["thank"])
|
||||
async def thank(self, ctx: SlashContext):
|
||||
"""Thank the bot."""
|
||||
await ctx.send("You're welcome :blush:")
|
||||
|
||||
@cog_ext.cog_slash(**params["hello"])
|
||||
async def hello(self, ctx: SlashContext):
|
||||
"""Greet the bot."""
|
||||
await self.bot.other.hello_func(ctx)
|
||||
|
||||
@cog_ext.cog_slash(**params["roll"])
|
||||
async def roll(self, ctx: SlashContext, dice="1d20"):
|
||||
"""Roll dice."""
|
||||
await self.bot.other.roll_dice(ctx, dice)
|
||||
|
||||
@cog_ext.cog_slash(**params["image"])
|
||||
async def image(self, ctx: SlashContext):
|
||||
"""Get a random image from Bing."""
|
||||
await self.bot.other.image_func(ctx)
|
||||
|
||||
@cog_ext.cog_slash(**params["movie"])
|
||||
async def movie(self, ctx: SlashContext):
|
||||
"""Get a random movie from the Plex server."""
|
||||
await self.bot.other.movie_func(ctx)
|
||||
|
||||
@cog_ext.cog_slash(**params["name"])
|
||||
async def name(self, ctx: SlashContext):
|
||||
"""Generate a random name."""
|
||||
await self.generators.name_gen(ctx)
|
||||
|
||||
@cog_ext.cog_slash(**params["tavern"])
|
||||
async def tavern(self, ctx: SlashContext):
|
||||
"""Generate a random tavern name."""
|
||||
await self.generators.tavern_gen(ctx)
|
||||
|
||||
@cog_ext.cog_slash(**params["wiki"])
|
||||
async def wiki(self, ctx: SlashContext, wiki_page=""):
|
||||
"""Get a page on a fandom wiki."""
|
||||
await self.bot.other.find_wiki_page(ctx, wiki_page)
|
||||
|
||||
@cog_ext.cog_slash(**params["add_movie"])
|
||||
async def add_movie(self, ctx: SlashContext, movie):
|
||||
"""Search for a movie and add it to the Plex server."""
|
||||
await self.plex.request_movie(ctx, movie)
|
||||
|
||||
@cog_ext.cog_slash(**params["add_show"])
|
||||
async def add_show(self, ctx: SlashContext, show):
|
||||
"""Search for a show and add it to the Plex server."""
|
||||
await self.plex.request_show(ctx, show)
|
||||
|
||||
@cog_ext.cog_slash(**params["downloading"])
|
||||
async def downloading(self, ctx: SlashContext, parameters="-d"):
|
||||
"""Get the current downloading torrents."""
|
||||
await self.plex.downloading(ctx, parameters)
|
||||
|
||||
@cog_ext.cog_slash(**params["wolf"])
|
||||
async def wolf(self, ctx: SlashContext, query):
|
||||
"""Perform a search on Wolfram Alpha."""
|
||||
await self.nerd_shit.wolf_search(ctx, query)
|
||||
|
||||
|
||||
def setup(bot):
|
||||
"""Add the cog to the bot."""
|
||||
bot.add_cog(MiscCog(bot))
|
Reference in New Issue
Block a user