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

GuildId is missing in SocketDiscordClient.MessageDeleted event #2863

Open
bakirov-eldar opened this issue Feb 24, 2024 · 3 comments
Open

GuildId is missing in SocketDiscordClient.MessageDeleted event #2863

bakirov-eldar opened this issue Feb 24, 2024 · 3 comments

Comments

@bakirov-eldar
Copy link

image

public event Func<Cacheable<IMessage, ulong>, Cacheable<IMessageChannel, ulong>, Task> MessageDeleted

How can i get GuildId from this event?

@Misha-133
Copy link
Member

  • Get the channel (call GetOrDownloadAsync() on the cacheable)
  • check whether the channel is a guild channel (if (channel is IGuildChannel guildChannel))
  • guildChannel.GuildId

@bakirov-eldar
Copy link
Author

  • Get the channel (call GetOrDownloadAsync() on the cacheable)
  • check whether the channel is a guild channel (if (channel is IGuildChannel guildChannel))
  • guildChannel.GuildId

Why would I need to load additional data if I just want to get the guild ID directly from the API event?

@Misha-133
Copy link
Member

That's a good question, but changing it at this point would be a breaking change.
And most likely you have the channel cached already, so it won't download any additional data

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