diff --git a/app/cogs/poll.py b/app/cogs/poll.py index 133cb017..121ec86c 100755 --- a/app/cogs/poll.py +++ b/app/cogs/poll.py @@ -1,6 +1,6 @@ import discord from discord.ext import commands -from discord.commands import Option +from discord import option class QuickPoll(commands.Cog): @@ -10,15 +10,50 @@ class QuickPoll(commands.Cog): @commands.slash_command( guild_ids=None, pass_context=True, - description="Create a poll with up to 10 options. Separate your options with a space", + description="Create a poll with up to 10 options", ) + @option(name="option1", description="Poll option", required=True) + @option(name="option2", description="Poll option", required=False) + @option(name="option3", description="Poll option", required=False) + @option(name="option4", description="Poll option", required=False) + @option(name="option5", description="Poll option", required=False) + @option(name="option6", description="Poll option", required=False) + @option(name="option7", description="Poll option", required=False) + @option(name="option8", description="Poll option", required=False) + @option(name="option9", description="Poll option", required=False) + @option(name="option10", description="Poll option", required=False) async def poll( self, ctx, - question, - options: Option(str, "poll options (separated by spaces)", required=True), + question: str, + option1: str, + option2: str, + option3: str, + option4: str, + option5: str, + option6: str, + option7: str, + option8: str, + option9: str, + option10: str, ): - options = options.split() + # Filter out empty "options" + options = [ + x + for x in [ + option1, + option2, + option3, + option4, + option5, + option6, + option7, + option8, + option9, + option10, + ] + if x + ] if len(options) <= 1: await ctx.send("You need more than one option to make a poll!") return diff --git a/app/source_rcon.py b/app/source_rcon.py index 46499a51..196b581f 100755 --- a/app/source_rcon.py +++ b/app/source_rcon.py @@ -1,4 +1,5 @@ """Utility for server administration via source rcon.""" + import socket import struct