@@ 16,6 16,23 @@ const teamspeak = new TeamSpeak({
nickname: "10Man",
});
+let commands = new Map([
+ ["!hello", "Say hello"],
+ ["!elo", "Show your elo"],
+ [
+ "!register <STEAMID64>",
+ "Register with your STEAMID64 (https://steamid.io/)",
+ ],
+ ["!play", "Go into the queue"],
+ ["!cancel", "Cancel you queue"],
+ ["!help", "Show this help text"],
+]);
+
+let admin_commands = new Map([
+ ["!cancelMatch", "Cancel the ongoing match"],
+ ["!finish <WINNER>", "Finish the ongoing match with WINNER (TEAM1, TEAM2)"],
+]);
+
teamspeak.on("ready", async () => {
const whoami = await teamspeak.whoami();
const channel = await teamspeak.channelFind("10 Man");
@@ 54,6 71,9 @@ teamspeak.on("textmessage", (ev) => {
case "!finish":
finish_match(clid, teamspeakID, argv[1]);
break;
+ case "!help":
+ help(clid, teamspeakID);
+ break;
}
});
@@ 382,3 402,22 @@ async function move_clients(back: boolean = false) {
}
}
}
+
+async function help(clid: string, teamspeakID: string) {
+ const admin = await is_admin(clid, teamspeakID);
+ var msg = "";
+
+ if (admin) {
+ msg += "\nAdmin only commands:\n";
+ for (let entry of admin_commands) {
+ msg += entry[0] + ": " + entry[1] + "\n";
+ }
+ }
+
+ msg += "\nUser commands:\n";
+ for (let entry of commands) {
+ msg += entry[0] + ": " + entry[1] + "\n";
+ }
+
+ teamspeak.sendTextMessage(clid, 1, msg);
+}