Compare commits
No commits in common. "main" and "v3.3.0-metars" have entirely different histories.
main
...
v3.3.0-met
@ -1,46 +0,0 @@
|
||||
name: NodBot PE Dockerization
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*-dev*'
|
||||
|
||||
env:
|
||||
DHUB_UNAME: ${{ secrets.DHUB_UNAME }}
|
||||
DHUB_PWORD: ${{ secrets.DHUB_PWORD }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Pull latest from Git
|
||||
run: |
|
||||
echo "Branch: tags/${{ gitea.ref_name }}"
|
||||
pwd
|
||||
whoami
|
||||
mkdir -p /var/lib/act_runner/
|
||||
cd /var/lib/act_runner/
|
||||
if [ ! -d "nodbot" ]; then
|
||||
git clone https://git.vfsh.dev/voidf1sh/nodbot
|
||||
cd nodbot
|
||||
else
|
||||
cd nodbot
|
||||
git checkout main
|
||||
git pull
|
||||
fi
|
||||
git checkout tags/${{ gitea.ref_name }}
|
||||
- name: Build the Docker image
|
||||
run: |
|
||||
cd /var/lib/act_runner/nodbot
|
||||
docker build . --file Dockerfile --tag v0idf1sh/nodbot-dev
|
||||
- name: Log into Docker Hub
|
||||
run: docker login -u $DHUB_UNAME -p $DHUB_PWORD
|
||||
- name: Push image to Docker Hub
|
||||
run: |
|
||||
cd /var/lib/act_runner/nodbot
|
||||
docker push v0idf1sh/nodbot-dev
|
||||
- name: Restart the container
|
||||
run: |
|
||||
cd /srv/docker/nodbot-dev
|
||||
docker-compose down
|
||||
docker-compose up -d
|
@ -2,8 +2,8 @@ name: NodBot PE Dockerization
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*-pe'
|
||||
branches:
|
||||
- pe
|
||||
|
||||
env:
|
||||
DHUB_UNAME: ${{ secrets.DHUB_UNAME }}
|
||||
@ -15,7 +15,7 @@ jobs:
|
||||
steps:
|
||||
- name: Pull latest from Git
|
||||
run: |
|
||||
echo "Branch: ${{ gitea.ref_name }}"
|
||||
echo "Branch: ${{ gitea.head_ref }}"
|
||||
pwd
|
||||
whoami
|
||||
mkdir -p /var/lib/act_runner/
|
||||
@ -27,7 +27,7 @@ jobs:
|
||||
cd nodbot
|
||||
git pull
|
||||
fi
|
||||
git checkout ${{ gitea.ref_name }}
|
||||
git checkout ${{ gitea.head_ref }}
|
||||
- name: Build the Docker image
|
||||
run: |
|
||||
cd /var/lib/act_runner/nodbot
|
||||
|
@ -1,9 +1,9 @@
|
||||
name: NodBot Production Dockerization
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*-prod*'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
DHUB_UNAME: ${{ secrets.DHUB_UNAME }}
|
||||
@ -15,7 +15,7 @@ jobs:
|
||||
steps:
|
||||
- name: Pull latest from Git
|
||||
run: |
|
||||
echo "Branch: tags/${{ gitea.ref_name }}"
|
||||
echo "Branch: ${{ gitea.head_ref }}"
|
||||
pwd
|
||||
whoami
|
||||
mkdir -p /var/lib/act_runner/
|
||||
@ -27,7 +27,7 @@ jobs:
|
||||
cd nodbot
|
||||
git pull
|
||||
fi
|
||||
git checkout tags/${{ gitea.ref_name }}
|
||||
git checkout ${{ gitea.head_ref }}
|
||||
- name: Build the Docker image
|
||||
run: |
|
||||
cd /var/lib/act_runner/nodbot
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,7 +3,6 @@
|
||||
package-lock.json
|
||||
.VSCodeCounter/
|
||||
.env*
|
||||
*.env
|
||||
|
||||
# Custom folders
|
||||
# gifs/*
|
||||
|
29
CHANGELOG.md
29
CHANGELOG.md
@ -1,29 +0,0 @@
|
||||
## v3.4.x
|
||||
#### v3.4.0 (#25)
|
||||
* Added nested commands, enclose a command in brackets, braces, or parenthesis inside a longer message: `You really don't get it do you? [that's the joke.gif] You're so dense` would return the results for just `that's the joke.gif`
|
||||
* Improved the `/save gifsearch` interface and the code behind the scenes
|
||||
|
||||
## v3.3.x
|
||||
#### v3.3.3 (#20)
|
||||
* Fixed content-list slash commands `/gifs`, `/pastas`, `/joints`, `/requests` (#19)
|
||||
* Fixed the creation of duplicate commands properly (#18)
|
||||
* Added a ton of aliases for `.gif` (`.wav`, `.mp3`, `.mp4`, `.wmv`, etc.)
|
||||
* Added alias lists in `/help`
|
||||
|
||||
#### v3.3.2 (#17)
|
||||
* Fixed the `/help` command to not crash the bot (#15)
|
||||
* Filtered out duplicate commands from the `/help` list, temporary fix (#18)
|
||||
* Removed instances of `MessageEmbed.addField` due to deprecation (#16)
|
||||
|
||||
v3.3.1 - Polishing and bugfixing for new AvWx commands
|
||||
v3.3.0 - Added `.metar`, `.atis`, and `.datis` AvWx commands
|
||||
|
||||
## v3.0.x
|
||||
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,211 +0,0 @@
|
||||
const customEmbeds = require('../CustomModules/Embeds.js');
|
||||
const InteractionStorage = require('../CustomModules/InteractionStorage.js');
|
||||
const indexer = require('../CustomModules/Indexer.js');
|
||||
const fn = require('../functions.js');
|
||||
const { GifData } = require('./NodBot.js');
|
||||
|
||||
module.exports = {
|
||||
baseEvent(interaction) {
|
||||
let iStorage;
|
||||
if (interaction.client.iStorage.has(interaction.message.interaction.id)) {
|
||||
iStorage = interaction.client.iStorage.get(interaction.message.interaction.id)
|
||||
} else {
|
||||
iStorage = new InteractionStorage(interaction.message.interaction.id, interaction);
|
||||
iStorage.page = 0;
|
||||
}
|
||||
if (interaction.user.id !== iStorage.userId) return;
|
||||
switch (interaction.component.customId) {
|
||||
// Any of the gifsPage Buttons
|
||||
case 'prevGifsPage':
|
||||
module.exports.gifsPage(interaction);
|
||||
break;
|
||||
case 'nextGifsPage':
|
||||
module.exports.gifsPage(interaction);
|
||||
break;
|
||||
case 'prevPastasPage':
|
||||
module.exports.pastasPage(interaction);
|
||||
break;
|
||||
case 'nextPastasPage':
|
||||
module.exports.pastasPage(interaction);
|
||||
break;
|
||||
case 'prevRequestsPage':
|
||||
module.exports.requestsPage(interaction);
|
||||
break;
|
||||
case 'nextRequestsPage':
|
||||
module.exports.requestsPage(interaction);
|
||||
break;
|
||||
case 'prevJointsPage':
|
||||
module.exports.jointsPage(interaction);
|
||||
break;
|
||||
case 'nextJointsPage':
|
||||
module.exports.jointsPage(interaction);
|
||||
break;
|
||||
case 'prevGif':
|
||||
module.exports.gifSearchPage(interaction);
|
||||
break;
|
||||
case 'nextGif':
|
||||
module.exports.gifSearchPage(interaction);
|
||||
break;
|
||||
case 'confirmGif':
|
||||
module.exports.gifSearchPage(interaction);
|
||||
break;
|
||||
case 'cancelGif':
|
||||
module.exports.gifSearchPage(interaction);
|
||||
break;
|
||||
case 'closeRequests':
|
||||
module.exports.closeRequests(interaction);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
},
|
||||
gifsPage(interaction) {
|
||||
const iStorage = interaction.client.iStorage.get(interaction.message.interaction.id);
|
||||
|
||||
switch (interaction.component.customId) {
|
||||
case 'prevGifsPage':
|
||||
if (iStorage.page > 0) {
|
||||
iStorage.page = iStorage.page - 1;
|
||||
}
|
||||
break;
|
||||
case 'nextGifsPage':
|
||||
if (iStorage.page < interaction.client.gifs.size / 10) {
|
||||
iStorage.page = iStorage.page + 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
const indexedGifs = indexer(interaction.client.gifs, iStorage.page);
|
||||
indexedGifs.gifsString = new String();
|
||||
|
||||
for (const gif of indexedGifs.thisPage) {
|
||||
indexedGifs.gifsString += `[${gif.name}.gif](${gif.url})\n`;
|
||||
}
|
||||
|
||||
interaction.update(fn.embeds.gifs({command: "/gifs", author: interaction.user.username}, indexedGifs));
|
||||
},
|
||||
pastasPage(interaction) {
|
||||
const iStorage = interaction.client.iStorage.get(interaction.message.interaction.id);
|
||||
|
||||
switch (interaction.component.customId) {
|
||||
case 'prevPastasPage':
|
||||
if (iStorage.page > 0) {
|
||||
iStorage.page = iStorage.page - 1;
|
||||
}
|
||||
break;
|
||||
case 'nextPastasPage':
|
||||
if (iStorage.page < interaction.client.pastas.size / 10) {
|
||||
iStorage.page = iStorage.page + 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
const indexedPastas = indexer(interaction.client.pastas, iStorage.page);
|
||||
indexedPastas.pastasString = new String();
|
||||
|
||||
for (const pasta of indexedPastas.thisPage) {
|
||||
indexedPastas.pastasString += `${pasta.name}.pasta\n`;
|
||||
}
|
||||
|
||||
interaction.update(fn.embeds.pastas({command: "/pastas", author: interaction.user.username}, indexedPastas));
|
||||
},
|
||||
requestsPage(interaction) {
|
||||
const iStorage = interaction.client.iStorage.get(interaction.message.interaction.id);
|
||||
|
||||
switch (interaction.component.customId) {
|
||||
case 'prevRequestsPage':
|
||||
if (iStorage.page > 0) {
|
||||
iStorage.page = iStorage.page - 1;
|
||||
}
|
||||
break;
|
||||
case 'nextRequestsPage':
|
||||
if (iStorage.page < interaction.client.requests.size / 10) {
|
||||
iStorage.page = iStorage.page + 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
const indexedRequests = indexer(interaction.client.requests, iStorage.page);
|
||||
indexedRequests.requestsString = new String();
|
||||
|
||||
for (const request of indexedRequests.thisPage) {
|
||||
indexedRequests.requestsString += `[${request.id}]: ${request.request} (submitted by ${request.author})\n`;
|
||||
}
|
||||
|
||||
interaction.update(fn.embeds.requests({command: "/requests", author: interaction.user.username}, indexedRequests));
|
||||
},
|
||||
jointsPage(interaction) {
|
||||
const iStorage = interaction.client.iStorage.get(interaction.message.interaction.id);
|
||||
|
||||
switch (interaction.component.customId) {
|
||||
case 'prevJointsPage':
|
||||
if (iStorage.page > 0) {
|
||||
iStorage.page = iStorage.page - 1;
|
||||
}
|
||||
break;
|
||||
case 'nextJointsPage':
|
||||
if (iStorage.page < interaction.client.joints.size / 10) {
|
||||
iStorage.page = iStorage.page + 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
const indexedJoints = indexer(interaction.client.joints, iStorage.page);
|
||||
indexedJoints.jointsString = new String();
|
||||
|
||||
for (const joint of indexedJoints.thisPage) {
|
||||
indexedJoints.jointsString += `${joint.content}\n`;
|
||||
}
|
||||
|
||||
interaction.update(fn.embeds.joints({command: "/joints", author: interaction.user.username}, indexedJoints));
|
||||
},
|
||||
gifSearchPage(interaction) {
|
||||
const iStorage = interaction.client.iStorage.get(interaction.message.interaction.id);
|
||||
|
||||
switch (interaction.component.customId) {
|
||||
case 'prevGif':
|
||||
if (iStorage.page > 0) {
|
||||
iStorage.page = iStorage.page - 1;
|
||||
}
|
||||
break;
|
||||
case 'nextGif':
|
||||
if (iStorage.page < interaction.client.gifs.size / 10) {
|
||||
iStorage.page = iStorage.page + 1;
|
||||
}
|
||||
break;
|
||||
case 'confirmGif':
|
||||
const gif = indexer(iStorage.gifsCollection, iStorage.page, 1).thisPage[0];
|
||||
const gifData = new GifData().setInfo(iStorage.gifName, gif.media_formats.gif.url, gif.id);
|
||||
fn.upload.gif(gifData, interaction.client);
|
||||
interaction.update({ content: `I've saved the GIF as ${gifData.name}.gif`, components: [] });
|
||||
fn.download.gifs(interaction.client);
|
||||
return;
|
||||
break;
|
||||
case 'cancelGif':
|
||||
interaction.update({ content: 'The GIF has been discarded.', components: [], embeds: [] });
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// Generate the action row
|
||||
const gifSearchAR = customEmbeds.actionRows.gifSearchAR(iStorage.state);
|
||||
// Update the index
|
||||
const indexedGifs = indexer(iStorage.gifsCollection, iStorage.page, 1);
|
||||
indexedGifs.query = iStorage.query;
|
||||
indexedGifs.gifName = iStorage.gifName;
|
||||
// Generate the embed
|
||||
const gifEmbed = customEmbeds.core.gifSearch({ author: interaction.user.username }, indexedGifs);
|
||||
// Update the interaction
|
||||
interaction.update({ embeds: [gifEmbed], components: [gifSearchAR], ephemeral: true });
|
||||
},
|
||||
closeRequests(interaction) {
|
||||
const closeRequestModal = customEmbeds.modals.closeRequestsModal();
|
||||
interaction.showModal(closeRequestModal);
|
||||
interaction.update({ content: 'The requests menu has been closed.', components: [] });
|
||||
}
|
||||
}
|
@ -1,179 +0,0 @@
|
||||
const { MessageActionRow, MessageButton, MessageEmbed, TextInputComponent } = require('discord.js');
|
||||
|
||||
module.exports = {
|
||||
actionRows: {
|
||||
gifSearchAR(state) {
|
||||
// Setup the buttons
|
||||
const previousButton = new MessageButton()
|
||||
.setCustomId('prevGif')
|
||||
.setLabel('⬅️')
|
||||
.setStyle('SECONDARY');
|
||||
|
||||
const confirmButton = new MessageButton()
|
||||
.setCustomId('confirmGif')
|
||||
.setLabel('Select')
|
||||
.setStyle('PRIMARY');
|
||||
|
||||
const nextButton = new MessageButton()
|
||||
.setCustomId('nextGif')
|
||||
.setLabel('➡️')
|
||||
.setStyle('SECONDARY');
|
||||
|
||||
const cancelButton = new MessageButton()
|
||||
.setCustomId('cancelGif')
|
||||
.setLabel('Cancel')
|
||||
.setStyle('DANGER');
|
||||
|
||||
switch (state) {
|
||||
case 'first':
|
||||
previousButton.setDisabled(true);
|
||||
break;
|
||||
case 'last':
|
||||
nextButton.setDisabled(true);
|
||||
break;
|
||||
}
|
||||
|
||||
// Put the buttons into an ActionRow
|
||||
return new MessageActionRow()
|
||||
.addComponents(previousButton, confirmButton, nextButton, cancelButton);
|
||||
},
|
||||
gifsPageAR(state) {
|
||||
// Setup the buttons
|
||||
const previousButton = new MessageButton()
|
||||
.setCustomId('prevGifsPage')
|
||||
.setLabel('⬅️')
|
||||
.setStyle('SECONDARY');
|
||||
|
||||
const nextButton = new MessageButton()
|
||||
.setCustomId('nextGifsPage')
|
||||
.setLabel('➡️')
|
||||
.setStyle('SECONDARY');
|
||||
|
||||
switch (state) {
|
||||
case 'first':
|
||||
previousButton.setDisabled(true);
|
||||
break;
|
||||
case 'last':
|
||||
nextButton.setDisabled(true);
|
||||
break;
|
||||
}
|
||||
|
||||
// Put the buttons into an ActionRow
|
||||
return new MessageActionRow()
|
||||
.addComponents(previousButton, nextButton);
|
||||
},
|
||||
requestsPageAR(state) {
|
||||
// Setup the buttons
|
||||
const previousButton = new MessageButton()
|
||||
.setCustomId('prevRequestsPage')
|
||||
.setLabel('⬅️')
|
||||
.setStyle('SECONDARY');
|
||||
|
||||
const nextButton = new MessageButton()
|
||||
.setCustomId('nextRequestsPage')
|
||||
.setLabel('➡️')
|
||||
.setStyle('SECONDARY');
|
||||
|
||||
const closeButton = new MessageButton()
|
||||
.setCustomId('closeRequests')
|
||||
.setLabel('Close Requests')
|
||||
.setStyle('DANGER');
|
||||
|
||||
switch (state) {
|
||||
case 'first':
|
||||
previousButton.setDisabled(true);
|
||||
break;
|
||||
case 'last':
|
||||
nextButton.setDisabled(true);
|
||||
break;
|
||||
}
|
||||
|
||||
// Put the buttons into an ActionRow
|
||||
return new MessageActionRow()
|
||||
.addComponents(previousButton, nextButton);
|
||||
},
|
||||
pastasPageAR(state) {
|
||||
// Setup the buttons
|
||||
const previousButton = new MessageButton()
|
||||
.setCustomId('prevPastasPage')
|
||||
.setLabel('⬅️')
|
||||
.setStyle('SECONDARY');
|
||||
|
||||
const nextButton = new MessageButton()
|
||||
.setCustomId('nextPastasPage')
|
||||
.setLabel('➡️')
|
||||
.setStyle('SECONDARY');
|
||||
|
||||
switch (state) {
|
||||
case 'first':
|
||||
previousButton.setDisabled(true);
|
||||
break;
|
||||
case 'last':
|
||||
nextButton.setDisabled(true);
|
||||
break;
|
||||
}
|
||||
|
||||
// Put the buttons into an ActionRow
|
||||
return new MessageActionRow()
|
||||
.addComponents(previousButton, nextButton);
|
||||
},
|
||||
jointsPageAR(state) {
|
||||
// Setup the buttons
|
||||
const previousButton = new MessageButton()
|
||||
.setCustomId('prevJointsPage')
|
||||
.setLabel('⬅️')
|
||||
.setStyle('SECONDARY');
|
||||
|
||||
const nextButton = new MessageButton()
|
||||
.setCustomId('nextJointsPage')
|
||||
.setLabel('➡️')
|
||||
.setStyle('SECONDARY');
|
||||
|
||||
switch (state) {
|
||||
case 'first':
|
||||
previousButton.setDisabled(true);
|
||||
break;
|
||||
case 'last':
|
||||
nextButton.setDisabled(true);
|
||||
break;
|
||||
}
|
||||
|
||||
// Put the buttons into an ActionRow
|
||||
return new MessageActionRow()
|
||||
.addComponents(previousButton, nextButton);
|
||||
}
|
||||
},
|
||||
modals: {
|
||||
closeRequestsModal() {
|
||||
const requestNumberInput = new TextInputComponent()
|
||||
.setCustomId('requestNumber')
|
||||
.setLabel('Request Number')
|
||||
.setPlaceholder('420')
|
||||
.setMinLength(1)
|
||||
.setMaxLength(5)
|
||||
.setStyle('SHORT')
|
||||
.setRequired(true);
|
||||
|
||||
const actionRow = new MessageActionRow()
|
||||
.addComponents([requestNumberInput]);
|
||||
|
||||
return new Modal()
|
||||
.setTitle('Close Request')
|
||||
.setDescription('Please enter the number of the request you would like to close.')
|
||||
.addComponents([actionRow]);
|
||||
}
|
||||
},
|
||||
core: {
|
||||
gifSearch(commandData, indexedGifs) {
|
||||
return new MessageEmbed()
|
||||
.setColor('#0099ff')
|
||||
.setTitle('GIF Search')
|
||||
.setImage(indexedGifs.thisPage[0].media_formats.gif.url)
|
||||
.setFooter({ text: `Page ${indexedGifs.pagesString}` })
|
||||
.addFields(
|
||||
{ name: 'Query', value: `"${indexedGifs.query}"`, inline: true },
|
||||
{ name: 'Saving As', value: `${indexedGifs.gifName}.gif`, inline: true },
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
module.exports = (collection, page, qty) => {
|
||||
const itemsPerPage = qty ? qty : 10;
|
||||
const index = page * itemsPerPage;
|
||||
const totalPages = Math.ceil(collection.size / itemsPerPage);
|
||||
let state = page === 0 ? 'first' : 'middle';
|
||||
|
||||
const thisPage = new Array();
|
||||
|
||||
// Map the Djs Collection to an Array
|
||||
const collectionArray = collection.map((command) => command);
|
||||
|
||||
for (let i = index; i < index + itemsPerPage; i++) {
|
||||
if (collectionArray[i]) {
|
||||
thisPage.push(collectionArray[i]);
|
||||
} else {
|
||||
state = 'last';
|
||||
break;
|
||||
}
|
||||
|
||||
if (i === collectionArray.size - 1) {
|
||||
state = 'last';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
state: state,
|
||||
thisPage: thisPage,
|
||||
totalPages: totalPages,
|
||||
pagesString: `${page + 1}/${totalPages}`
|
||||
};
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
module.exports = class InteractionStorage {
|
||||
constructor(idString, interaction) {
|
||||
this.idString = idString;
|
||||
this.userId = interaction.user.id;
|
||||
|
||||
// Store in the client
|
||||
interaction.client.iStorage.set(idString, this);
|
||||
|
||||
// Delete this from the interactionStorage after 5 minutes
|
||||
setTimeout(() => {
|
||||
console.log(`Deleting interactionStorage with id: ${idString}`);
|
||||
interaction.client.iStorage.delete(idString);
|
||||
}, 300000);
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
@ -1,131 +1,4 @@
|
||||
module.exports = {
|
||||
CommandData: class {
|
||||
constructor(message) {
|
||||
// Get the location of the final period in the message
|
||||
this.finalPeriod = message.content.lastIndexOf('.');
|
||||
this.isCommand = this.finalPeriod >= 0 ? true : false; // Check if there is a period somewhere in the message to flag as a possible command
|
||||
this.isValid = false;
|
||||
this.args = message.content.slice(0,this.finalPeriod).toLowerCase(); // Grab everything leading up to the final period
|
||||
this.command = message.content.slice(this.finalPeriod + 1).toLowerCase(); // Grab everything after the final period
|
||||
this.author = message.author.username;
|
||||
this.message = message;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
validate(dotCommands) {
|
||||
if (this.args.startsWith('http')) return false;
|
||||
if (this.args.startsWith('www')) return false;
|
||||
|
||||
const indices = {
|
||||
curlyBrace: {
|
||||
start: -1,
|
||||
end: -1
|
||||
},
|
||||
bracket: {
|
||||
start: -1,
|
||||
end: -1
|
||||
},
|
||||
parenthesis: {
|
||||
start: -1,
|
||||
end: -1
|
||||
}
|
||||
}
|
||||
|
||||
// Check for and extract the part of the message that's
|
||||
// wrapped in any type of brackets or quotes eg. ([{``''""}])
|
||||
const curlyBraceStart = this.message.content.match(/[\{]/g);
|
||||
const curlyBraceEnd = this.message.content.match(/[\}]/g);
|
||||
if (curlyBraceStart && curlyBraceEnd) {
|
||||
indices.curlyBrace.start = this.message.content.indexOf(curlyBraceStart[0]) + 1;
|
||||
indices.curlyBrace.end = this.message.content.lastIndexOf(curlyBraceEnd[0]);
|
||||
}
|
||||
|
||||
const bracketStart = this.message.content.match(/[\[]/g);
|
||||
const bracketEnd = this.message.content.match(/[\]]/g);
|
||||
if (bracketStart && bracketEnd) {
|
||||
indices.bracket.start = this.message.content.indexOf(bracketStart[0]) + 1;
|
||||
indices.bracket.end = this.message.content.lastIndexOf(bracketEnd[0]);
|
||||
}
|
||||
|
||||
const parenthesisStart = this.message.content.match(/[\(]/g);
|
||||
const parenthesisEnd = this.message.content.match(/[\)]/g);
|
||||
if (parenthesisStart && parenthesisEnd) {
|
||||
indices.parenthesis.start = this.message.content.indexOf(parenthesisStart[0]) + 1;
|
||||
indices.parenthesis.end = this.message.content.lastIndexOf(parenthesisEnd[0]);
|
||||
}
|
||||
|
||||
let nestedText = new String();
|
||||
|
||||
if (indices.curlyBrace.start >= 0 && indices.curlyBrace.end > 0) {
|
||||
nestedText = this.message.content.slice(indices.curlyBrace.start, indices.curlyBrace.end);
|
||||
}
|
||||
|
||||
if (indices.bracket.start >= 0 && indices.bracket.end > 0) {
|
||||
nestedText = this.message.content.slice(indices.bracket.start, indices.bracket.end);
|
||||
}
|
||||
|
||||
if (indices.parenthesis.start >= 0 && indices.parenthesis.end > 0) {
|
||||
nestedText = this.message.content.slice(indices.parenthesis.start, indices.parenthesis.end);
|
||||
}
|
||||
|
||||
console.log(nestedText);
|
||||
|
||||
if (nestedText !== "") {
|
||||
this.nestedCommand = {
|
||||
finalPeriod: nestedText.lastIndexOf('.'),
|
||||
isCommand: nestedText.lastIndexOf('.') >= 0 ? true : false,
|
||||
args: nestedText.slice(0, nestedText.lastIndexOf('.')).toLowerCase(),
|
||||
command: nestedText.slice(nestedText.lastIndexOf('.') + 1).toLowerCase()
|
||||
}
|
||||
|
||||
for (const [key, value] of dotCommands) {
|
||||
if (key === this.nestedCommand.command) {
|
||||
this.isValid = true;
|
||||
this.args = this.nestedCommand.args;
|
||||
this.command = key;
|
||||
this.isCommand = this.nestedCommand.isCommand;
|
||||
this.finalPeriod = this.nestedCommand.finalPeriod;
|
||||
return this;
|
||||
} else if (value.alias) {
|
||||
if (typeof value.alias === 'string' && value.alias === this.nestedCommand.command) {
|
||||
this.command = key
|
||||
this.args = this.nestedCommand.args;
|
||||
this.isValid = true;
|
||||
this.isCommand = this.nestedCommand.isCommand;
|
||||
this.finalPeriod = this.nestedCommand.finalPeriod;
|
||||
return this;
|
||||
} else if (typeof value.alias === 'object' && value.alias.includes(this.nestedCommand.command)) {
|
||||
this.command = key
|
||||
this.args = this.nestedCommand.args;
|
||||
this.isValid = true;
|
||||
this.isCommand = this.nestedCommand.isCommand;
|
||||
this.finalPeriod = this.nestedCommand.finalPeriod;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const [key, value] of dotCommands) {
|
||||
if (key === this.command) {
|
||||
this.isValid = true;
|
||||
return this;
|
||||
} else if (value.alias) {
|
||||
if (typeof value.alias === 'string' && value.alias === this.command) {
|
||||
this.command = key;
|
||||
this.isValid = true;
|
||||
return this;
|
||||
} else if (typeof value.alias === 'object' && value.alias.includes(this.command)) {
|
||||
this.command = key;
|
||||
this.isValid = true;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
},
|
||||
GifData: class {
|
||||
constructor() {
|
||||
this.id = 0;
|
||||
|
33
README.md
33
README.md
@ -1,6 +1,9 @@
|
||||
# About Nodbot
|
||||
Nodbot is a content saving and serving Discord bot. Nodbot is able to search Tenor for GIFs, save custom copypastas, and look up marijuana strain information. Nodbot is in semi-active development by voidf1sh. It's buggy as hell and very shoddily built. Don't use it.
|
||||
|
||||
# Status
|
||||
This should be ready to merge into `main`, let it run a couple days with testing before creating a PR. METAR and D-ATIS are implemented. TAFs will come later as they're more complicated.
|
||||
|
||||
# Nodbot Help
|
||||
|
||||
Use the `/help` command to see the bot's help message.
|
||||
@ -11,6 +14,16 @@ Use the `/help` command to see the bot's help message.
|
||||
## Push Docker Image
|
||||
`docker push name/nodbot`
|
||||
|
||||
# Immediate To-Do
|
||||
|
||||
1. ~~Sanitize inputs for SQL queries.~~
|
||||
2. ~~Move environment variables so they don't get included in the image.~~
|
||||
3. Implement error handling on all actions.
|
||||
4. ~~Ephemeral responses to some/most slash commands.~~
|
||||
5. Comment the code! Document!
|
||||
6. Check for and create database tables if necessary. Handle errors.
|
||||
7. Readjust keyword autoresponses to be more generic instead of hard coded
|
||||
|
||||
# Deploy NodBot Yourself
|
||||
|
||||
1. Create an application at the [Discord Developer Portal](https://discord.com/developers/applications)
|
||||
@ -22,6 +35,13 @@ Use the `/help` command to see the bot's help message.
|
||||
6. Configure your environment variables as outlined below.
|
||||
7. Fire it up with `node main.js`
|
||||
|
||||
# Recent Changes
|
||||
|
||||
* Added METAR via AviationWeather.gov API
|
||||
* Added D-ATIS via datis.clowd.io API
|
||||
* Updated how keyword autoresponses are handled
|
||||
* Changed `.joint` to reduce duplication and repetition by implementing an Ashtray and Roaches
|
||||
|
||||
## Table Structure
|
||||
|
||||
```
|
||||
@ -88,4 +108,15 @@ tenorAPIKey=<Tenor API Key>
|
||||
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
|
14
Roadmap.md
Normal file
14
Roadmap.md
Normal file
@ -0,0 +1,14 @@
|
||||
# v3.1.0
|
||||
|
||||
* Name checking for saving content
|
||||
* .jpg, .wav
|
||||
* Audio/Video attachments for saved content.
|
||||
* Pass The Joint
|
||||
* Voting system for Super Adventure Club
|
||||
|
||||
# v4.0.0
|
||||
* Scalability: modify the code to allow the bot to be used in multiple servers
|
||||
* including saved content, saved commands, preferences, etc.
|
||||
|
||||
# v3.?.?
|
||||
= Joke generator for Hallihan
|
@ -9,7 +9,6 @@ const dotenv = require('dotenv').config();
|
||||
module.exports = {
|
||||
name: 'gif',
|
||||
description: 'Send a GIF',
|
||||
alias: ['jpg', 'png', 'gifv', 'webm', 'mp4', 'wav', 'wmv', 'webp', 'mp3', 'flac', 'ogg', 'avi', 'mov', 'mpg', 'mpeg', 'mkv', 'flv', 'bmp', 'tiff', 'tif', 'svg', 'ico'],
|
||||
usage: '<GIF name or Search Query>.gif',
|
||||
async execute(message, commandData) {
|
||||
// if (message.deletable) message.delete();
|
||||
|
@ -10,10 +10,6 @@ module.exports = {
|
||||
// Also checks for validity of ICAOs
|
||||
const icaoList = fn.avWx.parseICAOs(commandData);
|
||||
const metarData = await fn.avWx.metar.getData(icaoList);
|
||||
if (metarData.length === 0) {
|
||||
message.reply('No METAR data found for the provided ICAOs.');
|
||||
return;
|
||||
}
|
||||
const messages = fn.avWx.metar.parseData(metarData);
|
||||
messages.forEach(messagePayload => {
|
||||
message.reply(messagePayload);
|
||||
|
230
functions.js
230
functions.js
@ -1,6 +1,7 @@
|
||||
/* eslint-disable comma-dangle */
|
||||
// dotenv for handling environment variables
|
||||
const dotenv = require('dotenv').config();
|
||||
const dotenv = require('dotenv');
|
||||
dotenv.config();
|
||||
// Assignment of environment variables for database access
|
||||
const dbHost = process.env.dbHost;
|
||||
const dbUser = process.env.dbUser;
|
||||
@ -8,6 +9,7 @@ const dbName = process.env.dbName;
|
||||
const dbPass = process.env.dbPass;
|
||||
const dbPort = process.env.dbPort;
|
||||
const isDev = process.env.isDev;
|
||||
|
||||
const ownerId = process.env.ownerId;
|
||||
|
||||
// filesystem
|
||||
@ -20,6 +22,10 @@ const Discord = require('discord.js');
|
||||
// Fuzzy text matching for db lookups
|
||||
const FuzzySearch = require('fuzzy-search');
|
||||
|
||||
// OpenAI
|
||||
// const OpenAI = require("openai");
|
||||
// const openai = new OpenAI();
|
||||
|
||||
// Axios for APIs
|
||||
const axios = require('axios');
|
||||
|
||||
@ -28,7 +34,6 @@ const config = require('./config.json');
|
||||
const strings = require('./strings.json');
|
||||
const slashCommandFiles = fs.readdirSync('./slash-commands/').filter(file => file.endsWith('.js'));
|
||||
const dotCommandFiles = fs.readdirSync('./dot-commands/').filter(file => file.endsWith('.js'));
|
||||
const customEmbeds = require('./CustomModules/Embeds.js');
|
||||
|
||||
// MySQL database connection
|
||||
const mysql = require('mysql');
|
||||
@ -45,11 +50,6 @@ const db = new mysql.createPool({
|
||||
const functions = {
|
||||
// Functions for managing and creating Collections
|
||||
collections: {
|
||||
interactionStorage(client) {
|
||||
if (!client.iStorage) client.iStorage = new Discord.Collection();
|
||||
client.iStorage.clear();
|
||||
if (isDev) console.log('Interaction Storage Collection Built');
|
||||
},
|
||||
// Create the collection of slash commands
|
||||
slashCommands(client) {
|
||||
if (!client.slashCommands) client.slashCommands = new Discord.Collection();
|
||||
@ -81,13 +81,13 @@ 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) {
|
||||
// client.dotCommands.set(dotCommand.alias, dotCommand);
|
||||
// }
|
||||
if (Array.isArray(dotCommand.alias)) {
|
||||
dotCommand.alias.forEach(element => {
|
||||
client.dotCommands.set(element, dotCommand);
|
||||
});
|
||||
} else if (dotCommand.alias != undefined) {
|
||||
client.dotCommands.set(dotCommand.alias, dotCommand);
|
||||
}
|
||||
}
|
||||
if (isDev) console.log('Dot Commands Collection Built');
|
||||
},
|
||||
@ -170,79 +170,91 @@ const functions = {
|
||||
if (isDev) console.log('Medical Advice Collection Built');
|
||||
}
|
||||
},
|
||||
dot: {
|
||||
getCommandData(message) {
|
||||
const commandData = {};
|
||||
// Split the message content at the final instance of a period
|
||||
const finalPeriod = message.content.lastIndexOf('.');
|
||||
// if(isDev) console.log(message.content);
|
||||
// If the final period is the last character, or doesn't exist
|
||||
if (finalPeriod < 0) {
|
||||
if (isDev) console.log(finalPeriod);
|
||||
commandData.isCommand = false;
|
||||
return commandData;
|
||||
}
|
||||
commandData.isCommand = true;
|
||||
// Get the first part of the message, everything leading up to the final period
|
||||
commandData.args = message.content.slice(0,finalPeriod).toLowerCase();
|
||||
// Get the last part of the message, everything after the final period
|
||||
commandData.command = message.content.slice(finalPeriod + 1).toLowerCase();
|
||||
commandData.author = `${message.author.username}`;
|
||||
return this.checkCommand(commandData);
|
||||
},
|
||||
checkCommand(commandData) {
|
||||
if (commandData.isCommand) {
|
||||
const validCommands = require('./config.json').validCommands;
|
||||
commandData.isValid = validCommands.includes(commandData.command);
|
||||
// Add exceptions for messages that contain only a link
|
||||
if (commandData.args.startsWith('http')) commandData.isValid = false;
|
||||
}
|
||||
else {
|
||||
commandData.isValid = false;
|
||||
console.error('Somehow a non-command made it to checkCommands()');
|
||||
}
|
||||
return commandData;
|
||||
}
|
||||
},
|
||||
embeds: {
|
||||
help(interaction) {
|
||||
// Construct the Help Embed
|
||||
const helpEmbed = new Discord.MessageEmbed()
|
||||
.setColor('BLUE')
|
||||
.setAuthor({name: 'Help Page'})
|
||||
.setDescription(strings.help.description)
|
||||
.setThumbnail(strings.urls.avatar);
|
||||
|
||||
// Construct the Slash Commands help
|
||||
|
||||
let slashCommandsFields = [];
|
||||
let slashSeenNames = new Array();
|
||||
|
||||
const slashCommandsMap = interaction.client.slashCommands.map(e => {
|
||||
if (!slashSeenNames.includes(e.data.name)) {
|
||||
slashSeenNames.push(e.data.name);
|
||||
const command = {
|
||||
name: e.data.name,
|
||||
description: e.data.description
|
||||
};
|
||||
return command;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
return {
|
||||
name: e.data.name,
|
||||
description: e.data.description
|
||||
};
|
||||
})
|
||||
|
||||
for (const e of slashCommandsMap) {
|
||||
slashCommandsFields.push(`- \`/${e.name}\` - ${e.description}`);
|
||||
slashCommandsFields.push({
|
||||
name: `- /${e.name}`,
|
||||
value: e.description,
|
||||
inline: false,
|
||||
});
|
||||
}
|
||||
console.log(slashCommandsFields);
|
||||
|
||||
// Construct the Dot Commands Help
|
||||
let dotCommandsFields = new Array();
|
||||
let dotSeenNames = new Array();
|
||||
let dotCommandsFields = [];
|
||||
|
||||
const dotCommandsMap = interaction.client.dotCommands.map(e => {
|
||||
if (!dotSeenNames.includes(e.name)) {
|
||||
dotSeenNames.push(e.name);
|
||||
let command = {
|
||||
name: e.name,
|
||||
description: e.description,
|
||||
usage: e.usage
|
||||
};
|
||||
command.aliasString = new String();
|
||||
if (e.alias != undefined && typeof e.alias === 'object') {
|
||||
for (const a of e.alias) {
|
||||
command.aliasString += `\`.${a}\`, `;
|
||||
}
|
||||
} else if (e.alias != undefined && typeof e.alias === 'string') {
|
||||
command.aliasString += `\`.${e.alias}\``;
|
||||
} else {
|
||||
command.aliasString = 'None';
|
||||
}
|
||||
return command;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
name: e.name,
|
||||
description: e.description,
|
||||
usage: e.usage
|
||||
};
|
||||
});
|
||||
|
||||
for (const e of dotCommandsMap) {
|
||||
if (e != null) {
|
||||
dotCommandsFields.push(`- \`.${e.name}\` - ${e.description}\n\tUsage: ${e.usage}\n\tAliases: ${e.aliasString}`);
|
||||
}
|
||||
dotCommandsFields.push({
|
||||
name: `- .${e.name}`,
|
||||
value: `${e.description}\nUsage: ${e.usage}`,
|
||||
inline: false,
|
||||
});
|
||||
}
|
||||
console.log(dotCommandsFields);
|
||||
|
||||
// Construct the Description Fields
|
||||
const descriptionFields = [
|
||||
`${strings.help.description}\n`,
|
||||
`**Slash Commands**\n${strings.help.slash}\n`,
|
||||
`${slashCommandsFields.join('\n')}\n`,
|
||||
`**Dot Commands**\n${strings.help.dot}\n`,
|
||||
`${dotCommandsFields.join('\n')}`
|
||||
];
|
||||
|
||||
// Set the description
|
||||
helpEmbed.setDescription(descriptionFields.join('\n'));
|
||||
helpEmbed.addField('Slash Commands', strings.help.slash);
|
||||
helpEmbed.addFields(slashCommandsFields);
|
||||
helpEmbed.addField('Dot Commands', strings.help.dot);
|
||||
helpEmbed.addFields(dotCommandsFields);
|
||||
|
||||
return { embeds: [
|
||||
helpEmbed
|
||||
@ -263,35 +275,30 @@ const functions = {
|
||||
.setTimestamp()
|
||||
.setFooter({text: commandData.author})]};
|
||||
},
|
||||
pastas(commandData, indexedPastas) {
|
||||
pastas(commandData) {
|
||||
const pastasArray = [];
|
||||
const pastasEmbed = new Discord.MessageEmbed()
|
||||
.setAuthor({name: commandData.command})
|
||||
.setTimestamp()
|
||||
.setFooter({text: `Page: ${indexedPastas.pagesString}`})
|
||||
.setDescription(indexedPastas.pastasString);
|
||||
.setFooter({text: commandData.author});
|
||||
|
||||
const pastasPageAR = customEmbeds.actionRows.pastasPageAR(indexedPastas.state);
|
||||
return { embeds: [pastasEmbed], components: [pastasPageAR], ephemeral: true };
|
||||
for (const row of commandData.pastas) {
|
||||
pastasArray.push(`#${row.id} - ${row.name}.pasta`);
|
||||
}
|
||||
|
||||
const pastasString = pastasArray.join('\n');
|
||||
pastasEmbed.setDescription(pastasString);
|
||||
|
||||
return { embeds: [pastasEmbed], ephemeral: true };
|
||||
},
|
||||
gifs(commandData, indexedGifs) {
|
||||
gifs(commandData, gifList) {
|
||||
const gifsEmbed = new Discord.MessageEmbed()
|
||||
.setAuthor({name: commandData.command})
|
||||
.setTimestamp()
|
||||
.setFooter({text: `Page: ${indexedGifs.pagesString}`})
|
||||
.setDescription(indexedGifs.gifsString);
|
||||
.setFooter({text: commandData.author})
|
||||
.setDescription(gifList.join('\n'));
|
||||
|
||||
const gifsPageAR = customEmbeds.actionRows.gifsPageAR(indexedGifs.state);
|
||||
return { embeds: [gifsEmbed], components: [gifsPageAR], ephemeral: true };
|
||||
},
|
||||
joints(commandData, indexedJoints) {
|
||||
const jointsEmbed = new Discord.MessageEmbed()
|
||||
.setAuthor({name: commandData.command})
|
||||
.setTimestamp()
|
||||
.setFooter({text: `Page: ${indexedJoints.pagesString}`})
|
||||
.setDescription(indexedJoints.jointsString);
|
||||
|
||||
const jointsPageAR = customEmbeds.actionRows.jointsPageAR(indexedJoints.state);
|
||||
return { embeds: [jointsEmbed], components: [jointsPageAR], ephemeral: true };
|
||||
return { embeds: [gifsEmbed] };
|
||||
},
|
||||
text(commandData) {
|
||||
return { embeds: [new Discord.MessageEmbed()
|
||||
@ -300,15 +307,24 @@ const functions = {
|
||||
.setTimestamp()
|
||||
.setFooter({text: commandData.author})]};
|
||||
},
|
||||
requests(commandData, indexedRequests) {
|
||||
requests(commandData) {
|
||||
const requestsEmbed = new Discord.MessageEmbed()
|
||||
.setAuthor({name: commandData.command})
|
||||
.setTimestamp()
|
||||
.setFooter({text: `Page: ${indexedRequests.pagesString}`})
|
||||
.setDescription(indexedRequests.requestsString);
|
||||
.setFooter({text: commandData.author});
|
||||
|
||||
const requestsPageAR = customEmbeds.actionRows.requestsPageAR(indexedRequests.state);
|
||||
return { embeds: [requestsEmbed], components: [requestsPageAR], ephemeral: true };
|
||||
const requestsArray = [];
|
||||
|
||||
for (const row of commandData.requests) {
|
||||
requestsArray.push(
|
||||
`**#${row.id} - ${row.author}**`,
|
||||
`Request: ${row.request}`
|
||||
);
|
||||
}
|
||||
|
||||
requestsEmbed.setDescription(requestsArray.join('\n'));
|
||||
|
||||
return { embeds: [requestsEmbed], ephemeral: true };
|
||||
},
|
||||
strain(strainInfo, interaction) {
|
||||
const strainEmbed = new Discord.MessageEmbed()
|
||||
@ -606,6 +622,38 @@ const functions = {
|
||||
}
|
||||
}
|
||||
},
|
||||
openAI: {
|
||||
chatPrompt(userPrompt) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const response = await openai.chat.completions.create({
|
||||
messages: [{
|
||||
role: 'user',
|
||||
content: userPrompt
|
||||
}],
|
||||
model: strings.ai.chatModel
|
||||
}).catch(e => {
|
||||
reject(e);
|
||||
return null;
|
||||
});
|
||||
resolve(response);
|
||||
});
|
||||
},
|
||||
imagePrompt(userPrompt, size, userId) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
const response = await openai.createImage({
|
||||
prompt: userPrompt,
|
||||
size: size,
|
||||
user: userId
|
||||
});
|
||||
resolve(response.data.data[0].url);
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
search: {
|
||||
gifs(query, client) {
|
||||
const gifSearcher = new FuzzySearch(client.gifs.map(element => element.name));
|
||||
|
127
main.js
127
main.js
@ -27,13 +27,10 @@ const { MessageActionRow, MessageButton } = require('discord.js');
|
||||
const fn = require('./functions.js');
|
||||
const config = require('./config.json');
|
||||
const strings = require('./strings.json');
|
||||
const { GifData, CommandData } = require('./CustomModules/NodBot.js');
|
||||
const ButtonHandlers = require('./CustomModules/ButtonHandlers.js');
|
||||
const InteractionStorage = require('./CustomModules/InteractionStorage.js');
|
||||
const { GifData } = require('./CustomModules/NodBot.js');
|
||||
const isDev = process.env.isDev;
|
||||
|
||||
client.once('ready', async () => {
|
||||
fn.collections.interactionStorage(client);
|
||||
fn.collections.slashCommands(client);
|
||||
fn.collections.dotCommands(client);
|
||||
fn.collections.setvalidCommands(client);
|
||||
@ -57,14 +54,10 @@ client.once('ready', async () => {
|
||||
client.on('interactionCreate', async interaction => {
|
||||
if (interaction.isCommand()) {
|
||||
if (isDev) {
|
||||
console.log('Interaction ID: ' + interaction.id);
|
||||
console.log(interaction);
|
||||
}
|
||||
const { commandName } = interaction;
|
||||
|
||||
if (!client.iStorage.has(interaction.id)) {
|
||||
new InteractionStorage(interaction.id, interaction);
|
||||
}
|
||||
|
||||
if (client.slashCommands.has(commandName)) {
|
||||
client.slashCommands.get(commandName).execute(interaction);
|
||||
} else {
|
||||
@ -74,9 +67,117 @@ client.on('interactionCreate', async interaction => {
|
||||
}
|
||||
|
||||
if (interaction.isButton()) {
|
||||
if (isDev) console.log('Origin Interaction ID: ' + interaction.message.interaction.id);
|
||||
if (isDev) console.log('Button ID: ' + interaction.component.customId);
|
||||
ButtonHandlers.baseEvent(interaction);
|
||||
if (interaction.user.id != strings.temp.gifUserId) return;
|
||||
// Get some meta info from strings
|
||||
const index = strings.temp.gifIndex;
|
||||
const limit = strings.temp.gifLimit;
|
||||
let newIndex;
|
||||
const buttonId = interaction.component.customId;
|
||||
switch (buttonId) {
|
||||
case 'prevGif':
|
||||
newIndex = index - 1;
|
||||
strings.temp.gifIndex = newIndex;
|
||||
// If we're leaving the last GIF, enable the Next GIF button
|
||||
if (index == limit) {
|
||||
// Re-Send Previous GIF button
|
||||
const prevButton = new MessageButton().setCustomId('prevGif').setLabel('Previous GIF').setStyle('SECONDARY');
|
||||
// Re-Send Confirm GIF Button
|
||||
const confirmButton = new MessageButton().setCustomId('confirmGif').setLabel('Confirm').setStyle('PRIMARY');
|
||||
// Enable Next GIF Button
|
||||
const nextButton = new MessageButton().setCustomId('nextGif').setLabel('Next GIF').setStyle('SECONDARY');
|
||||
// Re-Send Cancel Button
|
||||
const cancelButton = new MessageButton().setCustomId('cancelGif').setLabel('Cancel').setStyle('DANGER');
|
||||
// Put all the above into an ActionRow to be sent as a component of the reply
|
||||
const row = new MessageActionRow().addComponents(prevButton, confirmButton, nextButton, cancelButton);
|
||||
|
||||
interaction.update({ content: strings.temp.gifs[newIndex].embed_url, components: [row] });
|
||||
break;
|
||||
}
|
||||
// If we're going into the first GIF, disable the Previous GIF button
|
||||
if (newIndex == 0) {
|
||||
// Disable Previous GIF button
|
||||
const prevButton = new MessageButton().setCustomId('prevGif').setLabel('Previous GIF').setStyle('SECONDARY').setDisabled();
|
||||
// Re-Send Confirm GIF Button
|
||||
const confirmButton = new MessageButton().setCustomId('confirmGif').setLabel('Confirm').setStyle('PRIMARY');
|
||||
// Re-Send Next GIF Button
|
||||
const nextButton = new MessageButton().setCustomId('nextGif').setLabel('Next GIF').setStyle('SECONDARY');
|
||||
// Re-Send Cancel Button
|
||||
const cancelButton = new MessageButton().setCustomId('cancelGif').setLabel('Canceled').setStyle('DANGER');
|
||||
// Put all the above into an ActionRow to be sent as a component of the reply
|
||||
const row = new MessageActionRow().addComponents(prevButton, confirmButton, nextButton, cancelButton);
|
||||
|
||||
interaction.update({ content: strings.temp.gifs[newIndex].embed_url, components: [row] });
|
||||
break;
|
||||
}
|
||||
|
||||
interaction.update(strings.temp.gifs[newIndex].embed_url);
|
||||
break;
|
||||
case 'confirmGif':
|
||||
// const gifData = {
|
||||
// name: strings.temp.gifName,
|
||||
// url: strings.temp.gifs[strings.temp.gifIndex].embed_url,
|
||||
// };
|
||||
const gifData = new GifData().setInfo(strings.temp.gifName, strings.temp.gifs[strings.temp.gifIndex].embed_url);
|
||||
fn.upload.gif(gifData, client);
|
||||
interaction.update({ content: `I've saved the GIF as ${gifData.name}.gif`, components: [] });
|
||||
fn.download.gifs(interaction.client);
|
||||
break;
|
||||
case 'nextGif':
|
||||
newIndex = index + 1;
|
||||
strings.temp.gifIndex = newIndex;
|
||||
// If we're leaving the first GIF, enable the Previous GIF button
|
||||
if (index == 0) {
|
||||
// Enable Previous GIF button
|
||||
const prevButton = new MessageButton().setCustomId('prevGif').setLabel('Previous GIF').setStyle('SECONDARY').setDisabled(false);
|
||||
// Re-Send Confirm GIF Button
|
||||
const confirmButton = new MessageButton().setCustomId('confirmGif').setLabel('Confirm').setStyle('PRIMARY');
|
||||
// Re-Send Next GIF Button
|
||||
const nextButton = new MessageButton().setCustomId('nextGif').setLabel('Next GIF').setStyle('SECONDARY');
|
||||
// Re-Send Cancel Button
|
||||
const cancelButton = new MessageButton().setCustomId('cancelGif').setLabel('Cancel').setStyle('DANGER');
|
||||
// Put all the above into an ActionRow to be sent as a component of the reply
|
||||
const row = new MessageActionRow().addComponents(prevButton, confirmButton, nextButton, cancelButton);
|
||||
|
||||
interaction.update({ content: strings.temp.gifs[newIndex].embed_url, components: [row] });
|
||||
break;
|
||||
}
|
||||
// If we're going into the last GIF, disable the Next GIF button
|
||||
if (newIndex == strings.temp.gifLimit) {
|
||||
// Re-Send Previous GIF button
|
||||
const prevButton = new MessageButton().setCustomId('prevGif').setLabel('Previous GIF').setStyle('SECONDARY');
|
||||
// Re-Send Confirm GIF Button
|
||||
const confirmButton = new MessageButton().setCustomId('confirmGif').setLabel('Confirm').setStyle('PRIMARY');
|
||||
// Disable Next GIF Button
|
||||
const nextButton = new MessageButton().setCustomId('nextGif').setLabel('Next GIF').setStyle('SECONDARY').setDisabled();
|
||||
// Re-Send Cancel Button
|
||||
const cancelButton = new MessageButton().setCustomId('cancelGif').setLabel('Canceled').setStyle('DANGER');
|
||||
// Put all the above into an ActionRow to be sent as a component of the reply
|
||||
const row = new MessageActionRow().addComponents(prevButton, confirmButton, nextButton, cancelButton);
|
||||
|
||||
interaction.update({ content: strings.temp.gifs[newIndex].embed_url, components: [row] });
|
||||
break;
|
||||
}
|
||||
|
||||
interaction.update(strings.temp.gifs[newIndex].embed_url);
|
||||
break;
|
||||
case 'cancelGif':
|
||||
// Previous GIF button
|
||||
const prevButton = new MessageButton().setCustomId('prevGif').setLabel('Previous GIF').setStyle('SECONDARY').setDisabled();
|
||||
// Confirm GIF Button
|
||||
const confirmButton = new MessageButton().setCustomId('confirmGif').setLabel('Confirm').setStyle('PRIMARY').setDisabled();
|
||||
// Next GIF Button
|
||||
const nextButton = new MessageButton().setCustomId('nextGif').setLabel('Next GIF').setStyle('SECONDARY').setDisabled();
|
||||
// Cancel Button
|
||||
const cancelButton = new MessageButton().setCustomId('cancelGif').setLabel('Canceled').setStyle('DANGER');
|
||||
// Put all the above into an ActionRow to be sent as a component of the reply
|
||||
const row = new MessageActionRow().addComponents(prevButton, confirmButton, nextButton, cancelButton);
|
||||
interaction.component.setDisabled(true);
|
||||
|
||||
interaction.update({ content: 'Canceled.', components: [row] });
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle autocomplete requests
|
||||
@ -131,7 +232,7 @@ client.on('messageCreate', message => {
|
||||
});
|
||||
|
||||
// Break the message down into its components and analyze it
|
||||
const commandData = new CommandData(message).validate(message.client.dotCommands);
|
||||
const commandData = fn.dot.getCommandData(message);
|
||||
console.log(commandData);
|
||||
|
||||
if (commandData.isValid && commandData.isCommand) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "nodbot",
|
||||
"version": "3.4.0",
|
||||
"description": "Nods and Nod Accessories",
|
||||
"version": "3.3.1",
|
||||
"description": "Nods and Nod Accessories, now with ChatGPT!",
|
||||
"main": "main.js",
|
||||
"dependencies": {
|
||||
"@discordjs/builders": "^0.16.0",
|
||||
|
36
slash-commands/gifs.js
Normal file
36
slash-commands/gifs.js
Normal file
@ -0,0 +1,36 @@
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { config } = require('dotenv');
|
||||
const fn = require('../functions.js');
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('gifs')
|
||||
.setDescription('Get a list of currently saved GIFs.'),
|
||||
async execute(interaction) {
|
||||
if (!interaction.client.gifs) {
|
||||
interaction.reply('For some reason I don\'t have access to the collection of gifs. Sorry about that!');
|
||||
return;
|
||||
}
|
||||
// const gifsMap = interaction.client.gifs.map(e => {e.name, e.url});
|
||||
// const commandData = {
|
||||
// gifs: [],
|
||||
// command: 'gifs',
|
||||
// author: interaction.user.tag,
|
||||
// };
|
||||
// for (const row of gifsMap) {
|
||||
// commandData.gifs.push({
|
||||
// id: row.id,
|
||||
// name: row.name,
|
||||
// });
|
||||
// }
|
||||
let gifList = [];
|
||||
interaction.client.gifs.forEach(element => {
|
||||
gifList.push(`[${element.name}](${element.url})`);
|
||||
});
|
||||
const commandData = {
|
||||
command: "/gifs",
|
||||
author: interaction.member.displayName
|
||||
};
|
||||
interaction.reply(fn.embeds.gifs(commandData, gifList));
|
||||
},
|
||||
};
|
@ -4,8 +4,29 @@ const fn = require('../functions.js');
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('help')
|
||||
.setDescription('Send the help page.'),
|
||||
.setDescription('Send the help page.')
|
||||
// .addStringOption(option =>
|
||||
// option.setName('location')
|
||||
// .setDescription('Send help in this channel or in DMs?')
|
||||
// .setRequired(true)
|
||||
// .addChoice('Here', 'channel')
|
||||
// .addChoice('DMs', 'dm'))
|
||||
,
|
||||
async execute(interaction) {
|
||||
// switch (interaction.options.getString('location')) {
|
||||
// case 'channel':
|
||||
// await interaction.reply(fn.embeds.help(interaction));
|
||||
// break;
|
||||
// case 'dm':
|
||||
// await interaction.user.createDM().then(channel => {
|
||||
// channel.send(fn.embeds.help(interaction));
|
||||
// interaction.reply({content: 'I\'ve sent you a copy of my help page.', ephemeral: true});
|
||||
// });
|
||||
// break;
|
||||
// default:
|
||||
// interaction.reply('There was an error, please try again.');
|
||||
// break;
|
||||
// }
|
||||
await interaction.reply(fn.embeds.help(interaction));
|
||||
}
|
||||
},
|
||||
};
|
15
slash-commands/joints.js
Normal file
15
slash-commands/joints.js
Normal file
@ -0,0 +1,15 @@
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const fn = require('../functions.js');
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('joints')
|
||||
.setDescription('Send a list of all the /joint phrases.'),
|
||||
async execute(interaction) {
|
||||
let joints = [];
|
||||
interaction.client.joints.map(e => {
|
||||
joints.push(e.content);
|
||||
});
|
||||
interaction.reply({ content: 'Here are all the `.joint` phrases I have saved:\n\n' + joints.join('\n'), ephemeral: true });
|
||||
},
|
||||
};
|
33
slash-commands/pastas.js
Normal file
33
slash-commands/pastas.js
Normal file
@ -0,0 +1,33 @@
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { config } = require('dotenv');
|
||||
const fn = require('../functions.js');
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('pastas')
|
||||
.setDescription('Get a list of currently saved copypastas.'),
|
||||
async execute(interaction) {
|
||||
if (!interaction.client.pastas) {
|
||||
interaction.reply({ content: 'For some reason I don\'t have access to the collection of copypastas. Sorry about that!', ephemeral: true });
|
||||
return;
|
||||
}
|
||||
const commandData = {
|
||||
author: interaction.user.tag,
|
||||
command: interaction.commandName,
|
||||
pastas: [],
|
||||
};
|
||||
const pastasMap = interaction.client.pastas.map(e => {
|
||||
return {
|
||||
id: e.id,
|
||||
name: e.name,
|
||||
};
|
||||
});
|
||||
for (const row of pastasMap) {
|
||||
commandData.pastas.push({
|
||||
id: row.id,
|
||||
name: row.name,
|
||||
});
|
||||
}
|
||||
interaction.reply(fn.embeds.pastas(commandData));
|
||||
},
|
||||
};
|
39
slash-commands/requests.js
Normal file
39
slash-commands/requests.js
Normal file
@ -0,0 +1,39 @@
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { config } = require('dotenv');
|
||||
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)),
|
||||
async execute(interaction) {
|
||||
const pageNum = interaction.options.getString('page');
|
||||
const commandData = {
|
||||
author: interaction.user.tag,
|
||||
command: interaction.commandName,
|
||||
requests: [],
|
||||
};
|
||||
const requestsMap = interaction.client.requests.map(e => {
|
||||
return {
|
||||
id: e.id,
|
||||
author: e.author,
|
||||
request: e.request,
|
||||
};
|
||||
});
|
||||
for (let i = ( 10 * ( pageNum - 1 ) ); i < ( 10 * pageNum ); i++) {
|
||||
if (requestsMap[i] != undefined) {
|
||||
commandData.requests.push({
|
||||
id: requestsMap[i].id,
|
||||
author: requestsMap[i].author,
|
||||
request: requestsMap[i].request,
|
||||
});
|
||||
}
|
||||
}
|
||||
interaction.reply(fn.embeds.requests(commandData));
|
||||
},
|
||||
};
|
@ -7,13 +7,10 @@ const tenor = require('tenorjs').client({
|
||||
});
|
||||
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { Collection } = require('discord.js');
|
||||
const { MessageActionRow, MessageButton } = require('discord.js');
|
||||
const fn = require('../functions.js');
|
||||
const strings = require('../strings.json');
|
||||
const { GifData } = require('../CustomModules/NodBot.js');
|
||||
const customEmbeds = require('../CustomModules/Embeds.js');
|
||||
const Indexer = require('../CustomModules/Indexer.js');
|
||||
const Embeds = require('../CustomModules/Embeds.js');
|
||||
const { emoji } = strings;
|
||||
|
||||
module.exports = {
|
||||
@ -144,21 +141,24 @@ module.exports = {
|
||||
switch (subcommand) {
|
||||
// GIF Search
|
||||
case "gifsearch":
|
||||
// Grab the inputs from the command
|
||||
// TODO Check on option names
|
||||
// Previous GIF button
|
||||
const prevButton = new MessageButton().setCustomId('prevGif').setLabel('Previous GIF').setStyle('SECONDARY').setDisabled(true);
|
||||
// Confirm GIF Button
|
||||
const confirmButton = new MessageButton().setCustomId('confirmGif').setLabel('Confirm').setStyle('PRIMARY');
|
||||
// Next GIF Button
|
||||
const nextButton = new MessageButton().setCustomId('nextGif').setLabel('Next GIF').setStyle('SECONDARY');
|
||||
// Cancel Button
|
||||
const cancelButton = new MessageButton().setCustomId('cancelGif').setLabel('Cancel').setStyle('DANGER');
|
||||
// Put all the above into an ActionRow to be sent as a component of the reply
|
||||
const actionRow = new MessageActionRow().addComponents(prevButton, confirmButton, nextButton, cancelButton);
|
||||
|
||||
// Get the query
|
||||
const query = interaction.options.getString('query');
|
||||
const gifName = interaction.options.getString('name').toLowerCase();
|
||||
|
||||
const iStorage = interaction.client.iStorage.get(interaction.id);
|
||||
iStorage.page = 0;
|
||||
iStorage.gifsCollection = new Collection();
|
||||
iStorage.gifName = gifName;
|
||||
iStorage.query = query;
|
||||
|
||||
|
||||
strings.temp.gifName = interaction.options.getString('name').toLowerCase();
|
||||
|
||||
// Search Tenor for the GIF
|
||||
tenor.Search.Query(query, '20').then(res => {
|
||||
|
||||
tenor.Search.Query(query, '10').then(res => {
|
||||
strings.temp.gifs = [];
|
||||
strings.temp.gifIndex = 0;
|
||||
strings.temp.gifLimit = res.length - 1;
|
||||
@ -169,18 +169,11 @@ module.exports = {
|
||||
return;
|
||||
}
|
||||
for (const row of res) {
|
||||
iStorage.gifsCollection.set(row.id, row);
|
||||
strings.temp.gifs.push({
|
||||
embed_url: row.media_formats.gif.url,
|
||||
});
|
||||
}
|
||||
|
||||
// Generate the initial action row
|
||||
const actionRow = customEmbeds.actionRows.gifSearchAR('first');
|
||||
// Get the index built
|
||||
const gifPage = Indexer(iStorage.gifsCollection, 0, 1);
|
||||
gifPage.query = query;
|
||||
gifPage.gifName = gifName;
|
||||
// Generate the embed
|
||||
const gifEmbed = Embeds.core.gifSearch({ author: interaction.user.username }, gifPage);
|
||||
interaction.editReply({ embeds: [gifEmbed], components: [actionRow], ephemeral: true });
|
||||
interaction.editReply({ content: strings.temp.gifs[0].embed_url, components: [actionRow], ephemeral: true });
|
||||
});
|
||||
break;
|
||||
// GIF URL
|
||||
|
@ -1,132 +0,0 @@
|
||||
const tenor = require('tenorjs').client({
|
||||
'Key': process.env.tenorAPIKey, // https://tenor.com/developer/keyregistration
|
||||
'Filter': 'off', // "off", "low", "medium", "high", not case sensitive
|
||||
'Locale': 'en_US',
|
||||
'MediaFilter': 'minimal',
|
||||
'DateFormat': 'D/MM/YYYY - H:mm:ss A',
|
||||
});
|
||||
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { Collection } = require('discord.js');
|
||||
const fn = require('../functions.js');
|
||||
const strings = require('../strings.json');
|
||||
const { GifData } = require('../CustomModules/NodBot.js');
|
||||
const customEmbeds = require('../CustomModules/Embeds.js');
|
||||
const Indexer = require('../CustomModules/Indexer.js');
|
||||
const Embeds = require('../CustomModules/Embeds.js');
|
||||
const { emoji } = strings;
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('view')
|
||||
.setDescription('View content saved in Nodbot\'s database.')
|
||||
// GIFs
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
.setName('gifs')
|
||||
.setDescription('Display all saved GIFs.')
|
||||
)
|
||||
// Joints
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
.setName('joints')
|
||||
.setDescription('Display all saved joints.')
|
||||
)
|
||||
// Pastas
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
.setName('pastas')
|
||||
.setDescription('Display all saved copypastas.')
|
||||
)
|
||||
// Requests
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
.setName('requests')
|
||||
.setDescription('Display all saved requests.')
|
||||
),
|
||||
async execute(interaction) {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
try {
|
||||
// Code Here...
|
||||
const subcommand = interaction.options.getSubcommand();
|
||||
const iStorage = interaction.client.iStorage.get(interaction.id);
|
||||
const commandData = {
|
||||
author: interaction.user.username,
|
||||
command: `/${interaction.commandName} ${subcommand}`
|
||||
};
|
||||
switch (subcommand) {
|
||||
// GIFs
|
||||
case "gifs":
|
||||
if (!interaction.client.gifs) {
|
||||
interaction.editReply('For some reason I don\'t have access to the collection of gifs. Sorry about that!');
|
||||
return;
|
||||
}
|
||||
let indexedGifs = Indexer(interaction.client.gifs, 0);
|
||||
indexedGifs.gifsString = new String();
|
||||
|
||||
iStorage.page = 0;
|
||||
|
||||
for (const gif of indexedGifs.thisPage) {
|
||||
indexedGifs.gifsString += `[${gif.name}.gif](${gif.url})\n`;
|
||||
}
|
||||
interaction.editReply(fn.embeds.gifs(commandData, indexedGifs));
|
||||
break;
|
||||
// Joints
|
||||
case "joints":
|
||||
if (!interaction.client.joints) {
|
||||
interaction.editReply('For some reason I don\'t have access to the collection of joints. Sorry about that!');
|
||||
return;
|
||||
}
|
||||
let indexedJoints = Indexer(interaction.client.joints, 0);
|
||||
indexedJoints.jointsString = new String();
|
||||
|
||||
iStorage.page = 0;
|
||||
|
||||
for (const joint of indexedJoints.thisPage) {
|
||||
indexedJoints.jointsString += `${joint.content}\n`;
|
||||
}
|
||||
interaction.editReply(fn.embeds.joints(commandData, indexedJoints));
|
||||
break;
|
||||
// Pastas
|
||||
case "pastas":
|
||||
if (!interaction.client.pastas) {
|
||||
interaction.editReply({ content: 'For some reason I don\'t have access to the collection of copypastas. Sorry about that!', ephemeral: true });
|
||||
return;
|
||||
}
|
||||
let indexedPastas = Indexer(interaction.client.pastas, 0);
|
||||
indexedPastas.pastasString = new String();
|
||||
|
||||
iStorage.page = 0;
|
||||
|
||||
for (const pasta of indexedPastas.thisPage) {
|
||||
indexedPastas.pastasString += `${pasta.name}.pasta\n`;
|
||||
}
|
||||
interaction.editReply(fn.embeds.pastas(commandData, indexedPastas));
|
||||
break;
|
||||
case "requests":
|
||||
if (!interaction.client.requests) {
|
||||
interaction.editReply('For some reason I don\'t have access to the collection of requests. Sorry about that!');
|
||||
return;
|
||||
}
|
||||
let indexedRequests = Indexer(interaction.client.requests, 0);
|
||||
indexedRequests.requestsString = new String();
|
||||
|
||||
iStorage.page = 0;
|
||||
|
||||
for (const request of indexedRequests.thisPage) {
|
||||
indexedRequests.requestsString += `[${request.id}]: ${request.request} (submitted by ${request.author})\n`;
|
||||
}
|
||||
|
||||
interaction.editReply(fn.embeds.requests(commandData, indexedRequests));
|
||||
break;
|
||||
// Default
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} catch (err) {
|
||||
const errorId = fn.generateErrorId();
|
||||
console.error(`${errorId}: err`);
|
||||
await interaction.editReply(`Sorry, an error has occured. Error ID: ${errorId}`);
|
||||
}
|
||||
}
|
||||
};
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"help": {
|
||||
"description": "Hi there! Thanks for checking out NodBot. NodBot is used in two distinct ways: with 'Slash Commands' (`/help`), and with 'Dot Commands' (`nod.gif`). The two types will be outlined below, along with usage examples.",
|
||||
"slash": "Slash Commands always begin with a `/` and a menu will pop up to help complete the commands.",
|
||||
"dot": "Dot Commands have the command at the end of the message, for example to search for a gif of `nod`, type `nod.gif`"
|
||||
"description": "Hi there! Thanks for checking out NodBot. NodBot is used in two distinct ways: with 'Slash Commands' (/help), and with 'Dot Commands' (nod.gif). The two types will be outlined below, along with usage examples.",
|
||||
"slash": "Slash Commands always begin with a / and a menu will pop up to help complete the commands.",
|
||||
"dot": "Dot Commands have the command at the end of the message, for example to search for a gif of 'nod', type 'nod.gif'"
|
||||
},
|
||||
"emoji": {
|
||||
"joint": "<:joint:862082955902976000>",
|
||||
|
Loading…
Reference in New Issue
Block a user