DiscordAPIError[10070]: Unknown Guild Scheduled Event

I've been working on a bot that handles Guild Scheduled Events. While implementing the GuildScheduledEventDelete event, I ran into the following error while trying to fetch the subscribers.
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[10070]: Unknown Guild Scheduled Event

requestBody: { files: undefined, json: undefined },
rawError: { message: 'Unknown Guild Scheduled Event', code: 10070 },
code: 10070,
status: 404,
method: 'GET',
url: 'https://discord.com/api/v10/guilds/1150519158367334490/scheduled-events/1158664297224863815/users'
}
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[10070]: Unknown Guild Scheduled Event

requestBody: { files: undefined, json: undefined },
rawError: { message: 'Unknown Guild Scheduled Event', code: 10070 },
code: 10070,
status: 404,
method: 'GET',
url: 'https://discord.com/api/v10/guilds/1150519158367334490/scheduled-events/1158664297224863815/users'
}
This is the code I have right now:
const dotenv = require('dotenv');
dotenv.config();

const { Events } = require('discord.js');

module.exports = {
name : Events.GuildScheduledEventDelete,
once: false,
async execute(scheduledEvent) {
if (scheduledEvent.description.includes('Practice')) {
try {
const users = scheduledEvent.fetchSubscribers();
console.log(users);
console.log(typeof users);
} catch (error) {
console.error(error);
}
}
},
};
const dotenv = require('dotenv');
dotenv.config();

const { Events } = require('discord.js');

module.exports = {
name : Events.GuildScheduledEventDelete,
once: false,
async execute(scheduledEvent) {
if (scheduledEvent.description.includes('Practice')) {
try {
const users = scheduledEvent.fetchSubscribers();
console.log(users);
console.log(typeof users);
} catch (error) {
console.error(error);
}
}
},
};
I'm not sure what the error is, any help would be much appreciated.
11 Replies
d.js toolkit
d.js toolkit15mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
duck
duck15mo ago
the event has been deleted there are no subscribers to fetch
bruhbruhbruhwho
bruhbruhbruhwhoOP15mo ago
Is that how it works? What does the GuildScheduledEventDelete event do then? Does it not return the scheduled event as it was right before it was deleted?
duck
duck15mo ago
according to the dapi docs, the event uncharacteristically sends the event's data normally this isn't the case that being said, yes that is still how it works a deleted resource cannot be fetched
bruhbruhbruhwho
bruhbruhbruhwhoOP15mo ago
I see, thanks for your help. Is there a way that you would suggest that I fetch the subscribers once the event is deleted without using that event? Or should I try to find a work around?
duck
duck15mo ago
for what purpose do you need the subscribers to a deleted event?
bruhbruhbruhwho
bruhbruhbruhwhoOP15mo ago
Specifically my program uses Scheduled Events to take attendance for a club. I want to get the subscribers to log it directly onto a Google Sheets, and so for me I thought it would make sense to try and "take attendance" right at the end and then delete the event. Previously I had tracked when each person had been added, but that was a bit too resource intensive.
duck
duck15mo ago
well if your bot is deleting the event, why not just handle this before deleting it?
bruhbruhbruhwho
bruhbruhbruhwhoOP15mo ago
I'm actually not too familiar with events, does it not automatically delete once the scheduled end time is over? I assumed it was like that so I wouldn't have my bot delete it automatically. If that is not the case then I will implement it as you say. Thanks!
duck
duck15mo ago
I mean it does, I was going off of your phrasing "take attendance right at the end and then delete the event" if your bot isn't what's deleting the event, you're free to set some timeout or otherwise scheduled task to attempt to do this a little before the event actually ends though I imagine just the subscribers to the event may not necessarily reflect who actually attends
bruhbruhbruhwho
bruhbruhbruhwhoOP15mo ago
It doesn't but it gives us a rough idea on who will and we can then check in person. I will just use cron to implement the timer in that case. Thanks for your help, I really appreciate it 😀
Want results from more Discord servers?
Add your server