MrEthλn
MrEthλn
DIAdiscord.js - Imagine an app
Created by MrEthλn on 8/11/2023 in #djs-questions
MessageCollector not working
I am trying to get the content of the response so I can save it as a variable and move onto the next bit of information but I can't seem to work out how to get the message collector to work. I've tried 3 different methods and I really don't know what to do now. My codes current state:
} else if (interaction.options.getSubcommand() === 'newentry') {
let type = interaction.options.getString('type')

if (type === "character") {
await interaction.reply(`Creating new \`${type}\` entry. Have all information to hand, will auto cancel in \`300 seconds\`. Reply to the messages for it to work.`)
.then(() => {
sleep(3000)
let NameAsk = interaction.followUp('What is the name of the character? Ensure it is properly capitalised.')
.then(CollectedName => {
const collectorFilter = m => m.author.id === interaction.author.id
interaction.channel.awaitMessages({ filter: collectorFilter, max: 1, time: 30000, errors: ['time'] })
.then(CollectedName => {
NameAsk.delete();
interaction.followUp(`${CollectedName.content} is the provided name.`);
})
})
})
}
}
} else if (interaction.options.getSubcommand() === 'newentry') {
let type = interaction.options.getString('type')

if (type === "character") {
await interaction.reply(`Creating new \`${type}\` entry. Have all information to hand, will auto cancel in \`300 seconds\`. Reply to the messages for it to work.`)
.then(() => {
sleep(3000)
let NameAsk = interaction.followUp('What is the name of the character? Ensure it is properly capitalised.')
.then(CollectedName => {
const collectorFilter = m => m.author.id === interaction.author.id
interaction.channel.awaitMessages({ filter: collectorFilter, max: 1, time: 30000, errors: ['time'] })
.then(CollectedName => {
NameAsk.delete();
interaction.followUp(`${CollectedName.content} is the provided name.`);
})
})
})
}
}
And the error I am getting:
node:internal/process/promises:289
triggerUncaughtException(err, true /* fromPromise */);
^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "#<Collection>".] {
code: 'ERR_UNHANDLED_REJECTION'
}
node:internal/process/promises:289
triggerUncaughtException(err, true /* fromPromise */);
^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "#<Collection>".] {
code: 'ERR_UNHANDLED_REJECTION'
}
I don't think the error is related to my issue, I think thats because I didn't catch the time error. But I'm not sure why it wont give me the message. Any help is much apriciated.
6 replies
DIAdiscord.js - Imagine an app
Created by MrEthλn on 6/23/2023 in #djs-questions
error with pm2 nodejs server
SyntaxError: Unexpected token '.' at wrapSafe (internal/modules/cjs/loader.js:915:16) at Module._compile (internal/modules/cjs/loader.js:963:27) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Module.require (internal/modules/cjs/loader.js:887:19) at Module.Hook._require.Module.require (/usr/local/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:101:39) at require (internal/modules/cjs/helpers.js:74:18) at Object.<anonymous> (/root/ObjectionerBot/node_modules/discord.js/src/index.js:6:22) at Module._compile (internal/modules/cjs/loader.js:999:30) I get this error since I have been trying to run my bot on a linux server with pm2, I did not get this error before changing to my own vps so I am not sure why I am getting it?
3 replies
DIAdiscord.js - Imagine an app
Created by MrEthλn on 11/14/2022 in #djs-questions
How do I move from specific server bots to multiple ones
How do I learn to change the deploying to be global anyway and also how would I make things like individual server configuration?
3 replies
DIAdiscord.js - Imagine an app
Created by MrEthλn on 11/12/2022 in #djs-questions
Error getting when running unrelated subcommand?
I get this TypeError: Cannot read properties of undefined (reading 'colour') at Object.execute (/home/runner/Macron-Bot-Upload/commands/defcon.js:33:44) at Client.<anonymous> (/home/runner/Macron-Bot-Upload/index.js:59:19) at Client.emit (node:events:390:28) at Client.emit (node:domain:475:12) at InteractionCreateAction.handle (/home/runner/Macron-Bot-Upload/node_modules/discord.js/src/client/actions/InteractionCreate.js:81:12) at Object.module.exports [as INTERACTION_CREATE] (/home/runner/Macron-Bot-Upload/node_modules/discord.js/src/client/websocket/handlers/INTERACTION_CREATE.js:4:36) at WebSocketManager.handlePacket (/home/runner/Macron-Bot-Upload/node_modules/discord.js/src/client/websocket/WebSocketManager.js:352:31) at WebSocketShard.onPacket (/home/runner/Macron-Bot-Upload/node_modules/discord.js/src/client/websocket/WebSocketShard.js:481:22) at WebSocketShard.onMessage (/home/runner/Macron-Bot-Upload/node_modules/discord.js/src/client/websocket/WebSocketShard.js:321:10) When running my reset subcommand, despite the logs that create the error not being fired by the subcommand, and when I fire the related sub command theres no error? What?
26 replies
DIAdiscord.js - Imagine an app
Created by MrEthλn on 11/12/2022 in #djs-questions
Embed making errors
13 replies
DIAdiscord.js - Imagine an app
Created by MrEthλn on 10/30/2022 in #djs-questions
Event listeners
can I put them in a file with a command?
3 replies
DIAdiscord.js - Imagine an app
Created by MrEthλn on 10/22/2022 in #djs-voice
not playing anything
const { Client, SlashCommandBuilder } = require('discord.js')
const { createAudioPlayer, createAudioResource, generateDependencyReport, joinVoiceChannel } = require('@discordjs/voice');

console.log(generateDependencyReport());

module.exports = {
data: new SlashCommandBuilder()
.setName('anthem')
.setDescription('Let the anthem play!'),
async execute(interaction, client) {

const channel = client.channels.cache.get('1033420771294461952');
const connection = joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild.id,
adapterCreator: channel.guild.voiceAdapterCreator,
});

const player = createAudioPlayer();
const subscription = connection.subscribe(player);
const resource = createAudioResource('../Anthem.mp3');

connection.subscribe(player);
player.play(resource);

if (subscription) {
// Unsubscribe after 5 seconds (stop playing audio on the voice connection)
setTimeout(() => subscription.unsubscribe(), 5_000);
}


interaction.reply("Anthem playing in <#1033420771294461952>")

},
};
const { Client, SlashCommandBuilder } = require('discord.js')
const { createAudioPlayer, createAudioResource, generateDependencyReport, joinVoiceChannel } = require('@discordjs/voice');

console.log(generateDependencyReport());

module.exports = {
data: new SlashCommandBuilder()
.setName('anthem')
.setDescription('Let the anthem play!'),
async execute(interaction, client) {

const channel = client.channels.cache.get('1033420771294461952');
const connection = joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild.id,
adapterCreator: channel.guild.voiceAdapterCreator,
});

const player = createAudioPlayer();
const subscription = connection.subscribe(player);
const resource = createAudioResource('../Anthem.mp3');

connection.subscribe(player);
player.play(resource);

if (subscription) {
// Unsubscribe after 5 seconds (stop playing audio on the voice connection)
setTimeout(() => subscription.unsubscribe(), 5_000);
}


interaction.reply("Anthem playing in <#1033420771294461952>")

},
};
I'm not sure why first time using this so I don't know if I'm missing anything either?
6 replies
DIAdiscord.js - Imagine an app
Created by MrEthλn on 10/22/2022 in #djs-voice
Error FFmpegavconv not found!
This is my first time using this and I'm not sure if I've even done it right, I'm getting the error Error: FFmpeg/avconv not found! from:
const { Client, SlashCommandBuilder } = require('discord.js')
const { createAudioPlayer, createAudioResource } = require('@discordjs/voice');

module.exports = {
data: new SlashCommandBuilder()
.setName('anthem')
.setDescription('Let the athem play!'),
async execute(interaction, client) {

const connection1 = client.channels.cache.get('1033420771294461952');
const player = createAudioPlayer();

const resource = createAudioResource('../FrenchAnthem.mp3');
player.play(resource);

connection1.subscribe(player);


interaction.reply("Anthem playing in <#1033420771294461952>")

},
};
const { Client, SlashCommandBuilder } = require('discord.js')
const { createAudioPlayer, createAudioResource } = require('@discordjs/voice');

module.exports = {
data: new SlashCommandBuilder()
.setName('anthem')
.setDescription('Let the athem play!'),
async execute(interaction, client) {

const connection1 = client.channels.cache.get('1033420771294461952');
const player = createAudioPlayer();

const resource = createAudioResource('../FrenchAnthem.mp3');
player.play(resource);

connection1.subscribe(player);


interaction.reply("Anthem playing in <#1033420771294461952>")

},
};
8 replies
DIAdiscord.js - Imagine an app
Created by MrEthλn on 10/22/2022 in #djs-questions
Is there a way to see the join date of someone
Discord ha the member since thing, is there a way to work off this and for example do If z was member before x give role y
4 replies
DIAdiscord.js - Imagine an app
Created by MrEthλn on 8/18/2022 in #djs-questions
Checking Reactions
How can I know when a reaction is added to a message by anyone, and if the same reaction is reacted by another person will it trigger again?
8 replies
DIAdiscord.js - Imagine an app
Created by MrEthλn on 8/17/2022 in #djs-questions
New member randomly happening
10 replies
DIAdiscord.js - Imagine an app
Created by MrEthλn on 7/31/2022 in #djs-questions
Long Blank Space in Embeds
4 replies