feat: beta bot patches

This commit is contained in:
spiral
2021-11-27 11:09:08 -05:00
parent 997458c9dc
commit 99a9ec7928
4 changed files with 32 additions and 6 deletions

View File

@@ -14,11 +14,13 @@ public class Api
private static readonly Regex _webhookRegex =
new("https://(?:\\w+.)?discord(?:app)?.com/api(?:/v.*)?/webhooks/(.*)");
private readonly BotConfig _botConfig;
private readonly DispatchService _dispatch;
private readonly ModelRepository _repo;
public Api(ModelRepository repo, DispatchService dispatch)
public Api(BotConfig botConfig, ModelRepository repo, DispatchService dispatch)
{
_botConfig = botConfig;
_repo = repo;
_dispatch = dispatch;
}
@@ -42,6 +44,13 @@ public class Api
});
await ctx.Rest.CreateMessage(dm.Id, new MessageRequest { Content = token });
if (_botConfig.IsBetaBot)
await ctx.Rest.CreateMessage(dm.Id, new MessageRequest
{
Content = $"{Emojis.Note} The beta bot's API base URL is currently <{_botConfig.BetaBotAPIUrl}>."
+ " You need to use this URL instead of the base URL listed on the documentation website."
});
// If we're not already in a DM, reply with a reminder to check
if (ctx.Channel.Type != Channel.ChannelType.Dm)
await ctx.Reply($"{Emojis.Success} Check your DMs!");
@@ -87,6 +96,13 @@ public class Api
var token = await MakeAndSetNewToken(ctx.System);
await ctx.Rest.CreateMessage(dm.Id, new MessageRequest { Content = token });
if (_botConfig.IsBetaBot)
await ctx.Rest.CreateMessage(dm.Id, new MessageRequest
{
Content = $"{Emojis.Note} The beta bot's API base URL is currently <{_botConfig.BetaBotAPIUrl}>."
+ " You need to use this URL instead of the base URL listed on the documentation website."
});
// If we're not already in a DM, reply with a reminder to check
if (ctx.Channel.Type != Channel.ChannelType.Dm)
await ctx.Reply($"{Emojis.Success} Check your DMs!");

View File

@@ -50,7 +50,9 @@ public class Misc
var invite =
$"https://discord.com/oauth2/authorize?client_id={clientId}&scope=bot%20applications.commands&permissions={(ulong)permissions}";
await ctx.Reply($"{Emojis.Success} Use this link to add PluralKit to your server:\n<{invite}>");
var botName = _botConfig.IsBetaBot ? "PluralKit Beta" : "PluralKit";
await ctx.Reply($"{Emojis.Success} Use this link to add {botName} to your server:\n<{invite}>");
}
public async Task Stats(Context ctx)