Skip to content
This repository has been archived by the owner on Sep 11, 2022. It is now read-only.

Commit

Permalink
Set bot presence for displaying bot's prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
rubek-joshi committed Dec 4, 2020
1 parent 1c700d6 commit 56e8eb7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
15 changes: 12 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,23 @@ for (const file of commandFiles) {
bot.commands.set(command.name, command);
}

bot.once("ready", () => console.log("Bot is online biatch!"));
bot.once("ready", () => {
console.log("Bot is online biatch!");
// to display prefix of bot to users
bot.user.setPresence({
activity: {
type: "LISTENING",
name: prefixes.map((prefix) => prefix).join(" | "),
},
});
});

bot.on("message", (message) => {
// check for any one of the bot prefixes
let isBotCalled = false;
prefixes.forEach(prefix => {
prefixes.forEach((prefix) => {
if (message.content.startsWith(prefix)) return (isBotCalled = true);
})
});
if (!isBotCalled || message.author.bot) return;

const args = message.content.slice(prefixes.length).split(/ +/);
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "A discord bot that helps to manage deafening voice channels",
"main": "index.js",
"scripts": {
"start": "node .",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Rubek Joshi",
Expand Down

0 comments on commit 56e8eb7

Please sign in to comment.