summaryrefslogtreecommitdiff
path: root/commands
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-05-11 20:08:25 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2017-05-11 20:08:25 +0200
commit01a0f341cd19247c9b3d47bf62edefcb0c1545bc (patch)
treef3f2f3a10989bac90b78f5e915e62800c49c7e38 /commands
parent3a857d9795d467fcb91910feb23e12ac3c18393c (diff)
downloaddiscordbot-01a0f341cd19247c9b3d47bf62edefcb0c1545bc.tar.gz
discordbot-01a0f341cd19247c9b3d47bf62edefcb0c1545bc.zip
guild view: sort by fame, show role; add guild role cmd
Diffstat (limited to 'commands')
-rw-r--r--commands/vainsocial/guild_rm.js2
-rw-r--r--commands/vainsocial/guild_role.js47
2 files changed, 48 insertions, 1 deletions
diff --git a/commands/vainsocial/guild_rm.js b/commands/vainsocial/guild_rm.js
index 4857c44..e74aea4 100644
--- a/commands/vainsocial/guild_rm.js
+++ b/commands/vainsocial/guild_rm.js
@@ -13,7 +13,7 @@ module.exports = class AddGuildMemberCommand extends Commando.Command {
constructor(client) {
super(client, {
name: "vainsocial-guildrm",
- aliases: ["vguild-rm", "vgrm", "vgr"],
+ aliases: ["vguild-rm", "vgrm"],
group: "vainsocial-guild",
memberName: "vainsocial-guildrm",
description: "Remove a member from your Guild.",
diff --git a/commands/vainsocial/guild_role.js b/commands/vainsocial/guild_role.js
new file mode 100644
index 0000000..b37bb79
--- /dev/null
+++ b/commands/vainsocial/guild_role.js
@@ -0,0 +1,47 @@
+#!/usr/bin/node
+/* jshint esnext:true */
+"use strict";
+
+const Commando = require("discord.js-commando"),
+ oneLine = require("common-tags").oneLine,
+ Promise = require("bluebird"),
+ api = require("../../api"),
+ util = require("../../util"),
+ SimpleView = require("../../views/simple");
+
+module.exports = class RoleGuildMemberCommand extends Commando.Command {
+ constructor(client) {
+ super(client, {
+ name: "vainsocial-guildrole",
+ aliases: ["vguild-role", "vgrole", "vgr"],
+ group: "vainsocial-guild",
+ memberName: "vainsocial-guildrole",
+ description: "Change a Guild member's role.",
+ examples: ["vgrole StormCallerSr Officer", "vgrole shutterfly Leader"],
+ args: [ {
+ key: "name",
+ label: "name",
+ prompt: "Please specify a Guild member's name.",
+ type: "string",
+ min: 2,
+ default: "?"
+ }, {
+ key: "role",
+ label: "role",
+ prompt: "Please specify the member's new role.",
+ type: "string"
+ } ]
+ });
+ }
+ async run(msg, args) {
+ util.trackAction(msg, "vainsocial-guild-role");
+ const simpleView = new SimpleView(msg);
+ try {
+ const member = await api.changeRole(msg.author.id, args.name, args.role);
+ await simpleView.respond(`Successfully changed ${args.name}'s role to ${args.role}.`);
+ } catch (err) {
+ console.log(err);
+ return await simpleView.error(err.error.err);
+ }
+ }
+};