BirthdayBot/ApplicationCommands/HelpModule.cs

49 lines
2.6 KiB
C#
Raw Permalink Normal View History

2022-03-10 23:38:42 +00:00
using Discord.Interactions;
namespace BirthdayBot.ApplicationCommands;
[CommandContextType(InteractionContextType.Guild, InteractionContextType.BotDm)]
2022-03-10 23:38:42 +00:00
public class HelpModule : BotModuleBase {
2022-03-11 01:11:43 +00:00
private const string TopMessage =
"Thank you for using Birthday Bot!\n" +
"Support, data policy, more info: https://noithecat.dev/bots/BirthdayBot\n\n" +
"This bot is provided for free, without any paywalls or exclusive paid features. If this bot has been useful to you, " +
"please consider making a small contribution via the author's Ko-fi: https://ko-fi.com/noithecat.";
2022-03-10 23:38:42 +00:00
private const string RegularCommandsField =
$"`/birthday` - {BirthdayModule.HelpCmdBirthday}\n" +
$"` ⤷get` - {BirthdayModule.HelpCmdGet}\n" +
$"` ⤷show-nearest` - {BirthdayModule.HelpCmdNearest}\n" +
$"` ⤷set date` - {BirthdayModule.HelpCmdSetDate}\n" +
$"` ⤷set timezone` - {BirthdayModule.HelpCmdSetZone}\n" +
$"` ⤷remove` - {BirthdayModule.HelpCmdRemove}";
private const string ModCommandsField =
$"`/config` - {ConfigModule.HelpCmdConfig}\n" +
$"` ⤷check` - {ConfigModule.HelpCmdCheck}\n" +
$"` ⤷announce` - {ConfigModule.HelpCmdAnnounce}\n" +
$"` ⤷` See also: `/config announce help`.\n" +
$"` ⤷birthday-role` - {ConfigModule.HelpCmdBirthdayRole}\n" +
$"`/export-birthdays` - {ExportModule.HelpCmdExport}\n" +
2022-03-10 23:38:42 +00:00
$"`/override` - {BirthdayOverrideModule.HelpCmdOverride}\n" +
$"` ⤷set-birthday`, `⤷set-timezone`, `⤷remove`\n" +
2022-03-11 03:41:45 +00:00
"**Caution:** Skipping optional parameters __removes__ their configuration.";
2022-03-10 23:38:42 +00:00
[SlashCommand("help", "Show an overview of available commands.")]
public async Task CmdHelp() {
const string DMWarn = "Please note that this bot works in servers only. " +
2022-03-11 01:11:43 +00:00
"The bot will not respond to any other commands within a DM.";
2022-03-10 23:38:42 +00:00
#if DEBUG
2022-09-01 04:09:10 +00:00
var ver = "DEBUG flag set";
2022-03-10 23:38:42 +00:00
#else
2022-09-01 04:09:10 +00:00
var ver = "v" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version!.ToString(3);
2022-03-10 23:38:42 +00:00
#endif
var result = new EmbedBuilder()
.WithAuthor("Help & About")
.WithFooter($"Birthday Bot {ver} - Shard {Shard.ShardId:00} up {Program.BotUptime}",
Context.Client.CurrentUser.GetAvatarUrl())
2022-03-11 01:11:43 +00:00
.WithDescription(TopMessage)
2022-03-10 23:38:42 +00:00
.AddField("Commands", RegularCommandsField)
.AddField("Moderator commands", ModCommandsField)
.Build();
2022-09-01 04:09:10 +00:00
await RespondAsync(text: Context.Channel is IDMChannel ? DMWarn : null, embed: result).ConfigureAwait(false);
2022-03-10 23:38:42 +00:00
}
}