test-discord-logs
Version:
A Package for discord with logs
930 lines (906 loc) • 30.6 kB
JavaScript
const { GuildMemberManager } = require('discord.js');
const {
MessageEmbed,
Client,
GuildChannel,
Emoji,
GuildBan,
InviteGuild,
GuildEmoji,
GuildMember,
Guild,
Invite,
Message,
Role
} = require('discord.js')
class Modlogs {
/**
* @param {Client} client
*/
constructor(options = []){
this.options = options;
}
/**
*
* @param {Client} client
* @param {GuildChannel} channel
*/
ChannelCreate(client, channel, options = []) {
if(!client || !channel)
throw new Error('Du hast kein Client oder Channel Angegben');
let c;
let foot;
if(!options.chid && !this.options.chid) {
throw new Error(
'Bitte gebe eine Channel ID an, oder mach es in den Options aus.'
)
}
if(options.credits === false){
foot = 'You cant hide anything from us :)'
} else {
foot = '©️Logs. npm i discord-logs'
}
if(!options.chid){
c = client.channels.cache.get(this.options.chid);
} else {
c = client.channels.cache.get(options.chid)
}
if(!c)
throw new Error(
`KEIN_GÜLTIGER_CHANNEL: ${c}. Der Channel ist nicht Gültig oder ich habe volgende rechte nicht VIEW_CHANNEL`
);
let embed = new MessageEmbed()
.setTitle(":white_circle: Channel Created :white_circle: ")
.setColor('YELLOW')
.setDescription(
`**Channel Name:** \`${channel.name}\`\n**Channel ID:** \`${channel.id}\`\n**Channel Type:** \`${channel.type}\``
)
.setTimestamp()
.setFooter(foot)
c.send({ embeds: [embed] })
}
/**
*
* @param {Client} client
* @param {GuildChannel} channel
*/
ChannelPinsUpdate(client, channel, time, options = []) {
if(!client || !channel || !time)
throw new TypeError('Keine Gültigen Angaben getroffen');
let c;
let foot;
if(options.credits === false){
foot = 'You cant hide anything from us :)'
} else {
foot = '©️Logs. npm i discord-logs'
}
if(!options.chid && !this.options.chid) {
throw new Error(
'Bitte gebe eine Channel ID an, oder mach es in den Options aus.'
)
}
if(!options.chid) {
c = client.channels.cache.get(this.options.chid)
} else {
c = client.channels.cache.get(options.chid);
}
if(!c)
throw new Error(
`KEIN_GÜLTIGER_CHANNEL: ${c}. Der Channel ist nicht Gültig oder ich habe volgende rechte nicht VIEW_CHANNEL`
)
let embed = new MessageEmbed()
.setTitle(":safety_pin: Channel Pin Updated :safety_pin:")
.setColor("YELLOW")
.setDescription(
`**Channel Name:** \`${channel.name}\`\n**Channel ID:** \`${channel.id}\`\n**Pinned at** \`${time}\``
)
.setThumbnail(
"https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/samsung/265/pushpin_1f4cc.png"
)
.setTimestamp()
.setFooter(foot);
c.send({ embeds: [embed]})
}
/**
*
* @param {Client} client
* @param {GuildChannel} channel
*/
ChannelDelte(client, channel, options = []) {
if(!client || !channel)
throw new TypeError('Keine Gültigen Angaben getroffen');
let c;
let foot;
if(options.credits === false){
foot = 'You cant hide anything from us :)'
} else {
foot = '©️Logs. npm i discord-logs'
}
if(!options.chid && !this.options.chid) {
throw new Error(
'Bitte gebe eine Channel ID an, oder mach es in den Options aus.'
)
}
if(!options.chid) {
c = client.channels.cache.get(this.options.chid);
} else {
c = client.channels.cache.get(options.chid)
}
if(!c)
throw new Error(
`KEIN_GÜLTIGER_CHANNEL: ${c}. Der Channel ist nicht Gültig oder ich habe volgende rechte nicht VIEW_CHANNEL`
)
let embed = new MessageEmbed()
.setTitle(":x: Channel Deleted :x:")
.setColor('RED')
.setDescription(
`**Channel Name:** \`${channel.name}\`\n**Channel ID:** \`${channel.id}\`\n**Channel Type:** \`${channel.type}\``
)
.setTimestamp()
.setFooter(foot)
c.send({ embeds: [embed] })
}
/**
*
* @param {Client} client
* @param {GuildChannel} oldChannel
* @param {GuildChannel} newChannel
* @returns
*/
ChannelUpdate(client, oldChannel, newChannel, options = []) {
if(!client || !oldChannel || !oldChannel)
throw new TypeError('Keine Gültigen Angaben getroffen');
let c;
let foot;
if(!options.chid && !this.options.chid) {
throw new Error(
'Keine Auswahlt getroffen bitte geben sie eine aktion aus der Class an'
)
}
if(options.credits === false){
foot = 'You cant hide anything from us :)'
} else {
foot = '©️Logs. npm i discord-logs'
}
if(!options.chid) {
c = client.channels.cache.get(options.chid)
} else {
c = client.channels.cache.get(this.options.chid)
}
if(!c)
throw new Error(
`KEIN_GÜLTIGER_CHANNEL: ${c}. Der Channel ist nicht Gültig oder ich habe volgende rechte nicht VIEW_CHANNEL`
)
let guildchannel = newChannel.guild;
if(!guildchannel || !guildchannel.available) return;
let types = {
text: "Text Channel",
voice: "Voice Channel",
null: "No Type",
news: "News Channel",
store: "Store Channel",
category: "Category",
};
if (oldChannel.name != newChannel.name) {
let embed = new MessageEmbed()
.setTitle(":white_circle: Channel Updated - Name :white_circle:")
.setColor("YELLOW")
.setDescription(
`**Channel Name:** \`${oldChannel.name}\`\nChannel ID: \`${oldChannel.id}\`\n\n` +
`**Channel Name:** \`${newChannel.name}\`\nChannel ID: \`${newChannel.id}\``
)
.setTimestamp()
.setFooter(foot);
c.send({ embeds: [embed] });
} else if (oldChannel.type != newChannel.type) {
let embed = new MessageEmbed()
.setTitle(":white_circle: Channel Updated - Type :white_circle:")
.setColor("YELLOW")
.setDescription(
`**Channel Name:** \`${oldChannel.name}\`\nChannel ID: \`${
oldChannel.id
}\`\n**Channel Type:** \`${types[oldChannel.type]}\`\n\n` +
`**ChannelNAME:** \`${newChannel.name}\`\nChannel ID: \`${
newChannel.id
}\`\n**Channel Type:** \`${types[newChannel.type]}\``
)
.setFooter(foot)
.setTimestamp();
c.send({ embeds: [embed] });
} else if (oldChannel.topic != newChannel.topic) {
let embed = new MessageEmbed()
.setTitle(":white_circle: Channel Updated - Topic :white_circle:")
.setColor("YELLOW")
.setDescription(
`**Channel Name:** \`${oldChannel.name}\`\n**Channel ID:** \`${oldChannel.id}\`\n**Channel Topic:** \`${oldChannel.topic}\`\n\n` +
`**Channel Name:** \`${newChannel.name}\`\n**Channel ID:** \`${newChannel.id}\`\n**Channel Topic:** \`${newChannel.topic}\``
)
.setFooter(foot)
.setTimestamp();
c.send({ embeds: [embed] });
} else if (oldChannel.parent !== newChannel.parent) {
const embed = new MessageEmbed()
.setTitle(`:white_circle: Channel Category Updated :white_circle:`)
.addField(`Channel`, `${oldChannel}`)
.addField(`Old Category`, `${oldChannel.parent}`)
.addField(`New Category`, `${newChannel.parent}`)
.setColor("YELLOW")
.setTimestamp()
.setFooter(foot);
c.send({ embeds: [embed] });
} else if (oldChannel.rateLimitPerUser !== newChannel.rateLimitPerUser) {
const embed = new MessageEmbed()
.setTitle(`:white_circle: Channel Slowmode Updated :white_circle:`)
.addField(`Channel`, `${oldChannel}`)
.addField(`Old Slowmode`, `${oldChannel.rateLimitPerUser} seconds`)
.addField(`New Slowmode`, `${newChannel.rateLimitPerUser} seconds`)
.setColor("YELLOW")
.setTimestamp()
.setFooter(foot);
c.send({ embeds: [embed] });
}
}
/**
*
* @param {Client} client
* @param {Emoji} emoji
*/
EmojiDelte(client, emoji, options = []) {
if(!client || !emoji)
throw new TypeError('Keine Gültigen Angagebn getroffen.');
let c;
let foot;
if(options.credits === false){
foot = 'You cant hide anything from us :)'
} else {
foot = '©️Logs. npm i discord-logs'
}
if(!options.chid && !this.options.chid) {
throw new Error(
'Keine Auswahlt getroffen bitte geben sie eine aktion aus der Class an'
)
}
if(!options.chid) {
c = client.channels.cache.get(this.options.chid);
} else {
c = client.channels.cache.get(options.chid)
}
if(!c)
throw new Error(
`KEIN_GÜLTIGER_CHANNEL: ${c}. Der Channel ist nicht Gültig oder ich habe volgende rechte nicht VIEW_CHANNEL`
)
let embed = new MessageEmbed()
.setTitle("❌ Emoji Deleted ❌")
.setColor('RED')
.setDescription(
`**Emoji:** ${emoji}\n**Emoji Name:** ${emoji.name}\n**Emoji ID:** ${emoji.id}\n**Emoji URL:** ${emoji.url}`
)
.setFooter(foot)
.setTimestamp()
c.send({ embeds: [embed]})
}
/**
*
* @param {Client} client
* @param {Emoji} emoji
*/
EmojiCreate(client, emoji, options = []) {
if(!client || !emoji)
throw new TypeError('Keine Gültigen Angagebn getroffen.');
let c;
let foot;
if(options.credits === false){
foot = 'You cant hide anything from us :)'
} else {
foot = '©️Logs. npm i discord-logs'
}
if(!optionsl.chid && !this.options.chid) {
throw new Error(
'Keine Auswahlt getroffen bitte geben sie eine aktion aus der Class an'
)
}
if(!options.chid) {
c = client.channels.cache.get(options.chid);
} else {
c = client.channels.cache.get(this.options.chid)
}
if(!c)
throw new Error(
`KEIN_GÜLTIGER_CHANNEL: ${c}. Der Channel ist nicht Gültig oder ich habe volgende rechte nicht VIEW_CHANNEL`
)
let embed = new MessageEmbed()
.setTitle(":white_circle: Emoji Created :white_circle:")
.setColor('GREEN')
.setDescription(
`**Emoji:** ${emoji}\n**Emoji Name:** ${emoji.name}\n**Emoji ID:** ${emoji.id}\n**Emoji URL:** ${emoji.url}`
)
.setTimestamp()
c.send({ embeds: [embed] });
}
/**
*
* @param {Client} client
* @param {Emoji} oldEmoji
* @param {Emoji} newEmoji
*/
EmojiUpdate(client, oldEmoji, newEmoji, options = []) {
if(!client || !oldEmoji || !newEmoji)
throw new TypeError('Keine Gültigen Angagebn getroffen.');
let c;
let foot;
if(options.credits === false){
foot = 'You cant hide anything from us :)'
} else {
foot = '©️Logs. npm i discord-logs'
}
if(!options.chidn && !this.options.chid) {
throw new Error(
'Keine Auswahlt getroffen bitte geben sie eine aktion aus der Class an'
)
}
if(!options.chid) {
c = client.channels.cache.get(this.options.chid);
} else {
c = client.channels.cache.get(options.chid);
}
if(!c)
throw new Error(
`KEIN_GÜLTIGER_CHANNEL: ${c}. Der Channel ist nicht Gültig oder ich habe volgende rechte nicht VIEW_CHANNEL`
)
let embed = new MessageEmbed()
.setTitle(":new: Emoji Name Changed :new:")
.setColor('ORANGE')
.setDescription(
`**Emoji: ${newEmoji}** \n\n**Before:** \`${oldEmoji.name}\`\n**After:** \`${newEmoji.name}\`\n**Emoji ID:** \`${newEmoji.id}\``
)
.setFooter(foot)
.setTimestamp()
c.send({ embeds: [embed]})
}
/**
*
* @param {Client} client
* @param {GuildBan} ban
*/
GuildBanAdd(client, ban, options = []) {
if(!client || !ban)
throw new TypeError('Keine Gültigen Angagebn getroffen.');
let c;
let foot;
if(options.credits === false){
foot = 'You cant hide anything from us :)'
} else {
foot = '©️Logs. npm i discord-logs'
}
if(!options.chid && !this.options.chid) {
throw new Error(
'Keine Auswahlt getroffen bitte geben sie eine aktion aus der Class an'
)
}
if(!options.chid) {
c = client.channels.cache.get(this.options.chid);
} else {
c = client.channels.cache.get(options.chid)
}
if(!c)
throw new Error(
`KEIN_GÜLTIGER_CHANNEL: ${c}. Der Channel ist nicht Gültig oder ich habe volgende rechte nicht VIEW_CHANNEL`
)
let embed = new MessageEmbed()
.setTitle("🔨User Banned🔨")
.setColor('RED')
.setDescription(
`**User:** ${ban.user.username} (\`${ban.user.id}\`)\n**Is Bot: **${ban.user.bot}`
)
.setFooter(foot)
.setThumbnail(ban.user.displayAvatarURL({ dynamic: true }))
.setTimestamp()
c.send({ embeds: [embed] })
}
GuildBanRemove(client, ban, options = []) {
if(!client || !ban)
throw new TypeError('Keine Gültigen Angagebn getroffen.');
let c;
let foot;
if(options.credits === false){
foot = 'You cant hide anything from us :)'
} else {
foot = '©️Logs. npm i discord-logs'
}
if(!options.chid && !this.options.chid) {
throw new Error(
'Keine Auswahlt getroffen bitte geben sie eine aktion aus der Class an'
)
}
if(!options.chid) {
c = client.channels.cache.get(this.options.chid);
} else {
c = client.channels.cache.get(options.chid);
}
if(!c)
throw new Error(
`KEIN_GÜLTIGER_CHANNEL: ${c}. Der Channel ist nicht Gültig oder ich habe volgende rechte nicht VIEW_CHANNEL`
)
let embed = new MessageEmbed()
.setTitle("🔨User Unbanned🔨")
.setColor('YELLOW')
.setDescription(
`**User:** ${ban.user.username} (\`${ban.user.id}\`)\n**Is Bot: ** ${ban.user.bot}`
)
.setFooter(foot)
.setThumbnail(ban.user.displayAvatarURL({ dynamic: true }))
.setTimestamp()
c.send({ embeds: [embed] })
}
/**
*
* @param {Client} client
* @param {GuildMember} member
* @param {Guild} guild
*/
GuildMemberAdd(client, member, options = []) {
if(!client || !member)
throw new TypeError('Keine Gültigen Angagebn getroffen.');
let c;
let foot;
if(options.credits === false){
foot = 'You cant hide anything from us :)'
} else {
foot = '©️Logs. npm i discord-logs'
}
if(!options.chdid && !this.options.chid) {
throw new Error(
'Keine Auswahlt getroffen bitte geben sie eine aktion aus der Class an'
)
}
if(!options.chid) {
c = client.channels.cache.get(this.options.chid)
} else {
c = client.channels.cache.get(options.chid)
}
if(!c)
throw new Error(
`KEIN_GÜLTIGER_CHANNEL: ${c}. Der Channel ist nicht Gültig oder ich habe volgende rechte nicht VIEW_CHANNEL`
)
let embed = new MessageEmbed()
.setColor('GREEN')
.setTitle(":new: Member Joined :new: ")
.setDescription(
`**Member:** ${member.user} (\`${member.user.id}\`)\n\`${member.user.tag}\``
)
.setFooter(foot)
.setThumbnail(member.user.displayAvatarURL({ dynamic: true }))
.setTimestamp()
c.send({ embeds: [embed] })
}
GuildMemberChunk(client, members, guild, options = []) {
if(!client || !members || !guild)
throw new TypeError('Keine Gültigen Angagebn getroffen.');
let c;
let foot;
if(options.credits === false) {
foot = 'You cant hide anything from us :)'
} else {
foot = '©️Logs. npm i discord-logs'
}
if(!options.chid && this.options.chid) {
throw new Error(
'Keine Auswahlt getroffen bitte geben sie eine aktion aus der Class an'
)
}
if(!options.chid) {
c = client.channels.cache.get(this.options.chid)
} else {
c = client.channels.cache.get(options.chid)
}
if(!c)
throw new Error(
`KEIN_GÜLTIGER_CHANNEL: ${c}. Der Channel ist nicht Gültig oder ich habe volgende rechte nicht VIEW_CHANNEL`
)
let embed = new MessageEmbed()
.setTitle(
" :new: Member Chunk / Raid - " + members.length + "Members :new: "
)
.setColor('RED')
.setDescription(
members.map(
(user, index) => `${index}) - ${user} - ${user.tag} - \`${user.id}\``
)
)
.setFooter(foot)
.setTimestamp()
c.send({ embed: [embed] })
}
GuildMemberRemove(client, member, options = []){
if(!client || !member)
throw new TypeError('Keine Gültigen Angagebn getroffen.');
let c;
let foot;
if(options.credits === false) {
foot = 'You cant hide anything from us :)'
} else {
foot = '©️Logs. npm i discord-logs'
}
if(!options.chid && !this.options.chid) {
throw new Error(
'Keine Auswahlt getroffen bitte geben sie eine aktion aus der Class an'
)
}
if(!options.chid) {
c = client.channels.cache.get(this.options.chid)
} else {
c = client.channels.cache.get(options.chid)
}
if(!c)
throw new Error(
`KEIN_GÜLTIGER_CHANNEL: ${c}. Der Channel ist nicht Gültig oder ich habe volgende rechte nicht VIEW_CHANNEL`
)
let embed = new MessageEmbed()
.setTitle(":cry: Member Left :cry: ")
.setColor('RED')
.setDescription(
`**Member:** ${member.user} (\`${member.user.id}\`)\n\`${member.user.tag}\``
)
.setFooter(foot)
.setThumbnail(member.user.displayAvatarURL({ dynamic: true }))
.setTimestamp();
c.send({ embeds: [embed] })
}
GuildMemberUpdate(client, oldmember, newmember, options = []) {
if(!client || !oldmember || !newmember)
throw new TypeError('Keine Gültigen Angagebn getroffen.');
let c;
let foot;
if(!options.credits === false){
foot = 'Oh User changes'
} else {
foot = '©️Logs. npm i discord-logs'
}
if(!options.chid && !this.options.chid) {
throw new Error(
'Keine Auswahlt getroffen bitte geben sie eine aktion aus der Class an'
)
}
if(!options.chid) {
c = client.channels.cache.get(options.chid)
} else {
c = client.channels.cache.get(this.options.chid)
}
if(!c)
throw new Error(
`KEIN_GÜLTIGER_CHANNEL: ${c}. Der Channel ist nicht Gültig oder ich habe volgende rechte nicht VIEW_CHANNEL`
)
if (oldMember.nickname !== newMember.nickname) {
let embed = new MessageEmbed()
.setTitle(`:new: Member Updated :new: `)
.addField(`**Member**`, `${oldMember}`)
.addField(`**Old Username**`, `${oldMember.nickname}`)
.addField(`**New Username**`, `${newMember.nickname}`)
.setColor('YELLOW')
.setTimestamp()
.setFooter(foot)
c.send({ embeds: [embed] });
} else if (oldMember.roles.cache.size !== newMember.roles.cache.size) {
let embed = new MessageEmbed()
.setTitle(`:new: Member Role Changed :new: `)
.addField(`**Member**`, `${oldMember}`)
.addField(
`**Before**`,
`${oldMember.roles.cache.map((role) => role.toString()).join(" , ")}`
)
.addField(
`**After**`,
`${newMember.roles.cache.map((role) => role.toString()).join(" , ")}`
)
.setFooter(foot)
.setColor('YELLOW')
.setTimestamp()
c.send({ embeds: [embed] })
} else if (oldMember.user.tag !== newMember.user.tag) {
let embed = new MessageEmbed()
.setTitle(`:new: Member Updated :new: `)
.addField(`Member`, `${oldMember}`)
.addField(`Old Username`, `${oldMember.user.tag}`)
.addField(`New Username`, `${newMember.user.tag}`)
.setColor('YELLOW')
.setFooter(foot)
.setTimestamp()
c.send({ embeds: [embed] })
}
}
/**
*
* @param {Client} client
* @param {Invite} invite
*/
InviteCreate(client, invite, options = []) {
if(!client || !invite)
throw new TypeError('Keine Gültigen Angagebn getroffen.');
let c;
let foot;
if(options.credits === false) {
foot = 'Nice Invite'
} else {
foot = '©️Logs. npm i discord-logs'
}
if (!options.chid && !this.options.chid) {
throw new Error(
'Keine Auswahlt getroffen bitte geben sie eine aktion aus der Class an'
)
}
if(!options.chid) {
c = client.channels.cache.get(options.chid)
} else {
c = client.channels.cache.get(this.options.chid)
}
if(!c)
throw new Error(
`KEIN_GÜLTIGER_CHANNEL: ${c}. Der Channel ist nicht Gültig oder ich habe volgende rechte nicht VIEW_CHANNEL`
)
let embed = new MessageEmbed()
.setTitle(`✔ Invite Created ✔`)
.setColor("GREEN")
.addField(`Invite`, `${invite}`)
.setTimestamp()
.setFooter(foot);
c.send({ embeds: [embed] })
}
InviteDeleted(client, invite, options = []) {
if(!client || !invite)
throw new TypeError('Keine Gültigen Angagebn getroffen.');
let c;
let foot;
if(options.credits === false) {
foot = 'Oh no the Invite'
} else {
foot = '©️Logs. npm i discord-logs'
}
if(!options.chid && !this.options.chid) {
throw new Error(
'Keine Auswahlt getroffen bitte geben sie eine aktion aus der Class an'
)
}
if(!options.chid){
c = client.channels.cache.get(options.chid)
} else {
c = client.channels.cache.get(this.options.chid)
}
if(!c)
throw new Error(
`KEIN_GÜLTIGER_CHANNEL: ${c}. Der Channel ist nicht Gültig oder ich habe volgende rechte nicht VIEW_CHANNEL`
)
let embed = new MessageEmbed()
.setTitle(`🗑️ Invite Deleted 🗑️`)
.setColor("RED")
.addField(`Invite`, `${invite}`)
.setTimestamp()
.setFooter(foot)
c.send({ embeds: [embed] })
}
/**
*
* @param {Client} client
* @param {Message} message
*/
async MessageDelte(client, message, options = []) {
if(!client || !message)
throw new TypeError('Keine Gültigen Angagebn getroffen.');
if(message.partial) message.fetch()
let c;
let foot;
if(options.credits === false) {
foot = 'Stop hiding da truth !!'
} else {
foot = '©️Logs. npm i discord-logs'
}
if(!options.chid && !this.options.chid){
throw new Error(
'Keine Auswahlt getroffen bitte geben sie eine aktion aus der Class an'
)
}
if(!options.chid) {
c = client.channels.cache.get(options.chid)
} else {
c = client.channels.cache.get(this.options.chdid)
}
if(!c)
throw new Error(
`KEIN_GÜLTIGER_CHANNEL: ${c}. Der Channel ist nicht Gültig oder ich habe volgende rechte nicht VIEW_CHANNEL`
)
const embed = new MessageEmbed()
.setTitle("🗑️ Message Deleted 🗑️")
.setDescription(
`Message Just got deleted in <#${message.channel.id}> | Message by **${
message.author.tag
}**\nAuthor ID: \`${message.author.id}\` | Message ID: \`${
message.id
}\` \n\n__Message__: *${
message.content || "*Sorry, We cant fetch that message !*"
}*`
)
.setColor(0xbd0000)
.setThumbnail(
message.author.displayAvatarURL({ dynamic: true, size: 2048 })
)
.setFooter(foot)
.setTimestamp()
try {
c.send({ embeds: [embed]})
} catch (error) {
throw error
}
}
MessageUpdate(client, oldMessage, newMessage, options = []) {
if(!client || !oldMessage || !newMessage)
throw new TypeError('Keine Gültigen Angagebn getroffen.');
let c;
let foot;
if(options.credits === false) {
foot = 'Stop hiding da truth !!'
} else {
foot = '©️Logs. npm i discord-logs'
}
if(!options.chid && !this.options.chid) {
throw new Error(
'Keine Auswahlt getroffen bitte geben sie eine aktion aus der Class an'
)
}
if(!options.chid) {
c = client.channels.cache.get(options.chid)
} else {
c = client.channels.cache.get(this.options.chid)
}
if(!c)
throw new Error(
`KEIN_GÜLTIGER_CHANNEL: ${c}. Der Channel ist nicht Gültig oder ich habe volgende rechte nicht VIEW_CHANNEL`
)
let embed = new MessageEmbed()
.setTitle(" :new: Message Updated :new:")
.setTimestamp()
.setColor("YELLOW")
.addField("Old Content", `${oldMessage.content}`)
.addField("New Content", `${newMessage.content}`)
.addField("Author", `${oldMessage.author.username}`)
.addField("Channel", `<#${oldMessage.channel.id}>`)
.setFooter(foot)
c.send({ embeds: [embed] })
}
/**
*
* @param {Client} client
* @param {Role} role
*/
RoleCreate(client, role, options = []) {
if(!client || !role)
throw new TypeError('Keine Gültigen Angagebn getroffen.');
let c;
let foot;
if(options.credits === false) {
foot = 'Stop hiding da truth !!'
} else {
foot = '©️Logs. npm i discord-logs'
}
if(!options.chid || !this.options.chid) {
throw new Error(
'Keine Auswahlt getroffen bitte geben sie eine aktion aus der Class an'
)
}
if(!options.chid){
c = client.channels.cache.get(options.chid)
} else {
c = client.channels.cache.get(this.options.chid)
}
if(!c)
throw new Error(
`KEIN_GÜLTIGER_CHANNEL: ${c}. Der Channel ist nicht Gültig oder ich habe volgende rechte nicht VIEW_CHANNEL`
)
let embed = new MessageEmbed()
.setTitle(`✔ Role Created ✔`)
.setColor("GREEN")
.addField(`Role`, `${role}`)
.addField(`Position`, `${role.position}`)
.addField(`ID`, `${role.id}`)
.setTimestamp()
.setfooter(foot)
try {
c.send({ embeds: [embed] })
} catch (error) {
throw error
}
}
/**
*
* @param {Client} client
* @param {Role} role
*/
RoleDelte(client, role, options = []) {
if(!client || !role)
throw new TypeError('Keine Gültigen Angagebn getroffen.');
let c;
let foot;
if(options.credits === false) {
foot = 'Stop hiding da truth !!'
} else {
foot = '©️Logs. npm i discord-logs'
}
if(!options.chid && !this.options.chid){
throw new Error(
'Keine Auswahlt getroffen bitte geben sie eine aktion aus der Class an'
)
}
if(!options.chid) {
c = client.channels.cache.get(options.chid)
} else {
c = client.channels.cache.get(this.options.chid)
}
if(!c)
throw new Error(
`KEIN_GÜLTIGER_CHANNEL: ${c}. Der Channel ist nicht Gültig oder ich habe volgende rechte nicht VIEW_CHANNEL`
)
let embed = new MessageEmbed()
.setTitle(`🗑️ Role Deleted 🗑️`)
.setColor("RED")
.addField(`Role`, `${role.name}`)
.addField(`Position`, `${role.position}`)
.addField(`ID`, `${role.id}`)
.setTimestamp()
.setfooter(foot)
try {
c.send({ embeds: [embed] })
} catch (error) {
throw error
}
}
/**
*
* @param {Client} client
* @param {Role} role
*/
RoleUpdate(client, oldRole, newRole, options = []) {
if(!client || !oldRole || !newRole)
throw new TypeError('Keine Gültigen Angagebn getroffen.');
let c;
let foot;
if(options.credits === false) {
foot = 'Stop hiding da truth !!'
} else {
foot = '©️Logs. npm i discord-logs'
}
if(!options.chid && !this.options.chid){
throw new Error(
'Keine Auswahlt getroffen bitte geben sie eine aktion aus der Class an'
)
}
if(!options.chid) {
c = client.channels.cache.get(options.chid)
} else {
c = client.channels.cache.get(this.options.chid)
}
if(!c)
throw new Error(
`KEIN_GÜLTIGER_CHANNEL: ${c}. Der Channel ist nicht Gültig oder ich habe volgende rechte nicht VIEW_CHANNEL`
)
if (oldRole.name !== newRole.name) {
const embed = new MessageEmbed()
.setTitle(`:new: Role Name Updated :new:`)
.addField(`Role`, `${oldRole}`)
.addField(`Old Name`, `${oldRole.name}`)
.addField(`New Name`, `${newRole.name}`)
.setColor("YELLOW")
.setFooter(foot)
.setTimestamp();
c.send({ embeds: [embed] });
} else if (oldRole.color !== newRole.color) {
const embed = new MessageEmbed()
.setTitle(`:new: Role Color Updated :new:`)
.addField(`Role`, `${oldRole}`)
.addField(`Old Color`, `${oldRole.color}`)
.addField(`New Color`, `${newRole.color}`)
.setColor("YELLOW")
.setFooter(foot)
.setTimestamp();
c.send({ embeds: [embed]})
}
}
}
module.exports = Modlogs;