From 1ad69ff44e48284953da8a72a9d68cb86585c129 Mon Sep 17 00:00:00 2001 From: Navy Date: Mon, 25 May 2020 00:40:38 +0300 Subject: [PATCH] guild command --- .../components/commands/utility/Guild.js | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 structure/client/components/commands/utility/Guild.js diff --git a/structure/client/components/commands/utility/Guild.js b/structure/client/components/commands/utility/Guild.js new file mode 100644 index 0000000..ecd6d9c --- /dev/null +++ b/structure/client/components/commands/utility/Guild.js @@ -0,0 +1,57 @@ +const { Command } = require('../../../../interfaces/'); + +class GuildCommand extends Command { + + constructor(client) { + + super(client, { + name: 'server', + module: 'utility', + aliases: [ + 'guild' + ], + arguments: [ + + ] + }); + + this.client = client; + + } + + async execute(message) { + + const { guild } = message; + + let vc = 0, + tc = 0; + const createdAt = `${guild.createdAt.toDateString()} (${this.client.resolver.timeAgo(~~(Date.now() / 1000) - ~~(guild.createdTimestamp / 1000))} ago)`; + const description = guild._settings.description || this.client.defaultConfig.description; + + for (const channel of guild.channels.cache.values()) { + if (channel.type === 'voice') vc++; + if (channel.type === 'text') tc++; + } + + return message.embed({ + description: message.format('C_GUILD_TEMPLATE', { + createdAt, + description, + vc, + tc, + owner: guild.owner.id, + id: guild.id, + name: guild.name, + region: guild.region, + members: guild.memberCount + }), + thumbnail: { + url: guild.iconURL() + } + }); + + } + +} + +module.exports = GuildCommand; \ No newline at end of file