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

Commit

Permalink
Fix for where the port and IP were not read until after connecting
Browse files Browse the repository at this point in the history
  • Loading branch information
KarlOfDuty committed Jul 20, 2018
1 parent 73c4c97 commit ac5e578
Showing 1 changed file with 5 additions and 4 deletions.
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

0 comments on commit ac5e578

Please sign in to comment.