Added role shortcuts and to user also

This commit is contained in:
Amish Shah
2015-12-05 16:57:58 +00:00
parent f95822dcb7
commit 5a971ba097
28 changed files with 132 additions and 25 deletions

View File

@@ -1,5 +1,6 @@
"use strict";
import {Permissions} from "../Constants";
import {reg} from "../Util/ArgumentRegulariser";
/*
example data
@@ -130,4 +131,32 @@ export default class Role {
}
return "#"+val;
}
delete() {
return this.client.deleteRole.apply(this.client, reg(this, arguments));
}
edit() {
return this.client.updateRole.apply(this.client, reg(this, arguments));
}
update() {
return this.client.updateRole.apply(this.client, reg(this, arguments));
}
addMember(member, callback) {
return this.client.addMemberToRole.apply(this.client, [member, this, callback]);
}
addUser(member, callback) {
return this.client.addMemberToRole.apply(this.client, [member, this, callback]);
}
removeMember(member, callback) {
return this.client.removeMemberFromRole.apply(this.client, [member, this, callback]);
}
removeUser(member, callback) {
return this.client.removeMemberFromRole.apply(this.client, [member, this, callback]);
}
}

View File

@@ -2,6 +2,7 @@
import Equality from "../Util/Equality";
import {Endpoints} from "../Constants";
import {reg} from "../Util/ArgumentRegulariser";
export default class User extends Equality{
constructor(data, client){
@@ -60,4 +61,20 @@ export default class User extends Equality{
else
return false;
}
sendMessage(){
return this.client.sendMessage.apply(this.client, reg(this, arguments));
}
send() {
return this.client.sendMessage.apply(this.client, reg(this, arguments));
}
sendTTSMessage(){
return this.client.sendTTSMessage.apply(this.client, reg(this, arguments));
}
sendTTS() {
return this.client.sendTTSMessage.apply(this.client, reg(this, arguments));
}
}

View File

@@ -1,9 +1,14 @@
"use strict";
import ServerChannel from "./ServerChannel";
import {reg} from "../Util/ArgumentRegulariser";
export default class VoiceChannel extends ServerChannel{
constructor(data, client, server){
super(data, client, server);
}
join(callback = function () { }) {
return this.client.joinVoiceChannel.apply(this.client, [this, callback]);
}
}