⚙️ Cogs
This commit is contained in:
52
cogs/SwCog.py
Normal file
52
cogs/SwCog.py
Normal file
@ -0,0 +1,52 @@
|
||||
import discord, string
|
||||
from discord.ext import commands
|
||||
|
||||
from funcs import logThis, parseRoll, parseDestiny, critRoll, parseChar, cap
|
||||
|
||||
class SwCog(commands.Cog):
|
||||
|
||||
"""Cog for Star Wars functions"""
|
||||
|
||||
def __init__(self,client):
|
||||
self.client = client
|
||||
|
||||
# Rolls star wars dice
|
||||
@commands.command()
|
||||
async def swroll(self, ctx, *, content):
|
||||
command = cap(content)
|
||||
newMessage = parseRoll("#"+str(ctx.message.author.id),command)
|
||||
messageList = newMessage.split("\n")
|
||||
for messageItem in messageList:
|
||||
await ctx.send(messageItem)
|
||||
|
||||
# Controls destiny points
|
||||
@commands.command()
|
||||
async def swd(self, ctx, *, content):
|
||||
newMessage = parseDestiny("#"+str(ctx.message.author.id),content)
|
||||
messageList = newMessage.split("\n")
|
||||
for messageItem in messageList:
|
||||
await ctx.send(messageItem)
|
||||
|
||||
# Rolls for critical injuries
|
||||
@commands.command()
|
||||
async def swcrit(self, ctx, arg : int = 0):
|
||||
newMessage = critRoll(int(arg))
|
||||
|
||||
messageList = newMessage.split("\n")
|
||||
for messageItem in messageList:
|
||||
await ctx.send(messageItem)
|
||||
|
||||
# Accesses and changes character sheet data with the parseChar function
|
||||
# from funcs/swfuncs/swchar.py
|
||||
@commands.command(aliases=["sw"])
|
||||
async def swchar(self, ctx, *, content = ""):
|
||||
command = string.capwords(content.replace("+","+ ").replace("-","- ").replace(",",", "))
|
||||
title, desc = parseChar("#"+str(ctx.message.author.id),command)
|
||||
if title != "":
|
||||
em1 = discord.Embed(title = title, description = desc, colour=0xDEADBF)
|
||||
await ctx.send(embed = em1)
|
||||
else:
|
||||
await ctx.send(desc)
|
||||
|
||||
def setup(client):
|
||||
client.add_cog(SwCog(client))
|
Reference in New Issue
Block a user