Skip to content

Determining a Message's ChannelType #1319

Answered by DitchTurtL
DitchTurtL asked this question in Q&A
Discussion options

You must be logged in to vote

We can call the Channel function on the local session variable in messageCreate(session, message).
That will return a reference to the channel where we can get (int)Type and compare to the ChannelType constant to determine the message type.

st, err := s.Channel(m.ChannelID)
st.Type != discordgo.ChannelTypeDM

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
3 replies
@DitchTurtL
Comment options

@Nv7-GitHub
Comment options

@DitchTurtL
Comment options

Comment options

You must be logged in to vote
2 replies
@Vasyanhik

This comment has been minimized.

@Vasyanhik

This comment has been minimized.

Answer selected by DitchTurtL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants