⚙️ Cogs
This commit is contained in:
70
cogs/LookupCog.py
Normal file
70
cogs/LookupCog.py
Normal file
@ -0,0 +1,70 @@
|
||||
import discord, codecs
|
||||
from discord.ext import commands
|
||||
|
||||
from funcs import logThis, spellFunc, monsterFunc, cap
|
||||
|
||||
class LookupCog(commands.Cog):
|
||||
|
||||
"""Cog for lookup functions"""
|
||||
|
||||
def __init__(self,client):
|
||||
self.client = client
|
||||
|
||||
# Looks up a spell
|
||||
@commands.command()
|
||||
async def spell(self, ctx, *, content):
|
||||
spell = spellFunc(cap(content))
|
||||
if len(spell) > 2000:
|
||||
await ctx.send(spell[:2000])
|
||||
await ctx.send(spell[2000:])
|
||||
else:
|
||||
await ctx.send(spell)
|
||||
|
||||
# Looks up a monster
|
||||
@commands.command()
|
||||
async def monster(self, ctx, *, content):
|
||||
title, text1, text2, text3, text4, text5 = monsterFunc(cap(content))
|
||||
em1 = discord.Embed(title = title, description = text1, colour=0xDEADBF)
|
||||
|
||||
# Sends the received information. Seperates into seperate messages if
|
||||
# there is too much text
|
||||
await ctx.send(embed = em1)
|
||||
if text2 != "":
|
||||
if len(text2) < 2048:
|
||||
em2 = discord.Embed(title = "Special Abilities", description = text2, colour=0xDEADBF)
|
||||
await ctx.send(embed = em2)
|
||||
else:
|
||||
em2 = discord.Embed(title = "Special Abilities", description = text2[:2048], colour=0xDEADBF)
|
||||
await ctx.send(embed = em2)
|
||||
em2_2 = discord.Embed(title = "", description = text2[2048:], colour=0xDEADBF)
|
||||
await ctx.send(embed = em2_2)
|
||||
if text3 != "":
|
||||
if len(text3) < 2048:
|
||||
em3 = discord.Embed(title = "Actions", description = text3, colour=0xDEADBF)
|
||||
await ctx.send(embed = em3)
|
||||
else:
|
||||
em3 = discord.Embed(title = "Actions", description = text3[:2048], colour=0xDEADBF)
|
||||
await ctx.send(embed = em3)
|
||||
em3_2 = discord.Embed(title = "", description = text3[2048:], colour=0xDEADBF)
|
||||
await ctx.send(embed = em3_2)
|
||||
if text4 != "":
|
||||
if len(text4) < 2048:
|
||||
em4 = discord.Embed(title = "Reactions", description = text4, colour=0xDEADBF)
|
||||
await ctx.send(embed = em4)
|
||||
else:
|
||||
em4 = discord.Embed(title = "Reactions", description = text4[:2048], colour=0xDEADBF)
|
||||
await ctx.send(embed = em4)
|
||||
em4_2 = discord.Embed(title = "", description = text4[2048:], colour=0xDEADBF)
|
||||
await ctx.send(embed = em4_2)
|
||||
if text5 != "":
|
||||
if len(text5) < 2048:
|
||||
em5 = discord.Embed(title = "Legendary Actions", description = text5, colour=0xDEADBF)
|
||||
await ctx.send(embed = em5)
|
||||
else:
|
||||
em5 = discord.Embed(title = "Legendary Actions", description = text5[:2048], colour=0xDEADBF)
|
||||
await ctx.send(embed = em5)
|
||||
em5_2 = discord.Embed(title = "", description = text5[2048:], colour=0xDEADBF)
|
||||
await ctx.send(embed = em5_2)
|
||||
|
||||
def setup(client):
|
||||
client.add_cog(LookupCog(client))
|
Reference in New Issue
Block a user