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

Commit

Permalink
Added ToggleTag implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
KarlOfDuty committed Oct 8, 2018
1 parent bd57152 commit 84ddbb5
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 5 deletions.
38 changes: 38 additions & 0 deletions SCPDiscordPlugin/BotListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,44 @@ public BotListener(SCPDiscordPlugin plugin)
{
plugin.SendMessageToBot("default", "botresponses.exit");
}
else if(command == "hidetag" || command == "showtag")
{
if(plugin.pluginManager.GetEnabledPlugin("karlofduty.toggletag") != null)
{
if(arguments.Length > 0)
{
command = "console_" + command;
string[] feedback = plugin.pluginManager.CommandManager.CallCommand(plugin.pluginManager.Server, command, arguments);
string response = "";

StringBuilder builder = new StringBuilder();
foreach (string line in feedback)
{
builder.Append(line + "\n");
}
response = builder.ToString();


Dictionary<string, string> variables = new Dictionary<string, string>
{
{ "feedback", response }
};
plugin.SendMessageToBot("default", "botresponses.consolecommandfeedback", variables);
}
else
{
Dictionary<string, string> variables = new Dictionary<string, string>
{
{ "command", command }
};
plugin.SendMessageToBot("default", "botresponses.missingarguments", variables);
}
}
else
{
plugin.SendMessageToBot("default", "botresponses.toggletag.notinstalled");
}
}
else
{
string[] feedback = plugin.pluginManager.CommandManager.CallCommand(plugin.pluginManager.Server, command, arguments);
Expand Down
3 changes: 2 additions & 1 deletion SCPDiscordPlugin/Language.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ internal class Language
"botresponses.playerkicked",
"botresponses.playernotfound",
"botresponses.exit",
"botresponses.kickall"
"botresponses.kickall",
"botresponses.toggletag.notinstalled"
};

public Language(SCPDiscordPlugin plugin)
Expand Down
4 changes: 4 additions & 0 deletions SCPDiscordPlugin/Languages/english.yml
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,10 @@ botresponses:
exit:
message: "```diff\n- The exit command cannot be used from Discord.```"
regex: []
toggletag:
notinstalled:
message: "```diff\n- This command requires the ToggleTag plugin.```"
regex: []
# The feedback from a console command, except the custom ones above. (Is not affected by regex other than final_regex)
consolecommandfeedback:
# feedback
Expand Down
6 changes: 2 additions & 4 deletions SCPDiscordPlugin/SCPDiscord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,12 @@ public ReconnectCommand(SCPDiscordPlugin plugin)

public string GetCommandDescription()
{
// This prints when someone types HELP HELLO
return "Prints hello world";
return "Attempts to close the connection to the Discord bot and reconnect.";
}

public string GetUsage()
{
// This prints when someone types HELP HELLO
return "HELLO";
return "discord_reconnect";
}

public string[] OnCall(ICommandSender sender, string[] args)
Expand Down

0 comments on commit 84ddbb5

Please sign in to comment.