diff --git a/bot/commands/about.go b/bot/commands/about.go index 9fad2995..ad86d4a4 100644 --- a/bot/commands/about.go +++ b/bot/commands/about.go @@ -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), diff --git a/bot/commands/config.go b/bot/commands/config.go index 7edc9631..48813ccf 100644 --- a/bot/commands/config.go +++ b/bot/commands/config.go @@ -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), }, }, }, @@ -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), }, }, }, @@ -84,16 +94,19 @@ 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, }, @@ -101,13 +114,15 @@ func Config(b *botlib.Bot[*client.Client]) handler.Command { }, }, { - 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, @@ -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), }, }, }, diff --git a/bot/commands/level.go b/bot/commands/level.go index ec740e97..ab0fa9ff 100644 --- a/bot/commands/level.go +++ b/bot/commands/level.go @@ -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), }, }, }, diff --git a/bot/commands/math.go b/bot/commands/math.go deleted file mode 100644 index 7505bdfe..00000000 --- a/bot/commands/math.go +++ /dev/null @@ -1,3 +0,0 @@ -package commands - -var pint = func(n int) *int { return &n } diff --git a/bot/commands/message.go b/bot/commands/message.go index 65f23ee1..6aa2015e 100644 --- a/bot/commands/message.go +++ b/bot/commands/message.go @@ -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), }, }, }, @@ -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, }, }, }, diff --git a/bot/commands/message_other.go b/bot/commands/message_other.go index 3acd8996..274b4723 100644 --- a/bot/commands/message_other.go +++ b/bot/commands/message_other.go @@ -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{ diff --git a/bot/commands/minecraft.go b/bot/commands/minecraft.go index 24f6ab56..3e0c9d8b 100644 --- a/bot/commands/minecraft.go +++ b/bot/commands/minecraft.go @@ -32,25 +32,29 @@ func Minecraft(b *botlib.Bot[*client.Client]) handler.Command { Description: "status-panel", Options: []discord.ApplicationCommandOptionSubCommand{ { - Name: "create", - Description: "create status panel", + Name: "create", + Description: "create status panel", + DescriptionLocalizations: translate.MessageMap("minecraft_status_panel_create_command_description", false), Options: []discord.ApplicationCommandOption{ discord.ApplicationCommandOptionString{ - Name: "server-name", - Description: "name of server", - Required: true, - MaxLength: json.Ptr(100), + Name: "server-name", + Description: "name of server", + DescriptionLocalizations: translate.MessageMap("minecraft_status_panel_create_command_server_name_option_description", false), + Required: true, + MaxLength: json.Ptr(100), }, discord.ApplicationCommandOptionString{ - Name: "address", - Description: "address of server", - Required: true, - MaxLength: json.Ptr(32), + Name: "address", + Description: "address of server", + DescriptionLocalizations: translate.MessageMap("minecraft_status_panel_create_command_address_option_description", false), + Required: true, + MaxLength: json.Ptr(32), }, discord.ApplicationCommandOptionString{ - Name: "edition", - Description: "edition of server", - Required: true, + Name: "edition", + Description: "edition of server", + DescriptionLocalizations: translate.MessageMap("minecraft_status_panel_create_command_hide_address_option_description", false), + Required: true, Choices: []discord.ApplicationCommandOptionChoiceString{ { Name: "java", @@ -63,26 +67,30 @@ func Minecraft(b *botlib.Bot[*client.Client]) handler.Command { }, }, discord.ApplicationCommandOptionBool{ - Name: "hide-address", - Description: "hide address", + Name: "hide-address", + Description: "hide address", + DescriptionLocalizations: translate.MessageMap("minecraft_status_panel_create_command_hide_address_option_description", false), }, }, }, { - Name: "delete", - Description: "delete panel", + Name: "delete", + Description: "delete panel", + DescriptionLocalizations: translate.MessageMap("minecraft_status_panel_delete_command_description", false), Options: []discord.ApplicationCommandOption{ discord.ApplicationCommandOptionString{ - Name: "panel", - Description: "target panel", - Autocomplete: true, - Required: true, + Name: "panel", + Description: "target panel", + DescriptionLocalizations: translate.MessageMap("minecraft_status_panel_delete_command_panel_option", false), + Autocomplete: true, + Required: true, }, }, }, { - Name: "list", - Description: "show list of panels", + Name: "list", + Description: "show list of panels", + DescriptionLocalizations: translate.MessageMap("minecraft_status_panel_list_command_description", false), }, }, }, diff --git a/bot/commands/permission.go b/bot/commands/permission.go index b04b13fd..79aff730 100644 --- a/bot/commands/permission.go +++ b/bot/commands/permission.go @@ -8,6 +8,7 @@ import ( botlib "github.com/sabafly/sabafly-lib/v2/bot" "github.com/sabafly/sabafly-lib/v2/handler" "github.com/sabafly/sabafly-lib/v2/permissions" + "github.com/sabafly/sabafly-lib/v2/translate" ) func Permission(b *botlib.Bot[*client.Client]) handler.Command { @@ -17,49 +18,57 @@ func Permission(b *botlib.Bot[*client.Client]) handler.Command { Description: "permission", Options: []discord.ApplicationCommandOption{ discord.ApplicationCommandOptionSubCommand{ - Name: "add", - Description: "add permission to target", + Name: "add", + Description: "add permission to target", + DescriptionLocalizations: translate.MessageMap("permission_add_command_description", false), Options: []discord.ApplicationCommandOption{ discord.ApplicationCommandOptionMentionable{ - Name: "target", - Description: "target to add permission", - Required: true, + Name: "target", + Description: "target to add permission", + DescriptionLocalizations: translate.MessageMap("permission_add_command_target_option_description", false), + Required: true, }, discord.ApplicationCommandOptionString{ - Name: "permission", - Description: "permission string", - Required: true, - Autocomplete: true, - MaxLength: json.Ptr(32), + Name: "permission", + Description: "permission string", + DescriptionLocalizations: translate.MessageMap("permission_add_command_permission_option_description", false), + Required: true, + Autocomplete: true, + MaxLength: json.Ptr(32), }, }, }, discord.ApplicationCommandOptionSubCommand{ - Name: "remove", - Description: "remove permission to target", + Name: "remove", + Description: "remove permission to target", + DescriptionLocalizations: translate.MessageMap("permission_remove_command_description", false), Options: []discord.ApplicationCommandOption{ discord.ApplicationCommandOptionMentionable{ - Name: "target", - Description: "target to add permission", - Required: true, + Name: "target", + Description: "target to add permission", + DescriptionLocalizations: translate.MessageMap("permission_remove_command_target_option", false), + Required: true, }, discord.ApplicationCommandOptionString{ - Name: "permission", - Description: "permission string", - Required: true, - Autocomplete: true, - MaxLength: json.Ptr(32), + Name: "permission", + Description: "permission string", + DescriptionLocalizations: translate.MessageMap("permission_remove_command_permission_option", false), + Required: true, + Autocomplete: true, + MaxLength: json.Ptr(32), }, }, }, discord.ApplicationCommandOptionSubCommand{ - Name: "list", - Description: "show list os target permission", + Name: "list", + Description: "show list os target permission", + DescriptionLocalizations: translate.MessageMap("permission_list_command_description", false), Options: []discord.ApplicationCommandOption{ discord.ApplicationCommandOptionMentionable{ - Name: "target", - Description: "target to show permissions", - Required: true, + Name: "target", + Description: "target to show permissions", + DescriptionLocalizations: translate.MessageMap("permission_list_command_target_option", false), + Required: true, }, }, }, diff --git a/bot/commands/ping.go b/bot/commands/ping.go index e8644eca..06e29762 100644 --- a/bot/commands/ping.go +++ b/bot/commands/ping.go @@ -14,9 +14,10 @@ import ( func Ping(b *botlib.Bot[*client.Client]) handler.Command { return handler.Command{ Create: discord.SlashCommandCreate{ - Name: "ping", - Description: "pong!", - DMPermission: &b.Config.DMPermission, + Name: "ping", + Description: "pong!", + DescriptionLocalizations: translate.MessageMap("ping_command_description", false), + DMPermission: &b.Config.DMPermission, }, CommandHandlers: map[string]handler.CommandHandler{ "": pingHandler(b), diff --git a/bot/commands/poll.go b/bot/commands/poll.go index 2825a393..fe0ce6ce 100644 --- a/bot/commands/poll.go +++ b/bot/commands/poll.go @@ -20,6 +20,8 @@ import ( "github.com/sabafly/sabafly-lib/v2/translate" ) +// TODO: V2 + func Poll(b *botlib.Bot[*client.Client]) handler.Command { return handler.Command{ Create: discord.SlashCommandCreate{ @@ -35,69 +37,69 @@ func Poll(b *botlib.Bot[*client.Client]) handler.Command { Name: "title", Description: "title of poll", Required: true, - MaxLength: pint(54), + MaxLength: json.Ptr(54), }, discord.ApplicationCommandOptionString{ Name: "description", Description: "description of poll", Required: true, - MaxLength: pint(2048), + MaxLength: json.Ptr(2048), }, discord.ApplicationCommandOptionInt{ Name: "timeyear", Description: "year of end time", Required: true, - MinValue: pint(time.Now().Year()), - MaxValue: pint(time.Now().Year() + 1), + MinValue: json.Ptr(time.Now().Year()), + MaxValue: json.Ptr(time.Now().Year() + 1), }, discord.ApplicationCommandOptionInt{ Name: "timemonth", Description: "month of end time", Required: true, - MinValue: pint(1), - MaxValue: pint(12), + MinValue: json.Ptr(1), + MaxValue: json.Ptr(12), }, discord.ApplicationCommandOptionInt{ Name: "timeday", Description: "day of end time", Required: true, - MinValue: pint(1), - MaxValue: pint(31), + MinValue: json.Ptr(1), + MaxValue: json.Ptr(31), }, discord.ApplicationCommandOptionInt{ Name: "timehour", Description: "hour of end time", Required: true, - MinValue: pint(0), - MaxValue: pint(23), + MinValue: json.Ptr(0), + MaxValue: json.Ptr(23), }, discord.ApplicationCommandOptionInt{ Name: "timeminute", Description: "minute of end time", Required: true, - MinValue: pint(0), - MaxValue: pint(59), + MinValue: json.Ptr(0), + MaxValue: json.Ptr(59), }, discord.ApplicationCommandOptionInt{ Name: "timezone", Description: "timezone of end time", Required: true, - MinValue: pint(-12), - MaxValue: pint(+14), + MinValue: json.Ptr(-12), + MaxValue: json.Ptr(+14), }, discord.ApplicationCommandOptionInt{ Name: "maxchoice", Description: "Maximum number of votes a user can have", Required: true, - MinValue: pint(1), - MaxValue: pint(25), + MinValue: json.Ptr(1), + MaxValue: json.Ptr(25), }, discord.ApplicationCommandOptionInt{ Name: "minchoice", Description: "Minimum number of votes a user can have", Required: false, - MinValue: pint(1), - MaxValue: pint(25), + MinValue: json.Ptr(1), + MaxValue: json.Ptr(25), }, }, }, diff --git a/bot/commands/role.go b/bot/commands/role.go index a747b004..a932bf6f 100644 --- a/bot/commands/role.go +++ b/bot/commands/role.go @@ -32,8 +32,9 @@ func Role(b *botlib.Bot[*client.Client]) handler.Command { Description: "panel version 2", Options: []discord.ApplicationCommandOptionSubCommand{ { - Name: "create", - Description: "create a new role panel", + Name: "create", + Description: "create a new role panel", + DescriptionLocalizations: translate.MessageMap("role_panel_v2_create_command_description", false), }, // TODO: Listコマンドを実装する // { @@ -41,38 +42,44 @@ func Role(b *botlib.Bot[*client.Client]) handler.Command { // Description: "show list of role panels", // }, { - Name: "delete", - Description: "deletes a role panel", + Name: "delete", + Description: "deletes a role panel", + DescriptionLocalizations: translate.MessageMap("role_panel_v2_delete_command_description", false), Options: []discord.ApplicationCommandOption{ discord.ApplicationCommandOptionString{ - Name: "panel", - Description: "panel identify", - Autocomplete: true, - Required: true, + Name: "panel", + Description: "panel identify", + DescriptionLocalizations: translate.MessageMap("role_panel_v2_delete_command_panel_option_description", false), + Autocomplete: true, + Required: true, }, }, }, { - Name: "edit", - Description: "edit a role panel", + Name: "edit", + Description: "edit a role panel", + DescriptionLocalizations: translate.MessageMap("role_panel_v2_edit_command_description", false), Options: []discord.ApplicationCommandOption{ discord.ApplicationCommandOptionString{ - Name: "panel", - Description: "panel identify", - Autocomplete: true, - Required: true, + Name: "panel", + Description: "panel identify", + DescriptionLocalizations: translate.MessageMap("role_panel_v2_edit_command_panel_option_description", false), + Autocomplete: true, + Required: true, }, }, }, { - Name: "place", - Description: "place panel to the channel", + Name: "place", + Description: "place panel to the channel", + DescriptionLocalizations: translate.MessageMap("role_panel_v2_place_command_description", false), Options: []discord.ApplicationCommandOption{ discord.ApplicationCommandOptionString{ - Name: "panel", - Description: "panel identify", - Autocomplete: true, - Required: true, + Name: "panel", + Description: "panel identify", + DescriptionLocalizations: translate.MessageMap("role_panel_v2_place_command_panel_description", false), + Autocomplete: true, + Required: true, }, }, }, diff --git a/bot/commands/user.go b/bot/commands/user.go index bfd0f932..ad7b4415 100644 --- a/bot/commands/user.go +++ b/bot/commands/user.go @@ -20,70 +20,85 @@ func User(b *botlib.Bot[*client.Client]) handler.Command { DMPermission: &b.Config.DMPermission, Options: []discord.ApplicationCommandOption{ discord.ApplicationCommandOptionSubCommand{ - Name: "set-birthday", - Description: "set your own birthday", + Name: "set-birthday", + Description: "set your own birthday", + DescriptionLocalizations: translate.MessageMap("user_set_birthday_command_description", false), Options: []discord.ApplicationCommandOption{ discord.ApplicationCommandOptionInt{ - Name: "month", - Description: "month", - Required: true, + Name: "month", + Description: "month", + DescriptionLocalizations: translate.MessageMap("user_set_birthday_command_month_description", false), + Required: true, Choices: []discord.ApplicationCommandOptionChoiceInt{ { - Name: "January", - Value: 1, + Name: "January", + NameLocalizations: translate.MessageMap("january", false), + Value: 1, }, { - Name: "February", - Value: 2, + Name: "February", + NameLocalizations: translate.MessageMap("february", false), + Value: 2, }, { - Name: "March", - Value: 3, + Name: "March", + NameLocalizations: translate.MessageMap("march", false), + Value: 3, }, { - Name: "April", - Value: 4, + Name: "April", + NameLocalizations: translate.MessageMap("april", false), + Value: 4, }, { - Name: "May", - Value: 5, + Name: "May", + NameLocalizations: translate.MessageMap("may", false), + Value: 5, }, { - Name: "June", - Value: 6, + Name: "June", + NameLocalizations: translate.MessageMap("june", false), + Value: 6, }, { - Name: "July", - Value: 7, + Name: "July", + NameLocalizations: translate.MessageMap("july", false), + Value: 7, }, { - Name: "August", - Value: 8, + Name: "August", + NameLocalizations: translate.MessageMap("august", false), + Value: 8, }, { - Name: "September", - Value: 9, + Name: "September", + NameLocalizations: translate.MessageMap("september", false), + Value: 9, }, { - Name: "October", - Value: 10, + Name: "October", + NameLocalizations: translate.MessageMap("october", false), + Value: 10, }, { - Name: "November", - Value: 11, + Name: "November", + NameLocalizations: translate.MessageMap("november", false), + Value: 11, }, { - Name: "December", - Value: 12, + Name: "December", + NameLocalizations: translate.MessageMap("december", false), + Value: 12, }, }, }, discord.ApplicationCommandOptionInt{ - Name: "date", - Description: "date of number", - Required: true, - MinValue: json.Ptr(1), - MaxValue: json.Ptr(31), + Name: "date", + Description: "date of number", + DescriptionLocalizations: translate.MessageMap("user_set_birthday_command_date_description", false), + Required: true, + MinValue: json.Ptr(1), + MaxValue: json.Ptr(31), }, }, }, diff --git a/bot/commands/user_info.go b/bot/commands/user_info.go index 4c939b76..b067a460 100644 --- a/bot/commands/user_info.go +++ b/bot/commands/user_info.go @@ -18,7 +18,7 @@ func UserInfo(b *botlib.Bot[*client.Client]) handler.Command { return handler.Command{ Create: discord.UserCommandCreate{ Name: "info", - NameLocalizations: *translate.MessageMap("user_info_command", false), + NameLocalizations: translate.MessageMap("user_info_command", false), DMPermission: &b.Config.DMPermission, }, CommandHandlers: map[string]handler.CommandHandler{ diff --git a/bot/commands/util.go b/bot/commands/util.go index e6e9dcc7..dabf37e8 100644 --- a/bot/commands/util.go +++ b/bot/commands/util.go @@ -10,6 +10,7 @@ import ( "github.com/sabafly/gobot/bot/db" botlib "github.com/sabafly/sabafly-lib/v2/bot" "github.com/sabafly/sabafly-lib/v2/handler" + "github.com/sabafly/sabafly-lib/v2/translate" ) func Util(b *botlib.Bot[*client.Client]) handler.Command { @@ -20,13 +21,15 @@ func Util(b *botlib.Bot[*client.Client]) handler.Command { DMPermission: &b.Config.DMPermission, Options: []discord.ApplicationCommandOption{ discord.ApplicationCommandOptionSubCommand{ - Name: "calc", - Description: "in discord calculator", + Name: "calc", + Description: "in discord calculator", + DescriptionLocalizations: translate.MessageMap("util_calc_command_description", false), Options: []discord.ApplicationCommandOption{ discord.ApplicationCommandOptionBool{ - Name: "ephemeral", - Description: "create calculator as ephemeral message", - Required: false, + Name: "ephemeral", + Description: "create calculator as ephemeral message", + DescriptionLocalizations: translate.MessageMap("util_calc_command_ephemeral_option_description", false), + Required: false, }, }, }, diff --git a/go.mod b/go.mod index aad19d58..48d0b977 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/mattn/go-colorable v0.1.13 github.com/pelletier/go-toml/v2 v2.0.9 github.com/sabafly/disgo v0.5.0 - github.com/sabafly/sabafly-lib/v2 v2.6.3 + github.com/sabafly/sabafly-lib/v2 v2.6.4 github.com/shirou/gopsutil/v3 v3.23.7 github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.7.0 diff --git a/go.sum b/go.sum index 44a359ef..8ce0bc4e 100644 --- a/go.sum +++ b/go.sum @@ -72,6 +72,8 @@ github.com/sabafly/sabafly-lib/v2 v2.6.2 h1:MS3j8bdRL1q8q+8VBdkI8CQXEP7+X4+oxpRC github.com/sabafly/sabafly-lib/v2 v2.6.2/go.mod h1:6LwbMUGyrdlfa7q6Zg01zAekcjW0oI5B9hTFOV+DsLI= github.com/sabafly/sabafly-lib/v2 v2.6.3 h1:y35+FDkL1Jeh1SK4GO409pz0IdScahkEvFW0JsbSrTk= github.com/sabafly/sabafly-lib/v2 v2.6.3/go.mod h1:6LwbMUGyrdlfa7q6Zg01zAekcjW0oI5B9hTFOV+DsLI= +github.com/sabafly/sabafly-lib/v2 v2.6.4 h1:CkQpglvWzu8j6VYUb8fUGI9bIiAyGHVI5+W6gWQf7N0= +github.com/sabafly/sabafly-lib/v2 v2.6.4/go.mod h1:6LwbMUGyrdlfa7q6Zg01zAekcjW0oI5B9hTFOV+DsLI= github.com/sasha-s/go-csync v0.0.0-20210812194225-61421b77c44b h1:qYTY2tN72LhgDj2rtWG+LI6TXFl2ygFQQ4YezfVaGQE= github.com/sasha-s/go-csync v0.0.0-20210812194225-61421b77c44b/go.mod h1:/pA7k3zsXKdjjAiUhB5CjuKib9KJGCaLvZwtxGC8U0s= github.com/shirou/gopsutil/v3 v3.23.7 h1:C+fHO8hfIppoJ1WdsVm1RoI0RwXoNdfTK7yWXV0wVj4= diff --git a/lang/ja.yaml b/lang/ja.yaml index 449aa24a..a7e31998 100644 --- a/lang/ja.yaml +++ b/lang/ja.yaml @@ -292,3 +292,83 @@ level_leader_board_category_text: "テキストメッセージ" level_leader_board_author_text: "ギルド経験値リーダーボード" error_unavailable_page_title: "存在しないページ" error_unavailable_page_message: "そのページは存在しません" +about_command_description: "ボットの情報を表示する" +config_bump_on_command_description: "Bump通知を有効化する" +config_bump_off_command_description: "Bump通知を無効化する" +config_bump_message_command_description: "Bump通知のメッセージを編集する" +config_bump_mention_command_description: "Bump通知の際にメンションするロールを設定する" +config_bump_mention_command_role_option_description: "メンションするロール" +config_up_on_command_description: "UP通知を有効化する" +config_up_off_message_description: "UP通知を無効化する" +config_up_message_command_description: "UP通知のメッセージを編集する" +config_up_mention_command_description: "UP通知の際にメンションするロールを設定する" +config_up_mention_command_role_option_description: "メンションするロール" +config_level_notice_message_command_description: "レベルアップ通知のメッセージを編集する" +config_level_notice_channel_command_description: "レベルアップ通知を送信するチャンネルを設定する" +config_level_notice_channel_command_channel_option_description: "通知を送信するチャンネル" +config_level_exclude_add_command_description: "レベルアップの対象外にするチャンネルを追加します" +config_level_exclude_add_command_channel_option_description: "例外にするチャンネル" +config_level_exclude_remove_command_description: "レベルアップの対象外からチャンネルを取り除く" +config_level_exclude_remove_command_channel_option_description: "例外から外すチャンネル" +config_level_import_mee6_command_description: "mee6から経験値を引き継ぎます ⚠ 全員のレベルがリセットされます ⚠" +level_user_move_command_description: "経験値を別のメンバーに移動する" +level_user_move_command_target_from_option_description: "移動元メンバー" +level_user_move_command_target_to_option_description: "移動先メンバー" +level_user_reset_command_description: "メンバーの経験値をリセットする" +level_user_reset_command_target_option_description: "経験値をリセットするメンバー" +level_leaderboard_command_description: "ギルドのリーダーボードを表示する" +level_leaderboard_command_page_option_description: "表示するページ" +level_point_command_description: "自分のレベルを表示する" +message_pin_create_command_description: "固定メッセージを作成する" +message_pin_create_command_user_embed_option_description: "埋め込みを使用する" +message_pin_delete_command_description: "固定メッセージを削除する" +message_suffix_set_command_description: "メンバーに語尾を設定する" +message_suffix_set_command_target_option_description: "語尾を設定するユーザー" +message_suffix_set_command_suffix_option_description: "設定する語尾" +message_suffix_set_command_rule_type_option_description: "語尾の適用ルール" +message_suffix_set_command_rule_type_option_send_warn: "語尾がないときに警告メッセージを送信する" +message_suffix_set_command_rule_type_option_delete: "語尾がないメッセージを削除する" +message_suffix_set_command_rule_type_webhook: "webhookで語尾を強制的に追加する" +message_suffix_remove_command_description: "語尾を削除する" +message_suffix_remove_command_target_option_description: "語尾を削除するメンバー" +minecraft_status_panel_create_command_description: "マインクラフトのステータスパネル" +minecraft_status_panel_create_command_server_name_option_description: "サーバーの名前" +minecraft_status_panel_create_command_address_option_description: "アドレス" +minecraft_status_panel_create_command_edition_option_description: "エディション" +minecraft_status_panel_create_command_hide_address_option_description: "アドレスを隠す" +minecraft_status_panel_delete_command_description: "マインクラフトのステータスパネルを削除する" +minecraft_status_panel_delete_command_panel_option: "削除するパネル" +minecraft_status_panel_list_command_description: "マインクラフトのステータスパネルを一覧表示する" +permission_add_command_description: "権限を追加する" +permission_add_command_target_option_description: "対象" +permission_add_command_permission_option_description: "権限" +permission_remove_command_description: "権限を削除する" +permission_remove_command_target_option: "対象" +permission_remove_command_permission_option: "権限" +permission_list_command_description: "権限の一覧を表示する" +permission_list_command_target_option: "対象" +ping_command_description: "ポング!" +role_panel_v2_create_command_description: "役職パネルを作成して登録する" +role_panel_v2_delete_command_description: "登録された役職パネルを削除する" +role_panel_v2_delete_command_panel_option_description: "削除するパネルの名前またはID" +role_panel_v2_edit_command_description: "登録された役職パネルを編集する" +role_panel_v2_edit_command_panel_option_description: "編集するパネルの名前またはID" +role_panel_v2_place_command_description: "登録された役職パネルを設置する" +role_panel_v2_place_command_panel_description: "設置する役職パネルの名前またはID" +user_set_birthday_command_description: "誕生日を設定する" +user_set_birthday_command_month_description: "月" +user_set_birthday_command_date_description: "日" +util_calc_command_description: "電卓" +util_calc_command_ephemeral_option_description: "自分専用メッセージとして送信する" +january: "1月" +february: "2月" +march: "3月" +april: "4月" +may: "5月" +june: "6月" +july: "7月" +august: "8月" +september: "9月" +october: "10月" +november: "11月" +december: "12月"