1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#!/usr/bin/node
/* jshint esnext:true */
"use strict";
const Commando = require("discord.js-commando"),
oneLine = require("common-tags").oneLine,
api = require("../../api"),
util = require("../../util");
module.exports = class ViewGuildCommand extends Commando.Command {
constructor(client) {
super(client, {
name: "vainsocial-guildview",
aliases: ["vguild-view", "vgview", "vgv"],
group: "vainsocial-guild",
memberName: "vainsocial-guildview",
description: "View members of a Guild.",
details: oneLine`
Show a summary of your Guild.
`,
examples: ["vgview"],
args: [ {
key: "name",
label: "name",
prompt: "Please specify your Guild's name.",
type: "string",
min: 3,
default: "?"
} ]
});
}
// show Guild details
async run(msg, args) {
util.trackAction(msg, "vainsocial-guild-view");
// get this user's guild
const guild = await api.getGuild(msg.author.id);
if (guild == undefined) {
await msg.reply("You are not registered in any guilds.");
return;
}
// build response
let response = "";
response += `${guild.name} (${guild.shard_id})\n`;
guild.members.forEach((member) => {
response += `${member.player.name}: ${member.fame} VainSocial Fame\n`;
});
await msg.say(response);
}
};
|