mirror of
https://github.com/System-End/Discord-Bot.git
synced 2026-04-19 18:35:22 +00:00
46 lines
No EOL
1.4 KiB
JavaScript
46 lines
No EOL
1.4 KiB
JavaScript
const Discord = require('discord.js');
|
|
|
|
const Schema = require("../../database/models/stats");
|
|
|
|
module.exports = async (client, interaction, args) => {
|
|
var channelName = await client.getTemplate(interaction.guild);
|
|
channelName = channelName.replace(`{emoji}`, "💬")
|
|
channelName = channelName.replace(`{name}`, `Text Channels: ${interaction.guild.channels.cache.filter(channel => channel.type === Discord.ChannelType.GuildText).size || 0}`)
|
|
|
|
await interaction.guild.channels.create({
|
|
name: channelName,
|
|
type: Discord.ChannelType.GuildVoice, permissionOverwrites: [
|
|
{
|
|
deny: [Discord.PermissionsBitField.Flags.Connect],
|
|
id: interaction.guild.id
|
|
},
|
|
],
|
|
}).then(async (channel) => {
|
|
Schema.findOne({ Guild: interaction.guild.id }, async (err, data) => {
|
|
if (data) {
|
|
data.TextChannels = channel.id;
|
|
data.save();
|
|
}
|
|
else {
|
|
new Schema({
|
|
Guild: interaction.guild.id,
|
|
TextChannels: channel.id
|
|
}).save();
|
|
}
|
|
})
|
|
|
|
client.succNormal({
|
|
text: `Text channel count created!`,
|
|
fields: [
|
|
{
|
|
name: `📘┆Channel`,
|
|
value: `${channel}`
|
|
}
|
|
],
|
|
type: 'editreply'
|
|
}, interaction);
|
|
})
|
|
|
|
}
|
|
|
|
|