easy-discord-logs
Version:
Advanced discord logs system and easy usage!
64 lines (63 loc) • 3.67 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const discord_js_1 = require("discord.js");
const BaseCommand_1 = __importDefault(require("../../utils/structures/BaseCommand"));
class ViewLogsCommand extends BaseCommand_1.default {
constructor() {
super("view-logs", "Logs", []);
}
run(client, message, args) {
return __awaiter(this, void 0, void 0, function* () {
if (!message.guild || !message.member)
return;
if (!message.member.hasPermission("MANAGE_GUILD"))
return message.channel.send("You need server manager permissions");
const data = client.logs.get(message.guild.id);
if (!data)
return message.channel.send("There are no logs for this server");
let ChannelsLogs, BoostLogs, MemberLogs, GuildLogs, MessageLogs, RolesLogs, VoiceChannelsLogs;
if (data.ChannelLogs) {
ChannelsLogs = yield message.guild.channels.cache.find((ch) => ch.id === data.ChannelLogs);
}
if (data.BoostLogs) {
BoostLogs = yield message.guild.channels.cache.find((ch) => ch.id === data.BoostLogs);
}
if (data.MemberLogs) {
MemberLogs = yield message.guild.channels.cache.find((ch) => ch.id === data.MemberLogs);
}
if (data.GuildLogs) {
GuildLogs = yield message.guild.channels.cache.find((ch) => ch.id === data.GuildLogs);
}
if (data.MessageLogs) {
MessageLogs = yield message.guild.channels.cache.find((ch) => ch.id === data.MessageLogs);
}
if (data.RolesLogs) {
RolesLogs = yield message.guild.channels.cache.find((ch) => ch.id === data.RolesLogs);
}
if (data.VoiceChannelsLogs) {
VoiceChannelsLogs = yield message.guild.channels.cache.find((ch) => ch.id === data.VoiceChannelsLogs);
}
const embed = new discord_js_1.MessageEmbed().setTitle("Server logs").setDescription(`\`\`\`Channel Logs: ${ChannelsLogs ? ChannelsLogs.name : "No Channel!"}\`\`\`
\`\`\`Boost Logs: ${BoostLogs ? BoostLogs.name : "No Channel!"}\`\`\`
\`\`\`Member Logs: ${MemberLogs ? MemberLogs.name : "No Channel!"}\`\`\`
\`\`\`Server Logs: ${GuildLogs ? GuildLogs.name : "No Channel!"}\`\`\`
\`\`\`Message Logs: ${MessageLogs ? MessageLogs.name : "No Channel!"}\`\`\`
\`\`\`Roles Logs: ${RolesLogs ? RolesLogs.name : "No Channel!"}\`\`\`
\`\`\`Voice Logs: ${VoiceChannelsLogs ? VoiceChannelsLogs.name : "No Channel!"}\`\`\``);
message.channel.send(embed);
});
}
}
exports.default = ViewLogsCommand;