SowerofSystems
SowerofSystems
DIAdiscord.js - Imagine an app
Created by SowerofSystems on 8/10/2024 in #djs-questions
Reaction Collector not collecting reactions in DMs
I still haven't been able to figure this out
35 replies
DIAdiscord.js - Imagine an app
Created by SowerofSystems on 8/10/2024 in #djs-questions
Reaction Collector not collecting reactions in DMs
I don't believe I have made any other changes to djsbotbuilder since my last publish
35 replies
DIAdiscord.js - Imagine an app
Created by SowerofSystems on 8/10/2024 in #djs-questions
Reaction Collector not collecting reactions in DMs
Ah yes, I have recently changed djsbotbuilder to take client. I have not yet published that change, but I am using a linked version of djsbotbuilder for testing. This is the current runBot function:
static async runBot(options = {}) {
const config = this.getConfig();
const token = options.token || config.TOKEN;
const client = options.client;

if (!client) {
throw new Error('Client must be provided in options.');
}

client.commands = this.getCommands();

await this.deployCommands(options);

this.loadEvents({ client });

this.loadTasks({ client });

client.login(token).then(() => {
console.log('Bot is online.');
}).catch((error) => {
console.error('Failed to log in:', error);
});
}
static async runBot(options = {}) {
const config = this.getConfig();
const token = options.token || config.TOKEN;
const client = options.client;

if (!client) {
throw new Error('Client must be provided in options.');
}

client.commands = this.getCommands();

await this.deployCommands(options);

this.loadEvents({ client });

this.loadTasks({ client });

client.login(token).then(() => {
console.log('Bot is online.');
}).catch((error) => {
console.error('Failed to log in:', error);
});
}
35 replies
DIAdiscord.js - Imagine an app
Created by SowerofSystems on 8/10/2024 in #djs-questions
Reaction Collector not collecting reactions in DMs
I define the client in my index.js here:
const { Client, GatewayIntentBits, Partials } = require('discord.js');
const { Init } = require('djsbotbuilder');

Init.database();

const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.DirectMessageReactions
],
partials: [
Partials.Message,
Partials.Channel,
Partials.Reaction
]
});

Init.runBot({ client });
const { Client, GatewayIntentBits, Partials } = require('discord.js');
const { Init } = require('djsbotbuilder');

Init.database();

const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.DirectMessageReactions
],
partials: [
Partials.Message,
Partials.Channel,
Partials.Reaction
]
});

Init.runBot({ client });
35 replies
DIAdiscord.js - Imagine an app
Created by SowerofSystems on 8/10/2024 in #djs-questions
Reaction Collector not collecting reactions in DMs
I just realized that the client definition wasn't doing anything. I have removed it from the beginning of coffeeChatScheduler. My issue persists though.
35 replies
DIAdiscord.js - Imagine an app
Created by SowerofSystems on 8/10/2024 in #djs-questions
Reaction Collector not collecting reactions in DMs
The function is intended to be run automatically on a weekly schedule, but for testing purposes I am running it manually with a slash command send-invitations
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js');
const coffeeChatScheduler = require('../../tasks/coffeeChatScheduler');

module.exports = {
data: new SlashCommandBuilder()
.setName('send-invitations')
.setDescription('Manually send out coffee chat invitations to opted-in members.')
.setDefaultMemberPermissions(PermissionFlagsBits.ModerateMembers),
async execute(interaction) {
const client = interaction.client;

try {
await coffeeChatScheduler.execute(client);
await interaction.reply('Coffee chat invitations have been sent out successfully.');
} catch (error) {
console.error('Failed to send coffee chat invitations:', error);
await interaction.reply('There was an error sending out coffee chat invitations.');
}
},
};
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js');
const coffeeChatScheduler = require('../../tasks/coffeeChatScheduler');

module.exports = {
data: new SlashCommandBuilder()
.setName('send-invitations')
.setDescription('Manually send out coffee chat invitations to opted-in members.')
.setDefaultMemberPermissions(PermissionFlagsBits.ModerateMembers),
async execute(interaction) {
const client = interaction.client;

try {
await coffeeChatScheduler.execute(client);
await interaction.reply('Coffee chat invitations have been sent out successfully.');
} catch (error) {
console.error('Failed to send coffee chat invitations:', error);
await interaction.reply('There was an error sending out coffee chat invitations.');
}
},
};
35 replies
DIAdiscord.js - Imagine an app
Created by SowerofSystems on 8/10/2024 in #djs-questions
Reaction Collector not collecting reactions in DMs
35 replies
DIAdiscord.js - Imagine an app
Created by SowerofSystems on 8/10/2024 in #djs-questions
Reaction Collector not collecting reactions in DMs
I have now updated to 14.15.3, it still isn't responding. I have made a few adjustments to the script while trying to fix this issue, so for reference here is the current code:
35 replies
DIAdiscord.js - Imagine an app
Created by SowerofSystems on 8/10/2024 in #djs-questions
Reaction Collector not collecting reactions in DMs
I still can't figure out why it won't respond
35 replies
DIAdiscord.js - Imagine an app
Created by SowerofSystems on 8/10/2024 in #djs-questions
Reaction Collector not collecting reactions in DMs
35 replies
DIAdiscord.js - Imagine an app
Created by SowerofSystems on 8/10/2024 in #djs-questions
Reaction Collector not collecting reactions in DMs
Here is the full code before the collector:
35 replies
DIAdiscord.js - Imagine an app
Created by SowerofSystems on 8/10/2024 in #djs-questions
Reaction Collector not collecting reactions in DMs
I see, the message is defined here:
const message = await member.send('Would you like to participate in this week\'s coffee chat? React with 👍 for "yes" or 👎 for "no".');
const message = await member.send('Would you like to participate in this week\'s coffee chat? React with 👍 for "yes" or 👎 for "no".');
35 replies
DIAdiscord.js - Imagine an app
Created by SowerofSystems on 8/10/2024 in #djs-questions
Reaction Collector not collecting reactions in DMs
Message sent: <ref *1> Message {
channelId: '1190269311462412358',
guildId: null,
id: '1273010475734667338',
createdTimestamp: 1723579748806,
type: 0,
system: false,
content: `Would you like to participate in this week's coffee chat? React with 👍 for "yes" or 👎 for "no".`,
author: ClientUser {
id: '1188092579821137920',
bot: true,
system: false,
flags: UserFlagsBitField { bitfield: 0 },
username: 'Blenda_dev',
globalName: null,
discriminator: '4331',
avatar: 'bcc87f22fdf38cd4510c740dc45094bd',
banner: null,
accentColor: null,
avatarDecoration: null,
verified: true,
mfaEnabled: true
},
pinned: false,
tts: false,
nonce: null,
embeds: [],
components: [],
attachments: Collection(0) [Map] {},
stickers: Collection(0) [Map] {},
position: null,
roleSubscriptionData: null,
resolved: null,
editedTimestamp: null,
reactions: ReactionManager { message: [Circular *1] },
mentions: MessageMentions {
everyone: false,
users: Collection(0) [Map] {},
roles: Collection(0) [Map] {},
_members: null,
_channels: null,
_parsedUsers: null,
crosspostedChannels: Collection(0) [Map] {},
repliedUser: null
},
webhookId: null,
groupActivityApplication: null,
applicationId: null,
activity: null,
flags: MessageFlagsBitField { bitfield: 0 },
reference: null,
interaction: null,
poll: null
}
Message sent: <ref *1> Message {
channelId: '1190269311462412358',
guildId: null,
id: '1273010475734667338',
createdTimestamp: 1723579748806,
type: 0,
system: false,
content: `Would you like to participate in this week's coffee chat? React with 👍 for "yes" or 👎 for "no".`,
author: ClientUser {
id: '1188092579821137920',
bot: true,
system: false,
flags: UserFlagsBitField { bitfield: 0 },
username: 'Blenda_dev',
globalName: null,
discriminator: '4331',
avatar: 'bcc87f22fdf38cd4510c740dc45094bd',
banner: null,
accentColor: null,
avatarDecoration: null,
verified: true,
mfaEnabled: true
},
pinned: false,
tts: false,
nonce: null,
embeds: [],
components: [],
attachments: Collection(0) [Map] {},
stickers: Collection(0) [Map] {},
position: null,
roleSubscriptionData: null,
resolved: null,
editedTimestamp: null,
reactions: ReactionManager { message: [Circular *1] },
mentions: MessageMentions {
everyone: false,
users: Collection(0) [Map] {},
roles: Collection(0) [Map] {},
_members: null,
_channels: null,
_parsedUsers: null,
crosspostedChannels: Collection(0) [Map] {},
repliedUser: null
},
webhookId: null,
groupActivityApplication: null,
applicationId: null,
activity: null,
flags: MessageFlagsBitField { bitfield: 0 },
reference: null,
interaction: null,
poll: null
}
35 replies
DIAdiscord.js - Imagine an app
Created by SowerofSystems on 8/10/2024 in #djs-questions
Reaction Collector not collecting reactions in DMs
My bot DMs the user, and I need to capture their reaction so that I can record whether they are interested this week.
35 replies
DIAdiscord.js - Imagine an app
Created by SowerofSystems on 8/10/2024 in #djs-questions
Reaction Collector not collecting reactions in DMs
Adding that didn't solve the issue. It's still not recognizing when I react to the message
35 replies
DIAdiscord.js - Imagine an app
Created by SowerofSystems on 8/10/2024 in #djs-questions
Reaction Collector not collecting reactions in DMs
I guess I don't really need guild intents, eh?
35 replies
DIAdiscord.js - Imagine an app
Created by SowerofSystems on 8/10/2024 in #djs-questions
Reaction Collector not collecting reactions in DMs
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.DirectMessageReactions
],
partials: [Partials.Message, Partials.Channel, Partials.Reaction, Partials.User]
});
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.DirectMessageReactions
],
partials: [Partials.Message, Partials.Channel, Partials.Reaction, Partials.User]
});
35 replies
DIAdiscord.js - Imagine an app
Created by SowerofSystems on 8/10/2024 in #djs-questions
Reaction Collector not collecting reactions in DMs
Is this what you're saying?
const { Client, GatewayIntentBits, Partials } = require('discord.js');
const { Database } = require('djsbotbuilder');

const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions
],
partials: [Partials.Message, Partials.Channel, Partials.Reaction, Partials.User]
});
const { Client, GatewayIntentBits, Partials } = require('discord.js');
const { Database } = require('djsbotbuilder');

const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions
],
partials: [Partials.Message, Partials.Channel, Partials.Reaction, Partials.User]
});
35 replies
DIAdiscord.js - Imagine an app
Created by SowerofSystems on 8/10/2024 in #djs-questions
Reaction Collector not collecting reactions in DMs
what do you mean?
35 replies
DIAdiscord.js - Imagine an app
Created by SowerofSystems on 8/10/2024 in #djs-questions
Reaction Collector not collecting reactions in DMs
35 replies