Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add description parameter to start command #236

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/main/java/com/jagrosh/giveawaybot/commands/StartCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public StartCmd(GiveawayBot bot)
.setDescription("starts a giveaway")
.addOptions(new ApplicationCommandOption(ApplicationCommandOption.Type.STRING, "duration", "duration of the giveaway", true),
new ApplicationCommandOption(ApplicationCommandOption.Type.INTEGER, "winners", "number of winners", true, 1, 50, false),
new ApplicationCommandOption(ApplicationCommandOption.Type.STRING, "prize", "the prize being given away", true))
new ApplicationCommandOption(ApplicationCommandOption.Type.STRING, "prize", "the prize being given away", true),
new ApplicationCommandOption(ApplicationCommandOption.Type.STRING, "description", "a description of your giveaway", false))
.setDmPermission(false)
.setDefaultPermissions(Permission.MANAGE_GUILD)
.build();
Expand All @@ -61,7 +62,10 @@ public InteractionResponse gbExecute(Interaction interaction) throws GiveawayExc
Giveaway g = bot.getGiveawayManager().constructGiveaway(interaction.getUser(),
interaction.getCommandData().getOptionByName("duration").getStringValue(),
interaction.getCommandData().getOptionByName("winners").getIntValue() + "",
interaction.getCommandData().getOptionByName("prize").getStringValue(), null, pl, interaction.getEffectiveLocale());
interaction.getCommandData().getOptionByName("prize").getStringValue(),
interaction.getCommandData().getOptionByName("description") == null ? null :
interaction.getCommandData().getOptionByName("description").getStringValue(),
pl, interaction.getEffectiveLocale());

// attempt giveaway creation
long id = bot.getGiveawayManager().sendGiveaway(g, interaction.getGuildId(), interaction.getChannelId());
Expand Down