예제 #1
0
 public void Invite(SkypeCommander.Command cmd)
 {
     if (SkypeCommands.IsMod(cmd.SenderMember))
     {
         cmd.Chat.AddMembers(new UserCollection {
             SkypeCommands.GetUser(cmd.ArgumentsText)
         });
     }
 }
예제 #2
0
        public void Kick(SkypeCommander.Command cmd)
        {
            if (SkypeCommands.IsMod(cmd.SenderMember) && cmd.HasArguments)
            {
                var member = GetMemberByPartial(cmd.ChatMembersUsers, cmd.ArgumentsText);

                if (member != null)
                {
                    cmd.Message.Chat.Kick(member.Handle);
                }
            }
        }
예제 #3
0
        public void SetRole(SkypeCommander.Command cmd)
        {
            if (SkypeCommands.IsMod(cmd.SenderMember) && cmd.Arguments.Length > 1)
            {
                var role = cmd.Arguments[1].ToLower();

                var member = GetMemberByPartial(cmd.ChatMembersUsers, cmd.Arguments[0]);

                if (member != null)
                {
                    bool roleFound     = false;
                    var  currentMember = GetCurrentMember(cmd.ChatMembers);

                    switch (role)
                    {
                    case "helper":
                        if (currentMember.CanSetRoleTo(TChatMemberRole.chatMemberRoleHelper))
                        {
                            if (member.Role != TChatMemberRole.chatMemberRoleHelper)
                            {
                                member.Role = TChatMemberRole.chatMemberRoleHelper;
                                roleFound   = true;
                            }
                        }
                        break;

                    case "listener":
                        if (currentMember.CanSetRoleTo(TChatMemberRole.chatMemberRoleListener))
                        {
                            if (member.Role != TChatMemberRole.chatMemberRoleListener)
                            {
                                member.Role = TChatMemberRole.chatMemberRoleListener;
                                roleFound   = true;
                            }
                        }
                        break;

                    case "master":
                        if (currentMember.CanSetRoleTo(TChatMemberRole.chatMemberRoleMaster))
                        {
                            if (member.Role != TChatMemberRole.chatMemberRoleMaster)
                            {
                                member.Role = TChatMemberRole.chatMemberRoleMaster;
                                roleFound   = true;
                            }
                        }
                        break;

                    case "user":
                        if (currentMember.CanSetRoleTo(TChatMemberRole.chatMemberRoleUser))
                        {
                            if (member.Role != TChatMemberRole.chatMemberRoleUser)
                            {
                                member.Role = TChatMemberRole.chatMemberRoleUser;
                                roleFound   = true;
                            }
                        }
                        break;
                    }

                    if (roleFound)
                    {
                        cmd.ReplyChat(member.Handle + " promoted to " + role);
                    }
                }
            }
        }