From 73c4c97be88048aa786e830c40706f97a9a93844 Mon Sep 17 00:00:00 2001 From: Karl Essinger Date: Fri, 20 Jul 2018 15:20:51 +0200 Subject: [PATCH 1/2] Made a few more important messages bold --- SCPDiscordPlugin/RoundEventHandler.cs | 4 ++-- SCPDiscordPlugin/TeamEventHandler.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SCPDiscordPlugin/RoundEventHandler.cs b/SCPDiscordPlugin/RoundEventHandler.cs index 26f7d041..9bbd448e 100644 --- a/SCPDiscordPlugin/RoundEventHandler.cs +++ b/SCPDiscordPlugin/RoundEventHandler.cs @@ -17,7 +17,7 @@ public void OnRoundStart(RoundStartEvent ev) /// /// This is the event handler for Round start events (before people are spawned in) /// - plugin.SendMessageAsync(plugin.GetConfigString("discord_channel_onroundstart"), "Round started."); + plugin.SendMessageAsync(plugin.GetConfigString("discord_channel_onroundstart"), "**Round started.**"); } public void OnConnect(ConnectEvent ev) @@ -65,7 +65,7 @@ public void OnWaitingForPlayers(WaitingForPlayersEvent ev) /// /// This event handler will call when the server is waiting for players /// - plugin.SendMessageAsync(plugin.GetConfigString("discord_channel_onwaitingforplayers"), "Server is ready and waiting for players."); + plugin.SendMessageAsync(plugin.GetConfigString("discord_channel_onwaitingforplayers"), "**Server is ready and waiting for players.**"); } public void OnRoundRestart(RoundRestartEvent ev) diff --git a/SCPDiscordPlugin/TeamEventHandler.cs b/SCPDiscordPlugin/TeamEventHandler.cs index 708fe9e1..b42daf87 100644 --- a/SCPDiscordPlugin/TeamEventHandler.cs +++ b/SCPDiscordPlugin/TeamEventHandler.cs @@ -27,11 +27,11 @@ public void OnTeamRespawn(TeamRespawnEvent ev) /// if (!ev.SpawnChaos) { - plugin.SendMessageAsync(plugin.GetConfigString("discord_channel_onteamrespawn"), "MTF Epsilon-11 - \"Nine-Tailed Fox\" have arrived at the facility."); + plugin.SendMessageAsync(plugin.GetConfigString("discord_channel_onteamrespawn"), "**MTF Epsilon-11 - \"Nine-Tailed Fox\" have arrived at the facility.**"); } else { - plugin.SendMessageAsync(plugin.GetConfigString("discord_channel_onteamrespawn"), "Hostile incursion detected, intruders identified as members of hostile GOI \"Chaos Insurgency\"."); + plugin.SendMessageAsync(plugin.GetConfigString("discord_channel_onteamrespawn"), "**Hostile incursion detected, intruders identified as members of hostile GOI \"Chaos Insurgency\".**"); } } From ac5e578969abff123cb28a1f9848e7adab20fb9a Mon Sep 17 00:00:00 2001 From: Karl Essinger Date: Fri, 20 Jul 2018 21:05:16 +0200 Subject: [PATCH 2/2] Fix for where the port and IP were not read until after connecting --- SCPDiscordPlugin/SCPDiscord.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/SCPDiscordPlugin/SCPDiscord.cs b/SCPDiscordPlugin/SCPDiscord.cs index fb460144..0105a829 100644 --- a/SCPDiscordPlugin/SCPDiscord.cs +++ b/SCPDiscordPlugin/SCPDiscord.cs @@ -35,10 +35,6 @@ public override void Register() this.AddEventHandlers(new EnvironmentEventHandler(this)); this.AddEventHandlers(new TeamEventHandler(this)); - //Connection settings - this.AddConfig(new Smod2.Config.ConfigSetting("discord_bot_ip", "127.0.0.1", Smod2.Config.SettingType.STRING, true, "IP of the discord bot.")); - this.AddConfig(new Smod2.Config.ConfigSetting("discord_bot_port", 8888, Smod2.Config.SettingType.NUMERIC, true, "Port of the discord bot.")); - //Round events this.AddConfig(new Smod2.Config.ConfigSetting("discord_channel_onroundstart", "off", Smod2.Config.SettingType.STRING, true, "Discord channel to post event messages in.")); this.AddConfig(new Smod2.Config.ConfigSetting("discord_channel_onconnect", "off", Smod2.Config.SettingType.STRING, true, "Discord channel to post event messages in.")); @@ -90,8 +86,13 @@ public override void Register() public override void OnEnable() { + //Connection settings + this.AddConfig(new Smod2.Config.ConfigSetting("discord_bot_ip", "127.0.0.1", Smod2.Config.SettingType.STRING, true, "IP of the discord bot.")); + this.AddConfig(new Smod2.Config.ConfigSetting("discord_bot_port", 8888, Smod2.Config.SettingType.NUMERIC, true, "Port of the discord bot.")); + try { + this.Info("Your Bot IP: " + this.GetConfigString("discord_bot_ip") + ". Your Bot Port: " + this.GetConfigInt("discord_bot_port") + "."); clientSocket.Connect(this.GetConfigString("discord_bot_ip"), this.GetConfigInt("discord_bot_port")); } catch(SocketException e)