update/add logs and update prefix
This commit is contained in:
1 parent
0495577b3c
commit
2c1d15cfc4
9 files changed
+228
-31
No files matched your search
+1
-2
@@ -11,5 +11,4 @@ dev.js
|
|||||||
config/dev-config.js
|
config/dev-config.js
|
||||||
|
|
||||||
# Logs
|
# Logs
|
||||||
logs
|
logs/*
|
||||||
*.log
|
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Client has been logged in"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Client has been logged in"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Successfully Logged in as LPC-Bot Alpha#5344"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Successfully Logged in as LPC-Bot Alpha#5344"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"21:function getMinutes() { [native code] } - 7:2:2022 | Info: Successfully Logged in as LPC-Bot Alpha#5344"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Successfully Logged in as LPC-Bot Alpha#5344"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Successfully Logged in as LPC-Bot Alpha#5344"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Successfully Logged in as LPC-Bot Alpha#5344"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Successfully Logged in as LPC-Bot Alpha#5344"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Successfully Logged in as LPC-Bot Alpha#5344"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Successfully Logged in as LPC-Bot Alpha#5344"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Successfully Logged in as LPC-Bot Alpha#5344"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Successfully Logged in as LPC-Bot Alpha#5344"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Successfully Logged in as LPC-Bot Alpha#5344"}
|
||||||
|
{"level":"info","message":"22:function getMinutes() { [native code] } - 7:2:2022 | Info: Interaction"}
|
||||||
|
{"level":"info","message":"11:function getMinutes() { [native code] } - 8:2:2022 | Info: Command Loaded: help"}
|
||||||
|
{"level":"info","message":"11:function getMinutes() { [native code] } - 8:2:2022 | Info: Command Loaded: stats"}
|
||||||
|
{"level":"info","message":"11:function getMinutes() { [native code] } - 8:2:2022 | Info: Event Loaded: guildCreate"}
|
||||||
|
{"level":"info","message":"11:function getMinutes() { [native code] } - 8:2:2022 | Info: Event Loaded: message"}
|
||||||
|
{"level":"info","message":"11:function getMinutes() { [native code] } - 8:2:2022 | Info: Event Loaded: ready"}
|
||||||
|
{"level":"info","message":"11:function getMinutes() { [native code] } - 8:2:2022 | Info: Error: ENOENT: no such file or directory, scandir 'C:\\Users\\flami\\Desktop\\Projects\\commands'"}
|
||||||
|
{"level":"info","message":"11:function getMinutes() { [native code] } - 8:2:2022 | Info: Error: ENOENT: no such file or directory, scandir 'C:\\Users\\flami\\Desktop\\Projects\\events'"}
|
||||||
|
{"level":"info","message":"11:function getMinutes() { [native code] } - 8:2:2022 | Info: Error: ENOENT: no such file or directory, scandir 'C:\\Users\\flami\\Desktop\\Projects\\commands'"}
|
||||||
|
{"level":"info","message":"11:function getMinutes() { [native code] } - 8:2:2022 | Info: Error: ENOENT: no such file or directory, scandir 'C:\\Users\\flami\\Desktop\\Projects\\events'"}
|
||||||
+5
-2
@@ -11,7 +11,7 @@ module.exports = {
|
|||||||
aliases: ["command", "commands", "cmd"],
|
aliases: ["command", "commands", "cmd"],
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {import("../LPS")} client
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
* @param {import("discord.js").Message} message
|
* @param {import("discord.js").Message} message
|
||||||
* @param {string[]} args
|
* @param {string[]} args
|
||||||
* @param {*} param3
|
* @param {*} param3
|
||||||
@@ -91,13 +91,16 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {import("../LPS")} client
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
* @param {import("discord.js").Message} message
|
* @param {import("discord.js").Message} message
|
||||||
* @param {string[]} args
|
* @param {string[]} args
|
||||||
* @param {*} param3
|
* @param {*} param3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
run: async (client, interaction, args, { GuildDB }) => {
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
let Commands = client.commands.map(
|
let Commands = client.commands.map(
|
||||||
(cmd) =>
|
(cmd) =>
|
||||||
`\`${GuildDB ? GuildDB.prefix : client.config.DefaultPrefix}${
|
`\`${GuildDB ? GuildDB.prefix : client.config.DefaultPrefix}${
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "ping",
|
||||||
|
description: "check the bots responce",
|
||||||
|
usage: "",
|
||||||
|
permissions: {
|
||||||
|
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||||
|
member: [],
|
||||||
|
},
|
||||||
|
aliases: [],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").Message} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, message) => {
|
||||||
|
return message.channel.send('Pong!');
|
||||||
|
},
|
||||||
|
SlashCommand: {
|
||||||
|
options: [],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").Message} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
interaction.send('Pong!');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "setprefix",
|
||||||
|
description: "Update prefix for the bot",
|
||||||
|
usage: "[new Prefix]",
|
||||||
|
permissions: {
|
||||||
|
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||||
|
member: ["MANAGE_GUILD"],
|
||||||
|
},
|
||||||
|
aliases: ["newprefix", "new_prefix", "set_prefix"],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").Message} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, message, args, { GuildDB }) => {
|
||||||
|
if (args[0]==undefined) return message.channel.send(`You must provide a \`new prefix\` ${message.author}`);
|
||||||
|
if (args[0].length<1) return message.channel.send('Your new prefix must be \`1\` character!')
|
||||||
|
client.dbo.collection("prefixes").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.prefix":args[0]}},function(err, res) {
|
||||||
|
if (err) throw err;
|
||||||
|
message.channel.send(`The new prefix is now **\`${args[0]}\`**`);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
SlashCommand: {
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: "new-prefix",
|
||||||
|
description: "Update prefix for the bot",
|
||||||
|
value: "setprefix",
|
||||||
|
type: 3,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").Message} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
if (args[0].length<1) return interaction.send('Your new prefix must be \`1\` character!')
|
||||||
|
client.dbo.collection("prefixes").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.prefix":args[0].value}},function(err, res) {
|
||||||
|
if (err) throw err;
|
||||||
|
interaction.send(`The new prefix is now **\`${args[0].value}\`**`);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
+7
-4
@@ -12,7 +12,7 @@ module.exports = {
|
|||||||
aliases: ["stat", "statistics", "info"],
|
aliases: ["stat", "statistics", "info"],
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {import("../LPS")} client
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
* @param {import("discord.js").Message} message
|
* @param {import("discord.js").Message} message
|
||||||
* @param {string[]} args
|
* @param {string[]} args
|
||||||
* @param {*} param3
|
* @param {*} param3
|
||||||
@@ -30,12 +30,15 @@ module.exports = {
|
|||||||
SlashCommand: {
|
SlashCommand: {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {import("../LPS")} client
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
* @param {import("discord.js").Message} message
|
* @param {import("discord.js").Message} message
|
||||||
* @param {string[]} args
|
* @param {string[]} args
|
||||||
* @param {*} param3
|
* @param {*} param3
|
||||||
*/
|
*/
|
||||||
run: async (client, interaction) => {
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
const { version } = require("discord.js");
|
const { version } = require("discord.js");
|
||||||
const stats = new MessageEmbed()
|
const stats = new MessageEmbed()
|
||||||
.setColor('#0099ff')
|
.setColor('#0099ff')
|
||||||
@@ -44,7 +47,7 @@ module.exports = {
|
|||||||
.addField(" \u200B ", "**Channels** : ` " + `${client.channels.cache.size}` + " `")
|
.addField(" \u200B ", "**Channels** : ` " + `${client.channels.cache.size}` + " `")
|
||||||
.addField(" \u200B ", "**Servers** : ` " + `${client.guilds.cache.size}` + " `")
|
.addField(" \u200B ", "**Servers** : ` " + `${client.guilds.cache.size}` + " `")
|
||||||
.addField(" \u200B ", "**Users** : ` " + `${client.users.cache.size}` + " `")
|
.addField(" \u200B ", "**Users** : ` " + `${client.users.cache.size}` + " `")
|
||||||
return message.channel.send(stats)
|
interaction.send(stats)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
+5
-10
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {require("../LPS")} client
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
* @param {require("discord.js").Message} message
|
* @param {require("discord.js").Message} message
|
||||||
* @returns {void} or nothing if you didn't know
|
* @returns {void} or nothing if you didn't know
|
||||||
*/
|
*/
|
||||||
@@ -12,15 +12,6 @@ module.exports = async (client, message) => {
|
|||||||
let GuildDB = await client.GetGuild(message.guild.id);
|
let GuildDB = await client.GetGuild(message.guild.id);
|
||||||
if (GuildDB && GuildDB.prefix) prefix = GuildDB.prefix;
|
if (GuildDB && GuildDB.prefix) prefix = GuildDB.prefix;
|
||||||
|
|
||||||
//Initialize GuildDB
|
|
||||||
if (!GuildDB) {
|
|
||||||
await client.database.guild.set(message.guild.id, {
|
|
||||||
prefix: prefix,
|
|
||||||
DJ: null,
|
|
||||||
});
|
|
||||||
GuildDB = await client.GetGuild(message.guild.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Prefixes also have mention match
|
//Prefixes also have mention match
|
||||||
const prefixMention = new RegExp(`^<@!?${client.user.id}> `);
|
const prefixMention = new RegExp(`^<@!?${client.user.id}> `);
|
||||||
prefix = message.content.match(prefixMention)
|
prefix = message.content.match(prefixMention)
|
||||||
@@ -29,6 +20,10 @@ module.exports = async (client, message) => {
|
|||||||
|
|
||||||
if (message.content.indexOf(prefix) !== 0) return;
|
if (message.content.indexOf(prefix) !== 0) return;
|
||||||
|
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(message.channel.id)) {
|
||||||
|
return message.channel.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
|
||||||
const args = message.content.slice(prefix.length).trim().split(/ +/g);
|
const args = message.content.slice(prefix.length).trim().split(/ +/g);
|
||||||
//Making the command lowerCase because our file name will be in lowerCase
|
//Making the command lowerCase because our file name will be in lowerCase
|
||||||
const command = args.shift().toLowerCase();
|
const command = args.shift().toLowerCase();
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
const { Collection, Client, MessageEmbed } = require('discord.js');
|
const { Collection, Client, MessageEmbed } = require('discord.js');
|
||||||
const CommandHandler = require('./commands').Commands;
|
const CommandHandler = require('../commands').Commands;
|
||||||
const MongoClient = require('mongodb').MongoClient;
|
const MongoClient = require('mongodb').MongoClient;
|
||||||
const Logger = require("./util/Logger");
|
const Logger = require("../util/Logger");
|
||||||
|
const path = require("path");
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
class LinesPoliceCadBot extends Client {
|
class LinesPoliceCadBot extends Client {
|
||||||
@@ -11,13 +12,15 @@ class LinesPoliceCadBot extends Client {
|
|||||||
|
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.commands = new Collection();
|
this.commands = new Collection();
|
||||||
this.logger = new Logger('./Logs.log');
|
this.logger = new Logger(path.join(__dirname, "..", "logs/Logs.log"));
|
||||||
|
|
||||||
if (this.config.Token === "")
|
if (this.config.Token === "")
|
||||||
return new TypeError(
|
return new TypeError(
|
||||||
"The botconfig.js is not filled out. Please make sure nothing is blank, otherwise the bot will not work properly."
|
"The botconfig.js is not filled out. Please make sure nothing is blank, otherwise the bot will not work properly."
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.db;
|
||||||
|
this.dbo;
|
||||||
this.connectMongo(this.config.mongoURI, this.config.dbo);
|
this.connectMongo(this.config.mongoURI, this.config.dbo);
|
||||||
this.LoadCommands();
|
this.LoadCommands();
|
||||||
this.LoadEvents();
|
this.LoadEvents();
|
||||||
@@ -69,10 +72,11 @@ class LinesPoliceCadBot extends Client {
|
|||||||
async connectMongo(mongoURI, dbo) {
|
async connectMongo(mongoURI, dbo) {
|
||||||
this.db = await MongoClient.connect(mongoURI,{useUnifiedTopology:true});
|
this.db = await MongoClient.connect(mongoURI,{useUnifiedTopology:true});
|
||||||
this.dbo = this.db.db(dbo);
|
this.dbo = this.db.db(dbo);
|
||||||
|
this.log('Successfully connected to mongoDB');
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadCommands() {
|
LoadCommands() {
|
||||||
let CommandsDir = './commands';
|
let CommandsDir = path.join(__dirname, '..', 'commands');
|
||||||
fs.readdir(CommandsDir, (err, files) => {
|
fs.readdir(CommandsDir, (err, files) => {
|
||||||
if (err) this.log(err);
|
if (err) this.log(err);
|
||||||
else
|
else
|
||||||
@@ -91,7 +95,7 @@ class LinesPoliceCadBot extends Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LoadEvents() {
|
LoadEvents() {
|
||||||
let EventsDir = './events';
|
let EventsDir = path.join(__dirname, '..', 'events');
|
||||||
fs.readdir(EventsDir, (err, files) => {
|
fs.readdir(EventsDir, (err, files) => {
|
||||||
if (err) this.log(err);
|
if (err) this.log(err);
|
||||||
else
|
else
|
||||||
@@ -103,9 +107,17 @@ class LinesPoliceCadBot extends Client {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sendTime(Channel, Error) {
|
||||||
|
let embed = new MessageEmbed()
|
||||||
|
.setColor(this.config.EmbedColor)
|
||||||
|
.setDescription(Error);
|
||||||
|
|
||||||
|
Channel.send(embed);
|
||||||
|
}
|
||||||
|
|
||||||
RegisterSlashCommands() {
|
RegisterSlashCommands() {
|
||||||
this.guilds.cache.forEach((guild) => {
|
this.guilds.cache.forEach((guild) => {
|
||||||
require("./util/RegisterSlashCommands")(this, guild.id);
|
require("../util/RegisterSlashCommands")(this, guild.id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +133,6 @@ class LinesPoliceCadBot extends Client {
|
|||||||
|
|
||||||
async GetGuild(GuildId) {
|
async GetGuild(GuildId) {
|
||||||
let prefix;
|
let prefix;
|
||||||
let channelId;
|
|
||||||
let customRoleStatus;
|
let customRoleStatus;
|
||||||
let customChannelStatus;
|
let customChannelStatus;
|
||||||
let allowedChannels;
|
let allowedChannels;
|
||||||
@@ -154,10 +165,10 @@ class LinesPoliceCadBot extends Client {
|
|||||||
}
|
}
|
||||||
let guildData = {
|
let guildData = {
|
||||||
prefix: prefix,
|
prefix: prefix,
|
||||||
channelId: channelId,
|
allowedChannels: allowedChannels,
|
||||||
customRoleStatus: customRoleStatus,
|
customRoleStatus: customRoleStatus,
|
||||||
customChannelStatus: allowedChannels,
|
customChannelStatus: customChannelStatus,
|
||||||
guildId: GuildId
|
serverID: GuildId
|
||||||
}
|
}
|
||||||
return guildData;
|
return guildData;
|
||||||
}
|
}
|
||||||
@@ -420,4 +431,4 @@ class LinesPoliceCadBot extends Client {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {LinesPoliceCadBot};
|
module.exports = LinesPoliceCadBot;
|
||||||
@@ -3,12 +3,12 @@ const path = require("path");
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Register slash commands for a guild
|
* Register slash commands for a guild
|
||||||
* @param {require("../LPS")} client
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
* @param {string} guild
|
* @param {string} guild
|
||||||
*/
|
*/
|
||||||
module.exports = (client, guild) => {
|
module.exports = (client, guild) => {
|
||||||
|
|
||||||
let commandsDir = path.join(__dirname, "..", "commands");;
|
let commandsDir = path.join(__dirname, "..", "commands");
|
||||||
|
|
||||||
fs.readdir(commandsDir, (err, files) => {
|
fs.readdir(commandsDir, (err, files) => {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
|
|||||||
Reference in new issue
Block a user