Do the Big Rename

This commit is contained in:
Ske
2021-01-31 16:16:52 +01:00
parent 80c572f594
commit ef614d07c3
18 changed files with 119 additions and 119 deletions

View File

@@ -34,7 +34,7 @@ namespace PluralKit.Bot
public async Task Import(Context ctx)
{
var url = ctx.RemainderOrNull() ?? ctx.MessageNew.Attachments.FirstOrDefault()?.Url;
var url = ctx.RemainderOrNull() ?? ctx.Message.Attachments.FirstOrDefault()?.Url;
if (url == null) throw Errors.NoImportFilePassed;
await ctx.BusyIndicator(async () =>
@@ -69,7 +69,7 @@ namespace PluralKit.Bot
if (!data.Valid)
throw Errors.InvalidImportFile;
if (data.LinkedAccounts != null && !data.LinkedAccounts.Contains(ctx.AuthorNew.Id))
if (data.LinkedAccounts != null && !data.LinkedAccounts.Contains(ctx.Author.Id))
{
var msg = $"{Emojis.Warn} You seem to importing a system profile belonging to another account. Are you sure you want to proceed?";
if (!await ctx.PromptYesNo(msg)) throw Errors.ImportCancelled;
@@ -77,7 +77,7 @@ namespace PluralKit.Bot
// If passed system is null, it'll create a new one
// (and that's okay!)
var result = await _dataFiles.ImportSystem(data, ctx.System, ctx.AuthorNew.Id);
var result = await _dataFiles.ImportSystem(data, ctx.System, ctx.Author.Id);
if (!result.Success)
await ctx.Reply($"{Emojis.Error} The provided system profile could not be imported. {result.Message}");
else if (ctx.System == null)
@@ -143,15 +143,15 @@ namespace PluralKit.Bot
try
{
var dm = await ctx.RestNew.CreateDm(ctx.AuthorNew.Id);
var dm = await ctx.Rest.CreateDm(ctx.Author.Id);
var msg = await ctx.RestNew.CreateMessage(dm.Id,
var msg = await ctx.Rest.CreateMessage(dm.Id,
new MessageRequest {Content = $"{Emojis.Success} Here you go!"},
new[] {new MultipartFile("system.json", stream)});
await ctx.RestNew.CreateMessage(dm.Id, new MessageRequest { Content = $"<{msg.Attachments[0].Url}>" });
await ctx.Rest.CreateMessage(dm.Id, new MessageRequest { Content = $"<{msg.Attachments[0].Url}>" });
// If the original message wasn't posted in DMs, send a public reminder
if (ctx.ChannelNew.Type != Channel.ChannelType.Dm)
if (ctx.Channel.Type != Channel.ChannelType.Dm)
await ctx.Reply($"{Emojis.Success} Check your DMs!");
}
catch (UnauthorizedException)