rework poll to support full strings as options
This commit is contained in:
parent
8c20bf160c
commit
17374fd2f6
@ -1,6 +1,6 @@
|
|||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from discord.commands import Option
|
from discord import option
|
||||||
|
|
||||||
|
|
||||||
class QuickPoll(commands.Cog):
|
class QuickPoll(commands.Cog):
|
||||||
@ -10,15 +10,50 @@ class QuickPoll(commands.Cog):
|
|||||||
@commands.slash_command(
|
@commands.slash_command(
|
||||||
guild_ids=None,
|
guild_ids=None,
|
||||||
pass_context=True,
|
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(
|
async def poll(
|
||||||
self,
|
self,
|
||||||
ctx,
|
ctx,
|
||||||
question,
|
question: str,
|
||||||
options: Option(str, "poll options (separated by spaces)", required=True),
|
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:
|
if len(options) <= 1:
|
||||||
await ctx.send("You need more than one option to make a poll!")
|
await ctx.send("You need more than one option to make a poll!")
|
||||||
return
|
return
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
"""Utility for server administration via source rcon."""
|
"""Utility for server administration via source rcon."""
|
||||||
|
|
||||||
import socket
|
import socket
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user