Compare commits
No commits in common. "26e94e71b2112df637c46ccf4687e34322ffd1ae" and "b1ffd2d22bbd03099c85867ab11ce51990a786b3" have entirely different histories.
26e94e71b2
...
b1ffd2d22b
26
.github/workflows/docker-image.yml
vendored
Normal file
26
.github/workflows/docker-image.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
name: Docker Image CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "pe" ]
|
||||
pull_request:
|
||||
branches: [ "pe" ]
|
||||
|
||||
env:
|
||||
DHUB_UNAME: ${{ secrets.DHUB_UNAME }}
|
||||
DHUB_PWORD: ${{ secrets.DHUB_PWORD }}
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Build the Docker image
|
||||
run: docker build . --file Dockerfile --tag v0idf1sh/nodbot-pe
|
||||
- name: Log into Docker Hub
|
||||
run: docker login -u $DHUB_UNAME -p $DHUB_PWORD
|
||||
- name: Push image to Docker Hub
|
||||
run: docker push v0idf1sh/nodbot-pe
|
35
.github/workflows/pe-docker.yml
vendored
35
.github/workflows/pe-docker.yml
vendored
@ -1,35 +0,0 @@
|
||||
name: NodBot Production Dockerization
|
||||
|
||||
on:
|
||||
commit:
|
||||
branches:
|
||||
- pe
|
||||
|
||||
env:
|
||||
DHUB_UNAME: ${{ secrets.DHUB_UNAME }}
|
||||
DHUB_PWORD: ${{ secrets.DHUB_PWORD }}
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
|
||||
runs-on: self-hosted
|
||||
|
||||
steps:
|
||||
- name: Pull latest from Git
|
||||
run: |
|
||||
pwd
|
||||
whoami
|
||||
cd /root/nodbot
|
||||
git pull
|
||||
git checkout pe
|
||||
- name: Build the Docker image
|
||||
run: |
|
||||
cd /root/nodbot
|
||||
docker build . --file Dockerfile --tag v0idf1sh/nodbot-pe
|
||||
- name: Log into Docker Hub
|
||||
run: docker login -u $DHUB_UNAME -p $DHUB_PWORD
|
||||
- name: Push image to Docker Hub
|
||||
run: |
|
||||
cd /root/nodbot
|
||||
docker push v0idf1sh/nodbot-pe
|
35
.github/workflows/production-docker.yml
vendored
35
.github/workflows/production-docker.yml
vendored
@ -1,35 +0,0 @@
|
||||
name: NodBot Production Dockerization
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
DHUB_UNAME: ${{ secrets.DHUB_UNAME }}
|
||||
DHUB_PWORD: ${{ secrets.DHUB_PWORD }}
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
|
||||
runs-on: self-hosted
|
||||
|
||||
steps:
|
||||
- name: Pull latest from Git
|
||||
run: |
|
||||
pwd
|
||||
whoami
|
||||
cd /root/nodbot
|
||||
git pull
|
||||
git checkout $GITHUB_HEAD_REF
|
||||
- name: Build the Docker image
|
||||
run: |
|
||||
cd /root/nodbot
|
||||
docker build . --file Dockerfile --tag v0idf1sh/nodbot
|
||||
- name: Log into Docker Hub
|
||||
run: docker login -u $DHUB_UNAME -p $DHUB_PWORD
|
||||
- name: Push image to Docker Hub
|
||||
run: |
|
||||
cd /root/nodbot
|
||||
docker push v0idf1sh/nodbot
|
@ -5,4 +5,4 @@ WORKDIR /usr/src/app
|
||||
COPY package.json ./
|
||||
RUN npm install
|
||||
COPY . .
|
||||
CMD ["/bin/sh", "-c", "node main.js 2> /logs/nodbot.error 1> /logs/nodbot.log"]
|
||||
CMD [ "node", "main.js" ]
|
11
README.md
11
README.md
@ -98,14 +98,3 @@ ownerId=<your Discord user ID>
|
||||
statusChannelId=<Discord channel ID of channel used for status messages>
|
||||
clientId=<Discord user ID of your bot>
|
||||
```
|
||||
|
||||
## Changes
|
||||
|
||||
v3.0.1 - Migrate TenorJS API Endpoint
|
||||
v3.0.2 - Add medical advice commands
|
||||
v3.0.3 - Fix broken `/requests` command
|
||||
v3.0.4 - Add ability to use multiple aliases
|
||||
v3.0.5 - Add ability to save strains
|
||||
v3.0.6 - Move `.strain` to `/strain` and add Autocomplete
|
||||
v3.0.7 - Add `.spongebob` replies
|
||||
v3.0.8 - Add ability to open requests by pages
|
@ -1,16 +0,0 @@
|
||||
const fn = require('../functions.js');
|
||||
// const { emoji } = require('../strings.json');
|
||||
|
||||
module.exports = {
|
||||
name: 'md',
|
||||
description: 'Get some medical advice.',
|
||||
usage: '.md',
|
||||
execute(message, commandData) {
|
||||
let medicalAdviceArr = [];
|
||||
for (const entry of message.client.medicalAdviceColl.map(medicalAdvice => medicalAdvice.content)) {
|
||||
medicalAdviceArr.push(entry);
|
||||
}
|
||||
const randIndex = Math.floor(Math.random() * medicalAdviceArr.length);
|
||||
message.reply(`${medicalAdviceArr[randIndex]}`);
|
||||
}
|
||||
}
|
@ -10,21 +10,6 @@ module.exports = {
|
||||
// message.reply(fn.spongebob(commandData)).then(() => {
|
||||
// message.delete();
|
||||
// });
|
||||
if (message.reference != undefined) {
|
||||
const repliedMessageId = message.reference.messageId;
|
||||
message.channel.messages.fetch(repliedMessageId)
|
||||
.then(repliedMessage => {
|
||||
repliedMessage.reply(fn.spongebob({ args: repliedMessage.content })).then(() => {
|
||||
if (message.deletable) message.delete();
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
} else {
|
||||
message.channel.send(fn.spongebob(commandData)).then(() => {
|
||||
if (message.deletable) message.delete();
|
||||
});
|
||||
}
|
||||
message.channel.send(fn.spongebob(commandData));
|
||||
}
|
||||
}
|
34
functions.js
34
functions.js
@ -56,13 +56,10 @@ const functions = {
|
||||
setvalidCommands(client) {
|
||||
for (const entry of client.dotCommands.map(command => command)) {
|
||||
config.validCommands.push(entry.name);
|
||||
if (Array.isArray(entry.alias)) {
|
||||
entry.alias.forEach(element => {
|
||||
config.validCommands.push(element);
|
||||
});
|
||||
} else if (entry.alias != undefined) {
|
||||
if (entry.alias != undefined) {
|
||||
config.validCommands.push(entry.alias);
|
||||
}
|
||||
|
||||
}
|
||||
if (isDev) console.log(`Valid Commands Added to Config\n${config.validCommands}`);
|
||||
},
|
||||
@ -72,11 +69,7 @@ const functions = {
|
||||
for (const file of dotCommandFiles) {
|
||||
const dotCommand = require(`./dot-commands/${file}`);
|
||||
client.dotCommands.set(dotCommand.name, dotCommand);
|
||||
if (Array.isArray(dotCommand.alias)) {
|
||||
dotCommand.alias.forEach(element => {
|
||||
client.dotCommands.set(element, dotCommand);
|
||||
});
|
||||
} else if (dotCommand.alias != undefined) {
|
||||
if (dotCommand.alias != undefined) {
|
||||
client.dotCommands.set(dotCommand.alias, dotCommand);
|
||||
}
|
||||
}
|
||||
@ -146,19 +139,7 @@ const functions = {
|
||||
// if (isDev) console.log(strain)
|
||||
}
|
||||
if (isDev) console.log('Strains Collection Built');
|
||||
},
|
||||
medicalAdvice(rows, client) {
|
||||
if (!client.medicalAdviceCol) client.medicalAdviceColl = new Discord.Collection();
|
||||
client.medicalAdviceColl.clear();
|
||||
for (const row of rows) {
|
||||
const medicalAdvice = {
|
||||
id: row.id,
|
||||
content: row.content
|
||||
};
|
||||
client.medicalAdviceColl.set(medicalAdvice.id, medicalAdvice);
|
||||
}
|
||||
if (isDev) console.log('Medical Advice Collection Built');
|
||||
},
|
||||
},
|
||||
dot: {
|
||||
getCommandData(message) {
|
||||
@ -437,7 +418,7 @@ const functions = {
|
||||
},
|
||||
download: {
|
||||
requests(client) {
|
||||
const query = 'SELECT * FROM requests WHERE status = \'Active\' ORDER BY id DESC';
|
||||
const query = 'SELECT * FROM requests WHERE status = \'Active\' ORDER BY id ASC';
|
||||
db.query(query, (err, rows, fields) => {
|
||||
if (err) throw err;
|
||||
functions.collections.requests(rows, client);
|
||||
@ -489,13 +470,6 @@ const functions = {
|
||||
functions.collections.strains(rows, client);
|
||||
});
|
||||
},
|
||||
medicalAdvice(client) {
|
||||
const query = 'SELECT * FROM medical_advice ORDER BY id ASC';
|
||||
db.query(query, (err, rows, fields) => {
|
||||
if (err) throw err;
|
||||
functions.collections.medicalAdvice(rows, client);
|
||||
});
|
||||
}
|
||||
},
|
||||
weed: {
|
||||
strain: {
|
||||
|
19
main.js
19
main.js
@ -38,7 +38,6 @@ client.once('ready', () => {
|
||||
fn.download.joints(client);
|
||||
fn.download.requests(client);
|
||||
fn.download.strains(client);
|
||||
fn.download.medicalAdvice(client);
|
||||
console.log('Ready!');
|
||||
client.channels.fetch(statusChannelId).then(channel => {
|
||||
channel.send(`${new Date().toISOString()} -- <@${process.env.ownerId}>\nStartup Sequence Complete`);
|
||||
@ -173,19 +172,6 @@ client.on('interactionCreate', async interaction => {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle autocomplete requests
|
||||
if (interaction.isAutocomplete()) {
|
||||
if (interaction.commandName == 'strain') {
|
||||
const searchString = interaction.options.getFocused();
|
||||
const choices = fn.weed.strain.lookup(searchString, interaction.client);
|
||||
await interaction.respond(
|
||||
choices.map(choice => ({ name: choice, value: choice }))
|
||||
)
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// dot-commands
|
||||
@ -198,10 +184,7 @@ client.on('messageCreate', message => {
|
||||
const lowerContent = message.content.toLowerCase();
|
||||
if (lowerContent.includes('big') && lowerContent.includes('doinks')) message.reply('gang.');
|
||||
if (lowerContent.includes('ligma')) message.reply('ligma balls, goteem');
|
||||
if (lowerContent.includes('frfr') || lowerContent.includes('fr fr') || lowerContent.includes('bussin') || lowerContent.includes(' ong') || lowerContent.startsWith('ong')) {
|
||||
const randIndex = Math.floor(Math.random() * strings.capbacks.length);
|
||||
message.reply(strings.capbacks[randIndex]);
|
||||
}
|
||||
if (lowerContent.includes('frfr') || lowerContent.includes('fr fr') || lowerContent.includes('bussin') || lowerContent.includes(' ong') || lowerContent.startsWith('ong')) message.reply('ongggg no :billed_cap: fr fr str8 bussin');
|
||||
|
||||
// Break the message down into its components and analyze it
|
||||
const commandData = fn.dot.getCommandData(message);
|
||||
|
@ -1,14 +1,15 @@
|
||||
{
|
||||
"name": "nodbot",
|
||||
"version": "3.1.0",
|
||||
"version": "3.0.0",
|
||||
"description": "Nods and Nod Accessories.",
|
||||
"main": "main.js",
|
||||
"dependencies": {
|
||||
"@discordjs/builders": "^0.16.0",
|
||||
"@discordjs/builders": "^0.6.0",
|
||||
"@discordjs/rest": "^0.1.0-canary.0",
|
||||
"axios": "^0.21.4",
|
||||
"discord-api-types": "^0.22.0",
|
||||
"discord.js": "^13.15.1",
|
||||
"discord.js": "^13.1.0",
|
||||
"discord.js-selfbot-v13": "^2.9.15",
|
||||
"dotenv": "^10.0.0",
|
||||
"fuzzy-search": "^3.2.1",
|
||||
"mysql": "^2.18.1",
|
||||
|
@ -5,14 +5,8 @@ const fn = require('../functions.js');
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('requests')
|
||||
.setDescription('Get a list of Active requests from the database')
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName('page')
|
||||
.setDescription('Page Number')
|
||||
.setRequired(true)),
|
||||
.setDescription('Get a list of Active requests from the database'),
|
||||
async execute(interaction) {
|
||||
const pageNum = interaction.options.getString('page');
|
||||
const commandData = {
|
||||
author: interaction.user.tag,
|
||||
command: interaction.commandName,
|
||||
@ -25,15 +19,13 @@ module.exports = {
|
||||
request: e.request,
|
||||
};
|
||||
});
|
||||
for (let i = ( 10 * ( pageNum - 1 ) ); i < ( 10 * pageNum ); i++) {
|
||||
if (requestsMap[i] != undefined) {
|
||||
for (const row of requestsMap) {
|
||||
commandData.requests.push({
|
||||
id: requestsMap[i].id,
|
||||
author: requestsMap[i].author,
|
||||
request: requestsMap[i].request,
|
||||
id: row.id,
|
||||
author: row.author,
|
||||
request: row.request,
|
||||
});
|
||||
}
|
||||
}
|
||||
interaction.reply(fn.embeds.requests(commandData));
|
||||
},
|
||||
};
|
@ -1,17 +0,0 @@
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const fn = require('../functions.js');
|
||||
// const { emoji } = require('../strings.json');
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('savemd')
|
||||
.setDescription('Add medical advice to NodBot\'s Database!')
|
||||
.addStringOption(option =>
|
||||
option.setName('advice-content')
|
||||
.setDescription('What is the advice?')
|
||||
.setRequired(true)),
|
||||
async execute(interaction) {
|
||||
fn.upload.medicalAdvice(interaction.options.getString('advice-content'), interaction.client);
|
||||
interaction.reply({ content: `The advice has been saved!`, ephemeral: true });
|
||||
},
|
||||
};
|
@ -1,54 +0,0 @@
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const fn = require('../functions.js');
|
||||
const { emoji } = require('../strings.json');
|
||||
|
||||
// Strain Name | Type | Effects | Flavor | Rating | Description
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('savestrain')
|
||||
.setDescription('Store a new Strain in the database!')
|
||||
.addStringOption(option =>
|
||||
option.setName('name')
|
||||
.setDescription('Name of the Strain')
|
||||
.setRequired(true))
|
||||
.addStringOption(option =>
|
||||
option.setName('type')
|
||||
.setDescription('Indica/Sativa/Hybrid')
|
||||
.setRequired(true)
|
||||
.addChoices(
|
||||
{ name: "Indica", value: "Indica" },
|
||||
{ name: "Hybrid", value: "Hybrid" },
|
||||
{ name: "Sativa", value: "Sativa" }
|
||||
))
|
||||
.addStringOption(option =>
|
||||
option.setName('effects')
|
||||
.setDescription('The effects given by the strain')
|
||||
.setRequired(false))
|
||||
.addStringOption(option =>
|
||||
option.setName('flavor')
|
||||
.setDescription('Flavor notes')
|
||||
.setRequired(false))
|
||||
.addStringOption(option =>
|
||||
option.setName('rating')
|
||||
.setDescription('Number of stars')
|
||||
.setRequired(false))
|
||||
.addStringOption(option =>
|
||||
option.setName('description')
|
||||
.setDescription('Description of the strain')
|
||||
.setRequired(false)),
|
||||
async execute(interaction) {
|
||||
fn.upload.strain(interaction).then(res => {
|
||||
interaction.reply({
|
||||
content: `The strain information has been saved. (${interaction.options.getString('name')})`,
|
||||
ephemeral: true
|
||||
});
|
||||
}).catch(err => {
|
||||
console.log(`E: ${err}`);
|
||||
interaction.reply({
|
||||
content: 'There was a problem saving the strain.',
|
||||
ephemeral: true
|
||||
});
|
||||
});
|
||||
},
|
||||
};
|
@ -1,17 +0,0 @@
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const fn = require('../functions.js');
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('strain')
|
||||
.setDescription('Look up information about a cannabis strain.')
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName('name')
|
||||
.setDescription('Strain Name')
|
||||
.setRequired(true)
|
||||
.setAutocomplete(true)),
|
||||
async execute(interaction) {
|
||||
fn.download.strain(interaction.options.getString('name'), interaction);
|
||||
},
|
||||
};
|
@ -14,13 +14,5 @@
|
||||
"urls": {
|
||||
"avatar": "https://cdn.discordapp.com/avatars/513184762073055252/12227aa23a06d5178853e59b72c7487b.webp?size=128"
|
||||
},
|
||||
"capbacks": [
|
||||
"on god?!",
|
||||
"fr fr?!",
|
||||
"no cap?!",
|
||||
"no cap fr",
|
||||
"bussin fr, no cap",
|
||||
"ongggg no :billed_cap: fr fr"
|
||||
],
|
||||
"temp": {}
|
||||
}
|
Loading…
Reference in New Issue
Block a user