Fix Build Errors

This commit is contained in:
Fennel
2020-04-24 15:50:28 -04:00
committed by Astrid
parent 23cf06df4c
commit c99784b9dc
19 changed files with 301 additions and 136 deletions

View File

@@ -1,6 +1,7 @@
using System.Threading.Tasks;
using Discord;
using DSharpPlus;
using DSharpPlus.Entities;
using PluralKit.Core;
@@ -22,14 +23,15 @@ namespace PluralKit.Bot
var token = ctx.System.Token ?? await MakeAndSetNewToken(ctx.System);
// If we're not already in a DM, reply with a reminder to check
if (!(ctx.Channel is IDMChannel))
if (!(ctx.Channel is DiscordDmChannel))
{
await ctx.Reply($"{Emojis.Success} Check your DMs!");
}
// DM the user a security disclaimer, and then the token in a separate message (for easy copying on mobile)
await ctx.Author.SendMessageAsync($"{Emojis.Warn} Please note that this grants access to modify (and delete!) all your system data, so keep it safe and secure. If it leaks or you need a new one, you can invalidate this one with `pk;token refresh`.\n\nYour token is below:");
await ctx.Author.SendMessageAsync(token);
var dm = await ctx.Rest.CreateDmAsync(ctx.Author.Id);
await dm.SendMessageAsync($"{Emojis.Warn} Please note that this grants access to modify (and delete!) all your system data, so keep it safe and secure. If it leaks or you need a new one, you can invalidate this one with `pk;token refresh`.\n\nYour token is below:");
await dm.SendMessageAsync(token);
}
private async Task<string> MakeAndSetNewToken(PKSystem system)
@@ -55,14 +57,15 @@ namespace PluralKit.Bot
var token = await MakeAndSetNewToken(ctx.System);
// If we're not already in a DM, reply with a reminder to check
if (!(ctx.Channel is IDMChannel))
if (!(ctx.Channel is DiscordDmChannel))
{
await ctx.Reply($"{Emojis.Success} Check your DMs!");
}
// DM the user an invalidation disclaimer, and then the token in a separate message (for easy copying on mobile)
await ctx.Author.SendMessageAsync($"{Emojis.Warn} Your previous API token has been invalidated. You will need to change it anywhere it's currently used.\n\nYour token is below:");
await ctx.Author.SendMessageAsync(token);
var dm = await ctx.Rest.CreateDmAsync(ctx.Author.Id);
await dm.SendMessageAsync($"{Emojis.Warn} Your previous API token has been invalidated. You will need to change it anywhere it's currently used.\n\nYour token is below:");
await dm.SendMessageAsync(token);
}
}
}