Skip to content
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

"You are opening direct messages too fast" error #43

Open
napindc opened this issue Dec 16, 2024 · 3 comments
Open

"You are opening direct messages too fast" error #43

napindc opened this issue Dec 16, 2024 · 3 comments

Comments

@napindc
Copy link

napindc commented Dec 16, 2024

I am using the SnowTransfer library and using the method snowTransfer.channel.createMessage(channelId, message)

This works fine when sending several DMs at once, but when I want to send a few dozen at once, Discord will give an error of "You are opening direct messages too fast"

Is there some way around this error? I didn't see anything in Discords docs about this. i do see the "bots can only use 50 API requests a second", but not sure if this counts underSnow Transfer library counts under bot usage rate limits

@PapiOphidian
Copy link
Collaborator

PapiOphidian commented Dec 17, 2024

Hi. Thanks for bringing this up. Did you happen to enable the bypassBuckets Client option? This isn't a suggestion to do so, I'm just curious as there is a rate limit to how often you can create direct messages and if there's an issue with the rate limiter in snow, I need to fix it

@napindc
Copy link
Author

napindc commented Dec 17, 2024

@PapiOphidian I'm not doing any special configuration, Just as vanilla as it can get . Can see the rough code below. Is there some way I can look at the headers to see what the rate limits are ... Or should I wait for a new update. Our bot is about to go live and it messages a lot of people that opted in. Just want to make sure they receive super super speedy notifications... And that we would not get our bot banned

private static snowTransfer = new SnowTransfer(discordBotToken)

static getUser(discordId: string): Promise {
return this.snowTransfer.user.getUser(discordId)
}

const dm = await this.snowTransfer.user.createDirectMessageChannel(discordId)

this.snowTransfer.channel.createMessage(channelId, message)

@PapiOphidian
Copy link
Collaborator

I think I understand the situation. I believe Discord added countermeasures against this type of behavior as this could be considered as unwanted advertisement/scamming which is what they're trying to counteract. I do not know if this error follows with the rate limits, but I am asking in the DDevs server to get confirmation.

As for what I would do RIGHT NOW, I would make it so that users have to opt in by messaging your bot through DMs. You should also be caching the channel IDs of their DM channels otherwise you will have to hit the create DM channel endpoint each time you want to message them. If the users message your bot in DMs, you can get the channel ID without having to hit the create DM endpoint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants