From bf8387cf525b0f95c8515adb3de8f36c54c9494e Mon Sep 17 00:00:00 2001 From: Ske Date: Mon, 29 Apr 2019 20:21:16 +0200 Subject: [PATCH] bot: add invite command --- PluralKit/Bot/Commands/MiscCommands.cs | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 PluralKit/Bot/Commands/MiscCommands.cs diff --git a/PluralKit/Bot/Commands/MiscCommands.cs b/PluralKit/Bot/Commands/MiscCommands.cs new file mode 100644 index 00000000..e44d9f39 --- /dev/null +++ b/PluralKit/Bot/Commands/MiscCommands.cs @@ -0,0 +1,27 @@ +using System.Threading.Tasks; +using Discord; +using Discord.Commands; + +namespace PluralKit.Bot { + public class MiscCommands: ModuleBase { + [Command("invite")] + [Remarks("invite")] + public async Task Invite() { + var info = await Context.Client.GetApplicationInfoAsync(); + + var permissions = new GuildPermissions( + addReactions: true, + attachFiles: true, + embedLinks: true, + manageMessages: true, + manageWebhooks: true, + readMessageHistory: true, + sendMessages: true + ); + + // TODO: allow customization of invite ID + var invite = $"https://discordapp.com/oauth2/authorize?client_id={info.Id}&scope=bot&permissions={permissions.RawValue}"; + await Context.Channel.SendMessageAsync($"{Emojis.Success} Use this link to add PluralKit to your server:\n<{invite}>"); + } + } +} \ No newline at end of file