Skip to content

Commit

Permalink
コマンドの説明を日本語にする (#131)
Browse files Browse the repository at this point in the history
Signed-off-by: ikafly144 <support@sabafly.net>
  • Loading branch information
ikafly144 authored Aug 23, 2023
1 parent 640fdf1 commit 426d0c8
Show file tree
Hide file tree
Showing 17 changed files with 389 additions and 225 deletions.
8 changes: 5 additions & 3 deletions bot/commands/about.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ import (
lib "github.com/sabafly/sabafly-lib/v2"
botlib "github.com/sabafly/sabafly-lib/v2/bot"
"github.com/sabafly/sabafly-lib/v2/handler"
"github.com/sabafly/sabafly-lib/v2/translate"
"github.com/shirou/gopsutil/v3/mem"
)

func About(b *botlib.Bot[*client.Client]) handler.Command {
return handler.Command{
Create: discord.SlashCommandCreate{
Name: "about",
Description: "ボットの情報を表示します",
DMPermission: &b.Config.DMPermission,
Name: "about",
Description: "show bot info",
DescriptionLocalizations: translate.MessageMap("about_command_description", false),
DMPermission: &b.Config.DMPermission,
},
CommandHandlers: map[string]handler.CommandHandler{
"": aboutCommandHandler(b),
Expand Down
96 changes: 57 additions & 39 deletions bot/commands/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,29 @@ func Config(b *botlib.Bot[*client.Client]) handler.Command {
Description: "bump",
Options: []discord.ApplicationCommandOptionSubCommand{
{
Name: "on",
Description: "turn on",
Name: "on",
Description: "turn on",
DescriptionLocalizations: translate.MessageMap("config_bump_on_command_description", false),
},
{
Name: "off",
Description: "turn off",
Name: "off",
Description: "turn off",
DescriptionLocalizations: translate.MessageMap("config_bump_off_command_description", false),
},
{
Name: "message",
Description: "config message",
Name: "message",
Description: "config message",
DescriptionLocalizations: translate.MessageMap("config_bump_message_command_description", false),
},
{
Name: "mention",
Description: "set mention role",
Name: "mention",
Description: "set mention role",
DescriptionLocalizations: translate.MessageMap("config_bump_mention_command_description", false),
Options: []discord.ApplicationCommandOption{
discord.ApplicationCommandOptionRole{
Name: "role",
Description: "target role",
Name: "role",
Description: "target role",
DescriptionLocalizations: translate.MessageMap("config_bump_mention_command_role_option_description", false),
},
},
},
Expand All @@ -56,24 +61,29 @@ func Config(b *botlib.Bot[*client.Client]) handler.Command {
Description: "up",
Options: []discord.ApplicationCommandOptionSubCommand{
{
Name: "on",
Description: "turn on",
Name: "on",
Description: "turn on",
DescriptionLocalizations: translate.MessageMap("config_up_on_command_description", false),
},
{
Name: "off",
Description: "turn off",
Name: "off",
Description: "turn off",
DescriptionLocalizations: translate.MessageMap("config_up_off_message_description", false),
},
{
Name: "message",
Description: "config message",
Name: "message",
Description: "config message",
DescriptionLocalizations: translate.MessageMap("config_up_message_command_description", false),
},
{
Name: "mention",
Description: "set mention role",
Name: "mention",
Description: "set mention role",
DescriptionLocalizations: translate.MessageMap("config_up_mention_command_description", false),
Options: []discord.ApplicationCommandOption{
discord.ApplicationCommandOptionRole{
Name: "role",
Description: "target role",
Name: "role",
Description: "target role",
DescriptionLocalizations: translate.MessageMap("config_up_mention_command_role_option_description", false),
},
},
},
Expand All @@ -84,30 +94,35 @@ func Config(b *botlib.Bot[*client.Client]) handler.Command {
Description: "level config",
Options: []discord.ApplicationCommandOptionSubCommand{
{
Name: "notice-message",
Description: "set level up message",
Name: "notice-message",
Description: "set level up message",
DescriptionLocalizations: translate.MessageMap("config_level_notice_message_command_description", false),
},
{
Name: "notice-channel",
Description: "set level up message channel to send",
Name: "notice-channel",
Description: "set level up message channel to send",
DescriptionLocalizations: translate.MessageMap("config_level_notice_channel_command_description", false),
Options: []discord.ApplicationCommandOption{
discord.ApplicationCommandOptionChannel{
Name: "channel",
Description: "target channel",
Name: "channel",
Description: "target channel",
DescriptionLocalizations: translate.MessageMap("config_level_notice_channel_command_channel_option_description", false),
ChannelTypes: []discord.ChannelType{
discord.ChannelTypeGuildText,
},
},
},
},
{
Name: "exclude-add",
Description: "add exclude channel",
Name: "exclude-add",
Description: "add exclude channel",
DescriptionLocalizations: translate.MessageMap("config_level_exclude_add_command_description", false),
Options: []discord.ApplicationCommandOption{
discord.ApplicationCommandOptionChannel{
Name: "channel",
Description: "target channel",
Required: true,
Name: "channel",
Description: "target channel",
DescriptionLocalizations: translate.MessageMap("config_level_exclude_add_command_channel_option_description", false),
Required: true,
ChannelTypes: []discord.ChannelType{
discord.ChannelTypeGuildText,
discord.ChannelTypeGuildPublicThread,
Expand All @@ -118,20 +133,23 @@ func Config(b *botlib.Bot[*client.Client]) handler.Command {
},
},
{
Name: "exclude-remove",
Description: "remove exclude channel",
Name: "exclude-remove",
Description: "remove exclude channel",
DescriptionLocalizations: translate.MessageMap("config_level_exclude_remove_command_description", false),
Options: []discord.ApplicationCommandOption{
discord.ApplicationCommandOptionString{
Name: "channel",
Description: "target channel",
Required: true,
Autocomplete: true,
Name: "channel",
Description: "target channel",
DescriptionLocalizations: translate.MessageMap("config_level_exclude_remove_command_channel_option_description", false),
Required: true,
Autocomplete: true,
},
},
},
{
Name: "import-mee6",
Description: "import level data from mee6 ⚠ all guild levels reset ⚠",
Name: "import-mee6",
Description: "import level data from mee6 ⚠ all guild levels reset ⚠",
DescriptionLocalizations: translate.MessageMap("config_level_import_mee6_command_description", false),
},
},
},
Expand Down
48 changes: 28 additions & 20 deletions bot/commands/level.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,48 +28,56 @@ func Level(b *botlib.Bot[*client.Client]) handler.Command {
Description: "user",
Options: []discord.ApplicationCommandOptionSubCommand{
{
Name: "move",
Description: "set user level",
Name: "move",
Description: "set user level",
DescriptionLocalizations: translate.MessageMap("level_user_move_command_description", false),
Options: []discord.ApplicationCommandOption{
discord.ApplicationCommandOptionUser{
Name: "target-from",
Description: "target user move level from",
Required: true,
Name: "target-from",
Description: "target user move level from",
DescriptionLocalizations: translate.MessageMap("level_user_move_command_target_from_option_description", false),
Required: true,
},
discord.ApplicationCommandOptionUser{
Name: "target-to",
Description: "target user move level to",
Required: true,
Name: "target-to",
Description: "target user move level to",
DescriptionLocalizations: translate.MessageMap("level_user_move_command_target_to_option_description", false),
Required: true,
},
},
},
{
Name: "reset",
Description: "reset user level",
Name: "reset",
Description: "reset user level",
DescriptionLocalizations: translate.MessageMap("level_user_reset_command_description", false),
Options: []discord.ApplicationCommandOption{
discord.ApplicationCommandOptionUser{
Name: "target",
Description: "target user",
Required: true,
Name: "target",
Description: "target user",
DescriptionLocalizations: translate.MessageMap("level_user_reset_command_target_option_description", false),
Required: true,
},
},
},
},
},
discord.ApplicationCommandOptionSubCommand{
Name: "leaderboard",
Description: "show guild member leaderboard",
Name: "leaderboard",
Description: "show guild member leaderboard",
DescriptionLocalizations: translate.MessageMap("level_leaderboard_command_description", false),
Options: []discord.ApplicationCommandOption{
discord.ApplicationCommandOptionInt{
Name: "page",
Description: "page number",
MinValue: json.Ptr(1),
Name: "page",
Description: "page number",
DescriptionLocalizations: translate.MessageMap("level_leaderboard_command_page_option_description", false),
MinValue: json.Ptr(1),
},
},
},
discord.ApplicationCommandOptionSubCommand{
Name: "point",
Description: "show yourself point",
Name: "point",
Description: "show yourself point",
DescriptionLocalizations: translate.MessageMap("level_point_command_description", false),
},
},
},
Expand Down
3 changes: 0 additions & 3 deletions bot/commands/math.go

This file was deleted.

70 changes: 41 additions & 29 deletions bot/commands/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,22 @@ func Message(b *botlib.Bot[*client.Client]) handler.Command {
Description: "pin",
Options: []discord.ApplicationCommandOptionSubCommand{
{
Name: "create",
Description: "create pinned message",
Name: "create",
Description: "create pinned message",
DescriptionLocalizations: translate.MessageMap("message_pin_create_command_description", false),
Options: []discord.ApplicationCommandOption{
discord.ApplicationCommandOptionBool{
Name: "use-embed",
Description: "wither uses embed creator",
Required: false,
Name: "use-embed",
Description: "wither uses embed creator",
DescriptionLocalizations: translate.MessageMap("message_pin_create_command_user_embed_option_description", false),
Required: false,
},
},
},
{
Name: "delete",
Description: "delete pinned message",
Name: "delete",
Description: "delete pinned message",
DescriptionLocalizations: translate.MessageMap("message_pin_delete_command_description", false),
},
},
},
Expand All @@ -51,48 +54,57 @@ func Message(b *botlib.Bot[*client.Client]) handler.Command {
Description: "suffix",
Options: []discord.ApplicationCommandOptionSubCommand{
{
Name: "set",
Description: "set user message suffix",
Name: "set",
Description: "set user message suffix",
DescriptionLocalizations: translate.MessageMap("message_suffix_set_command_description", false),
Options: []discord.ApplicationCommandOption{
discord.ApplicationCommandOptionUser{
Name: "target",
Description: "target user",
Required: true,
Name: "target",
Description: "target user",
DescriptionLocalizations: translate.MessageMap("message_suffix_set_command_target_option_description", false),
Required: true,
},
discord.ApplicationCommandOptionString{
Name: "suffix",
Description: "suffix text",
Required: true,
Name: "suffix",
Description: "suffix text",
DescriptionLocalizations: translate.MessageMap("message_suffix_set_command_suffix_option_description", false),
Required: true,
},
discord.ApplicationCommandOptionInt{
Name: "rule-type",
Description: "force suffix rule type",
Required: true,
Name: "rule-type",
Description: "force suffix rule type",
DescriptionLocalizations: translate.MessageMap("message_suffix_set_command_rule_type_option_description", false),
Required: true,
Choices: []discord.ApplicationCommandOptionChoiceInt{
{
Name: "send warning message",
Value: db.MessageSuffixRuleTypeWarning,
Name: "send warning message",
NameLocalizations: translate.MessageMap("message_suffix_set_command_rule_type_option_send_warn", false),
Value: db.MessageSuffixRuleTypeWarning,
},
{
Name: "delete message",
Value: db.MessageSuffixRuleTypeDelete,
Name: "delete message",
NameLocalizations: translate.MessageMap("message_suffix_set_command_rule_type_option_delete", false),
Value: db.MessageSuffixRuleTypeDelete,
},
{
Name: "webhook replace",
Value: db.MessageSuffixRuleTypeWebhook,
Name: "webhook replace",
NameLocalizations: translate.MessageMap("message_suffix_set_command_rule_type_webhook", false),
Value: db.MessageSuffixRuleTypeWebhook,
},
},
},
},
},
{
Name: "remove",
Description: "remove suffix rule from target",
Name: "remove",
Description: "remove suffix rule from target",
DescriptionLocalizations: translate.MessageMap("message_suffix_remove_command_description", false),
Options: []discord.ApplicationCommandOption{
discord.ApplicationCommandOptionUser{
Name: "target",
Description: "target user",
Required: true,
Name: "target",
Description: "target user",
DescriptionLocalizations: translate.MessageMap("message_suffix_remove_command_target_option_description", false),
Required: true,
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion bot/commands/message_other.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func MessageOther(b *botlib.Bot[*client.Client]) handler.Command {
return handler.Command{
Create: discord.MessageCommandCreate{
Name: "message other",
NameLocalizations: *translate.MessageMap("message_other_command_name", false),
NameLocalizations: translate.MessageMap("message_other_command_name", false),
DMPermission: &b.Config.DMPermission,
},
CommandHandlers: map[string]handler.CommandHandler{
Expand Down
Loading

0 comments on commit 426d0c8

Please sign in to comment.