PluralKit/PluralKit.Bot/Commands/MiscCommands.cs

29 lines
1.1 KiB
C#
Raw Normal View History

2019-04-29 18:21:16 +00:00
using System.Threading.Tasks;
using Discord;
using Discord.Commands;
2019-05-21 21:40:26 +00:00
namespace PluralKit.Bot.Commands {
2019-04-29 18:21:16 +00:00
public class MiscCommands: ModuleBase<PKCommandContext> {
public BotConfig BotConfig { get; set; }
2019-04-29 18:21:16 +00:00
[Command("invite")]
[Remarks("invite")]
public async Task Invite()
{
var clientId = BotConfig.ClientId ?? (await Context.Client.GetApplicationInfoAsync()).Id;
2019-04-29 18:21:16 +00:00
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={clientId}&scope=bot&permissions={permissions.RawValue}";
2019-04-29 18:21:16 +00:00
await Context.Channel.SendMessageAsync($"{Emojis.Success} Use this link to add PluralKit to your server:\n<{invite}>");
}
}
}