Ejemplo n.º 1
0
        public static async Task PerformAsync(ShardedCommandContext context, string identifier, DataBase db)
        {
            if (!BanIdentifier.ValidIdentifier(identifier))
            {
                await context.Channel.SendMessageAsync("Please use the 4 digit number following the identifier to unban users.");

                return;
            }

            var guild = FindOrCreateGuild.Perform(context.Guild, db);

            var identifiers = guild.BannedIdentifiers.Where(x => x.Identifier == identifier);

            if (identifiers.Count() == 0)
            {
                await context.Channel.SendMessageAsync("That user is not currently banned.");

                return;
            }

            db.BannedIdentifiers.RemoveRange(identifiers.ToList());

            db.SaveChanges();
            await context.Channel.SendMessageAsync(text : $"{identifier} is now unbanned");
        }
Ejemplo n.º 2
0
        public static async Task PerformAsync(UnifiedContext context, string identifier, DataBase db)
        {
            if (!BanIdentifier.ValidIdentifier(identifier))
            {
                await Send.SendErrorWithDeleteReaction(context, "Please use the 4 digit number following the identifier to unban users.");

                return;
            }

            var guild = await FindOrCreateGuild.Perform(context.Guild, db);

            var identifiers = guild.BannedIdentifiers.Where(x => x.Identifier == identifier);

            if (identifiers.Count() == 0)
            {
                await Send.SendErrorWithDeleteReaction(context, "That user is not currently banned.");

                return;
            }

            db.BannedIdentifiers.RemoveRange(identifiers.ToList());

            await db.SaveChangesAsync();

            await Send.SendMessageToContext(context, $"{identifier} is now unbanned");
        }