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 class BotConfig
|
||||||
{
|
{
|
||||||
public string Token { get; set; }
|
public string Token { get; set; }
|
||||||
|
public ulong? ClientId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,11 +4,13 @@ using Discord.Commands;
|
|||||||
|
|
||||||
namespace PluralKit.Bot.Commands {
|
namespace PluralKit.Bot.Commands {
|
||||||
public class MiscCommands: ModuleBase<PKCommandContext> {
|
public class MiscCommands: ModuleBase<PKCommandContext> {
|
||||||
|
public BotConfig BotConfig { get; set; }
|
||||||
|
|
||||||
[Command("invite")]
|
[Command("invite")]
|
||||||
[Remarks("invite")]
|
[Remarks("invite")]
|
||||||
public async Task Invite() {
|
public async Task Invite()
|
||||||
var info = await Context.Client.GetApplicationInfoAsync();
|
{
|
||||||
|
var clientId = BotConfig.ClientId ?? (await Context.Client.GetApplicationInfoAsync()).Id;
|
||||||
var permissions = new GuildPermissions(
|
var permissions = new GuildPermissions(
|
||||||
addReactions: true,
|
addReactions: true,
|
||||||
attachFiles: true,
|
attachFiles: true,
|
||||||
@ -20,7 +22,7 @@ namespace PluralKit.Bot.Commands {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// TODO: allow customization of invite ID
|
// 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}>");
|
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