Channels
Last updated
Was this helpful?
Last updated
Was this helpful?
Anarchy has multiple channel classes to match the data for the different types of Discord channels (DM, Group, Text, etc.).
PrivateChannel: For any private channel; DM or Group.
DiscordGroup: Only for groups.
GuildChannel: For all channels within a guild.
TextChannel: For guild text channels. News and Store channels also fall under this.
VoiceChannel: For guild voice channels.
Aside from these, the minimal objects MinimalChannel and MinimalTextChannel also exist.
Messages can be sent through Text, News, Store, DM and Group channels.
Consider the following .
All of the 3 .SendMessage() calls above are valid, because there's either supplied a message or an embed.
This will supress the embed in your message, making it look like the reaction is the message itself ;).
Unfortunately, the channel types that allow messages don't exactly follow Anarchy's channel type hierarchy. Therefore, the IMessageChannel interface exists. This means that you could, for example, create a method that accepts an IMessageChannel to include both guild and private text channels. The MinimalTextChannel (which is used instead of MinimalChannel whenever the type is known to allow messages) class also inherits this interface.