Пример #1
0
 public SendMessageFunction(
     ISendMessageService sendMessageService,
     IErrorResponseFactory errorResponseFactory)
 {
     _sendMessageService   = sendMessageService;
     _errorResponseFactory = errorResponseFactory;
 }
Пример #2
0
 public UserService(UserManager <User> userManager, ISendMessageService <EmailMessage> sendingService, ICustomerProfileRepository customerRep, IEmployeeProfileRepository employeeRep)
 {
     _userManager    = userManager;
     _customerRep    = customerRep;
     _employeeRep    = employeeRep;
     _sendingService = sendingService;
 }
 public StartCommand(
     ISendMessageService sendMessageService,
     IChatRepository chatRepository)
 {
     _sendMessageService = sendMessageService;
     _chatRepository     = chatRepository;
 }
 public HandleCommandService(
     ICommandsService commandsService,
     IAuthorizationService spotifyAuthorizationService,
     IAuthorizationTokenRepository authorizationTokenRepository,
     ISendMessageService sendMessageService,
     ISpotifyLinkHelper spotifyLinkHelper,
     ISyncTracksService trackService,
     IPlaylistRepository playlistRepository,
     IKeyboardService keyboardService,
     IChatRepository chatRepository,
     IUserService userService,
     IUserRepository userRepository,
     ISpotifyClientFactory spotifyClientFactory,
     ISpotifyClientService spotifyClientService)
     : base(commandsService, userRepository, sendMessageService, spotifyLinkHelper)
 {
     _commandsService              = commandsService;
     _spotifyAuthorizationService  = spotifyAuthorizationService;
     _authorizationTokenRepository = authorizationTokenRepository;
     _sendMessageService           = sendMessageService;
     _spotifyLinkHelper            = spotifyLinkHelper;
     _syncTracksService            = trackService;
     _playlistRepository           = playlistRepository;
     _keyboardService              = keyboardService;
     _chatRepository       = chatRepository;
     _userService          = userService;
     _spotifyClientFactory = spotifyClientFactory;
     _spotifyClientService = spotifyClientService;
 }
Пример #5
0
        public void Process(ISendMessageService service, MessageInfo message)
        {
            if (!message.IsGroupMessage)
            {
                service.SendToFriend(message.UserMember, "暂不支持好友互动!");
                return;
            }
            var args = message.Content.ToString().Split(' ');

            if (args.Length == 1)
            {
                service.SendToGroup(message.GroupNumber, "使用方法: 查询 <Youtube Id>");
                return;
            }

            var videos = YoutubeApi.GetVideosByChannelId(args[1]);

            if (videos.All(v => !v.IsLive))
            {
                service.SendToGroup(message.GroupNumber, "该频道目前没有直播");
                return;
            }

            var live = videos.First(v => v.IsLive);

            service.SendToGroup(message.GroupNumber, $"频道 {live.ChannelTitle} 当前正在直播中\r\n" +
                                $"Title: {live.Title}\r\n" +
                                $"Description: {live.Description}\r\n" +
                                $"Link: {live.VideoLink}");
        }
Пример #6
0
 public MsgbotController(
     IPeopleRepository peopleRepository,
     ISendMessageService sendMessageService)
 {
     this.peopleRepository   = peopleRepository;
     this.sendMessageService = sendMessageService;
 }
Пример #7
0
        public UpdateTests(TestHost testHost)
        {
            _generateUpdateStreamService = testHost.GetService <GenerateUpdateStreamService>();
            _testOptions = testHost.GetService <IOptions <TestOptions> >().Value;

            _spotifyClientFactory   = testHost.GetService <ISpotifyClientFactory>();
            _spotifyClientService   = testHost.GetService <ISpotifyClientService>();
            _trackRepository        = testHost.GetService <ITrackRepository>();
            _playlistRepository     = testHost.GetService <IPlaylistRepository>();
            _chatRepository         = testHost.GetService <IChatRepository>();
            _chatMemberRepository   = testHost.GetService <IChatMemberRepository>();
            _userRepository         = testHost.GetService <IUserRepository>();
            _voteRepository         = testHost.GetService <IVoteRepository>();
            _voteTextHelper         = testHost.GetService <IVoteTextHelper>();
            _loginRequestRepository = testHost.GetService <ILoginRequestRepository>();
            _sendMessageService     = testHost.GetService <ISendMessageService>();
            _spotifyLinkHelper      = testHost.GetService <ISpotifyLinkHelper>();

            var handleMessageService       = testHost.GetService <IHandleMessageService>();
            var handleCallbackQueryService = testHost.GetService <IHandleCallbackQueryService>();
            var handleInlineQueryService   = testHost.GetService <IHandleInlineQueryService>();
            var commandsService            = testHost.GetService <ICommandsService>();
            var updateDtoService           = testHost.GetService <IUpdateDtoService>();
            var sentryOptions = testHost.GetService <IOptions <SentryOptions> >();

            _sut = new Update(handleMessageService, handleCallbackQueryService, handleInlineQueryService, commandsService, updateDtoService, sentryOptions);
        }
Пример #8
0
        public ChattingViewModel(string strRoomSID, IRoomsControlable roomsController)
        {
            if (null == strRoomSID)
            {
                throw new ArgumentNullException("strRoomSID");
            }
            if (null == roomsController)
            {
                throw new ArgumentNullException("roomsController");
            }

            this.m_AnonymousThumbnailDictionary = new Dictionary <string, Brush>();
            this.m_AnonymousThumbnailDictionary.Add(AuthRepository.MQKeyInfo.UserSid, ColorGenerator.Instance.GetRandomBrush());
            this.RoomSID           = strRoomSID;
            this.m_RoomsController = roomsController;

            this.m_SendMessageService = new SendMessageService();
            this.m_LoadMsgService     = new LoadMessagesService(AuthRepository.MQKeyInfo.UserSid, this.m_AnonymousThumbnailDictionary);
            this.m_ReadMsgService     = new ReadMessageService();

            this.InitialLoadedCommand    = new DelegateCommand <IChattingViewBehavior>(ExecuteInitialLoadedCommand);
            this.InitialFocusCommand     = new DelegateCommand <UIElement>(ExecuteInitialFocusCommand);
            this.InputTextChangedCommand = new DelegateCommand(ExecuteInputTextChangedCommand);
            this.ReSendCommand           = new DelegateCommand <CommunicationMsg>(ExecuteReSendCommand);
            this.DeletePendingMsgCommand = new DelegateCommand <CommunicationMsg>(ExecuteDeletePendingMsgCommand);
            this.SendTextCommand         = new DelegateCommand <string>(ExecuteSendTextCommand, CanExecuteSendTextCommand);
            this.DefineScrollingCommand  = new DelegateCommand <ScrollViewer>(ExecuteDefineScrollingCommand);
            this.AttachFileCommand       = new DelegateCommand(ExecuteAttachFileCommand);
            this.m_ReceiveChatMsgCommand = new DelegateCommand <ReceivedMsg>(ExecuteReceiveChatMsgCommand);
            this.m_ReceiveReadMsgCommand = new DelegateCommand <ReceivedReadMsg>(ExecuteReceiveReadMsgCommand);
            this.Messages         = new MsgCollection(this.m_LoadMsgService.LoadMessages(strRoomSID, 0).Reverse());
            this.m_UnReadMessages = this.m_LoadMsgService.LoadUnReadMessages(strRoomSID);
        }
Пример #9
0
 public HandleInlineQueryService(
     ISendMessageService sendMessageService,
     IHandleInlineQueryCommandService inlineQueryCommandsService)
 {
     _sendMessageService         = sendMessageService;
     _inlineQueryCommandsService = inlineQueryCommandsService;
 }
 public SendMessageQueue(int capacity, ISendMessageService service)
 {
     Capacity             = capacity;
     m_Monitor            = new AsyncMonitor();
     m_MessageCollection  = new List <MessageTaskCompletionSource>();
     m_SendMessageService = service;
     m_SendingTask        = StartSendingAsync();
 }
Пример #11
0
 public static void SendImageToGroup(this ISendMessageService service, long groupId, Image image)
 {
     using (var memory = new MemoryStream())
     {
         image.Save(memory, ImageFormat.Jpeg);
         service.SendImageToGroup(groupId, memory.GetBuffer());
     }
 }
Пример #12
0
        public virtual void Process(ISendMessageService service, MessageInfo message)
        {
            var methods = GetType().GetMethods().Where(v => v.IsDefined(typeof(RobotCommandAttribute), false));
            var atts    = methods.Select(v =>
                                         v.GetCustomAttributes(false).First(att => att.GetType() == typeof(RobotCommandAttribute)))
                          .Select(v => (RobotCommandAttribute)v);
            var handled = false;
            var args    = message.Content.ToString().Trim().Split(' ');

            foreach (var method in methods)
            {
                var attr        = method.GetCustomAttributes(false);
                var commandAttr = attr.FirstOrDefault(v => v.GetType() == typeof(RobotCommandAttribute));
                if (commandAttr != null)
                {
                    var info = (RobotCommandAttribute)commandAttr;
                    if (args.Length == info.ProcessLength || info.ProcessLength == 0)
                    {
                        if (!string.IsNullOrEmpty(info.SubCommandName))
                        {
                            if (args.Length <= info.SubCommandOffset)
                            {
                                continue;
                            }
                            if (!StringTools.EqualsIgnoreCase(args[info.SubCommandOffset], info.SubCommandName))
                            {
                                continue;
                            }
                        }
                        else
                        {
                            if (atts.Any(v => !string.IsNullOrEmpty(v.SubCommandName) && args.Length > v.SubCommandOffset && args[v.SubCommandOffset] == v.SubCommandName))
                            {
                                continue;
                            }
                        }
                        try
                        {
                            handled = true;
                            method.Invoke(this, new object[]
                            {
                                message,
                                args
                            });
                        }
                        catch (Exception ex)
                        {
                            LogHelper.Error("处理消息时出现未知异常 包名:" + GetType() + " 函数名: " + method.Name, true, ex);
                            service.SendToGroup(message.GroupNumber, $"处理请求时出现未知异常: {ex.Message} 处理函数: {method.Name}");
                        }
                    }
                }
            }
            if (!handled)
            {
                ShowHelpMessage(message, args);
            }
        }
Пример #13
0
 public override void Process(ISendMessageService service, MessageInfo message)
 {
     if (!message.IsGroupMessage)
     {
         service.SendToFriend(message.UserMember, "暂不支持好友互动!");
         return;
     }
     base.Process(service, message);
 }
 public SendReviewDutiesMessageService(
     ISendMessageService sendMessageService,
     IReviewByDateProvider reviewByDateProvider,
     IChatRepository chatRepository)
 {
     _sendMessageService   = sendMessageService;
     _reviewByDateProvider = reviewByDateProvider;
     _chatRepository       = chatRepository;
 }
Пример #15
0
        public CustomRobot(ISendMessageService service, IServerMessageSubject transponder, QQUser user)
        {
            _service     = service;
            _transponder = transponder;
            _user        = user;

            // 将机器人加入转发器的订阅列表中
            _transponder.AddCustomRoBot(this);
        }
Пример #16
0
 /// <summary>
 /// 初始化一个<c>MessageServiceImpl</c>类型的实例。
 /// </summary>
 public MessageServiceImpl(IRepositoryContext context,
                           IMessageRepository messageRepository,
                           IContactRepository contactRepository,
                           ISendMessageService sendMessageService)
     : base(context)
 {
     this.messageRepository  = messageRepository;
     this.contactRepository  = contactRepository;
     this.sendMessageService = sendMessageService;
 }
 /// <summary>
 /// 初始化一个<c>MessageServiceImpl</c>类型的实例。
 /// </summary>
 public MessageServiceImpl(IRepositoryContext context,
     IMessageRepository messageRepository,
     IContactRepository contactRepository,
     ISendMessageService sendMessageService)
     : base(context)
 {
     this.messageRepository = messageRepository;
     this.contactRepository = contactRepository;
     this.sendMessageService = sendMessageService;
 }
Пример #18
0
        public static void SendImageToGroup(this ISendMessageService service, long groupId, byte[] bytes)
        {
            var image = new TextSnippet()
            {
                Type = MessageType.Picture
            };

            image.Set("data", bytes);
            service.SendToGroup(groupId, image);
        }
Пример #19
0
 public override void Process(ISendMessageService service, MessageInfo message)
 {
     //Admin
     if (message.UserMember != 1844812067)
     {
         _service.SendToGroup(message.GroupNumber, "您没有权限执行这个命令");
         return;
     }
     base.Process(service, message);
 }
        public DvbTelegramBot(IConfiguration config, CloudTable favoriteStopTable)
        {
            _stopService         = new StopService();
            _favoriteStopService =
                new FavoriteStopService(new FavoriteStopRepository(favoriteStopTable, new StopRepository()));

            var token     = config["TelegramBotToken"];
            var botClient = new TelegramBotClient(token);

            _sendMessageService = new SendMessageService(botClient);
        }
Пример #21
0
 public RemoveTrackService(
     ITrackRepository trackRepository,
     ISpotifyClientFactory spotifyClientFactory,
     ISpotifyClientService spotifyClientService,
     ISendMessageService sendMessageService)
 {
     _trackRepository      = trackRepository;
     _spotifyClientFactory = spotifyClientFactory;
     _spotifyClientService = spotifyClientService;
     _sendMessageService   = sendMessageService;
 }
Пример #22
0
 public BaseCommandsService(
     ICommandsService commandsService,
     IUserRepository userRepository,
     ISendMessageService sendMessageService,
     ISpotifyLinkHelper spotifyLinkHelper)
 {
     _commandsService    = commandsService;
     _userRepository     = userRepository;
     _sendMessageService = sendMessageService;
     _spotifyLinkHelper  = spotifyLinkHelper;
 }
Пример #23
0
 public void Process(ISendMessageService service, MessageInfo message)
 {
     if (!message.IsGroupMessage)
     {
         service.SendToFriend(message.UserMember, "暂不支持好友互动!");
         return;
     }
     service.SendToGroup(message.GroupNumber, "====== Vtuber天狗机器人功能菜单 ====== \r\n!Timeline 查看放送时间表\r\n" +
                         "!订阅 添加群内事件订阅\r\n" +
                         "!vtuber 查看数据库中的vtuber信息\r\n" +
                         "!直播 查看直播信息");
 }
Пример #24
0
 public ViberBotService(
     ISendMessageService sendMessageService,
     IHttpClientFactory httpClientFactory,
     IPeopleRepository peopleRepository,
     ILogger <ViberBotService> logger
     )
 {
     this.sendMessageService = sendMessageService;
     this.httpClientFactory  = httpClientFactory;
     this.peopleRepository   = peopleRepository;
     this.logger             = logger;
 }
 public HandleCallbackQueryService(
     IVoteService voteService,
     IUserService userService,
     ISpotifyClientFactory spotifyClientFactory,
     ISpotifyClientService spotifyClientService,
     ISendMessageService sendMessageService)
 {
     _voteService          = voteService;
     _userService          = userService;
     _spotifyClientFactory = spotifyClientFactory;
     _spotifyClientService = spotifyClientService;
     _sendMessageService   = sendMessageService;
 }
Пример #26
0
 public VoteService(
     ISendMessageService sendMessageService,
     IKeyboardService keyboardService,
     IVoteTextHelper voteTextHelper,
     IVoteRepository voteRepository,
     IRemoveTrackService removeTrackService)
 {
     _sendMessageService = sendMessageService;
     _keyboardService    = keyboardService;
     _voteTextHelper     = voteTextHelper;
     _voteRepository     = voteRepository;
     _removeTrackService = removeTrackService;
 }
 public HandleInlineQueryCommandService(
     ICommandsService commandsService,
     IUserRepository userRepository,
     ISendMessageService sendMessageService,
     IVoteRepository voteRepository,
     ISpotifyLinkHelper spotifyLinkHelper)
     : base(commandsService, userRepository, sendMessageService, spotifyLinkHelper)
 {
     _commandsService    = commandsService;
     _userRepository     = userRepository;
     _sendMessageService = sendMessageService;
     _voteRepository     = voteRepository;
 }
 public ReceivedMessageService(IMessageResponseService messageResponseService,
                               IMessageTokenCache messageTokenCache,
                               ISendMessageService sendMessageService,
                               IOptions <BotOptions> botConfig,
                               ILogger <ReceivedMessageService> logger)
 {
     _logger = logger;
     _messageResponseService = messageResponseService;
     _messageTokenCache      = messageTokenCache;
     _sendMessageService     = sendMessageService;
     _botOptions             = botConfig.Value;
     _handler = new ViberBotWebhookHandler();
     AddHandlers(_handler);
 }
Пример #29
0
        static void Main(string[] args)
        {
            ServiceProvider serviceProvider = new ServiceCollection()

                                              .AddSingleton <ISendMessageService, SendMessageService>()
                                              .BuildServiceProvider();

            ISendMessageService sendMessageServ = serviceProvider.GetService <ISendMessageService>();

            sendMessageServ.SendMessage(args);

            Console.WriteLine(" Press [enter] to exit.");
            Console.ReadLine();
        }
Пример #30
0
 public int SendMessage(string message, string MQName, bool needResponse = true)
 {
     if ((address != null) && (Binding != null))
     {
         using (ChannelFactory <ISendMessageService> channel = new ChannelFactory <ISendMessageService>(Binding, address))
         {
             ISendMessageService service = channel.CreateChannel();
             return(service.SendMessage(message, MQName, needResponse));
         }
     }
     else
     {
         return(-1);
     }
 }
Пример #31
0
 public int SendMFNMessage(string message)
 {
     if ((address != null) && (Binding != null))
     {
         using (ChannelFactory <ISendMessageService> channel = new ChannelFactory <ISendMessageService>(Binding, address))
         {
             ISendMessageService service = channel.CreateChannel();
             return(service.SendMessageBackACK(message));
         }
     }
     else
     {
         return(-1);
     }
 }