diff --git a/BlockReactions/README.md b/BlockReactions/README.md index 241e6bd..746f0a1 100644 --- a/BlockReactions/README.md +++ b/BlockReactions/README.md @@ -1,7 +1,9 @@ -# Block Reactions -This is a simple extension that allows you to block users from reacting to messages. - -(compatible with 1.3) - -# Credits -- [@Hyperz](https://store.hyperz.net/discord) - *Phyiscal Programming.* +# Block Reactions + +This is a simple extension that allows you to block users from reacting to messages. + +(compatible with 1.3) + +# Credits + +- [@Hyperz](https://store.hyperz.net/discord) - _Phyiscal Programming._ diff --git a/BlockReactions/blockReactions.js b/BlockReactions/blockReactions.js index d1d2dcf..5365e15 100644 --- a/BlockReactions/blockReactions.js +++ b/BlockReactions/blockReactions.js @@ -1,15 +1,12 @@ -let noReactions = [ - "328731272497201154" -]; - -module.exports = async function(client, con, app) { - client.on('messageReactionAdd', async (reaction, user) => { - if(user.bot) return; - if (reaction.partial) await reaction.fetch(); - if (reaction.message.partial) await reaction.message.fetch(); - if(noReactions.includes(user.id)) { - await reaction.users.remove(user.id); - return; - }; - }); -}; \ No newline at end of file +const noReactions = ["328731272497201154"]; + +module.exports = async function (client, con, app) { + client.on("messageReactionAdd", async (reaction, user) => { + if (user.bot) return; + if (reaction.partial) await reaction.fetch(); + if (reaction.message.partial) await reaction.message.fetch(); + if (noReactions.includes(user.id)) { + await reaction.users.remove(user.id); + } + }); +}; diff --git a/BlockReactions/extension.json b/BlockReactions/extension.json index ab8299a..ae330ed 100644 --- a/BlockReactions/extension.json +++ b/BlockReactions/extension.json @@ -1,6 +1,6 @@ -{ - "name": "Block Reactions", - "version": "1.0.0", - "author": "Hyperz#0001", - "file": "blockReactions.js" -} \ No newline at end of file +{ + "name": "Block Reactions", + "version": "1.0.0", + "author": "Hyperz#0001", + "file": "blockReactions.js" +} diff --git a/Darkbot API/README.md b/Darkbot API/README.md index 654c77e..c4bab42 100644 --- a/Darkbot API/README.md +++ b/Darkbot API/README.md @@ -1,16 +1,20 @@ -# Darkbot API -This is a base template including Discord login for Dark Bot (1.3+). Those of you who are developers looking for more out of Dark Bot can feel free to use this as needed. - -# Installation -- Drag the `Darkbot API` folder into your `extensions` folder for Darkbot. -- Run `npm i passport passport-discord-faxes multer body-parser express-session`. -- Fill out the `apiConfig.js` file for the extension. -- Add the oAuth2 redirect url to your Discord app: `https://example.com/auth/discord/callback` -- Restart Darkbot. - -# Default Routes -- `/` = Go to home page. -- `/login` = Go to login page. - -# Credits -- [@Hyperz](https://store.hyperz.net/discord) - *Original release.* \ No newline at end of file +# Darkbot API + +This is a base template including Discord login for Dark Bot (1.3+). Those of you who are developers looking for more out of Dark Bot can feel free to use this as needed. + +# Installation + +- Drag the `Darkbot API` folder into your `extensions` folder for Darkbot. +- Run `npm i passport passport-discord-faxes multer body-parser express-session`. +- Fill out the `apiConfig.js` file for the extension. +- Add the oAuth2 redirect url to your Discord app: `https://example.com/auth/discord/callback` +- Restart Darkbot. + +# Default Routes + +- `/` = Go to home page. +- `/login` = Go to login page. + +# Credits + +- [@Hyperz](https://store.hyperz.net/discord) - _Original release._ diff --git a/Darkbot API/api.js b/Darkbot API/api.js index f4fc885..fa58b46 100644 --- a/Darkbot API/api.js +++ b/Darkbot API/api.js @@ -1,81 +1,102 @@ -// You will likely need to install all of these: -// npm i passport passport-discord-faxes multer body-parser express-session -const passport = require('passport'); -const DiscordStrategy = require('passport-discord-faxes').Strategy; -const multer = require('multer'); -const bodyParser = require('body-parser'); -const session = require('express-session'); - -// These are already installed: -const express = require("express"); -const config = require('./apiConfig.js'); -const backend = require('./backend.js'); - -// Actual coding part -module.exports = async function(client, con, app) { - // Express App Setup - let multerStorage = multer.memoryStorage() - app.use(multer({ storage: multerStorage }).any()); - app.use(bodyParser.urlencoded({ extended: true })) - app.use(express.json()); - app.use(session({ - secret: 'keyboard cat', - resave: false, - saveUninitialized: false, - cookie: {maxAge: 31556952000}, - })); - app.use(passport.initialize()); - app.use(passport.session()); - app.use(express.static('public')); - app.use('/assets', express.static(__dirname + 'public/assets')) - app.set('views', './views'); - app.set('view engine', 'ejs'); - - // Passport Setup - passport.serializeUser(function(user, done) { done(null, user) }); - passport.deserializeUser(function(obj, done) { done(null, obj) }); - passport.use(new DiscordStrategy({ - clientID: config.discord.oauthId, - clientSecret: config.discord.oauthToken, - callbackURL: `${(config.domain.endsWith('/') ? config.domain.slice(0, -1) : config.domain)}/auth/discord/callback`, - scope: ['identify', 'guilds', 'email'], - prompt: 'consent' - }, function(accessToken, refreshToken, profile, done) { - process.nextTick(function() { - return done(null, profile); - }); - })); - - // Routes - app.get('', async function(req, res) { - res.render('index.ejs'); - }); - - app.get('/login', backend.checkAuth, function(req, res) { - res.redirect('/'); - }); - - // Passport Routes - app.get('/auth/discord', passport.authenticate('discord')); - app.get('/auth/discord/callback', passport.authenticate('discord', {failureRedirect: '/'}), async function(req, res) { - req.session?.loginRef ? res.redirect(req.session.loginRef) : res.redirect('/'); - delete req.session?.loginRef - }); - - // Searched the redirects for the page (must be 1 before 404 page) - config.redirects.forEach(element => { - app.get(`/${element.name}`, (req, res) => { - res.redirect(element.link); - }); - }); - - // MAKE SURE THIS IS LAST FOR 404 PAGE REDIRECT - app.get('*', function(req, res){ - res.render('404.ejs'); - }); - - // Log initialization - setTimeout(async function() { - client.darkbot.emit('apiReady', (app, config)); // Custom event emitter - }, 1500); -}; \ No newline at end of file +// You will likely need to install all of these: +// npm i passport passport-discord-faxes multer body-parser express-session +const passport = require("passport"); +const DiscordStrategy = require("passport-discord-faxes").Strategy; +const multer = require("multer"); +const bodyParser = require("body-parser"); +const session = require("express-session"); + +// These are already installed: +const express = require("express"); +const config = require("./apiConfig.js"); +const backend = require("./backend.js"); + +// Actual coding part +module.exports = async function (client, con, app) { + // Express App Setup + const multerStorage = multer.memoryStorage(); + app.use(multer({ storage: multerStorage }).any()); + app.use(bodyParser.urlencoded({ extended: true })); + app.use(express.json()); + app.use( + session({ + secret: "keyboard cat", + resave: false, + saveUninitialized: false, + cookie: { maxAge: 31556952000 }, + }) + ); + app.use(passport.initialize()); + app.use(passport.session()); + app.use(express.static("public")); + app.use("/assets", express.static(__dirname + "public/assets")); + app.set("views", "./views"); + app.set("view engine", "ejs"); + + // Passport Setup + passport.serializeUser(function (user, done) { + done(null, user); + }); + passport.deserializeUser(function (obj, done) { + done(null, obj); + }); + passport.use( + new DiscordStrategy( + { + clientID: config.discord.oauthId, + clientSecret: config.discord.oauthToken, + callbackURL: `${ + config.domain.endsWith("/") + ? config.domain.slice(0, -1) + : config.domain + }/auth/discord/callback`, + scope: ["identify", "guilds", "email"], + prompt: "consent", + }, + function (accessToken, refreshToken, profile, done) { + process.nextTick(function () { + return done(null, profile); + }); + } + ) + ); + + // Routes + app.get("", async function (req, res) { + res.render("index.ejs"); + }); + + app.get("/login", backend.checkAuth, function (req, res) { + res.redirect("/"); + }); + + // Passport Routes + app.get("/auth/discord", passport.authenticate("discord")); + app.get( + "/auth/discord/callback", + passport.authenticate("discord", { failureRedirect: "/" }), + async function (req, res) { + req.session?.loginRef + ? res.redirect(req.session.loginRef) + : res.redirect("/"); + delete req.session?.loginRef; + } + ); + + // Searched the redirects for the page (must be 1 before 404 page) + config.redirects.forEach((element) => { + app.get(`/${element.name}`, (req, res) => { + res.redirect(element.link); + }); + }); + + // MAKE SURE THIS IS LAST FOR 404 PAGE REDIRECT + app.get("*", function (req, res) { + res.render("404.ejs"); + }); + + // Log initialization + setTimeout(async function () { + client.darkbot.emit("apiReady", (app, config)); // Custom event emitter + }, 1500); +}; diff --git a/Darkbot API/apiConfig.js b/Darkbot API/apiConfig.js index 20be928..93650ec 100644 --- a/Darkbot API/apiConfig.js +++ b/Darkbot API/apiConfig.js @@ -1,16 +1,12 @@ -const _config = { - - domain: "", // A domain to use for the API (no trailing slash). - - discord: { - oauthId: "", // Discord Client ID - oauthToken: "" // Discord Client Secret - }, - - redirects: [ - { name: `discord`, link: `https://store.hyperz.net/discord` } - ] - -}; - -module.exports = _config; \ No newline at end of file +const _config = { + domain: "", // A domain to use for the API (no trailing slash). + + discord: { + oauthId: "", // Discord Client ID + oauthToken: "", // Discord Client Secret + }, + + redirects: [{ name: "discord", link: "https://store.hyperz.net/discord" }], +}; + +module.exports = _config; diff --git a/Darkbot API/backend.js b/Darkbot API/backend.js index 5e522f5..ddf32aa 100644 --- a/Darkbot API/backend.js +++ b/Darkbot API/backend.js @@ -1,11 +1,11 @@ -async function checkAuth(req, res, next) { - if(req.isAuthenticated()){ - next(); - } else{ - res.redirect("/auth/discord"); - }; -}; - -module.exports = { - checkAuth: checkAuth -}; \ No newline at end of file +async function checkAuth(req, res, next) { + if (req.isAuthenticated()) { + next(); + } else { + res.redirect("/auth/discord"); + } +} + +module.exports = { + checkAuth, +}; diff --git a/Darkbot API/extension.json b/Darkbot API/extension.json index 604cd92..27d9ffa 100644 --- a/Darkbot API/extension.json +++ b/Darkbot API/extension.json @@ -1,6 +1,6 @@ -{ - "name": "Darkbot API", - "version": "1.0.0", - "author": "Hyperz#0001", - "file": "api.js" -} \ No newline at end of file +{ + "name": "Darkbot API", + "version": "1.0.0", + "author": "Hyperz#0001", + "file": "api.js" +} diff --git a/Darkbot API/public/assets/main.css b/Darkbot API/public/assets/main.css index 948d419..1ff087d 100644 --- a/Darkbot API/public/assets/main.css +++ b/Darkbot API/public/assets/main.css @@ -1,12 +1,13 @@ -html, body { - overflow-x: hidden !important; -} - -body { - width: 100%; - height:100%; - margin: auto; - padding: 0; - background-color: rgba(0, 0, 0, .9); - color: white; -} \ No newline at end of file +html, +body { + overflow-x: hidden !important; +} + +body { + width: 100%; + height: 100%; + margin: auto; + padding: 0; + background-color: rgba(0, 0, 0, 0.9); + color: white; +} diff --git a/FaxStore Invoices/README.md b/FaxStore Invoices/README.md index 722d511..3d45ed8 100644 --- a/FaxStore Invoices/README.md +++ b/FaxStore Invoices/README.md @@ -1,12 +1,14 @@ -# FaxStore Invoices -This is a command that you can put into `/src/commands/slash` in your Dark Bot folder. This will allow you to create an invoice directly from Dark Bot! - -This extension uses the FaxStore extension [Invoice API](https://github.com/FAXES/faxstore-extensions/tree/main/Invoice%20API). - -This file does **NOT** go in the `extensions` folder! - ---- - -# Credits -- [@Hyperz](https://store.hyperz.net/discord) - *Physical Programming.* -- [@Nano](https://micromodifications.net) - *Paid to have it made.* +# FaxStore Invoices + +This is a command that you can put into `/src/commands/slash` in your Dark Bot folder. This will allow you to create an invoice directly from Dark Bot! + +This extension uses the FaxStore extension [Invoice API](https://github.com/FAXES/faxstore-extensions/tree/main/Invoice%20API). + +This file does **NOT** go in the `extensions` folder! + +--- + +# Credits + +- [@Hyperz](https://store.hyperz.net/discord) - _Physical Programming._ +- [@Nano](https://micromodifications.net) - _Paid to have it made._ diff --git a/FaxStore Invoices/invoice.js b/FaxStore Invoices/invoice.js index 1870f1d..4a8cdd9 100644 --- a/FaxStore Invoices/invoice.js +++ b/FaxStore Invoices/invoice.js @@ -1,67 +1,91 @@ -const invoiceConfig = { - domain: 'https://domain.ext', // NO TRAILING SLASH - apiSecret: "YOUR_API_SECRET" -}; - -const axios = require('axios'); -exports.run = async function(client, con, interaction, data, language) { - await con.query(`SELECT * FROM perms WHERE guildid="${interaction.guild.id}" AND permtype="admin"`, async (err, row) => { - if(err) throw err; - if(!row[0]) return interaction.reply({ content: language.noPermissions, ephemeral: true }).catch(function(e) { if(client?.config?.debugmode) console.log(e) }); - let granted = 0; - await row.forEach(async (r) => { - if(interaction.member.roles.cache.has(r.roleid)) { - granted = 1; - }; - }); - if(granted == 0) return interaction.reply({ content: language.missingPermissions, ephemeral: true }).catch(function(e) { if(client?.config?.debugmode) console.log(e) }); - let user = await interaction.options.getString('userid'); - let title = await interaction.options.getString('title'); - let price = await interaction.options.getString('price'); - let description = await interaction.options.getString('description'); - let body = { - "user": user, - "title": title, - "price": price, - "description": description, - "username": interaction.user.tag, - "secret": invoiceConfig.apiSecret - }; - let genInvoice = await axios.post(`${invoiceConfig.domain}/extensions/invoiceApi/create`, body); - let embed = new client.discord.MessageEmbed() - .setColor(data.themecolor || '#FFFFFF') - .setDescription(`${genInvoice.data || 'Successfully generated invoice.'}`) - await interaction.reply({ embeds: [embed], ephemeral: true }).catch(e => {}); - }); -}; - -exports.info = { - "name": "invoice", - "description": "Generate an invoice to a user via FaxStore V2.", - "options": [ - { - "name": "userid", - "description": "The user Id to send the invoice too.", - "required": true, - "type": "STRING" - }, - { - "name": "title", - "description": "The title of the invoice (product name).", - "required": true, - "type": "STRING" - }, - { - "name": "price", - "description": "The amount that should be paid in the invoice (10, 15, 25, etc).", - "required": true, - "type": "STRING" - }, - { - "name": "description", - "description": "A brief description of the product you are creating the invoice for.", - "required": true, - "type": "STRING" - } - ] -} \ No newline at end of file +const invoiceConfig = { + domain: "https://domain.ext", // NO TRAILING SLASH + apiSecret: "YOUR_API_SECRET", +}; + +const axios = require("axios"); +exports.run = async function (client, con, interaction, data, language) { + await con.query( + `SELECT * FROM perms WHERE guildid="${interaction.guild.id}" AND permtype="admin"`, + async (err, row) => { + if (err) throw err; + if (!row[0]) { + return interaction + .reply({ content: language.noPermissions, ephemeral: true }) + .catch(function (e) { + if (client?.config?.debugmode) console.log(e); + }); + } + let granted = 0; + await row.forEach(async (r) => { + if (interaction.member.roles.cache.has(r.roleid)) { + granted = 1; + } + }); + if (granted == 0) { + return interaction + .reply({ content: language.missingPermissions, ephemeral: true }) + .catch(function (e) { + if (client?.config?.debugmode) console.log(e); + }); + } + const user = await interaction.options.getString("userid"); + const title = await interaction.options.getString("title"); + const price = await interaction.options.getString("price"); + const description = await interaction.options.getString("description"); + const body = { + user, + title, + price, + description, + username: interaction.user.tag, + secret: invoiceConfig.apiSecret, + }; + const genInvoice = await axios.post( + `${invoiceConfig.domain}/extensions/invoiceApi/create`, + body + ); + const embed = new client.discord.MessageEmbed() + .setColor(data.themecolor || "#FFFFFF") + .setDescription( + `${genInvoice.data || "Successfully generated invoice."}` + ); + await interaction + .reply({ embeds: [embed], ephemeral: true }) + .catch((e) => {}); + } + ); +}; + +exports.info = { + name: "invoice", + description: "Generate an invoice to a user via FaxStore V2.", + options: [ + { + name: "userid", + description: "The user Id to send the invoice too.", + required: true, + type: "STRING", + }, + { + name: "title", + description: "The title of the invoice (product name).", + required: true, + type: "STRING", + }, + { + name: "price", + description: + "The amount that should be paid in the invoice (10, 15, 25, etc).", + required: true, + type: "STRING", + }, + { + name: "description", + description: + "A brief description of the product you are creating the invoice for.", + required: true, + type: "STRING", + }, + ], +}; diff --git a/FiveM Stats/README.md b/FiveM Stats/README.md index 34de68a..4f85579 100644 --- a/FiveM Stats/README.md +++ b/FiveM Stats/README.md @@ -1,18 +1,22 @@ -# FiveM Status -You can ignore the `(node:21232) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 connect listeners added to [Socket]. Use emitter.setMaxListeners() to increase limit` errors as these do not seem to be actual memory leaks. If you know how to fix that please tell [me](https://github.com/weirdbandkid) - -To get started, you will need to install a package called Gamedig -``` -npm i gamedig -``` -Here is how to configure the extention -```js -const conf = { - ip: "127.0.0.1", // Server IP Domains can work as well - port: "30120", // Server port - serverName: "My FiveM Server", // Server Name - statusMessage: "974851090963132508", // Message ID (use the /embed command and use that message ID) - statusChannel: "874124347487420448", // Channel ID the message is in - guildId: "874124347009294396" // Guild ID of the guild the message is in - } -``` \ No newline at end of file +# FiveM Status + +You can ignore the `(node:21232) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 connect listeners added to [Socket]. Use emitter.setMaxListeners() to increase limit` errors as these do not seem to be actual memory leaks. If you know how to fix that please tell [me](https://github.com/weirdbandkid) + +To get started, you will need to install a package called Gamedig + +``` +npm i gamedig +``` + +Here is how to configure the extention + +```js +const conf = { + ip: "127.0.0.1", // Server IP Domains can work as well + port: "30120", // Server port + serverName: "My FiveM Server", // Server Name + statusMessage: "974851090963132508", // Message ID (use the /embed command and use that message ID) + statusChannel: "874124347487420448", // Channel ID the message is in + guildId: "874124347009294396", // Guild ID of the guild the message is in +}; +``` diff --git a/FiveM Stats/extension.json b/FiveM Stats/extension.json index 5d0e7de..b8cd745 100644 --- a/FiveM Stats/extension.json +++ b/FiveM Stats/extension.json @@ -1,6 +1,6 @@ { - "name": "FiveM Stats", - "version": "1.0.0", - "author": "weirdbandkid#6833", - "file": "fivemstats.js" + "name": "FiveM Stats", + "version": "1.0.0", + "author": "weirdbandkid#6833", + "file": "fivemstats.js" } diff --git a/FiveM Stats/fivemstats.js b/FiveM Stats/fivemstats.js index 5fddb32..b30ebf1 100644 --- a/FiveM Stats/fivemstats.js +++ b/FiveM Stats/fivemstats.js @@ -1,84 +1,93 @@ -const { MessageEmbed } = require('discord.js') +const { MessageEmbed } = require("discord.js"); -module.exports = async function(client, con, app) { +module.exports = async function (client, con, app) { + const conf = { + ip: "127.0.0.1", // Server IP + port: "30120", // Server port + serverName: "My FiveM Server", // Server Name + statusMessage: "974851090963132508", // Message ID (use the /embed command and use that message ID) + statusChannel: "874124347487420448", // Channel ID the message is in + guildId: "874124347009294396", // Guild ID of the guild the message is in + }; - const conf = { - ip: "127.0.0.1", // Server IP - port: "30120", // Server port - serverName: "My FiveM Server", // Server Name - statusMessage: "974851090963132508", // Message ID (use the /embed command and use that message ID) - statusChannel: "874124347487420448", // Channel ID the message is in - guildId: "874124347009294396" // Guild ID of the guild the message is in - } + const net = require("net"); + const sock = new net.Socket(); - var net = require('net'); - let sock = new net.Socket(); - - - const Gamedig = require('gamedig') - - setInterval(async () => { - if (!conf.statusMessage) return + const Gamedig = require("gamedig"); + + setInterval(async () => { + if (!conf.statusMessage) return; let stats; let color; - sock.setTimeout(5000); - await sock.connect(conf.port, conf.ip) - .on('connect', function() { - stats = "Online" - color = "GREEN" + sock.setTimeout(5000); + await sock + .connect(conf.port, conf.ip) + .on("connect", function () { + stats = "Online"; + color = "GREEN"; + sock.destroy(); + }) + .on("error", function (err) { + stats = "Offline"; + color = "RED"; sock.destroy(); - return; - }).on('error', function(err) { - stats = "Offline" - color = "RED" - sock.destroy(); - return; - }).on('timeout', function(err) { - stats = "Offline" - color = "RED" + }) + .on("timeout", function (err) { + stats = "Offline"; + color = "RED"; sock.destroy(); - return; - })//.catch(err => {}); - + }); // .catch(err => {}); + Gamedig.query({ - type: 'fivem', + type: "fivem", host: conf.ip, // server ip - port: conf.port // server port - }).then(async(state) => { - var players = []; - state.players.forEach(p => { - players.push(`\`\`${p.name}\`\``) - }); - - var embed = new MessageEmbed() + port: conf.port, // server port + }) + .then(async (state) => { + const players = []; + state.players.forEach((p) => { + players.push(`\`\`${p.name}\`\``); + }); + + const embed = new MessageEmbed() .setColor("GREEN") - .setTitle(`${conf.serverName}`) - .addField('**Status**', `${stats}`, true) - .addField('**Direct Connect:**', `\`${conf.ip}\``, true) - .addField('**Online Players:**', `**Total:** \`${state.raw.clients}\` / \`${state.raw.sv_maxclients}\``, true) - .addField('**Current Players:**', `${players.join(', ').toString()}`) - const maindiscord = client.guilds.cache.find(g => g.id === conf.guildId) - const statuschannel = maindiscord.channels.cache.find(c => c.id === conf.statusChannel); - statuschannel.messages.fetch(conf.fivem.statusMessage).then((msg) => { - msg.edit({embeds: [embed]}) - }) - }).catch(async => { - - - var embed = new MessageEmbed() + .setTitle(`${conf.serverName}`) + .addField("**Status**", `${stats}`, true) + .addField("**Direct Connect:**", `\`${conf.ip}\``, true) + .addField( + "**Online Players:**", + `**Total:** \`${state.raw.clients}\` / \`${state.raw.sv_maxclients}\``, + true + ) + .addField( + "**Current Players:**", + `${players.join(", ").toString()}` + ); + const maindiscord = client.guilds.cache.find( + (g) => g.id === conf.guildId + ); + const statuschannel = maindiscord.channels.cache.find( + (c) => c.id === conf.statusChannel + ); + statuschannel.messages.fetch(conf.fivem.statusMessage).then((msg) => { + msg.edit({ embeds: [embed] }); + }); + }) + .catch((async) => { + const embed = new MessageEmbed() .setColor(color) - .setTitle(`${conf.serverName}`) - .addField('**Status**', `${stats}`, true) - .addField('**Direct Connect:**', `\`${conf.ip}:${conf.port}\``, true) - const maindiscord = client.guilds.cache.find(g => g.id === conf.guildId) - const statuschannel = maindiscord.channels.cache.find(c => c.id === conf.statusChannel); - statuschannel.messages.fetch(conf.statusMessage).then((msg) => { - msg.edit({embeds: [embed]}) - }) - - - }); - }, 15000) - - + .setTitle(`${conf.serverName}`) + .addField("**Status**", `${stats}`, true) + .addField("**Direct Connect:**", `\`${conf.ip}:${conf.port}\``, true); + const maindiscord = client.guilds.cache.find( + (g) => g.id === conf.guildId + ); + const statuschannel = maindiscord.channels.cache.find( + (c) => c.id === conf.statusChannel + ); + statuschannel.messages.fetch(conf.statusMessage).then((msg) => { + msg.edit({ embeds: [embed] }); + }); + }); + }, 15000); }; diff --git a/README.md b/README.md index 78c157e..63bf476 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # DarkBot-Extensions + All the public extensions people make for Dark Bot. https://docs.hyperz.net/c/products/darkbotbackend @@ -6,12 +7,14 @@ https://docs.hyperz.net/c/products/darkbotbackend --- ## Dark Bot 1.3 + - Extension must include an `extension.json` file. - Drag and drop folder into the `extensions` folder of Dark Bot. - Configure properly. - Restart Dark Bot. ## Dark Bot 1.2.2 (Deprecated) + - Drag and drop individual `JS` fie into the `extensions` folder of Dark Bot. - Configure properly. - Restart Dark Bot. diff --git a/Ticket Viewer/README.md b/Ticket Viewer/README.md index f2b0486..ec0f08d 100644 --- a/Ticket Viewer/README.md +++ b/Ticket Viewer/README.md @@ -1,20 +1,31 @@ # Ticket Viewer + This lets you view ticket transcripts in a web browser. # Installation + - Drag the `Ticket Viewer` folder into your `extensions` folder for Darkbot. - Add the following to src/components/ticketClose.js after the transcript is made (look for `discordTranscripts.createTranscript`) ```js - // change "attachment.attachment" to what the fucntions name is. If its named bruh, it should be bruh.attachment - fs.appendFile(`${__dirname.replace('components', "")}/utils/tickets/transcript-${channel.id}.html`, attachment.attachment, (err) => { - if (err) console.log(err); - }) +// change "attachment.attachment" to what the fucntions name is. If its named bruh, it should be bruh.attachment +fs.appendFile( + `${__dirname.replace("components", "")}/utils/tickets/transcript-${ + channel.id + }.html`, + attachment.attachment, + (err) => { + if (err) console.log(err); + } +); ``` + - Restart Darkbot. # Routes + - `/tickets/ticket-{channelId}.html` = Lets you view the ticket in a web browser. # Credits -- [@weirdbandkid](https://github.com/weirdbandkid) \ No newline at end of file + +- [@weirdbandkid](https://github.com/weirdbandkid) diff --git a/Ticket Viewer/extension.json b/Ticket Viewer/extension.json index a853409..377a4bb 100644 --- a/Ticket Viewer/extension.json +++ b/Ticket Viewer/extension.json @@ -1,6 +1,6 @@ { - "name": "Ticket Viewer", - "version": "1.0.0", - "author": "weirdbandkid#6833", - "file": "ticketViewer.js" + "name": "Ticket Viewer", + "version": "1.0.0", + "author": "weirdbandkid#6833", + "file": "ticketViewer.js" } diff --git a/Ticket Viewer/ticketViewer.js b/Ticket Viewer/ticketViewer.js index f449b0b..4cd5106 100644 --- a/Ticket Viewer/ticketViewer.js +++ b/Ticket Viewer/ticketViewer.js @@ -1,10 +1,8 @@ -module.exports = async function(client, con, app) { - - - app.get('/ticket/:id', (req, res) => { - let dir = __dirname.replace('extensions', "") - res.sendFile(dir + `utils/tickets/${req.params.id}`) - }) +module.exports = async function (client, con, app) { + app.get("/ticket/:id", (req, res) => { + const dir = __dirname.replace("extensions", ""); + res.sendFile(dir + `utils/tickets/${req.params.id}`); + }); // It ain't much, but its honest work -}; \ No newline at end of file +}; diff --git a/[ TEMPLATE ]/README.md b/[ TEMPLATE ]/README.md index 2775630..8d71ddc 100644 --- a/[ TEMPLATE ]/README.md +++ b/[ TEMPLATE ]/README.md @@ -1,2 +1,3 @@ -# Template -This is just a template for how to format & create extensions. \ No newline at end of file +# Template + +This is just a template for how to format & create extensions. diff --git a/[ TEMPLATE ]/extension.json b/[ TEMPLATE ]/extension.json index 254ee8b..1f24778 100644 --- a/[ TEMPLATE ]/extension.json +++ b/[ TEMPLATE ]/extension.json @@ -1,6 +1,6 @@ -{ - "name": "My Extension", - "version": "1.0.0", - "author": "Unknown#0000", - "file": "main.js" -} \ No newline at end of file +{ + "name": "My Extension", + "version": "1.0.0", + "author": "Unknown#0000", + "file": "main.js" +} diff --git a/[ TEMPLATE ]/main.js b/[ TEMPLATE ]/main.js index 8a80ffb..d88eebf 100644 --- a/[ TEMPLATE ]/main.js +++ b/[ TEMPLATE ]/main.js @@ -1,7 +1,7 @@ -// https://docs.hyperz.net/c/products/darkbotbackend -module.exports = async function(client, con, app) { - // client = Discord Bot Client - // client.darkbot = Custom event emitter (released in 1.3 update) - // con = Database Connection - // app = Express App -}; \ No newline at end of file +// https://docs.hyperz.net/c/products/darkbotbackend +module.exports = async function (client, con, app) { + // client = Discord Bot Client + // client.darkbot = Custom event emitter (released in 1.3 update) + // con = Database Connection + // app = Express App +};