Skip to content

Instantly share code, notes, and snippets.

@FireController1847
Created February 11, 2018 21:54
Show Gist options
  • Save FireController1847/4b418a43588f29be7196f3e1d9af4728 to your computer and use it in GitHub Desktop.
Save FireController1847/4b418a43588f29be7196f3e1d9af4728 to your computer and use it in GitHub Desktop.
m.prefix = "x"; // set your prefix here
const mreg = new RegExp(`^<@!?${this.client.user.id}>`);
if (mreg.test(m.content)) { // Test for a tag
m.content = m.prefix + m.content.replace(mreg, "").replace(" ", ""); // Replaces the content of the message with the prefix instead of the tag
m.mentions.users = m.mentions.users.filter(u => u.id != this.client.user.id); // Fixes the user tags to remove the client
// The three lines below will change any tags with "what" and "prefix" to turn it into a "prefix" command.
if (m.content.toLowerCase().includes("what") && m.content.toLowerCase().includes("prefix")) {
m.content = `${m.prefix}prefix`;
}
}
if (!m.content.startsWith(m.prefix)) return;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment