public async Task AddEmoteToDatabase(Emote em, string nick, ulong userId) { var emotes = _db.GetAll <EeveeEmote>(Defined.EEVEE_EMOTES_TABLE_NAME); if (_db.Exists <EeveeEmote>(Defined.EEVEE_EMOTES_TABLE_NAME, (x => x.Name.ToLower() == em.Name.ToLower() && x.AdderId == userId))) { Defined.BuildErrorMessage(_eBuilder, Context, ErrorTypes.E405, em.ToString(), "Emote", "the Emote Database"); await Task.CompletedTask; } else { bool isDef = !_db.Exists <EeveeEmote>(Defined.EEVEE_EMOTES_TABLE_NAME, (x => x.Name.ToLower() == em.Name.ToLower())); var result = await AddEmoteToEmoteGuilds(em); EeveeEmote nEmote = new EeveeEmote(result.emote, result.guildId, userId, isDef); _db.AddEntity(Defined.EEVEE_EMOTES_TABLE_NAME, nEmote); _eBuilder.WithTitle(nEmote.Name) .WithImageUrl(nEmote.Url) .WithUrl(nEmote.Url); if (nick != null) { AddAliasEmote(nick, nEmote, nEmote.Name, false); } } }
public async Task WhitenUserCommand([Remainder] SocketGuildUser u = null) { u = u ?? (SocketGuildUser)Context.User; if (u.IsBot) { Defined.BuildErrorMessage(_eBuilder, Context, ErrorTypes.E411, null, "added to the Whitelist"); } else { if (_db.Exists <WhitelistUser>(Defined.WHITELIST_TABLE_NAME, (x => x.Id == Context.User.Id))) { if (!_db.Exists <WhitelistUser>(Defined.WHITELIST_TABLE_NAME, (x => x.Id == u.Id))) { _db.AddEntity(Defined.WHITELIST_TABLE_NAME, new WhitelistUser(u.Id, _db.IsEmpty <WhitelistUser>((Defined.WHITELIST_TABLE_NAME)))); if (_db.Exists <BlacklistUser>(Defined.BLACKLIST_TABLE_NAME, (x => x.Id == Context.User.Id))) { _db.DeleteEntity <BlacklistUser>(Defined.BLACKLIST_TABLE_NAME, (x => x.Id == Context.User.Id)); } } Defined.BuildSuccessMessage(_eBuilder, Context, $"Successfully added the User **{u.Username}#{u.Discriminator}** to the Whitelist"); } else { Defined.BuildErrorMessage(_eBuilder, Context, ErrorTypes.E410, null, "add a User to the Whitelist"); } } await ReplyAsync(embed : _eBuilder.Build()); }