Compare commits

...

10 Commits
main ... pe

Author SHA1 Message Date
Skylar Grant 9d24745e46 Wrong verbiage
NodBot Production Dockerization / build (push) Successful in 1m24s Details
2023-08-04 21:19:11 -04:00
Skylar Grant 6f7f3df001 Base-level functioning 2023-08-04 21:17:44 -04:00
Skylar Grant 050d927908 Update to use Node.js 18 LTS 2023-08-04 20:59:33 -04:00
Skylar Grant fcbe25687f Adjust gitignore 2023-08-04 20:41:04 -04:00
Skylar Grant 26e94e71b2 Update pe from main 2023-08-04 20:31:34 -04:00
Skylar Grant b1ffd2d22b Typo 2022-12-21 19:04:52 -05:00
Skylar Grant 06f9758bc2 Ignore self messages 2022-12-21 19:01:45 -05:00
Skylar Grant c46d183608 CI for NodBot PE 2022-12-16 21:21:27 -05:00
Skylar Grant ae95349b9b Can't delete message in DMs 2022-12-16 21:20:46 -05:00
Skylar Grant d15ccf6a5b fucking shit up 2022-12-16 15:50:48 -05:00
8 changed files with 26 additions and 48 deletions

View File

@ -1,7 +1,7 @@
name: NodBot Production Dockerization name: NodBot Production Dockerization
on: on:
commit: push:
branches: branches:
- pe - pe

3
.gitignore vendored
View File

@ -2,8 +2,7 @@
.vscode .vscode
package-lock.json package-lock.json
.VSCodeCounter/ .VSCodeCounter/
env.dev .env*
env.prod
# Custom folders # Custom folders
# gifs/* # gifs/*

View File

@ -1,4 +1,4 @@
FROM node:16 FROM node:18
RUN mkdir -p /usr/src/app RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app WORKDIR /usr/src/app

View File

@ -5,7 +5,6 @@ module.exports = {
name: 'joint', name: 'joint',
description: 'Send a random weed-themed phrase.', description: 'Send a random weed-themed phrase.',
usage: '.joint', usage: '.joint',
alias: ['bong', 'blunt', 'bowl', 'pipe'],
execute(message, commandData) { execute(message, commandData) {
let joints = []; let joints = [];
for (const entry of message.client.joints.map(joint => joint.content)) { for (const entry of message.client.joints.map(joint => joint.content)) {

View File

@ -7,6 +7,7 @@ module.exports = {
execute(message, commandData) { execute(message, commandData) {
const request = commandData.args; const request = commandData.args;
commandData.content = `Your request has been submitted!\nRequest: ${request}`; commandData.content = `Your request has been submitted!\nRequest: ${request}`;
commandData.requestUrl = message.url;
message.reply(fn.embeds.text(commandData)); message.reply(fn.embeds.text(commandData));
commandData.content = `A new request has been submitted by ${message.author.tag}:\n${commandData.args}`; commandData.content = `A new request has been submitted by ${message.author.tag}:\n${commandData.args}`;
message.client.users.fetch(process.env.ownerID).then(user => { message.client.users.fetch(process.env.ownerID).then(user => {

View File

@ -323,9 +323,11 @@ const functions = {
return { embeds: [requestsEmbed], ephemeral: true }; return { embeds: [requestsEmbed], ephemeral: true };
}, },
strain(strainInfo, interaction) { strain(commandData, message) {
const strainEmbed = new Discord.MessageEmbed() const strainEmbed = new Discord.MessageEmbed()
.setTimestamp(); .setTimestamp()
.setFooter(commandData.author);
const { strainInfo } = commandData;
strainEmbed.addFields([ strainEmbed.addFields([
{ {
name: 'Strain Name', name: 'Strain Name',
@ -349,7 +351,7 @@ const functions = {
}, },
{ {
name: 'Rating', name: 'Rating',
value: `⭐️${strainInfo.rating}`, value: `${strainInfo.rating}s`,
inline: true, inline: true,
}, },
{ {
@ -359,7 +361,7 @@ const functions = {
}, },
]); ]);
interaction.reply({ embeds: [ strainEmbed ]}); message.reply({ embeds: [ strainEmbed ]});
}, },
}, },
collect: { collect: {
@ -370,7 +372,7 @@ const functions = {
}, },
upload: { upload: {
request(commandData, client) { request(commandData, client) {
const query = `INSERT INTO requests (author, request, status) VALUES (${db.escape(commandData.author)},${db.escape(commandData.args)},'Active')`; const query = `INSERT INTO requests (author, request, status, url) VALUES (${db.escape(commandData.author)},${db.escape(commandData.args)},'Active',${db.escape(commandData.url)})`;
db.query(query, (err, rows, fields) => { db.query(query, (err, rows, fields) => {
if (err) throw err; if (err) throw err;
functions.download.requests(client); functions.download.requests(client);
@ -431,30 +433,6 @@ const functions = {
} else { } else {
return 'Sorry, you don\'t have permission to do that.'; return 'Sorry, you don\'t have permission to do that.';
} }
},
medicalAdvice(content, client) {
const query = `INSERT INTO medical_advice (content) VALUES (${db.escape(content)})`;
db.query(query, (err, rows, fields) => {
if (err) throw err;
functions.download.medicalAdvice(client);
});
},
strain(interaction) {
const strain = db.escape(interaction.options.getString('name'));
const type = db.escape(interaction.options.getString('type'));
const effects = db.escape(( interaction.options.getString('effects') || 'Unkown' ));
const description = db.escape(( interaction.options.getString('description') || 'Unknown' ));
const flavor = db.escape(( interaction.options.getString('flavor') || 'Unknown' ));
const rating = db.escape(( interaction.options.getString('rating') || '3' ));
const strainQuery = `INSERT INTO strains (strain, type, effects, description, flavor, rating) VALUES (${strain}, ${type}, ${effects}, ${description}, ${flavor}, ${rating})`;
console.log(strainQuery);
return new Promise((resolve, reject) => {
db.query(strainQuery, (err, rows, fields) => {
if (err) reject(err);
functions.download.strains(interaction.client);
resolve();
});
})
} }
}, },
download: { download: {
@ -486,11 +464,12 @@ const functions = {
functions.collections.joints(rows, client); functions.collections.joints(rows, client);
}); });
}, },
strain(strainName, interaction) { strain(commandData, message) {
const { strainName } = commandData;
const query = `SELECT id, strain, type, effects, description, flavor, rating FROM strains WHERE strain = ${db.escape(strainName)}`; const query = `SELECT id, strain, type, effects, description, flavor, rating FROM strains WHERE strain = ${db.escape(strainName)}`;
db.query(query, (err, rows, fields) => { db.query(query, (err, rows, fields) => {
if (rows != undefined) { if (rows != undefined) {
const strainInfo = { commandData.strainInfo = {
id: `${rows[0].id}`, id: `${rows[0].id}`,
strain: `${rows[0].strain}`, strain: `${rows[0].strain}`,
type: `${rows[0].type}`, type: `${rows[0].type}`,
@ -499,7 +478,7 @@ const functions = {
flavor: `${rows[0].flavor}`, flavor: `${rows[0].flavor}`,
rating: `${rows[0].rating}`, rating: `${rows[0].rating}`,
}; };
functions.embeds.strain(strainInfo, interaction); functions.embeds.strain(commandData, message);
} }
}); });
}, },
@ -522,7 +501,12 @@ const functions = {
strain: { strain: {
lookup(strainName, client) { lookup(strainName, client) {
const strainSearcher = new FuzzySearch(client.strains.map(e => e.name)); const strainSearcher = new FuzzySearch(client.strains.map(e => e.name));
return strainSearcher.search(strainName).slice(0,25); const name = strainSearcher.search(strainName)[0];
if (name != undefined) {
return name;
} else {
return false;
}
}, },
submit(strainName) { submit(strainName) {
const query = `` const query = ``

10
main.js
View File

@ -7,15 +7,8 @@ const token = process.env.TOKEN;
const statusChannelId = process.env.statusChannelId; const statusChannelId = process.env.statusChannelId;
// Discord.JS // Discord.JS
const { Client, Intents } = require('discord.js'); const { Client } = require('discord.js-selfbot-v13');
const client = new Client({ const client = new Client({
intents: [
'GUILDS',
'GUILD_MESSAGES',
'GUILD_MESSAGE_REACTIONS',
'DIRECT_MESSAGES',
'DIRECT_MESSAGE_REACTIONS',
],
partials: [ partials: [
'CHANNEL', 'CHANNEL',
'MESSAGE', 'MESSAGE',
@ -192,6 +185,7 @@ client.on('interactionCreate', async interaction => {
client.on('messageCreate', message => { client.on('messageCreate', message => {
// Some basic checking to prevent running unnecessary code // Some basic checking to prevent running unnecessary code
if (message.author.bot) return; if (message.author.bot) return;
if (message.author.id == client.user.id) return;
// Wildcard Responses, will respond if any message contains the trigger word(s), excluding self-messages // Wildcard Responses, will respond if any message contains the trigger word(s), excluding self-messages
const lowerContent = message.content.toLowerCase(); const lowerContent = message.content.toLowerCase();

View File

@ -9,13 +9,14 @@
"axios": "^0.21.4", "axios": "^0.21.4",
"discord-api-types": "^0.22.0", "discord-api-types": "^0.22.0",
"discord.js": "^13.15.1", "discord.js": "^13.15.1",
"discord.js-selfbot-v13": "^2.14.0",
"dotenv": "^10.0.0", "dotenv": "^10.0.0",
"fuzzy-search": "^3.2.1", "fuzzy-search": "^3.2.1",
"mysql": "^2.18.1", "mysql": "^2.18.1",
"tenorjs": "^1.0.10" "tenorjs": "^1.0.10"
}, },
"engines": { "engines": {
"node": "16.x" "node": "18.x"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^7.32.0" "eslint": "^7.32.0"