Skip to content

Instantly share code, notes, and snippets.

@insyri
Created January 14, 2022 20:16
Show Gist options
  • Save insyri/0faf33aa7a96a7913d3957719fdd1cd9 to your computer and use it in GitHub Desktop.
Save insyri/0faf33aa7a96a7913d3957719fdd1cd9 to your computer and use it in GitHub Desktop.
const commmands: Map<String, Function> = new Map();
commmands.set("help", () => console.log("This is the help command"));
const message = "/help".slice(1);
commmands.has(message)
? commmands.get(message)()
: console.log("Command not found");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment