public ExploitPunishmentService(DiscordClient client, DiscordGuild guild, ExploitDetectionService detection, Config config) { this.client = client; this.guild = guild; this.config = config; detection.FakeMuteExploitDetected += Detection_FakeMuteExploitDetected; }
public LogToChannelService(ExploitDetectionService exploitDetection, Config config, DiscordClient client) { this.config = config; this.client = client; if (string.IsNullOrWhiteSpace(config.LogChannelID)) { return; } logChannelID = ulong.Parse(config.LogChannelID); exploitDetection.FakeMuteExploitDetected += ExploitDetection_FakeMuteExploitDetected; }
public InactivityRestartTimerService(DiscordClient client, ExploitDetectionService detectionService, Config config) { this.client = client; this.detectionService = detectionService; restartTimer = new Timer(); if (config.InactiveRestartTimerDuration > 0f) { restartTimer.Enabled = true; // We need to convert from config's Minutes to Timer's milliseconds restartTimer.Interval = config.InactiveRestartTimerDuration * 60000d; } restartTimer.Elapsed += Stopwatch_Elapsed; }
public VoiceChannelUserCountMonitorService(DiscordChannel channel, DiscordClient client, ExploitDetectionService detectionService, InactivityRestartTimerService inactivityRestartTimer, Config config) { this.detectionService = detectionService; this.inactivityRestartTimer = inactivityRestartTimer; this.channel = channel; this.config = config; this.client = client; client.VoiceStateUpdated += Client_VoiceStateUpdated; client.Resumed += Client_Ready; client.Ready += Client_Ready; // We manually call the event ourselves to have the bot automatically join the VC (if it deems it necessary) on launch Client_VoiceStateUpdated(client, null).GetAwaiter().GetResult(); }