Fully converted to slash commands

This commit is contained in:
NikolajDanger
2021-03-31 00:38:51 +02:00
parent a8a7e5eabd
commit b345720468
50 changed files with 1102 additions and 1111 deletions

View File

@ -3,28 +3,19 @@ from discord.ext import commands
from discord_slash import cog_ext
from discord_slash import SlashCommandOptionType as scot
from funcs import spellFunc, monsterFunc, cap
from utils import Options
from utils import getParams, cap
with open("resources/slashParameters.json", "r") as f:
params = json.load(f)
options = Options()
if options.testing:
for p in params:
params[p]["guild_ids"] = options.guildIds
params = getParams()
class LookupCog(commands.Cog):
def __init__(self,client):
def __init__(self, bot):
"""Runs lookup commands."""
self.client = client
self.bot = bot
# Looks up a spell
@cog_ext.cog_slash(**params["spell"])
async def spell(self, ctx, query):
spell = spellFunc(cap(query))
spell = self.bot.lookupFuncs.spellFunc(cap(query))
if len(spell) > 2000:
await ctx.send(spell[:2000])
await ctx.send(spell[2000:])
@ -34,7 +25,7 @@ class LookupCog(commands.Cog):
# Looks up a monster
@cog_ext.cog_slash(**params["monster"])
async def monster(self, ctx, query):
title, text1, text2, text3, text4, text5 = monsterFunc(cap(query))
title, text1, text2, text3, text4, text5 = self.bot.lookupFuncs.monsterFunc(cap(query))
em1 = discord.Embed(title = title, description = text1, colour=0xDEADBF)
# Sends the received information. Separates into separate messages if
@ -77,5 +68,5 @@ class LookupCog(commands.Cog):
em5_2 = discord.Embed(title = "", description = text5[2048:], colour=0xDEADBF)
await ctx.send(embed = em5_2)
def setup(client):
client.add_cog(LookupCog(client))
def setup(bot):
bot.add_cog(LookupCog(bot))