示例#1
0
 public GroupMessageEvent(
     IMahuaApi mahuaApi
     , QQRobotService qqRobotService)
 {
     _mahuaApi       = mahuaApi;
     _qqRobotService = qqRobotService;
 }
示例#2
0
 public DiscussMessageDone(
     IMahuaApi mahuaApi,
     IQqLightMessage message)
 {
     _mahuaApi = mahuaApi;
     _message  = message;
 }
 public Livegirl(
     IMahuaApi mahuaApi,
     ILiveRoom liveRoom)
 {
     _mahuaApi = mahuaApi;
     _liveRoom = liveRoom;
 }
 public GroupMessageDone(
     IMahuaApi mahuaApi,
     IAmandaMessage message)
 {
     _mahuaApi = mahuaApi;
     _message  = message;
 }
示例#5
0
        /// <summary>
        /// 禁言某人
        /// </summary>
        /// <param name="fromqq"></param>
        /// <param name="banqq"></param>
        /// <param name="group"></param>
        /// <param name="_mahuaApi"></param>
        /// <returns></returns>
        public static string BanSomebody(string fromqq, string banqq, string group, IMahuaApi _mahuaApi)
        {
            int    fk  = 0;
            string fks = XmlSolve.xml_get("ban_card", fromqq);

            if (fks != "")
            {
                fk = int.Parse(fks);
            }
            if (fk > 0)
            {
                try
                {
                    Random   ran     = new Random(System.DateTime.Now.Millisecond);
                    int      RandKey = ran.Next(0, 60 + Tools.GetXmlNumber("gift", fromqq));
                    TimeSpan span    = new TimeSpan(0, 0, RandKey, 0);
                    _mahuaApi.BanGroupMember(group, banqq, span);
                    fk--;
                    XmlSolve.del("ban_card", fromqq);
                    XmlSolve.insert("ban_card", fromqq, fk.ToString());

                    return(Tools.At(fromqq) + "\r\n[CQ:emoji,id=128683]已将" + banqq + "禁言" + RandKey + "分钟");
                }
                catch
                {
                    return(Tools.At(fromqq) + "\r\n执行失败。");
                }
            }
            else
            {
                return(Tools.At(fromqq) + "\r\n[CQ:emoji,id=128162]你哪儿有禁言卡?");
            }
        }
 public GroupMessageReceivedMahuaEvent1(
     IMahuaApi mahuaApi, TimerEvent timerEvent)
 {
     _mahuaApi   = mahuaApi;
     _timerEvent = timerEvent;
     _timerEvent.Start();
 }
 public GetAssetEvent(
     IMahuaApi mahuaApi,
     IUserAssetService userAssetService)
     : base(mahuaApi)
 {
     _userAssetService = userAssetService;
 }
示例#8
0
        public TimerEvent(IMahuaApi api)
        {
            _api   = api;
            _timer = new Timer(100);
            var timer = _timer;

            timer.Elapsed += (sender, args) =>
            {
                foreach (var desk in Desk.GetDesks())
                {
                    if (desk.Message != null)
                    {
                        var msg = desk.Message;
                        desk.ClearMessage();
                        _api.SendGroupMessage(desk.DeskId, msg);
                    }

                    foreach (var player in desk.Players.Where(player => player.Message != null))
                    {
                        var msg = player.Message;
                        player.ClearMessage();
                        _api.SendPrivateMessage(player.PlayerId, msg);
                    }
                }
            };
        }
 public GroupMemberIncreasedMahuaEvent1(
     IMahuaApi mahuaApi,
     IFaQuanStorege faQuanStorege)
 {
     _mahuaApi      = mahuaApi;
     _faQuanStorege = faQuanStorege;
 }
 public SetNoticeApiMahuaCommandHandler(
     IMahuaApi mahuaApi,
     IQqGroupApi qqGroupApi)
 {
     _mahuaApi   = mahuaApi;
     _qqGroupApi = qqGroupApi;
 }
 public DiscussMessageDone(
     IMahuaApi mahuaApi,
     IAmandaMessage message)
 {
     _mahuaApi = mahuaApi;
     _message  = message;
 }
示例#12
0
        public InitEvent(
            IMahuaApi mahuaApi, ICoinNewsTimeJob coinNewsTimeJob)
        {
            _mahuaApi = mahuaApi;

            _coinNewsTimeJob = coinNewsTimeJob;
        }
示例#13
0
 public ConfigurationManagerCommandHandler(
     IMahuaAdministration mahuaAdministration,
     IMahuaApi mahuaApi)
 {
     _mahuaAdministration = mahuaAdministration;
     _mahuaApi            = mahuaApi;
 }
示例#14
0
 public PrivateMessageFromFriendReceivedMahuaEvent1(
     ILivegirl livegirl,
     IMahuaApi mahuaApi)
 {
     _mahuaApi = mahuaApi;
     _livegirl = livegirl;
 }
示例#15
0
 public InitializationMahuaEvent(
     IMahuaApi mahuaApi,
     IWebHost webHost)
 {
     _mahuaApi = mahuaApi;
     _webHost  = webHost;
 }
示例#16
0
 public PrivateMessageDone(
     IMahuaApi mahuaApi,
     IMessage message)
 {
     _mahuaApi = mahuaApi;
     _message  = message;
 }
示例#17
0
 public GroupMessageDone(
     IMahuaApi mahuaApi,
     IQqLightMessage message)
 {
     _mahuaApi = mahuaApi;
     _message  = message;
 }
示例#18
0
        public async Task DealMessage(string groupNo, string account)
        {
            try
            {
                var key = CacheConst.GetGroupMsgListKey(groupNo);

                string cacheMsgInfo = await _database.ListLeftPopAsync(key);

                IMahuaApi mahuaApi = null;

                while (!string.IsNullOrWhiteSpace(cacheMsgInfo))
                {
                    mahuaApi = mahuaApi ?? MahuaRobotManager.Instance.CreateSession(account).MahuaApi;

                    GroupItemRes msg = JsonConvert.DeserializeObject <GroupItemRes>(cacheMsgInfo);

                    MahuaApiHelper.SendGroupMsg(mahuaApi, msg, groupNo, account);

                    cacheMsgInfo = await _database.ListLeftPopAsync(key);
                }
            }
            catch (Exception e)
            {
                var str = e.Message;
            }
        }
        private static void PrintStartMessage(string group, PlayGround game, IMahuaApi mahuaApi)
        {
            var message = new StringBuilder("开始游戏!\n");

            message.AppendLine("---------------------------------");
            message.AppendLine("命令列表: (您随时都可以使用/help查看命令)");
            message.AppendLine("   落子: x坐标y坐标(先后顺序不固定,0a和a0效果等同)");
            message.AppendLine("   退出: /ge");
            message.AppendLine("   投降: /gf");
            message.AppendLine("   投票结束: /ve");
            message.AppendLine("   查看Gomoku Credit: /gc");
            message.AppendLine("---------------------------------");

            switch (game.Role)
            {
            case Role.Black:
                message.Append($"黑方:{CqCode.At(game.BlackPlayer)}先手!请{CqCode.At(game.BlackPlayer)}走子!");
                break;

            case Role.White:
                message.Append($"白方:{CqCode.At(game.WhitePlayer)}先手!请{CqCode.At(game.WhitePlayer)}走子!");
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            mahuaApi.SendGroupMessage(group)
            .Text(message.ToString())
            .Newline()
            .Text(CqCode.Image($"{game.GameId}\\ChessBoard_{game.Steps}.jpg"))
            .Done();
        }
 public PrivateMessageFromFriendReceivedMahuaEvent(
     IMahuaApi mahuaApi,
     IFriendMessageStore friendMessageStore)
 {
     _mahuaApi           = mahuaApi;
     _friendMessageStore = friendMessageStore;
 }
 public GroupMessageReceivedMahuaEvent(IMahuaApi mahuaApi, IGenerateGroupMsgDeal generateGroupMsgDeal,
                                       GroupAuthService groupAuthService, GroupMsgCopyService groupMsgCopyService)
 {
     _mahuaApi             = mahuaApi;
     _generateGroupMsgDeal = generateGroupMsgDeal;
     GroupAuthService      = groupAuthService;
     GroupMsgCopyService   = groupMsgCopyService;
 }
 public GroupImageUploadEvent(
     IMahuaApi mahuaApi, QQRobotService qqRobotService, GroupMemberInfosCache groupMemberInfosCache, HttpClient client)
 {
     _mahuaApi              = mahuaApi;
     _qqRobotService        = qqRobotService;
     _groupMemberInfosCache = groupMemberInfosCache;
     _client = client;
 }
示例#23
0
        public GMRMEvent(
            IMahuaApi mahuaApi,
            IMessageHanderService iMessageHanderService)
        {
            _mahuaApi = mahuaApi;

            _iMessageHanderService = iMessageHanderService;
        }
示例#24
0
 public PrivateMessageFromFriendReceivedMahuaEvent(IMahuaApi mahuaApi,
                                                   IGeneratePrivateMsgDeal generatePrivateMsgDeal, PikachuDataContext dbContext
                                                   )
 {
     _mahuaApi = mahuaApi;
     _generatePrivateMsgDeal = generatePrivateMsgDeal;
     this.dbContext          = dbContext;
 }
示例#25
0
 private void sendPrivateMessage(DouyuData data, string qq)
 {
     using (IRobotSession robotSession = MahuaRobotManager.Instance.CreateSession())
     {
         IMahuaApi api = robotSession.MahuaApi;
         api.SendPrivateMessage(qq, getOnlineMessage(data));
         return;
     }
 }
 public PrivateMessageDone(
     IMahuaApi mahuaApi,
     IQqLightMessage message,
     IQqLightApi QqLightApi)
 {
     _mahuaApi   = mahuaApi;
     _message    = message;
     _QqLightApi = QqLightApi;
 }
示例#27
0
 public SystemInitEvent(IMpqApi mpqApi, IWebHost webHost, IMahuaApi mahuaApi, JobConfigService jobConfigService,
                        CustomerJob customerJob)
 {
     this._mpqApi      = mpqApi;
     _webHost          = webHost;
     _mahuaApi         = mahuaApi;
     _jobConfigService = jobConfigService;
     _customerJob      = customerJob;
 }
示例#28
0
 public GroupEventLogEvent(
     IMahuaApi mahuaApi
     , QQRobotService qqRobotService
     , GroupMemberInfosCache groupMemberInfosCache)
 {
     _mahuaApi              = mahuaApi;
     _qqRobotService        = qqRobotService;
     _groupMemberInfosCache = groupMemberInfosCache;
 }
 public PrivateMessageDone(
     IMahuaApi mahuaApi,
     IAmandaMessage message,
     IAmandaApi amandaApi)
 {
     _mahuaApi  = mahuaApi;
     _message   = message;
     _amandaApi = amandaApi;
 }
 public InitializationMahuaEvent1(
     IMahuaApi mahuaApi,
     IWebHost webHost,
     IDbHelper dbHelper)
 {
     _mahuaApi = mahuaApi;
     _webhost  = webHost;
     _dbHelper = dbHelper;
 }