コード例 #1
0
        public static int ProcessPrivateMessage(int subType, int sendTime, long fromQQ, string msg, int font)
        {
            PrivateMessageFromType privateMessageFromType;

            switch (subType)
            {
            case 11:
                privateMessageFromType = PrivateMessageFromType.Friend;
                break;

            case 1:
                privateMessageFromType = PrivateMessageFromType.Online;
                break;

            case 2:
                privateMessageFromType = PrivateMessageFromType.Group;
                break;

            case 3:
                privateMessageFromType = PrivateMessageFromType.DiscussGroup;
                break;

            default:
                privateMessageFromType = PrivateMessageFromType.Unknown;
                break;
            }
            PluginInstanceManager.GetInstance().SendCommand(new PrivateMessageCommand
            {
                PrivateMessageFromType = privateMessageFromType,
                FormNum  = fromQQ,
                Message  = msg,
                SendTime = ConvertToDatetime(sendTime),
            });
            return(0);
        }
コード例 #2
0
        public static int ProcessGroupMemberIncrease(int subType, int sendTime, long fromGroup, long fromQQ,
                                                     long target)
        {
            GroupMemberIncreasedReason reason;

            switch (subType)
            {
            case 1:
                reason = GroupMemberIncreasedReason.AdminAllowed;
                break;

            case 2:
                reason = GroupMemberIncreasedReason.GroupMemberInvitated;
                break;

            default:
                reason = GroupMemberIncreasedReason.Unknow;
                break;
            }
            PluginInstanceManager.GetInstance().SendCommand(new GroupMemberIncreasedCommand
            {
                SendTime  = ConvertToDatetime(sendTime),
                ToQq      = target,
                FromGroup = fromGroup,
                FromQq    = fromQQ,
                GroupMemberIncreasedReason = reason,
            });
            return(0);
        }
コード例 #3
0
        public static int ProcessJoinGroupRequest(int subType, int sendTime, long fromGroup, long fromQQ, string msg,
                                                  string responseMark)
        {
            switch (subType)
            {
            case 1:     //管理员收到入群申请
                PluginInstanceManager.GetInstance().SendCommand(new GroupJoiningRequestCommand
                {
                    SendTime = ConvertToDatetime(sendTime),
                    FromQq   = fromQQ,
                    ToGroup  = fromGroup,
                    Message  = msg,
                    GroupJoiningRequestId = responseMark,
                });
                break;

            case 2:     //收到加群邀请
                PluginInstanceManager.GetInstance().SendCommand(new GroupJoiningInvitationCommand
                {
                    SendTime = ConvertToDatetime(sendTime),
                    FromQq   = fromQQ,
                    ToGroup  = fromGroup,
                    Message  = msg,
                    GroupJoiningInvitationId = responseMark,
                });
                break;

            default:
                break;
            }
            return(0);
        }
コード例 #4
0
 public static int Initialize(int authcode)
 {
     PluginInstanceManager.GetInstance().SendCommand(new InitializeCommand
     {
         AuthCode = authcode
     });
     return(0);
 }
コード例 #5
0
 public static int ProcessFriendsAdded(int subType, int sendTime, long fromQQ)
 {
     PluginInstanceManager.GetInstance().SendCommand(new FriendsAddedCommand
     {
         SendTime = ConvertToDatetime(sendTime),
         FromQq   = fromQQ
     });
     return(0);
 }
コード例 #6
0
 public static int ProcessAddFriendRequest(int subType, int sendTime, long fromQQ, string msg, int font)
 {
     PluginInstanceManager.GetInstance().SendCommand(new AddFriendRequestCommand
     {
         SendTime = ConvertToDatetime(sendTime),
         FromQq   = fromQQ,
         Message  = msg
     });
     return(0);
 }
コード例 #7
0
 public static int ProcessGroupAdminChange(int subType, int sendTime, long fromGroup, long target)
 {
     PluginInstanceManager.GetInstance().SendCommand(new GroupAdminChangeCommand
     {
         SendTime             = ConvertToDatetime(sendTime),
         GroupAdminChangeType = subType == 1 ? GroupAdminChangeType.Disabled : GroupAdminChangeType.Enabled,
         ToQq      = target,
         FromGroup = fromGroup
     });
     return(0);
 }
コード例 #8
0
 public static int ProcessGroupUpload(int subType, int sendTime, long fromGroup, long fromQQ, string file)
 {
     PluginInstanceManager.GetInstance().SendCommand(new GroupUploadedCommand
     {
         SendTime = ConvertToDatetime(sendTime),
         GroupNum = fromGroup,
         FromQq   = fromQQ,
         File     = file
     });
     return(0);
 }
コード例 #9
0
 public static int ProcessDiscussGroupMessage(int subType, int sendTime, long fromDiscuss, long fromQQ,
                                              string msg,
                                              int font)
 {
     PluginInstanceManager.GetInstance().SendCommand(new DiscussGroupMessageCommand()
     {
         SendTime        = ConvertToDatetime(sendTime),
         Message         = msg,
         DiscussGroupNum = fromDiscuss,
         FromQq          = fromQQ,
     });
     return(0);
 }
コード例 #10
0
 public static int CoolQExited()
 {
     PluginInstanceManager.GetInstance().SendCommand(new CoolQExitedCommand());
     return(0);
 }
コード例 #11
0
        public static string AppInfo()
        {
            var re = PluginInstanceManager.GetInstance().SendCommand <AppInfoCommandResult>(new AppInfoCommand());

            return($"{CoolApiVersion},{re.AppId}".ToLowerInvariant());
        }
コード例 #12
0
 public static int Disabled()
 {
     PluginInstanceManager.GetInstance().SendCommand(new DisabledCommand());
     return(0);
 }