100 lines
3.2 KiB
Python
100 lines
3.2 KiB
Python
"""Contains the MiscCog, which deals with miscellaneous commands."""
|
|
from discord.ext import commands # Has the cog class
|
|
from discord_slash import cog_ext # Used for slash commands
|
|
|
|
from utils import getParams # pylint: disable=import-error
|
|
|
|
params = getParams()
|
|
|
|
|
|
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.bedreNetflix = bot.other.bedreNetflix
|
|
self.nerdShit = bot.other.nerdShit
|
|
|
|
@cog_ext.cog_slash(**params["ping"])
|
|
async def ping(self, ctx):
|
|
"""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):
|
|
"""Stop the bot."""
|
|
await self.bot.stop(ctx)
|
|
|
|
@cog_ext.cog_slash(**params["help"])
|
|
async def helpCommand(self, ctx, command=""):
|
|
"""Get help for commands."""
|
|
await self.bot.other.helpFunc(ctx, command)
|
|
|
|
@cog_ext.cog_slash(**params["thank"])
|
|
async def thank(self, ctx):
|
|
"""Thank the bot."""
|
|
await ctx.send("You're welcome :blush:")
|
|
|
|
@cog_ext.cog_slash(**params["hello"])
|
|
async def hello(self, ctx):
|
|
"""Greet the bot."""
|
|
await self.bot.other.helloFunc(ctx)
|
|
|
|
@cog_ext.cog_slash(**params["roll"])
|
|
async def roll(self, ctx, dice="1d20"):
|
|
"""Roll dice."""
|
|
await self.bot.other.rollDice(ctx, dice)
|
|
|
|
@cog_ext.cog_slash(**params["image"])
|
|
async def image(self, ctx):
|
|
"""Get a random image from Bing."""
|
|
await self.bot.other.imageFunc(ctx)
|
|
|
|
@cog_ext.cog_slash(**params["movie"])
|
|
async def movie(self, ctx):
|
|
"""Get a random movie from the Plex server."""
|
|
await self.bot.other.movieFunc(ctx)
|
|
|
|
@cog_ext.cog_slash(**params["name"])
|
|
async def name(self, ctx):
|
|
"""Generate a random name."""
|
|
await self.generators.nameGen(ctx)
|
|
|
|
@cog_ext.cog_slash(**params["tavern"])
|
|
async def tavern(self, ctx):
|
|
"""Generate a random tavern name."""
|
|
await self.generators.tavernGen(ctx)
|
|
|
|
@cog_ext.cog_slash(**params["wiki"])
|
|
async def wiki(self, ctx, wikiPage=""):
|
|
"""Get a page on a fandom wiki."""
|
|
await self.bot.other.findWikiPage(ctx, wikiPage)
|
|
|
|
@cog_ext.cog_slash(**params["addMovie"])
|
|
async def addMovie(self, ctx, movie):
|
|
"""Search for a movie and add it to the Plex server."""
|
|
await self.bedreNetflix.requestMovie(ctx, movie)
|
|
|
|
@cog_ext.cog_slash(**params["addShow"])
|
|
async def addShow(self, ctx, show):
|
|
"""Search for a show and add it to the Plex server."""
|
|
await self.bedreNetflix.requestShow(ctx, show)
|
|
|
|
@cog_ext.cog_slash(**params["downloading"])
|
|
async def downloading(self, ctx, parameters="-d"):
|
|
"""Get the current downloading torrents."""
|
|
await self.bedreNetflix.downloading(ctx, parameters)
|
|
|
|
@cog_ext.cog_slash(**params["wolf"])
|
|
async def wolf(self, ctx, query):
|
|
"""Perform a search on Wolfram Alpha."""
|
|
await self.nerdShit.wolfSearch(ctx, query)
|
|
|
|
|
|
def setup(bot):
|
|
"""Add the cog to the bot."""
|
|
bot.add_cog(MiscCog(bot))
|