feat: beta bot patches

This commit is contained in:
spiral 2021-11-27 11:09:08 -05:00
parent 997458c9dc
commit 99a9ec7928
No known key found for this signature in database
GPG key ID: A6059F0CA0E1BD31
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!");