using System; using System.Collections.Generic; using System.Threading.Tasks; namespace Discord.WebSocket { public partial class BaseSocketClient { //Channels /// Fired when a channel is created. /// /// /// This event is fired when a generic channel has been created. The event handler must return a /// and accept a as its parameter. /// /// /// The newly created channel is passed into the event handler parameter. The given channel type may /// include, but not limited to, Private Channels (DM, Group), Guild Channels (Text, Voice, Category); /// see the derived classes of for more details. /// /// /// /// /// public event Func ChannelCreated { add { _channelCreatedEvent.Add(value); } remove { _channelCreatedEvent.Remove(value); } } internal readonly AsyncEvent> _channelCreatedEvent = new AsyncEvent>(); /// Fired when a channel is destroyed. /// /// /// This event is fired when a generic channel has been destroyed. The event handler must return a /// and accept a as its parameter. /// /// /// The destroyed channel is passed into the event handler parameter. The given channel type may /// include, but not limited to, Private Channels (DM, Group), Guild Channels (Text, Voice, Category); /// see the derived classes of for more details. /// /// /// /// /// public event Func ChannelDestroyed { add { _channelDestroyedEvent.Add(value); } remove { _channelDestroyedEvent.Remove(value); } } internal readonly AsyncEvent> _channelDestroyedEvent = new AsyncEvent>(); /// Fired when a channel is updated. /// /// /// This event is fired when a generic channel has been destroyed. The event handler must return a /// and accept 2 as its parameters. /// /// /// The original (prior to update) channel is passed into the first , while /// the updated channel is passed into the second. The given channel type may include, but not limited /// to, Private Channels (DM, Group), Guild Channels (Text, Voice, Category); see the derived classes of /// for more details. /// /// /// /// /// public event Func ChannelUpdated { add { _channelUpdatedEvent.Add(value); } remove { _channelUpdatedEvent.Remove(value); } } internal readonly AsyncEvent> _channelUpdatedEvent = new AsyncEvent>(); //Messages /// Fired when a message is received. /// /// /// This event is fired when a message is received. The event handler must return a /// and accept a as its parameter. /// /// /// The message that is sent to the client is passed into the event handler parameter as /// . This message may be a system message (i.e. /// ) or a user message (i.e. . See the /// derived classes of for more details. /// /// /// /// The example below checks if the newly received message contains the target user. /// /// public event Func MessageReceived { add { _messageReceivedEvent.Add(value); } remove { _messageReceivedEvent.Remove(value); } } internal readonly AsyncEvent> _messageReceivedEvent = new AsyncEvent>(); /// Fired when a message is deleted. /// /// /// This event is fired when a message is deleted. The event handler must return a /// and accept a and /// as its parameters. /// /// /// /// It is not possible to retrieve the message via /// ; the message cannot be retrieved by Discord /// after the message has been deleted. /// /// If caching is enabled via , the /// entity will contain the deleted message; otherwise, in event /// that the message cannot be retrieved, the snowflake ID of the message is preserved in the /// . /// /// /// The source channel of the removed message will be passed into the /// parameter. /// /// /// /// /// public event Func, ISocketMessageChannel, Task> MessageDeleted { add { _messageDeletedEvent.Add(value); } remove { _messageDeletedEvent.Remove(value); } } internal readonly AsyncEvent, ISocketMessageChannel, Task>> _messageDeletedEvent = new AsyncEvent, ISocketMessageChannel, Task>>(); /// Fired when multiple messages are bulk deleted. /// /// /// The event will not be fired for individual messages contained in this event. /// /// /// This event is fired when multiple messages are bulk deleted. The event handler must return a /// and accept an and /// as its parameters. /// /// /// /// It is not possible to retrieve the message via /// ; the message cannot be retrieved by Discord /// after the message has been deleted. /// /// If caching is enabled via , the /// entity will contain the deleted message; otherwise, in event /// that the message cannot be retrieved, the snowflake ID of the message is preserved in the /// . /// /// /// The source channel of the removed message will be passed into the /// parameter. /// /// public event Func>, ISocketMessageChannel, Task> MessagesBulkDeleted { add { _messagesBulkDeletedEvent.Add(value); } remove { _messagesBulkDeletedEvent.Remove(value); } } internal readonly AsyncEvent>, ISocketMessageChannel, Task>> _messagesBulkDeletedEvent = new AsyncEvent>, ISocketMessageChannel, Task>>(); /// Fired when a message is updated. /// /// /// This event is fired when a message is updated. The event handler must return a /// and accept a , , /// and as its parameters. /// /// /// If caching is enabled via , the /// entity will contain the original message; otherwise, in event /// that the message cannot be retrieved, the snowflake ID of the message is preserved in the /// . /// /// /// The updated message will be passed into the parameter. /// /// /// The source channel of the updated message will be passed into the /// parameter. /// /// public event Func, SocketMessage, ISocketMessageChannel, Task> MessageUpdated { add { _messageUpdatedEvent.Add(value); } remove { _messageUpdatedEvent.Remove(value); } } internal readonly AsyncEvent, SocketMessage, ISocketMessageChannel, Task>> _messageUpdatedEvent = new AsyncEvent, SocketMessage, ISocketMessageChannel, Task>>(); /// Fired when a reaction is added to a message. /// /// /// This event is fired when a reaction is added to a user message. The event handler must return a /// and accept a , an /// , and a as its parameter. /// /// /// If caching is enabled via , the /// entity will contain the original message; otherwise, in event /// that the message cannot be retrieved, the snowflake ID of the message is preserved in the /// . /// /// /// The source channel of the reaction addition will be passed into the /// parameter. /// /// /// The reaction that was added will be passed into the parameter. /// /// /// When fetching the reaction from this event, a user may not be provided under /// . Please see the documentation of the property for more /// information. /// /// /// /// /// public event Func, ISocketMessageChannel, SocketReaction, Task> ReactionAdded { add { _reactionAddedEvent.Add(value); } remove { _reactionAddedEvent.Remove(value); } } internal readonly AsyncEvent, ISocketMessageChannel, SocketReaction, Task>> _reactionAddedEvent = new AsyncEvent, ISocketMessageChannel, SocketReaction, Task>>(); /// Fired when a reaction is removed from a message. public event Func, ISocketMessageChannel, SocketReaction, Task> ReactionRemoved { add { _reactionRemovedEvent.Add(value); } remove { _reactionRemovedEvent.Remove(value); } } internal readonly AsyncEvent, ISocketMessageChannel, SocketReaction, Task>> _reactionRemovedEvent = new AsyncEvent, ISocketMessageChannel, SocketReaction, Task>>(); /// Fired when all reactions to a message are cleared. public event Func, ISocketMessageChannel, Task> ReactionsCleared { add { _reactionsClearedEvent.Add(value); } remove { _reactionsClearedEvent.Remove(value); } } internal readonly AsyncEvent, ISocketMessageChannel, Task>> _reactionsClearedEvent = new AsyncEvent, ISocketMessageChannel, Task>>(); /// /// Fired when all reactions to a message with a specific emote are removed. /// /// /// /// This event is fired when all reactions to a message with a specific emote are removed. /// The event handler must return a and accept a and /// a as its parameters. /// /// /// The channel where this message was sent will be passed into the parameter. /// /// /// The emoji that all reactions had and were removed will be passed into the parameter. /// /// public event Func, ISocketMessageChannel, IEmote, Task> ReactionsRemovedForEmote { add { _reactionsRemovedForEmoteEvent.Add(value); } remove { _reactionsRemovedForEmoteEvent.Remove(value); } } internal readonly AsyncEvent, ISocketMessageChannel, IEmote, Task>> _reactionsRemovedForEmoteEvent = new AsyncEvent, ISocketMessageChannel, IEmote, Task>>(); //Roles /// Fired when a role is created. public event Func RoleCreated { add { _roleCreatedEvent.Add(value); } remove { _roleCreatedEvent.Remove(value); } } internal readonly AsyncEvent> _roleCreatedEvent = new AsyncEvent>(); /// Fired when a role is deleted. public event Func RoleDeleted { add { _roleDeletedEvent.Add(value); } remove { _roleDeletedEvent.Remove(value); } } internal readonly AsyncEvent> _roleDeletedEvent = new AsyncEvent>(); /// Fired when a role is updated. public event Func RoleUpdated { add { _roleUpdatedEvent.Add(value); } remove { _roleUpdatedEvent.Remove(value); } } internal readonly AsyncEvent> _roleUpdatedEvent = new AsyncEvent>(); //Guilds /// Fired when the connected account joins a guild. public event Func JoinedGuild { add { _joinedGuildEvent.Add(value); } remove { _joinedGuildEvent.Remove(value); } } internal readonly AsyncEvent> _joinedGuildEvent = new AsyncEvent>(); /// Fired when the connected account leaves a guild. public event Func LeftGuild { add { _leftGuildEvent.Add(value); } remove { _leftGuildEvent.Remove(value); } } internal readonly AsyncEvent> _leftGuildEvent = new AsyncEvent>(); /// Fired when a guild becomes available. public event Func GuildAvailable { add { _guildAvailableEvent.Add(value); } remove { _guildAvailableEvent.Remove(value); } } internal readonly AsyncEvent> _guildAvailableEvent = new AsyncEvent>(); /// Fired when a guild becomes unavailable. public event Func GuildUnavailable { add { _guildUnavailableEvent.Add(value); } remove { _guildUnavailableEvent.Remove(value); } } internal readonly AsyncEvent> _guildUnavailableEvent = new AsyncEvent>(); /// Fired when offline guild members are downloaded. public event Func GuildMembersDownloaded { add { _guildMembersDownloadedEvent.Add(value); } remove { _guildMembersDownloadedEvent.Remove(value); } } internal readonly AsyncEvent> _guildMembersDownloadedEvent = new AsyncEvent>(); /// Fired when a guild is updated. public event Func GuildUpdated { add { _guildUpdatedEvent.Add(value); } remove { _guildUpdatedEvent.Remove(value); } } internal readonly AsyncEvent> _guildUpdatedEvent = new AsyncEvent>(); //Users /// Fired when a user joins a guild. public event Func UserJoined { add { _userJoinedEvent.Add(value); } remove { _userJoinedEvent.Remove(value); } } internal readonly AsyncEvent> _userJoinedEvent = new AsyncEvent>(); /// Fired when a user leaves a guild. public event Func UserLeft { add { _userLeftEvent.Add(value); } remove { _userLeftEvent.Remove(value); } } internal readonly AsyncEvent> _userLeftEvent = new AsyncEvent>(); /// Fired when a user is banned from a guild. public event Func UserBanned { add { _userBannedEvent.Add(value); } remove { _userBannedEvent.Remove(value); } } internal readonly AsyncEvent> _userBannedEvent = new AsyncEvent>(); /// Fired when a user is unbanned from a guild. public event Func UserUnbanned { add { _userUnbannedEvent.Add(value); } remove { _userUnbannedEvent.Remove(value); } } internal readonly AsyncEvent> _userUnbannedEvent = new AsyncEvent>(); /// Fired when a user is updated. public event Func UserUpdated { add { _userUpdatedEvent.Add(value); } remove { _userUpdatedEvent.Remove(value); } } internal readonly AsyncEvent> _userUpdatedEvent = new AsyncEvent>(); /// Fired when a guild member is updated, or a member presence is updated. public event Func GuildMemberUpdated { add { _guildMemberUpdatedEvent.Add(value); } remove { _guildMemberUpdatedEvent.Remove(value); } } internal readonly AsyncEvent> _guildMemberUpdatedEvent = new AsyncEvent>(); /// Fired when a user joins, leaves, or moves voice channels. public event Func UserVoiceStateUpdated { add { _userVoiceStateUpdatedEvent.Add(value); } remove { _userVoiceStateUpdatedEvent.Remove(value); } } internal readonly AsyncEvent> _userVoiceStateUpdatedEvent = new AsyncEvent>(); /// Fired when the bot connects to a Discord voice server. public event Func VoiceServerUpdated { add { _voiceServerUpdatedEvent.Add(value); } remove { _voiceServerUpdatedEvent.Remove(value); } } internal readonly AsyncEvent> _voiceServerUpdatedEvent = new AsyncEvent>(); /// Fired when the connected account is updated. public event Func CurrentUserUpdated { add { _selfUpdatedEvent.Add(value); } remove { _selfUpdatedEvent.Remove(value); } } internal readonly AsyncEvent> _selfUpdatedEvent = new AsyncEvent>(); /// Fired when a user starts typing. public event Func UserIsTyping { add { _userIsTypingEvent.Add(value); } remove { _userIsTypingEvent.Remove(value); } } internal readonly AsyncEvent> _userIsTypingEvent = new AsyncEvent>(); /// Fired when a user joins a group channel. public event Func RecipientAdded { add { _recipientAddedEvent.Add(value); } remove { _recipientAddedEvent.Remove(value); } } internal readonly AsyncEvent> _recipientAddedEvent = new AsyncEvent>(); /// Fired when a user is removed from a group channel. public event Func RecipientRemoved { add { _recipientRemovedEvent.Add(value); } remove { _recipientRemovedEvent.Remove(value); } } internal readonly AsyncEvent> _recipientRemovedEvent = new AsyncEvent>(); } }