feat: upgrade to .NET 6, refactor everything
This commit is contained in:
@@ -1,42 +1,40 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using PluralKit.Core;
|
||||
|
||||
namespace PluralKit.Bot
|
||||
namespace PluralKit.Bot;
|
||||
|
||||
public class System
|
||||
{
|
||||
public class System
|
||||
private readonly IDatabase _db;
|
||||
private readonly EmbedService _embeds;
|
||||
private readonly ModelRepository _repo;
|
||||
|
||||
public System(EmbedService embeds, IDatabase db, ModelRepository repo)
|
||||
{
|
||||
private readonly EmbedService _embeds;
|
||||
private readonly IDatabase _db;
|
||||
private readonly ModelRepository _repo;
|
||||
_embeds = embeds;
|
||||
_db = db;
|
||||
_repo = repo;
|
||||
}
|
||||
|
||||
public System(EmbedService embeds, IDatabase db, ModelRepository repo)
|
||||
{
|
||||
_embeds = embeds;
|
||||
_db = db;
|
||||
_repo = repo;
|
||||
}
|
||||
public async Task Query(Context ctx, PKSystem system)
|
||||
{
|
||||
if (system == null) throw Errors.NoSystemError;
|
||||
|
||||
public async Task Query(Context ctx, PKSystem system)
|
||||
{
|
||||
if (system == null) throw Errors.NoSystemError;
|
||||
await ctx.Reply(embed: await _embeds.CreateSystemEmbed(ctx, system, ctx.LookupContextFor(system)));
|
||||
}
|
||||
|
||||
await ctx.Reply(embed: await _embeds.CreateSystemEmbed(ctx, system, ctx.LookupContextFor(system)));
|
||||
}
|
||||
public async Task New(Context ctx)
|
||||
{
|
||||
ctx.CheckNoSystem();
|
||||
|
||||
public async Task New(Context ctx)
|
||||
{
|
||||
ctx.CheckNoSystem();
|
||||
var systemName = ctx.RemainderOrNull();
|
||||
if (systemName != null && systemName.Length > Limits.MaxSystemNameLength)
|
||||
throw Errors.StringTooLongError("System name", systemName.Length, Limits.MaxSystemNameLength);
|
||||
|
||||
var systemName = ctx.RemainderOrNull();
|
||||
if (systemName != null && systemName.Length > Limits.MaxSystemNameLength)
|
||||
throw Errors.StringTooLongError("System name", systemName.Length, Limits.MaxSystemNameLength);
|
||||
var system = await _repo.CreateSystem(systemName);
|
||||
await _repo.AddAccount(system.Id, ctx.Author.Id);
|
||||
|
||||
var system = await _repo.CreateSystem(systemName);
|
||||
await _repo.AddAccount(system.Id, ctx.Author.Id);
|
||||
|
||||
// TODO: better message, perhaps embed like in groups?
|
||||
await ctx.Reply($"{Emojis.Success} Your system has been created. Type `pk;system` to view it, and type `pk;system help` for more information about commands you can use now. Now that you have that set up, check out the getting started guide on setting up members and proxies: <https://pluralkit.me/start>");
|
||||
}
|
||||
// TODO: better message, perhaps embed like in groups?
|
||||
await ctx.Reply(
|
||||
$"{Emojis.Success} Your system has been created. Type `pk;system` to view it, and type `pk;system help` for more information about commands you can use now. Now that you have that set up, check out the getting started guide on setting up members and proxies: <https://pluralkit.me/start>");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user