示例#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);
                    }
                }
            }
        }