Skip to content
This repository has been archived by the owner on May 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #10 from KarlOfDuty/rateLimitEnhancement
Browse files Browse the repository at this point in the history
Connection fix
  • Loading branch information
KarlOfDuty authored Jul 20, 2018
2 parents 859f62e + ac5e578 commit fdfc74d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions SCPDiscordPlugin/RoundEventHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void OnRoundStart(RoundStartEvent ev)
/// <summary>
/// This is the event handler for Round start events (before people are spawned in)
/// </summary>
plugin.SendMessageAsync(plugin.GetConfigString("discord_channel_onroundstart"), "Round started.");
plugin.SendMessageAsync(plugin.GetConfigString("discord_channel_onroundstart"), "**Round started.**");
}

public void OnConnect(ConnectEvent ev)
Expand Down Expand Up @@ -65,7 +65,7 @@ public void OnWaitingForPlayers(WaitingForPlayersEvent ev)
/// <summary>
/// This event handler will call when the server is waiting for players
/// </summary>
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)
Expand Down
9 changes: 5 additions & 4 deletions SCPDiscordPlugin/SCPDiscord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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."));
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions SCPDiscordPlugin/TeamEventHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ public void OnTeamRespawn(TeamRespawnEvent ev)
/// <summary>
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\".**");
}
}

Expand Down

0 comments on commit fdfc74d

Please sign in to comment.