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> {
|
2019-06-15 10:03:07 +00:00
|
|
|
public BotConfig BotConfig { get; set; }
|
|
|
|
|
2019-04-29 18:21:16 +00:00
|
|
|
[Command("invite")]
|
|
|
|
[Remarks("invite")]
|
2019-06-15 10:03:07 +00:00
|
|
|
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
|
2019-06-15 10:03:07 +00:00
|
|
|
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}>");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|