forked from EllieBotDevs/elliebot
fixed .sinfo for guilds on other shards
This commit is contained in:
parent
3532554a13
commit
97094dbe5d
3 changed files with 1 additions and 24 deletions
|
@ -53,7 +53,7 @@ public partial class Utility
|
||||||
.WithTitle(guild.Name)
|
.WithTitle(guild.Name)
|
||||||
.AddField(GetText(strs.id), guild.Id.ToString(), true)
|
.AddField(GetText(strs.id), guild.Id.ToString(), true)
|
||||||
.AddField(GetText(strs.owner), ownername.ToString(), true)
|
.AddField(GetText(strs.owner), ownername.ToString(), true)
|
||||||
.AddField(GetText(strs.members), (guild as SocketGuild)?.MemberCount ?? guild.ApproximateMemberCount, true)
|
.AddField(GetText(strs.members), (guild as SocketGuild)?.MemberCount.ToString() ?? guild.ApproximateMemberCount?.ToString() ?? "?", true)
|
||||||
.AddField(GetText(strs.channels), channels, true)
|
.AddField(GetText(strs.channels), channels, true)
|
||||||
.AddField(GetText(strs.created_at), $"{createdAt:dd.MM.yyyy HH:mm}", true)
|
.AddField(GetText(strs.created_at), $"{createdAt:dd.MM.yyyy HH:mm}", true)
|
||||||
.AddField(GetText(strs.roles), (guild.Roles.Count - 1).ToString(), true)
|
.AddField(GetText(strs.roles), (guild.Roles.Count - 1).ToString(), true)
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using EllieBot.Db.Models;
|
|
||||||
|
|
||||||
namespace EllieBot.Db;
|
|
||||||
|
|
||||||
public static class SelfAssignableRolesExtensions
|
|
||||||
{
|
|
||||||
public static bool DeleteByGuildAndRoleId(this DbSet<SelfAssignedRole> roles, ulong guildId, ulong roleId)
|
|
||||||
{
|
|
||||||
var role = roles.FirstOrDefault(s => s.GuildId == guildId && s.RoleId == roleId);
|
|
||||||
|
|
||||||
if (role is null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
roles.Remove(role);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IReadOnlyCollection<SelfAssignedRole> GetFromGuild(
|
|
||||||
this DbSet<SelfAssignedRole> roles,
|
|
||||||
ulong guildId)
|
|
||||||
=> roles.AsQueryable().Where(s => s.GuildId == guildId).ToArray();
|
|
||||||
}
|
|
Reference in a new issue