public void Setup(string ServerName, bool LoadConfig = false) { _servername = ServerName; sCalendarCommand = new CalendarCommand(ServerName); sBirthdayCommand = new BirthdayCommand(ServerName); sBanCommand = new BanCommand(ServerName); sBan = new Ban(ServerName); if (IRCConfig.List[ServerName].ServerId == 1 || LoadConfig) { _config = new AddonConfig(Name, ".yml"); } _calendar = new Calendar(ServerName); _calendar.Start(); sIrcBase.Networks[ServerName].IrcRegisterHandler("PRIVMSG", HandlePrivmsg); InitIrcCommand(); SchumixBase.DManager.Update("banned", string.Format("ServerName = '{0}'", ServerName), string.Format("ServerId = '{0}'", IRCConfig.List[ServerName].ServerId)); SchumixBase.DManager.Update("birthday", string.Format("ServerName = '{0}'", ServerName), string.Format("ServerId = '{0}'", IRCConfig.List[ServerName].ServerId)); SchumixBase.DManager.Update("calendar", string.Format("ServerName = '{0}'", ServerName), string.Format("ServerId = '{0}'", IRCConfig.List[ServerName].ServerId)); if (CleanConfig.Database) { SchumixBase.sCleanManager.CDatabase.CleanTable("banned"); SchumixBase.sCleanManager.CDatabase.CleanTable("birthday"); SchumixBase.sCleanManager.CDatabase.CleanTable("calendar"); } }
/// <summary> /// Attempts to add or remove an IP/Subnet from the banned list. /// </summary> /// <param name="subnet">The IP/Subnet (see getpeerinfo for nodes IP) with an optional netmask (default is /32 = single IP).</param> /// <param name="banCommand">'add' to add an IP/Subnet to the list, 'remove' to remove an IP/Subnet from the list.</param> /// <param name="bantime">time in seconds how long (or until when if [absolute] is set) the IP is banned (0 or empty means using the default time of 24h which can also be overwritten by the -bantime startup argument).</param> /// <param name="absolute">If set, the bantime must be an absolute timestamp expressed in UNIX epoch time.</param> /// <returns></returns> public async Task <string> SetBan(string subnet, BanCommand banCommand, int bantime = 0, bool absolute = false) { SetBan setBan = new SetBan { Subnet = subnet, BanCommand = banCommand, BanTime = bantime, Absolute = absolute }; string response = await httpRequest.SendReq(MethodName.setban, setBan); return(response); }
public IActionResult BanUser([FromBody] BanCommand command) { var result = _authService.BanUser(command.Id, command.IsBan); if (result == BanResult.NotFound) { return(BadRequest()); } return(Ok()); }
public async Task ShouldPerformBanningOfMember_WhenValidRequestCalled() { var command = new BanCommand { GuildId = 70650, UserId = 90, Reason = "You're Annoying", }; await _appFixture.SendAsync(command); await _moderationService.ReceivedWithAnyArgs(1).BanAsync(default, default);
private static void InitializeCommands() { ChatCommand.AddCommand("/about", new AboutCommand()); ChatCommand.AddCommand("/addfriend", new AddFriendCommand()); AddAdminCommand command = new AddAdminCommand(); command.AdminFlags = "CanAddAdmin"; ChatCommand.AddCommand("/addadmin", command); AddFlagCommand command2 = new AddFlagCommand(); command2.AdminFlags = "CanAddFlags"; ChatCommand.AddCommand("/addflag", command2); AnnounceCommand command3 = new AnnounceCommand(); command3.AdminFlags = "CanAnnounce"; ChatCommand.AddCommand("/announce", command3); BanCommand command4 = new BanCommand(); command4.AdminFlags = "CanBan"; ChatCommand.AddCommand("/ban", command4); ChatCommand.AddCommand("/friends", new FriendsCommand()); GetFlagsCommand command5 = new GetFlagsCommand(); command5.AdminFlags = "CanGetFlags"; ChatCommand.AddCommand("/getflags", command5); GiveItemCommand command6 = new GiveItemCommand(); command6.AdminFlags = "CanGiveItem"; ChatCommand.AddCommand("/give", command6); GodModeCommand command7 = new GodModeCommand(); command7.AdminFlags = "CanGodMode"; ChatCommand.AddCommand("/god", command7); ChatCommand.AddCommand("/help", new HelpCommand()); ChatCommand.AddCommand("/history", new HistoryCommand()); SpawnItemCommand command8 = new SpawnItemCommand(); command8.AdminFlags = "CanSpawnItem"; ChatCommand.AddCommand("/i", command8); InstaKOCommand command9 = new InstaKOCommand(); command9.AdminFlags = "CanInstaKO"; ChatCommand.AddCommand("/instako", command9); KickCommand command10 = new KickCommand(); command10.AdminFlags = "CanKick"; ChatCommand.AddCommand("/kick", command10); KillCommand command11 = new KillCommand(); command11.AdminFlags = "CanKill"; ChatCommand.AddCommand("/kill", command11); LoadoutCommand command12 = new LoadoutCommand(); command12.AdminFlags = "CanLoadout"; ChatCommand.AddCommand("/loadout", command12); ChatCommand.AddCommand("/motd", new MOTDCommand()); MuteCommand command13 = new MuteCommand(); command13.AdminFlags = "CanMute"; ChatCommand.AddCommand("/mute", command13); ChatCommand.AddCommand("/location", new LocationCommand()); ChatCommand.AddCommand("/ping", new PingCommand()); ChatCommand.AddCommand("/players", new PlayersCommand()); ChatCommand.AddCommand("/pm", new PrivateMessagesCommand()); ReloadCommand command14 = new ReloadCommand(); command14.AdminFlags = "CanReload"; ChatCommand.AddCommand("/reload", command14); RemoveAdminCommand command15 = new RemoveAdminCommand(); command15.AdminFlags = "CanDeleteAdmin"; ChatCommand.AddCommand("/unadmin", command15); ChatCommand.AddCommand("/r", new ReplyCommand()); ChatCommand.AddCommand("/rules", new RulesCommand()); SaveAllCommand command16 = new SaveAllCommand(); command16.AdminFlags = "CanSaveAll"; ChatCommand.AddCommand("/saveall", command16); MasterAdminCommand command17 = new MasterAdminCommand(); command17.AdminFlags = "RCON"; ChatCommand.AddCommand("/setmasteradmin", command17); ChatCommand.AddCommand("/share", new ShareCommand()); ChatCommand.AddCommand("/starter", new StarterCommand()); TeleportHereCommand command18 = new TeleportHereCommand(); command18.AdminFlags = "CanTeleport"; ChatCommand.AddCommand("/tphere", command18); TeleportToCommand command19 = new TeleportToCommand(); command19.AdminFlags = "CanTeleport"; ChatCommand.AddCommand("/tpto", command19); UnbanCommand command20 = new UnbanCommand(); command20.AdminFlags = "CanUnban"; ChatCommand.AddCommand("/unban", command20); ChatCommand.AddCommand("/unfriend", new UnfriendCommand()); RemoveFlagsCommand command21 = new RemoveFlagsCommand(); command21.AdminFlags = "CanUnflag"; ChatCommand.AddCommand("/unflag", command21); UnmuteCommand command22 = new UnmuteCommand(); command22.AdminFlags = "CanUnmute"; ChatCommand.AddCommand("/unmute", command22); ChatCommand.AddCommand("/unshare", new UnshareCommand()); WhiteListAddCommand command23 = new WhiteListAddCommand(); command23.AdminFlags = "CanWhiteList"; ChatCommand.AddCommand("/addwl", command23); ShutDownCommand command24 = new ShutDownCommand(); command24.AdminFlags = "CanShutdown"; ChatCommand.AddCommand("/shutdown", command24); InstaKOAllCommand command25 = new InstaKOAllCommand(); command25.AdminFlags = "CanInstaKOAll"; ChatCommand.AddCommand("/instakoall", command25); }