mirror of
https://github.com/System-End/Discord-Bot.git
synced 2026-04-19 16:28:26 +00:00
Update
This commit is contained in:
parent
beccd479c7
commit
3c37bc9815
15 changed files with 73 additions and 33 deletions
|
|
@ -163,6 +163,7 @@ fs.readdirSync('./src/handlers').forEach((dir) => {
|
|||
client.login(process.env.DISCORD_TOKEN);
|
||||
|
||||
process.on('unhandledRejection', error => {
|
||||
console.log(error)
|
||||
if(error) if (error.length > 950) error = error.slice(0, 950) + '... view console for details';
|
||||
if(error.stack) if (error.stack.length > 950) error.stack = error.stack.slice(0, 950) + '... view console for details';
|
||||
const embed = new Discord.EmbedBuilder()
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ const Discord = require('discord.js');
|
|||
|
||||
module.exports = async (client, interaction, args) => {
|
||||
const perms = await client.checkPerms({
|
||||
flags: [Discord.PermissionsBitField.Flags.KICK_MEMBERS],
|
||||
flags: [Discord.PermissionsBitField.Flags.KickMembers],
|
||||
perms: [Discord.PermissionsBitField.Flags.KickMembers]
|
||||
}, interaction)
|
||||
|
||||
|
|
@ -11,7 +11,7 @@ module.exports = async (client, interaction, args) => {
|
|||
const member = await interaction.guild.members.fetch(interaction.options.getUser('user').id);
|
||||
const reason = interaction.options.getString('reason') || 'Not given';
|
||||
|
||||
if (member.permissions.has(Discord.PermissionsBitField.Flags.KICK_MEMBERS) || member.permissions.has(Discord.PermissionsBitField.Flags.KICK_MEMBERS)) return client.errNormal({
|
||||
if (member.permissions.has(Discord.PermissionsBitField.Flags.KickMembers) || member.permissions.has(Discord.PermissionsBitField.Flags.KickMembers)) return client.errNormal({
|
||||
error: "You can't kick a moderator",
|
||||
type: 'editreply'
|
||||
}, interaction);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ module.exports = async (client, interaction, args) => {
|
|||
const channel = interaction.options.getChannel('channel') || interaction.channel;
|
||||
|
||||
await channel.permissionOverwrites.edit(interaction.guild.roles.cache.find(x => x.name === '@everyone'), {
|
||||
SEND_MESSAGES: false,
|
||||
SendMessages: false,
|
||||
});
|
||||
|
||||
client.succNormal({
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ module.exports = async (client, interaction, args) => {
|
|||
if (perms == false) return;
|
||||
|
||||
interaction.guild.channels.cache.forEach(ch => {
|
||||
if (ch.type == "text") {
|
||||
ch.permissionOverwrites.edit(interaction.guild.roles.cache.find(x => x.name === '@everyone'), {
|
||||
SEND_MESSAGES: false,
|
||||
if (ch.type == Discord.ChannelType.GuildText) {
|
||||
ch.permissionOverwrites.edit(interaction.guild.id, {
|
||||
SendMessages: false,
|
||||
});
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ module.exports = async (client, interaction, args) => {
|
|||
const channel = interaction.options.getChannel('channel') || interaction.channel;
|
||||
|
||||
await channel.permissionOverwrites.edit(interaction.guild.roles.cache.find(x => x.name === '@everyone'), {
|
||||
SEND_MESSAGES: true,
|
||||
SendMessages: true,
|
||||
});
|
||||
|
||||
client.succNormal({
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ module.exports = async (client, interaction, args) => {
|
|||
|
||||
if (interaction.channel.parentId == ticketCategory.id) {
|
||||
let user = interaction.options.getUser('user');
|
||||
interaction.channel.permissionOverwrites.edit(user.id, { VIEW_CHANNEL: true, SEND_MESSAGES: true });
|
||||
interaction.channel.permissionOverwrites.edit(user.id, { ViewChannel: true, SendMessages: true });
|
||||
|
||||
return client.simpleEmbed({
|
||||
desc: `Added ${user}`,
|
||||
|
|
|
|||
|
|
@ -31,11 +31,11 @@ module.exports = async (client, interaction, args) => {
|
|||
if (interaction.guild.channels.cache.find(c => c.id === ticketCategory.id)) {
|
||||
client.users.fetch(ticketData.creator).then(async usr => {
|
||||
interaction.channel.permissionOverwrites.edit(usr, {
|
||||
VIEW_CHANNEL: false,
|
||||
SEND_MESSAGES: false,
|
||||
ATTACH_FILES: false,
|
||||
READ_MESSAGE_HISTORY: false,
|
||||
ADD_REACTIONS: false
|
||||
ViewChannel: false,
|
||||
SendMessages: false,
|
||||
AttachFiles: false,
|
||||
ReadMessageHistory: false,
|
||||
AddReactions: false
|
||||
});
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -27,11 +27,11 @@ module.exports = async (client, interaction, args) => {
|
|||
|
||||
try {
|
||||
interaction.channel.permissionOverwrites.edit(ticketRole, {
|
||||
VIEW_CHANNEL: true,
|
||||
SEND_MESSAGES: true,
|
||||
ATTACH_FILES: true,
|
||||
READ_MESSAGE_HISTORY: true,
|
||||
ADD_REACTIONS: true
|
||||
ViewChannel: true,
|
||||
SendMessages: true,
|
||||
AttachFiles: true,
|
||||
ReadMessageHistory: true,
|
||||
AddReactions: true
|
||||
});
|
||||
|
||||
return client.simpleEmbed({
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ module.exports = async (client, interaction, args) => {
|
|||
if (interaction.channel.parentId == ticketCategory.id) {
|
||||
client.users.fetch(ticketData.creator).then(usr => {
|
||||
interaction.channel.permissionOverwrites.edit(usr, {
|
||||
VIEW_CHANNEL: true,
|
||||
SEND_MESSAGES: true,
|
||||
ATTACH_FILES: true,
|
||||
READ_MESSAGE_HISTORY: true,
|
||||
ADD_REACTIONS: true
|
||||
ViewChannel: true,
|
||||
SendMessages: true,
|
||||
AttachFiles: true,
|
||||
ReadMessageHistory: true,
|
||||
AddReactions: true
|
||||
});
|
||||
|
||||
var ticketid = String(ticketData.TicketID).padStart(4, 0);
|
||||
|
|
|
|||
|
|
@ -27,11 +27,11 @@ module.exports = async (client, interaction, args) => {
|
|||
|
||||
try {
|
||||
interaction.channel.permissionOverwrites.edit(ticketRole, {
|
||||
VIEW_CHANNEL: false,
|
||||
SEND_MESSAGES: false,
|
||||
ATTACH_FILES: false,
|
||||
READ_MESSAGE_HISTORY: false,
|
||||
ADD_REACTIONS: false
|
||||
ViewChannel: false,
|
||||
SendMessages: false,
|
||||
AttachFiles: false,
|
||||
ReadMessageHistory: false,
|
||||
AddReactions: false
|
||||
});
|
||||
|
||||
return client.simpleEmbed({
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ module.exports = async (client, interaction, args) => {
|
|||
}, interaction)
|
||||
}
|
||||
|
||||
interaction.channel.permissionOverwrites.edit(user.id, { VIEW_CHANNEL: false, SEND_MESSAGES: false });
|
||||
interaction.channel.permissionOverwrites.edit(user.id, { ViewChannel: false, SendMessages: false });
|
||||
|
||||
return client.simpleEmbed({
|
||||
desc: `Removed ${user}`,
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ module.exports = async (client, interaction, args) => {
|
|||
}, interaction);
|
||||
|
||||
channel.permissionOverwrites.edit(interaction.guild.roles.cache.find(x => x.name === '@everyone'), {
|
||||
CONNECT: false
|
||||
Connect: false
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ module.exports = async (client, interaction, args) => {
|
|||
}, interaction);
|
||||
|
||||
channel.permissionOverwrites.edit(interaction.guild.roles.cache.find(x => x.name === '@everyone'), {
|
||||
CONNECT: true
|
||||
Connect: true
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@ const Captcha = require("@haileybot/captcha-generator");
|
|||
const reactionSchema = require("../../database/models/reactionRoles");
|
||||
const banSchema = require("../../database/models/userBans");
|
||||
const verify = require("../../database/models/verify");
|
||||
|
||||
const Commands = require("../../database/models/customCommand");
|
||||
const CommandsSchema = require("../../database/models/customCommandAdvanced");
|
||||
module.exports = async (client, interaction) => {
|
||||
// Commands
|
||||
if (interaction.isCommand() || interaction.isContextMenu()) {
|
||||
|
|
@ -19,6 +20,42 @@ module.exports = async (client, interaction) => {
|
|||
}
|
||||
else {
|
||||
const cmd = client.commands.get(interaction.commandName);
|
||||
if (!cmd){
|
||||
const cmdd = await Commands.findOne({
|
||||
Guild: interaction.guild.id,
|
||||
Name: interaction.commandName,
|
||||
});
|
||||
if (cmdd) {
|
||||
return interaction.channel.send({ content: cmdd.Responce });
|
||||
}
|
||||
|
||||
const cmdx = await CommandsSchema.findOne({
|
||||
Guild: interaction.guild.id,
|
||||
Name: interaction.commandName,
|
||||
});
|
||||
if (cmdx) {
|
||||
if (cmdx.Action == "Normal") {
|
||||
return interaction.channel.send({ content: cmdx.Responce });
|
||||
} else if (cmdx.Action == "Embed") {
|
||||
return client.simpleEmbed(
|
||||
{
|
||||
desc: `${cmdx.Responce}`,
|
||||
type: 'editreply'
|
||||
},
|
||||
interaction.channel,
|
||||
);
|
||||
} else if (cmdx.Action == "DM") {
|
||||
return interaction.author.send({ content: cmdx.Responce }).catch((e) => {
|
||||
client.errNormal(
|
||||
{
|
||||
error: "I can't DM you, maybe you have DM turned off!",
|
||||
},
|
||||
interaction.channel
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
if (interaction.options._subcommand !== null && interaction.options.getSubcommand() == "help") {
|
||||
const commands = interaction.client.commands.filter(x => x.data.name == interaction.commandName).map((x) => x.data.options.map((c) => '`' + c.name + '` - ' + c.description).join("\n"));
|
||||
|
||||
|
|
@ -29,7 +66,7 @@ module.exports = async (client, interaction) => {
|
|||
}, interaction)
|
||||
}
|
||||
|
||||
cmd.run(client, interaction, interaction.options._hoistedOptions).catch(err => {
|
||||
if(cmd) cmd.run(client, interaction, interaction.options._hoistedOptions).catch(err => {
|
||||
client.emit("errorCreate", err, interaction.commandName, interaction)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ axios.get('https://api.github.com/repos/CorwinDev/Discord-Bot/releases/latest').
|
|||
if (res.data.tag_name !== version) {
|
||||
console.log(chalk.red.bgYellow(`Your bot is not up to date! Please update to the latest version!`, version + ' -> ' + res.data.tag_name));
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(chalk.red.bgYellow(`Failed to check if bot is up to date!`));
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue