Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Idle & Online Commands with Status Command #192

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions discord_bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,19 @@ commands = {
}
},
},
idle: {
description: "Sets bot status to idle.",
status: {
description: "Sets bot status to idle/online.",
process: function (bot, msg, suffix) {
bot.user.setStatus("idle").then(console.log).catch(console.error);
},
},
online: {
description: "Sets bot status to online.",
process: function (bot, msg, suffix) {
bot.user.setStatus("online").then(console.log).catch(console.error);
if(massage.author.id !== yor id here) return; // here you check if the message auhor id was the same (so only you can use it)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably remove this line and let people restrict command access via the permission system. Otherwise the bot might break if someone doesn't manually edit this line.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 on using the permission system to restrict access. Could make it a default restricted command if we're worried about it, although changing the bot's status is relatively harmless.

if (args[0] === "idle") {
type = 0
} else if (args[0] === "online"){
type = 1
}
args.shift()
bot.user.setStatus(type).then(console.log).catch(console.error);

message.channel.send('status changed')
},
},
say: {
Expand Down