Add customization of invite link client ID. Closes #77.
This commit is contained in:
parent
e66c815295
commit
5d15a973f1
@ -3,5 +3,6 @@ namespace PluralKit.Bot
|
||||
public class BotConfig
|
||||
{
|
||||
public string Token { get; set; }
|
||||
public ulong? ClientId { get; set; }
|
||||
}
|
||||
}
|
@ -4,11 +4,13 @@ using Discord.Commands;
|
||||
|
||||
namespace PluralKit.Bot.Commands {
|
||||
public class MiscCommands: ModuleBase<PKCommandContext> {
|
||||
public BotConfig BotConfig { get; set; }
|
||||
|
||||
[Command("invite")]
|
||||
[Remarks("invite")]
|
||||
public async Task Invite() {
|
||||
var info = await Context.Client.GetApplicationInfoAsync();
|
||||
|
||||
public async Task Invite()
|
||||
{
|
||||
var clientId = BotConfig.ClientId ?? (await Context.Client.GetApplicationInfoAsync()).Id;
|
||||
var permissions = new GuildPermissions(
|
||||
addReactions: true,
|
||||
attachFiles: true,
|
||||
@ -20,7 +22,7 @@ namespace PluralKit.Bot.Commands {
|
||||
);
|
||||
|
||||
// TODO: allow customization of invite ID
|
||||
var invite = $"https://discordapp.com/oauth2/authorize?client_id={info.Id}&scope=bot&permissions={permissions.RawValue}";
|
||||
var invite = $"https://discordapp.com/oauth2/authorize?client_id={clientId}&scope=bot&permissions={permissions.RawValue}";
|
||||
await Context.Channel.SendMessageAsync($"{Emojis.Success} Use this link to add PluralKit to your server:\n<{invite}>");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user