-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* wip * working and new style * working and new style * cleanup * working * fix custom parameter with long paramters and add doc * add blue and dark style
- Loading branch information
1 parent
cb5c5e3
commit 5dd7704
Showing
842 changed files
with
1,381 additions
and
824 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,7 +159,16 @@ image:image/minimal.png[image,320] | |
|
||
=== Dice Images | ||
|
||
The `custom_dice`, `sum_custom_dice` and `custom_parameter` commands have an `result_image` option that can be configured to add an image of the rolled dice. | ||
The `custom_dice`, `sum_custom_dice` and `custom_parameter` commands have a `dice_image_style` and a `dice_image_color` option that can be configured to add an image of the rolled dice. | ||
The color of specific dice can be overwritten, with valid colors for the style, in the expression. | ||
For example: | ||
|
||
`/custom_dice start buttons: 2d6+color(2d10, 'red_and_gold')+color(2d20,'green_and_gold')@color roll answer_format: without_expression dice_image_style: polyhedral_alies_v2 dice_image_color: blue_and_gold` | ||
|
||
produces: | ||
|
||
image:image/colorRoll.png[image,320] | ||
|
||
For the direct rolls it can be configured with the `channel_config` command. | ||
The images will only be shown if the following conditions are met: | ||
|
||
|
@@ -174,92 +183,78 @@ There are the following options: | |
|
||
No image will be shown. | ||
|
||
==== polyhedral_3d_red_and_white | ||
==== polyhedral_3d | ||
|
||
image:image/3d_red_and_white.png[image,600] | ||
|
||
Valid for d4, d6, d10, d8, d12, d20, d100 | ||
Valid for d4, d6, d10, d8, d12, d20, d100 and the only supported color is: `red_and_white` | ||
|
||
==== fate_black | ||
==== fate | ||
|
||
image:image/fate_image.png[image,360] | ||
|
||
Valid for d[-1,1,1] | ||
Valid for d[-1,1,1] and the only supported color is: `black` | ||
|
||
==== d6_dots_white | ||
==== d6_dots | ||
|
||
image:image/d6White.png[image,360] | ||
|
||
Valid for d6 | ||
Valid for d6 and the only supported color is: `white` | ||
|
||
==== polyhedral_draw_color | ||
==== polyhedral_2d | ||
|
||
image:image/draw_color.png[image,600] | ||
|
||
Valid for d4, d6, d10, d8, d12, d20, d100. | ||
Generates the dice images in the given color of the die (default is red). | ||
The color of a die can be set with the `color` function. | ||
|
||
The supported colors are: 'white', 'gray', 'black', 'red', 'pink', 'orange', 'yellow', 'green', 'magenta', 'cyan', 'blue'. | ||
|
||
For example: | ||
`color(1d4,'gray') + color(1d6,'black') + color(1d8,'white') + color(1d10,'red') + color(1d12,'blue') + color(1d20,'green') + color(1d100,'orange')` rolls each die type in another color. | ||
Valid for d4, d6, d10, d8, d12, d20, d100 and the supported colors are: `white`, `gray`, `black`, `red`, `pink`, `orange`, `yellow`, `green`, `magenta`, `cyan`, `blue`. | ||
|
||
==== polyhedral_black_and_gold | ||
==== polyhedral_alies_v1 | ||
|
||
image:image/black_and_gold.png[image,600] | ||
|
||
Valid for d4, d6, d10, d8, d12, d20, d100. | ||
Valid for d4, d6, d10, d8, d12, d20, d100 and the only supported color is: `black_and_gold` | ||
This set was designed and contributed by https://www.instagram.com/alie_in_beanland/[alieinbeanland]. | ||
|
||
==== polyhedral_black_and_gold_v2 | ||
|
||
image:image/polyhedral_black_and_gold_v2.png[image,600] | ||
==== polyhedral_alies_v2 | ||
|
||
Valid for d4, d6, d10, d8, d12, d20, d100. | ||
This set was designed and contributed by https://www.instagram.com/alie_in_beanland/[alieinbeanland]. | ||
Valid for d4, d6, d10, d8, d12, d20, d100 and supported colors are: `black_and_gold`, `blue_and_silver`, `blue_and_gold`, `green_and_gold`, `orange_and_silver`, `red_and_gold`, `purple_and_silver` | ||
|
||
==== polyhedral_alies_blue_and_silver | ||
.black_and_gold | ||
image:image/polyhedral_black_and_gold_v2.png[image,600] | ||
|
||
.blue_and_silver | ||
image:image/blue_and_silver.png[image,600] | ||
|
||
Valid for d4, d6, d10, d8, d12, d20, d100. | ||
This set was designed and contributed by https://www.instagram.com/alie_in_beanland/[alieinbeanland]. | ||
|
||
==== polyhedral_green_and_gold | ||
|
||
.green_and_gold | ||
image:image/green_and_gold.png[image,600] | ||
|
||
Valid for d4, d6, d10, d8, d12, d20, d100. | ||
This set was designed and contributed by https://www.instagram.com/alie_in_beanland/[alieinbeanland]. | ||
|
||
==== polyhedral_red_and_gold | ||
|
||
.red_and_gold | ||
image:image/red_and_gold.png[image,600] | ||
|
||
Valid for d4, d6, d10, d8, d12, d20, d100. | ||
This set was designed and contributed by https://www.instagram.com/alie_in_beanland/[alieinbeanland]. | ||
.blue_and_gold | ||
image:image/polyhedral_blue_and_gold.png[image,600] | ||
|
||
==== polyhedral_blue_and_gold | ||
.orange_and_silver | ||
image:image/polyhedral_orange_and_silver.png[image,600] | ||
|
||
image:image/polyhedral_blue_and_gold.png[image,600] | ||
.purple_and_silver | ||
image:image/polyhedral_purple_and_silver.png[image,600] | ||
|
||
Valid for d4, d6, d10, d8, d12, d20, d100. | ||
This set was designed and contributed by https://www.instagram.com/alie_in_beanland/[alieinbeanland]. | ||
|
||
==== polyhedral_orange_and_silver | ||
==== polyhedral_knots | ||
|
||
image:image/polyhedral_orange_and_silver.png[image,600] | ||
.blue | ||
image:image/polyhedral_knots_blue.png[image,600] | ||
|
||
Valid for d4, d6, d10, d8, d12, d20, d100. | ||
This set was designed and contributed by https://www.instagram.com/alie_in_beanland/[alieinbeanland]. | ||
.purple_dark | ||
image:image/polyhedral_knots_purple-dark.png[image,600] | ||
|
||
==== polyhedral_purple_and_silver | ||
.purple_white | ||
image:image/polyhedral_knots_purple-white.png[image,600] | ||
|
||
image:image/polyhedral_purple_and_silver.png[image,600] | ||
Valid for d4, d6, d10, d8, d12, d20, d100 and the supported color is: `blue`, `purple_dark` and `purple_white` | ||
|
||
Valid for d4, d6, d10, d8, d12, d20, d100. | ||
This set was designed and contributed by https://www.instagram.com/alie_in_beanland/[alieinbeanland]. | ||
This set was designed and contributed by mailto:[email protected][Myrynvalona]. | ||
|
||
=== Custom Dice Buttons | ||
|
||
|
@@ -467,7 +462,7 @@ The maximum are 23 buttons. | |
It is possible to add an optional label to each value in the format `value@label`. | ||
For example `{bonus:0@None/3@Small Bonus/5@Big Bonus}` will show on the buttons 'None', 'Small Bonus' and 'Big Bonus' but apply the values 0, 3 or 5 to the expression | ||
|
||
A expression can have up to 4 parameter. | ||
An expression can have up to 4 parameter. | ||
The user can click on the buttons to fill all open parameter of the expression. | ||
If all parameter are selected then the expression will be rolled. | ||
The first user that clicks on a button add his name to the message and only this user can select further parameter. | ||
|
@@ -577,6 +572,7 @@ All functions are case insensitiv. | |
|
||
== Contributors | ||
|
||
* Special thank to https://www.instagram.com/alie_in_beanland/[alieinbeanland ] for the design of the dice images. | ||
* The `polyhedral_3d_red_and_white` dice images where adapted from https://blendswap.com/blend/16634 | ||
* The `d6_dots_white` dice images are from https://game-icons.net/ | ||
* Special thank to https://www.instagram.com/alie_in_beanland/[alieinbeanland] for the design of the dice images for `polyhedral_alies_v1` and `polyhedral_alies_v2` | ||
* Special thank to mailto:[email protected][Myrynvalona] for the design of the dice images for `polyhedral_knots` | ||
* The `polyhedral_3d` dice images where adapted from https://blendswap.com/blend/16634 | ||
* The `d6_dot` dice images are from https://game-icons.net/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
bot/src/main/java/de/janno/discord/bot/command/BaseCommandOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
package de.janno.discord.bot.command; | ||
|
||
import de.janno.discord.bot.dice.image.DiceImageStyle; | ||
import de.janno.discord.connector.api.AutoCompleteAnswer; | ||
import de.janno.discord.connector.api.AutoCompleteRequest; | ||
import de.janno.discord.connector.api.OptionValue; | ||
import de.janno.discord.connector.api.slash.CommandDefinitionOption; | ||
import de.janno.discord.connector.api.slash.CommandDefinitionOptionChoice; | ||
import de.janno.discord.connector.api.slash.CommandInteractionOption; | ||
import lombok.NonNull; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Optional; | ||
import java.util.stream.Collectors; | ||
|
||
public final class BaseCommandOptions { | ||
private static final String ANSWER_TARGET_CHANNEL_OPTION = "target_channel"; | ||
public static final CommandDefinitionOption ANSWER_TARGET_CHANNEL_COMMAND_OPTION = CommandDefinitionOption.builder() | ||
.name(ANSWER_TARGET_CHANNEL_OPTION) | ||
.description("Another channel where the answer will be given") | ||
.type(CommandDefinitionOption.Type.CHANNEL) | ||
.build(); | ||
private static final String ANSWER_FORMAT_OPTION = "answer_format"; | ||
public static final CommandDefinitionOption ANSWER_FORMAT_COMMAND_OPTION = CommandDefinitionOption.builder() | ||
.name(ANSWER_FORMAT_OPTION) | ||
.description("How the answer will be displayed") | ||
.type(CommandDefinitionOption.Type.STRING) | ||
.choices(Arrays.stream(AnswerFormatType.values()) | ||
.map(answerFormatType -> CommandDefinitionOptionChoice.builder() | ||
.name(answerFormatType.name()) | ||
.value(answerFormatType.name()) | ||
.build()) | ||
.collect(Collectors.toList())) | ||
.build(); | ||
private static final String DICE_IMAGE_STYLE_OPTION = "dice_image_style"; | ||
public static final CommandDefinitionOption DICE_IMAGE_STYLE_COMMAND_OPTION = CommandDefinitionOption.builder() | ||
.name(DICE_IMAGE_STYLE_OPTION) | ||
.description("If and in what style the dice throw should be shown as image") | ||
.type(CommandDefinitionOption.Type.STRING) | ||
.choices(Arrays.stream(DiceImageStyle.values()) | ||
.map(ri -> CommandDefinitionOptionChoice.builder() | ||
.name(ri.name()) | ||
.value(ri.name()) | ||
.build()) | ||
.collect(Collectors.toList())) | ||
.build(); | ||
private static final String DICE_IMAGE_COLOR_OPTION = "dice_image_color"; | ||
public static final CommandDefinitionOption DICE_IMAGE_COLOR_COMMAND_OPTION = CommandDefinitionOption.builder() | ||
.name(DICE_IMAGE_COLOR_OPTION) | ||
.description("The default color option. Can be influenced by the `color` method") | ||
.type(CommandDefinitionOption.Type.STRING) | ||
.autoComplete(true) | ||
.build(); | ||
|
||
public static List<AutoCompleteAnswer> autoCompleteColorOption(AutoCompleteRequest autoCompleteRequest) { | ||
if (!DICE_IMAGE_COLOR_OPTION.equals(autoCompleteRequest.getFocusedOptionName())) { | ||
return List.of(); | ||
} | ||
Optional<String> styleOptionValue = autoCompleteRequest.getOptionValues().stream() | ||
.filter(o -> DICE_IMAGE_STYLE_OPTION.equals(o.getOptionName())) | ||
.map(OptionValue::getOptionValue) | ||
.findFirst(); | ||
if (styleOptionValue.isEmpty() || !DiceImageStyle.isValidStyle(styleOptionValue.get())) { | ||
return List.of(new AutoCompleteAnswer("Select the dice image style first", "none")); | ||
} | ||
return DiceImageStyle.valueOf(styleOptionValue.get()).getSupportedColors().stream() | ||
.filter(s -> s.contains(autoCompleteRequest.getFocusedOptionValue())) | ||
.limit(25) | ||
.map(c -> new AutoCompleteAnswer(c, c)) | ||
.collect(Collectors.toList()); | ||
} | ||
|
||
public static Optional<Long> getAnswerTargetChannelIdFromStartCommandOption(@NonNull CommandInteractionOption options) { | ||
return options.getChannelIdSubOptionWithName(ANSWER_TARGET_CHANNEL_OPTION); | ||
} | ||
|
||
public static Optional<AnswerFormatType> getAnswerTypeFromStartCommandOption(@NonNull CommandInteractionOption options) { | ||
return options.getStringSubOptionWithName(ANSWER_FORMAT_OPTION) | ||
.map(AnswerFormatType::valueOf); | ||
} | ||
|
||
public static Optional<DiceImageStyle> getDiceStyleOptionFromStartCommandOption(@NonNull CommandInteractionOption options) { | ||
return options.getStringSubOptionWithName(DICE_IMAGE_STYLE_OPTION) | ||
.map(DiceImageStyle::valueOf); | ||
} | ||
|
||
public static Optional<String> getDiceColorOptionFromStartCommandOption(@NonNull CommandInteractionOption options) { | ||
return options.getStringSubOptionWithName(DICE_IMAGE_COLOR_OPTION); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.