lint
This commit is contained in:
parent
c9f91e0c13
commit
923ad100e5
@ -139,7 +139,7 @@ namespace Myriad.Cache
|
|||||||
public Task<Channel?> TryGetDmChannel(ulong userId)
|
public Task<Channel?> TryGetDmChannel(ulong userId)
|
||||||
{
|
{
|
||||||
if (!_dmChannels.TryGetValue(userId, out var channelId))
|
if (!_dmChannels.TryGetValue(userId, out var channelId))
|
||||||
return Task.FromResult((Channel?) null);
|
return Task.FromResult((Channel?)null);
|
||||||
return TryGetChannel(channelId);
|
return TryGetChannel(channelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ namespace Myriad.Extensions
|
|||||||
|
|
||||||
public static async ValueTask<Channel?> GetOrFetchChannel(this IDiscordCache cache, DiscordApiClient rest, ulong channelId)
|
public static async ValueTask<Channel?> GetOrFetchChannel(this IDiscordCache cache, DiscordApiClient rest, ulong channelId)
|
||||||
{
|
{
|
||||||
if (await cache.TryGetChannel(channelId) is {} cacheChannel)
|
if (await cache.TryGetChannel(channelId) is { } cacheChannel)
|
||||||
return cacheChannel;
|
return cacheChannel;
|
||||||
|
|
||||||
var restChannel = await rest.GetChannel(channelId);
|
var restChannel = await rest.GetChannel(channelId);
|
||||||
@ -61,7 +61,7 @@ namespace Myriad.Extensions
|
|||||||
|
|
||||||
public static async Task<Channel> GetOrCreateDmChannel(this IDiscordCache cache, DiscordApiClient rest, ulong recipientId)
|
public static async Task<Channel> GetOrCreateDmChannel(this IDiscordCache cache, DiscordApiClient rest, ulong recipientId)
|
||||||
{
|
{
|
||||||
if (await cache.TryGetDmChannel(recipientId) is {} cacheChannel)
|
if (await cache.TryGetDmChannel(recipientId) is { } cacheChannel)
|
||||||
return cacheChannel;
|
return cacheChannel;
|
||||||
|
|
||||||
var restChannel = await rest.CreateDm(recipientId);
|
var restChannel = await rest.CreateDm(recipientId);
|
||||||
|
@ -78,7 +78,7 @@ namespace PluralKit.Bot
|
|||||||
}, null, timeTillNextWholeMinute, TimeSpan.FromMinutes(1));
|
}, null, timeTillNextWholeMinute, TimeSpan.FromMinutes(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task <PermissionSet> PermissionsIn(ulong channelId)
|
public async Task<PermissionSet> PermissionsIn(ulong channelId)
|
||||||
{
|
{
|
||||||
var channel = await _cache.GetRootChannel(channelId);
|
var channel = await _cache.GetRootChannel(channelId);
|
||||||
|
|
||||||
|
@ -42,7 +42,8 @@ namespace PluralKit.Bot
|
|||||||
};
|
};
|
||||||
}).AsSelf().SingleInstance();
|
}).AsSelf().SingleInstance();
|
||||||
builder.RegisterType<Cluster>().AsSelf().SingleInstance();
|
builder.RegisterType<Cluster>().AsSelf().SingleInstance();
|
||||||
builder.Register(c => {
|
builder.Register(c =>
|
||||||
|
{
|
||||||
return new MemoryDiscordCache();
|
return new MemoryDiscordCache();
|
||||||
}).AsSelf().As<IDiscordCache>().SingleInstance();
|
}).AsSelf().As<IDiscordCache>().SingleInstance();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user