-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
!am User not adding in user #7
Comments
Hey, thanks for putting in the issue, please output the full error (including stack trace) in the issue description, and I can take a look. Thanks. |
|
And just to confirm, do you have a .env file with DISCORD_TOKEN, and MONGO_URI? Apologies for not mentioning this in the README. |
No no it's pretty evident. You had a sample.env anyways... I do have mine
configured with the bot token and mongo uri.. Because I am also able to get
some commands working and getting reply from bot.. Like !help for
example...
…On Sat, 16 Jul, 2022, 7:15 pm Navinn Ravindaran, ***@***.***> wrote:
And just to confirm, do you have a .env file with DISCORD_TOKEN, and
MONGO_URI? Apologies for not mentioning this in the README.
—
Reply to this email directly, view it on GitHub
<#7 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEWOZL3FTCSI7RUHJ3XIIKTVUK4F5ANCNFSM53V7CV3Q>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
The standupModel
.findById(message.guild.id)
.then((standup) => {
args.forEach((mention) => {
if (mention.startsWith("<@") && mention.endsWith(">")) {
mention = mention.slice(2, -1);
if (mention.startsWith("!")) mention = mention.slice(1);
const member = message.guild.members.cache.get(mention);
console.log(standup);
if (member && standup.members.indexOf(member.id) == -1)
standup.members.push(member.id);
console.log(standup);
}
}); This is the error that returns in the console:
Within the code, the error that returns on the server is this second standup
.save()
.then(() => message.channel.send("Members updated :tada:"))
.catch((err) => {
console.err(err);
message.channel.send(
"Oh no :scream:! An error occured somewhere in the matrix!"
);
});
})
.catch((err) => {
console.error(err);
message.channel.send(
"Oh no :scream:! An error occured somewhere in the matrix!2222" // This one is returned
);
});
},
}; Is there someway to fix that by getting it recognise the |
Hey @Fiddler46, thanks for the explanation. The guild id should have been present in the database at that point, as when the bot is added to a new guild, we create a new document as shown here bot.on("guildCreate", async (guild) => {
//...
// creates the database model
const newStandup = new standupModel({
_id: guild.id,
channelId: channel.id,
members: [],
responses: new Map(),
});
//...
await channel.send(standupIntroMessage);
}); So, followup question: When you add the bot to the server, do you see the Unfortunately I'm quite busy at the moment, so I do not have time to investigate further. It would be great if anyone could take this and submit a PR. I'd be happy to review it. Please let me know if there are other questions regarding this issue, thanks. |
TypeError: Cannot read properties of null (reading 'members')
Passing in user as
!am <@user_id>
The text was updated successfully, but these errors were encountered: