Make decide a slash command

This commit is contained in:
Luke Robles 2022-11-07 07:59:38 -08:00
parent cbbcfa8faa
commit 74dcf9b8a3
2 changed files with 13 additions and 16 deletions

View File

@ -10,12 +10,21 @@ class Cheeky(commands.Cog):
def __init__(self, bot):
self.bot: commands.Bot = bot
@commands.command(name="decide")
async def decide(self, ctx: commands.Context):
@commands.slash_command(
guild_ids=None,
name="decide",
description="Separate your choices with the word 'or', or dont to get a yes or no response.",
)
@option(name="input_string", required=True)
async def decide(self, ctx, input_string):
import decide
import random
await ctx.reply(decide.decide(ctx.message.content))
choices = input_string.split(" or ")
if len(choices) > 1:
await ctx.respond(random.choice(choices))
else:
await ctx.respond(random.choice(["yes", "no"]))
@commands.command(name="coom", pass_context=True)
async def coom(self, ctx: commands.Context, id=None):

View File

@ -1,12 +0,0 @@
import random
import help_methods
def decide(message):
choices = message.replace("!decide", "").lstrip().split(" or ")
if "" in choices:
return help_methods.get_help_message("decide")
elif len(choices) > 1:
return random.choice(choices)
else:
return random.choice(["yes", "no"])