95 lines
3.0 KiB
Python
95 lines
3.0 KiB
Python
import discord, codecs, string, json
|
|
from discord.ext import commands
|
|
from discord_slash import cog_ext
|
|
|
|
from utils import getParams # pylint: disable=import-error
|
|
|
|
params = getParams()
|
|
|
|
class MiscCog(commands.Cog):
|
|
def __init__(self, bot):
|
|
"""Runs misc commands."""
|
|
self.bot = bot
|
|
self.bot.remove_command("help")
|
|
self.generators = bot.other.generators
|
|
self.bedreNetflix = bot.other.bedreNetflix
|
|
self.nerdShit = bot.other.nerdShit
|
|
|
|
# Sends the bot's latency
|
|
@cog_ext.cog_slash(**params["ping"])
|
|
async def ping(self, ctx):
|
|
await ctx.send(f"Pong!\nLatency is {round(self.bot.latency * 1000)}ms")
|
|
|
|
# Restarts the bot
|
|
@cog_ext.cog_slash(**params["stop"])
|
|
async def stop(self, ctx):
|
|
await self.bot.stop(ctx)
|
|
|
|
# Gets help for specific command
|
|
@cog_ext.cog_slash(**params["help"])
|
|
async def helpCommand(self, ctx, command = ""):
|
|
await self.bot.other.helpFunc(ctx, command)
|
|
|
|
# Lets you thank the bot
|
|
@cog_ext.cog_slash(**params["thank"])
|
|
async def thank(self, ctx):
|
|
await ctx.send("You're welcome :blush:")
|
|
|
|
# Sends a friendly message
|
|
@cog_ext.cog_slash(**params["hello"])
|
|
async def hello(self, ctx):
|
|
await self.bot.other.helloFunc(ctx)
|
|
|
|
# Rolls dice
|
|
@cog_ext.cog_slash(**params["roll"])
|
|
async def roll(self, ctx, dice = "1d20"):
|
|
await self.bot.other.rollDice(ctx, dice)
|
|
|
|
# Sends a random image
|
|
@cog_ext.cog_slash(**params["image"])
|
|
async def image(self, ctx):
|
|
await self.bot.other.imageFunc(ctx)
|
|
|
|
# Finds a random movie
|
|
@cog_ext.cog_slash(**params["movie"])
|
|
async def movie(self, ctx):
|
|
await self.bot.other.movieFunc(ctx)
|
|
|
|
# Generates a random name
|
|
@cog_ext.cog_slash(**params["name"])
|
|
async def name(self, ctx):
|
|
await self.generators.nameGen(ctx)
|
|
|
|
# Generates a random tavern name
|
|
@cog_ext.cog_slash(**params["tavern"])
|
|
async def tavern(self, ctx):
|
|
await self.generators.tavernGen(ctx)
|
|
|
|
# Finds a page on the Senkulpa wiki
|
|
@cog_ext.cog_slash(**params["wiki"])
|
|
async def wiki(self, ctx, wikiPage = ""):
|
|
await self.bot.other.findWikiPage(ctx, wikiPage)
|
|
|
|
#Searches for movie and adds it to Bedre Netflix
|
|
@cog_ext.cog_slash(**params["addMovie"])
|
|
async def addMovie(self, ctx, movie):
|
|
await self.bedreNetflix.requestMovie(ctx, movie)
|
|
|
|
#Searches for show and adds it to Bedre Netflix
|
|
@cog_ext.cog_slash(**params["addShow"])
|
|
async def addShow(self, ctx, show):
|
|
await self.bedreNetflix.requestShow(ctx, show)
|
|
|
|
#Returns currently downloading torrents
|
|
@cog_ext.cog_slash(**params["downloading"])
|
|
async def downloading(self, ctx, parameters = "-d"):
|
|
await self.bedreNetflix.downloading(ctx, parameters)
|
|
|
|
#Looks up on Wolfram Alpha
|
|
@cog_ext.cog_slash(**params["wolf"])
|
|
async def wolf(self, ctx, query):
|
|
await self.nerdShit.wolfSearch(ctx, query)
|
|
|
|
def setup(bot):
|
|
bot.add_cog(MiscCog(bot))
|