Пример #1
0
        static BotAPI()
        {
            vkService  = new VkService();
            gifService = new GifService();

            Commands["call"] = async args =>
            {
                var users = await vkService.GetGroupUsers();

                await vkService.SendMessagesByIds(users, args[0]);
            };

            Commands["ok"] = async args =>
            {
                await vkService.SendMessageById(args[0], "Ok. Request is processing");
            };

            Commands["error"] = async args =>
            {
                await vkService.SendMessageById(args[0], "Command not found. Send help");
            };

            Commands["anime"] = async args =>
            {
                await vkService.SendMessageById(args[0], AnimeList.Urls[new Random().Next(0, AnimeList.Urls.Count)]);
            };

            Commands["help"] = async args =>
            {
                await vkService.SendMessageById(args[0], HelpText.Text);
            };

            Commands["gg"] = async args =>
            {
                string userId;
                string gifLink;
                if (args.Length > 1)
                {
                    userId  = args[1];
                    gifLink = gifService.GetGifByCategory(args[0]);
                }
                else
                {
                    userId  = args[0];
                    gifLink = gifService.GetRandomGif();
                }

                if (gifLink == null)
                {
                    await Commands["help"](new[] { userId });
                }
                else
                {
                    await vkService.SendGifById(userId, gifLink);
                }
            };
        }
Пример #2
0
 public GifCommands(GifService ser)
 {
     _gifService = ser;
 }
Пример #3
0
 public GifModule(GifService ser)
 {
     _gifService = ser;
 }
Пример #4
0
 public IndexModel(GifService gifService)
 {
     _gifService = gifService;
 }
Пример #5
0
 public GifController()
 {
     _gifService = new GifService();
 }