mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 17:28:27 -04:00
- Some renamings and code cleanups - Chained method calls, binary expressions and binary patterns will now break into newlines - Type param constraints and base constructor calls will be on the new line
23 lines
685 B
C#
23 lines
685 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using NadekoBot.Services.Database.Models;
|
|
|
|
namespace NadekoBot.Db;
|
|
|
|
public static class MusicPlayerSettingsExtensions
|
|
{
|
|
public static async Task<MusicPlayerSettings> ForGuildAsync(this DbSet<MusicPlayerSettings> settings, ulong guildId)
|
|
{
|
|
var toReturn = await settings.AsQueryable()
|
|
.FirstOrDefaultAsync(x => x.GuildId == guildId);
|
|
|
|
if (toReturn is null)
|
|
{
|
|
var newSettings = new MusicPlayerSettings() { GuildId = guildId, PlayerRepeat = PlayerRepeatType.Queue };
|
|
|
|
await settings.AddAsync(newSettings);
|
|
return newSettings;
|
|
}
|
|
|
|
return toReturn;
|
|
}
|
|
} |