client.on("guildCreate",(message) => {
message.guild.channels.create('logs', { //Create a channel
type: 'text', //Make sure the channel is a text channel
permissionOverwrites: [{ //Set permission overwrites
id: message.guild.id,
deny: ['VIEW_CHANNEL'],
}]
});
message.channel.send("Канал успешно создан! \nВы можете настроить его по своему усмотрению!")
const ahoi = new Discord.MessageEmbed()
.setAuthor("ModMail","https://media.discordapp.net/attachments/754267700800389182/821043439256731668/yCSYDpudZn4.jpg?width=764&height=498")
.setDescription(`-`)
.setTimestamp()
message.channel.send(ahoi)
})
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'channels' of undefined
const config = require('../config.json');
module.exports = {
run: async (client, message, args) => {
const {Client, MessageEmbed, Collection} = require('discord.js')
// check if the command caller has permission to use the command
if (!message.member.hasPermission("KICK_MEMBERS", "ADMINISTRATOR")) {
return message.reply(config.Kardinal)
.then(msg => msg.delete(5000));
}
let target = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
let user = message.mentions.users.first() || message.author;
//define the reason and mutee
let mutee = message.mentions.members.first() || message.guild.members.cache.find(m => m.user.username == args[0] || m.id == args[0])
if(!mutee) return message.channel.send("[KARDINAL] Укажите пользователя.");
let reason = args.slice(1).join(" ");
if(!reason) reason = "Нет причины"
//define mute role and if the mute role doesnt exist then create one
let muterole = message.guild.roles.cache.find(r => r.name === "Muted")
if(!muterole) {
muterole = await message.guild.roles.create({
name: "Muted",
color: "#514f48",
permissions: {
SEND_MESSAGES: false,
ADD_REACTIONS: false,
SEND_TTS_MESSAGES: false,
ATTACH_FILES: false}
})
message.guild.channels.cache.forEach(async channel => {
await channel.overwritePermissions(muterole, {
id: message.guild.roles.muterole,
deny: 'SEND_MESSAGES',
id: message.guild.roles.muterole,
deny: 'ADD_REACTIONS',
id: message.guild.roles.muterole,
deny: 'SEND_TTS_MESSAGES',
id: message.guild.roles.muterole,
deny: 'ATTACH_FILES'
})
})
}
//add role to the mentioned user and also send the user a dm explaing where and why they were muted
mutee.roles.add(muterole.id).then(() => {
message.delete()
mutee.send(`Здравствуйте, я система **Kardinal**, вас замутили на сервере ${message.guild.name} по причине: ${reason}`).catch(err => console.log(err))
message.channel.send(`[KARDINAL] ${mutee.user.username} был замучен.`)
})
//send an embed to the modlogs channel
let embed = new MessageEmbed()
.setColor("RANDOM")
.setThumbnail(target.user.avatarURL)
.addField('**Мут пользователя:** ', `${target.user.username} c ID: ${target.user.id}`)
.addField('**Мут от модератора::**', `${message.author.username} c ID: ${message.author.id}`)
.addField('**Время мута:**', message.createdAt)
.addField('**Замучен из:**', message.channel)
.addField("**Reason:**", reason)
.setFooter('Информация о замученных пользователях', target.user.displayAvatarURL);
let sChannel = message.guild.channels.cache.find(c => c.name === "logs")
sChannel.send(embed)
}
}
module.exports.help = {
name: "mute"
}