This repository has been archived by the owner on Jul 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
[events] command
PossiblyKris edited this page Jan 28, 2017
·
6 revisions
Key | Type | Description |
---|---|---|
raw | Object | Raw message object |
id | Int | Message ID |
from | Object | User object |
message | String | Raw message |
mentions | Array | String array of people metioned |
muted | Bool | Mute status of user |
message | String | Message type |
command | String | Message w/o command indicator |
args | Array | String array of command arguments |
respond | Function | Sends a message that mentions the command's sender |
respondTimeout | Function | Sends a message, deletes it after specified time |
havePermission | Function | Returns if user has perm or not (Bool) |
isFrom | Function | Returns true if userid (from arg) is valid for the user |
{
raw: {
cid: '1234567-1472747916733',
message: '!command',
sub: 1,
uid: 1234567,
un: 'username'
},
id: '1234567-1472747916733',
from:
User {
avatarID: 'zoo-s03',
badge: null,
blurb: undefined,
gRole: 0,
grab: false,
id: 1234567,
ignores: undefined,
joined: '2016-09-01 18:43:00.359000',
language: null,
level: 17,
notifications: undefined,
pp: undefined,
pw: undefined,
role: 2,
slug: null,
status: 1,
sub: 1,
username: 'username',
vote: 0,
xp: undefined
},
message: '!command',
mentions: [],
muted: false,
type: 'message',
command: 'command',
args: [ '' ],
respond: [Function],
respondTimeout: [Function],
havePermission: [Function],
isFrom: [Function]
}
bot.on('command:ping', function(data) {
return data.respond('Pong!');
});
bot.on('command:skip', function(data) {
if (data.havePermission(PlugAPI.ROOM_ROLE.BOUNCER)) {
bot.moderateForceSkip(function() {
data.respond('Skipped the song');
});
}
// OR
data.havePermission(PlugAPI.ROOM_ROLE.BOUNCER, function() {
bot.moderateForceSkip(function() {
data.respond('Skipped the song');
});
});
})