Esempio n. 1
0
 public GoCallbackQueryHandler(RaidService raidService, IUrlHelper urlHelper, ITelegramBotClient bot, ReplyHandler replyHandler)
 {
     myRaidService  = raidService;
     myUrlHelper    = urlHelper;
     myBot          = bot;
     myReplyHandler = replyHandler;
 }
Esempio n. 2
0
 public PollModeCallbackQueryHandler(RaidService raidService, IUrlHelper urlHelper, RaidBattlesContext db, ITelegramBotClient bot)
 {
     myRaidService = raidService;
     myUrlHelper   = urlHelper;
     myDb          = db;
     myBot         = bot;
 }
Esempio n. 3
0
 public MessageUpdateHandler(RaidService raidService, IMemoryCache cache, IUrlHelper urlHelper, IEnumerable <Lazy <Func <Message, IMessageHandler>, MessageTypeAttribute> > messageHandlers)
     : base(messageHandlers)
 {
     myRaidService = raidService;
     myCache       = cache;
     myUrlHelper   = urlHelper;
 }
 public InviteCallbackQueryHandler(RaidBattlesContext context, RaidService raidService, IUrlHelper urlHelper, ITelegramBotClient bot)
 {
     myContext     = context;
     myRaidService = raidService;
     myUrlHelper   = urlHelper;
     myBot         = bot;
 }
 public NotifyCallbackQueryHandler(RaidService raidService, IUrlHelper urlHelper, ITelegramBotClient bot, TelemetryClient telemetryClient)
 {
     myRaidService     = raidService;
     myUrlHelper       = urlHelper;
     myBot             = bot;
     myTelemetryClient = telemetryClient;
 }
Esempio n. 6
0
 public CancelCallbackQueryHandler(RaidBattlesContext context, RaidService raidService, IUrlHelper urlHelper, ChatInfo chatInfo)
 {
     myContext     = context;
     myRaidService = raidService;
     myUrlHelper   = urlHelper;
     myChatInfo    = chatInfo;
 }
Esempio n. 7
0
 public ChosenInlineResultHandler(RaidBattlesContext context, RaidService raidService, IUrlHelper urlHelper, PoGoToolsClient poGoToolsClient)
 {
     myContext         = context;
     myRaidService     = raidService;
     myUrlHelper       = urlHelper;
     myPoGoToolsClient = poGoToolsClient;
 }
 public ChosenInlineResultHandler(ITelegramBotClient bot, RaidService raidService, IUrlHelper urlHelper, PoGoToolsClient poGoToolsClient)
 {
     myBot             = bot;
     myRaidService     = raidService;
     myUrlHelper       = urlHelper;
     myPoGoToolsClient = poGoToolsClient;
 }
        internal async void ToggleFinalize()
        {
            Raid.Finalized = !Raid.Finalized;
            Raid           = await RaidService.UpdateRaid(Raid);

            StateHasChanged();
        }
 public InviteInlineQueryHandler(IUrlHelper urlHelper, RaidService raidService, ITelegramBotClientEx bot,
                                 RaidBattlesContext db)
 {
     myUrlHelper   = urlHelper;
     myRaidService = raidService;
     myBot         = bot;
     myDB          = db;
 }
 public ShareInlineQueryHandler(RaidBattlesContext context, ITelegramBotClientEx bot, IUrlHelper urlHelper, IClock clock, RaidService raidService)
 {
     myContext     = context;
     myBot         = bot;
     myUrlHelper   = urlHelper;
     myClock       = clock;
     myRaidService = raidService;
 }
 public CancelCallbackQueryHandler(RaidBattlesContext context, RaidService raidService, IUrlHelper urlHelper, ChatInfo chatInfo, ITelegramBotClient bot)
 {
     myContext     = context;
     myRaidService = raidService;
     myUrlHelper   = urlHelper;
     myChatInfo    = chatInfo;
     myBot         = bot;
 }
Esempio n. 13
0
 private RaidCreateContinuousTextConversation(ConversationService conversationService, RaidService raidService, UserService userService, IUser user, IGuild guild, int frequency) : base(conversationService, user)
 {
     _raid        = new Raid(raidService.CreateRaidId(), frequency);
     _guild       = guild;
     _state       = State.creation;
     _raidService = raidService;
     _userService = userService;
 }
 public GymInlineQueryHandler(IUrlHelper urlHelper, IngressClient ingressClient, ITelegramBotClientEx bot, RaidBattlesContext db, RaidService raidService)
 {
     myUrlHelper     = urlHelper;
     myIngressClient = ingressClient;
     myBot           = bot;
     myDb            = db;
     myRaidService   = raidService;
 }
Esempio n. 15
0
 public GeneralInlineQueryHandler(ITelegramBotClientEx bot, IUrlHelper urlHelper, ShareInlineQueryHandler shareInlineQueryHandler, RaidService raidService, IngressClient ingressClient, RaidBattlesContext db)
 {
     myBot       = bot;
     myUrlHelper = urlHelper;
     myShareInlineQueryHandler = shareInlineQueryHandler;
     myRaidService             = raidService;
     myIngressClient           = ingressClient;
     myDb = db;
 }
 public async Task Unsign(Player player)
 {
     if (!Raid.Finalized)
     {
         Console.WriteLine($"Unsigning player {player.Name}");
         Raid.SignedUp.Remove((int)player.Id);
         await RaidService.Unsign(Raid, player);
     }
 }
Esempio n. 17
0
 public BotCommandMessageEntityHandler(RaidBattlesContext context, Message message, ITelegramBotClient telegramBotClient, RaidService raidService, IUrlHelper urlHelper, SetCallbackQueryHandler setCallbackQueryHandler)
 {
     myContext                 = context;
     myMessage                 = message;
     myTelegramBotClient       = telegramBotClient;
     myRaidService             = raidService;
     myUrlHelper               = urlHelper;
     mySetCallbackQueryHandler = setCallbackQueryHandler;
 }
 public VoteCallbackQueryHandler(RaidBattlesContext context, RaidService raidService, IUrlHelper urlHelper, IClock clock, IOptions <BotConfiguration> options)
 {
     myContext     = context;
     myRaidService = raidService;
     myUrlHelper   = urlHelper;
     myClock       = clock;
     myVoteTimeout = options.Value.VoteTimeout;
     myBlackList   = options.Value.BlackList ?? new HashSet <int>(0);
 }
 public async Task Signup(Player player)
 {
     if (!Raid.Finalized)
     {
         Console.WriteLine($"Signing player {player.Name}");
         Raid.SignedUp.Add((int)player.Id);
         await RaidService.Signup(Raid, player);
     }
 }
Esempio n. 20
0
 private SignUpConversation(ConversationService conversationService, RaidService raidService, UserService userService, ISocketMessageChannel channel, IGuildUser user, Raid raid, Constants.Availability availability) : base(conversationService, user)
 {
     _user              = user;
     _channel           = channel;
     this._raid         = raid;
     this._availability = availability;
     _raidService       = raidService;
     _userService       = userService;
     _state             = State.role;
 }
Esempio n. 21
0
 // Retrieve client and CommandService instance via ctor
 public CommandHandler(DiscordSocketClient client, CommandService commands, RoleService roleService, RaidService raidService, ConversationService conversationService, UserService userService, IServiceProvider services)
 {
     _commands            = commands;
     _client              = client;
     _services            = services;
     _roleService         = roleService;
     _raidService         = raidService;
     _conversationService = conversationService;
     _userService         = userService;
 }
        public async Task GetDestination_Should_Throw_If_No_Destination_Found()
        {
            var context = await this.GetDatabase();

            var mapper           = this.GetMapper();
            var characterService = new CharacterService(context, mapper);
            var raidService      = new RaidService(context, characterService, mapper);

            Assert.Throws <ArgumentException>(() => raidService.GetDestination <RaidDestination>("Invalid"));
        }
        public async Task KickCharacterAsync_Should_Throw_If_No_Such_Character_Joined_Raid()
        {
            var context = await this.GetDatabase();

            var mapper           = this.GetMapper();
            var characterService = new CharacterService(context, mapper);
            var raidService      = new RaidService(context, characterService, mapper);

            await Assert.ThrowsAsync <InvalidOperationException>(async() => await raidService.KickPlayerAsync("1", "1"));
        }
        public async Task RegisterCharacterAsync_Should_Throw_If_Character_Or_Raid_Not_Found(string characterId, string riadId)
        {
            var context = await this.GetDatabase();

            var mapper           = this.GetMapper();
            var characterService = new CharacterService(context, mapper);
            var raidService      = new RaidService(context, characterService, mapper);

            await Assert.ThrowsAsync <ArgumentException>(async() => await raidService.RegisterCharacterAsync(characterId, riadId));
        }
        public async Task DeleteRaid()
        {
            bool confirmed = await JSRuntime.InvokeAsync <bool>("confirm", $"Are you sure you want to raid {Raid.Date.ToString("yyyy-MM-dd")}?");

            if (confirmed)
            {
                await RaidService.DeleteRaid(Raid);

                Raids.DeleteRaid(Raid);
            }
        }
Esempio n. 26
0
 private RaidEditConversation(ConversationService conversationService, RaidService raidService, IUser user, string raidId, Edits edit, IUserMessage userMessage) : base(conversationService, user)
 {
     this._edit        = edit;
     this._userMessage = userMessage;
     _raidService      = raidService;
     if (!_raidService.TryFindRaid(raidId, out _raid))
     {
         throw new KeyNotFoundException("The raid for this message was not found!");
     }
     ;
 }
Esempio n. 27
0
 public GymInlineQueryHandler(IUrlHelper urlHelper, GeneralInlineQueryHandler generalInlineQueryHandler, IngressClient ingressClient, ITelegramBotClientEx bot, RaidBattlesContext db, RaidService raidService, GeoCoderEx geoCoder, IClock clock, TimeZoneService timeZoneService)
 {
     myUrlHelper = urlHelper;
     myGeneralInlineQueryHandler = generalInlineQueryHandler;
     myIngressClient             = ingressClient;
     myBot             = bot;
     myDb              = db;
     myRaidService     = raidService;
     myGeoCoder        = geoCoder;
     myClock           = clock;
     myTimeZoneService = timeZoneService;
 }
Esempio n. 28
0
        protected override async Task OnInitializedAsync()
        {
            try {
                Raid = await RaidService.GetLatest();

                Players = await PlayerService.GetPlayers();

                Bosses = (await InstanceService.GetInstances()).SelectMany(i => i.Bosses).ToList();
            } catch (Exception e) {
                ErrorMessage = "Unable to fetch latest raid";
            }
        }
        public async Task GetDestination_Should_Return_Correct_Destination()
        {
            var context = await this.GetDatabase();

            var mapper           = this.GetMapper();
            var characterService = new CharacterService(context, mapper);
            var raidService      = new RaidService(context, characterService, mapper);

            var expected = 10;
            var actual   = raidService.GetDestination <RaidDestination>("TestRaid1").TotalBosses;

            Assert.Equal(expected, actual);
        }
        public async Task GetRaid_Should_Return_Correct_Raid()
        {
            var context = await this.GetDatabase();

            var mapper           = this.GetMapper();
            var characterService = new CharacterService(context, mapper);
            var raidService      = new RaidService(context, characterService, mapper);

            var expected = "Correct";
            var actual   = raidService.GetRaid <Raid>("1").Description;

            Assert.Equal(expected, actual);
        }