52 lines
1.7 KiB
Python
52 lines
1.7 KiB
Python
import discord, string
|
|
from discord.ext import commands
|
|
|
|
from funcs import 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)) |