MCPcopy Create free account
hub / github.com/RTByte/rtbyte / serverLog

Method serverLog

src/events/rtbyteChannelDelete.js:68–107  ·  view source on GitHub ↗
(channel, executor)

Source from the content-addressed store, hash-verified

66 }
67
68 async serverLog(channel, executor) {
69 const embed = new MessageEmbed()
70 .setAuthor(`#${channel.name}`, channel.guild.iconURL())
71 .setColor(this.client.settings.get('colors.red'))
72 .addField(channel.guild.language.get('ID'), channel.id)
73 .setTimestamp()
74 .setFooter(channel.guild.language.get('GUILD_LOG_CHANNELDELETE', executor), executor ? executor.displayAvatarURL() : undefined);
75
76 // Add category field if channel is in category
77 if (channel.parent) {
78 embed.addField(channel.guild.language.get('CATEGORY'), channel.parent);
79 }
80
81 // Change author and footer fields if channel is voice channel
82 if (channel.type === 'voice') {
83 embed.setAuthor(channel.name, channel.guild.iconURL());
84 embed.setFooter(channel.guild.language.get('GUILD_LOG_CHANNELDELETE_VOICE', executor), executor ? executor.displayAvatarURL() : undefined);
85 }
86
87 // Change author and footer fields if channel is category
88 if (channel.type === 'category') {
89 embed.setAuthor(channel.name, channel.guild.iconURL());
90 embed.setFooter(channel.guild.language.get('GUILD_LOG_CHANNELDELETE_CATEGORY', executor), executor ? executor.displayAvatarURL() : undefined);
91 }
92
93 // Change footer field if channel is news channel
94 if (channel.type === 'news') {
95 embed.setFooter(channel.guild.language.get('GUILD_LOG_CHANNELDELETE_NEWS', executor), executor ? executor.displayAvatarURL() : undefined);
96 }
97
98 // Change footer field if channel is store channel
99 if (channel.type === 'store') {
100 embed.setFooter(channel.guild.language.get('GUILD_LOG_CHANNELDELETE_STORE', executor), executor ? executor.displayAvatarURL() : undefined);
101 }
102
103 const logChannel = await this.client.channels.cache.get(channel.guild.settings.get('channels.log'));
104 if (logChannel) await logChannel.send('', { disableEveryone: true, embed: embed });
105
106 return;
107 }
108
109};

Callers 1

runMethod · 0.45

Calls 1

sendMethod · 0.80

Tested by

no test coverage detected