예제 #1
0
 private async Task DiscordShardedClientOnReactionAdded(Cacheable <IUserMessage, ulong> arg1, ISocketMessageChannel arg2, SocketReaction arg3)
 {
     if (ReactionAdded != null)
     {
         await ReactionAdded.Invoke(this, arg1, arg2, arg3).ConfigureAwait(false);
     }
 }
예제 #2
0
 /// <summary>
 /// Will be fired when a reaction was added
 /// </summary>
 /// <param name="reaction"></param>
 internal Task OnReactionAddedAsync(Reaction reaction)
 {
     LoggerFactory.CreateLogger(GetType().FullName).LogTrace($"Reaction was added: {reaction.Content}");
     return(ReactionAdded != null
         ? ReactionAdded.Invoke(reaction)
         : Task.CompletedTask);
 }
예제 #3
0
        private void Socket_DataReceived(object sender, dynamic data)
        {
            var type = data.Value <string>("type");

            switch (type)//todo more from https://api.slack.com/rtm
            {
            case "message":
            case "message.channels":
            case "message.groups":
            case "message.im":
            case "message.mpim":
                MessageReceived?.Invoke(this, new MessageReceivedEventArgs(MakeMessageFromData(data)));
                break;

            case "reaction_added":
                ReactionAdded?.Invoke(this, GetReactionAddedEventArgs(data));
                break;

            case "reaction_removed":
                ReactionRemoved?.Invoke(this, GetReactionAddedEventArgs(data));
                break;

            case "star_added":
                StarAdded?.Invoke(this, GetReactionAddedEventArgs(data));
                break;

            case "star_removed":
                StarRemoved?.Invoke(this, GetReactionAddedEventArgs(data));
                break;

            case "pin_added":
                PinAdded?.Invoke(this, GetReactionAddedEventArgs(data));
                break;

            case "pin_removed":
                PinRemoved?.Invoke(this, GetReactionAddedEventArgs(data));
                break;

            case "team_join":
                UserJoined?.Invoke(this, new UserDataReceivedEventArgs(Team.Users.FirstOrDefault(x => x.Id == data.Value <string>("user")), null, Team));
                break;

            case "user_typing":
                UserTyping?.Invoke(this, new UserDataReceivedEventArgs(Team.Users.FirstOrDefault(x => x.Id == data.Value <string>("user")),
                                                                       Team.Channels.FirstOrDefault(x => x.Id == data.Value <string>("channel")), Team));
                break;

            case "presence_change":
                UserPresenceChanged?.Invoke(this, new UserPresenceChangeEventArgs(data.Value <string>("presence"),
                                                                                  Team.Users.FirstOrDefault(x => x.Id == data.Value <string>("user"))));
                break;
            }
        }
예제 #4
0
 internal async Task OnReactionAdded(Cacheable <IUserMessage, ulong> message, ISocketMessageChannel channel, SocketReaction reaction) => await(ReactionAdded?.Invoke(message, channel, reaction) ?? Task.CompletedTask);
예제 #5
0
 private Task ReactionAddedAsync(Cacheable <IUserMessage, ulong> before, ISocketMessageChannel channel, SocketReaction reaction)
 {
     ReactionAdded?.Invoke(reaction);
     return(Task.CompletedTask);
 }
예제 #6
0
 private async Task ReactionAddedAsync(Cacheable <IUserMessage, ulong> before, ISocketMessageChannel channel, SocketReaction reaction)
 {
     ReactionAdded?.Invoke(reaction);
 }