コード例 #1
0
 public CoinFlipService
 (
     IHashService hashService,
     IRandomService randomService,
     IRepoServiceFactory repoServiceFactory,
     ITransactionFactory transactionFactory,
     IBetService betService,
     IItemService itemService,
     IMongoJackpotRepoService mongoJackpotRepoService,
     ICoinFlipHubConnections coinFlipHubConnections,
     IMongoPreHashRepoService preHashRepoService,
     IDiscordService discordService
 )
 {
     _hashService             = hashService;
     _randomService           = randomService;
     _repoServiceFactory      = repoServiceFactory;
     _transactionFactory      = transactionFactory;
     _betService              = betService;
     _itemService             = itemService;
     _mongoJackpotRepoService = mongoJackpotRepoService;
     _coinFlipHubConnections  = coinFlipHubConnections;
     _preHashRepoService      = preHashRepoService;
     _discordService          = discordService;
 }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BindableVoiceState"/> class.
        /// </summary>
        internal BindableVoiceState(
            IMessenger messenger,
            IDiscordService discordService,
            QuarrelClient quarrelClient,
            IDispatcherService dispatcherService,
            VoiceState state) :
            base(messenger, discordService, quarrelClient, dispatcherService)
        {
            _state = state;

            JoinStreamCommand = new RelayCommand(JoinStream);

            _messenger.Register <VoiceStateUpdatedMessage>(this, (_, m) =>
            {
                if (m.VoiceState.User.Id == State.User.Id)
                {
                    _dispatcherService.RunOnUIThread(() =>
                    {
                        OnPropertyChanged(nameof(State));
                        OnPropertyChanged(nameof(CanJoin));
                    });
                }
            });
            _messenger.Register <StreamCreatedMessage>(this, (_, m) =>
            {
                if (m.StreamKey.EndsWith(State.User.Id.ToString()))
                {
                    _dispatcherService.RunOnUIThread(() =>
                    {
                        IsWatching = true;
                    });
                }
            });
        }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MessagesViewModel"/> class.
        /// </summary>
        public MessagesViewModel(
            IMessenger messenger,
            IDiscordService discordService,
            IDispatcherService dispatcherService,
            IClipboardService clipboardService,
            QuarrelClient quarrelClient)
        {
            _messenger         = messenger;
            _discordService    = discordService;
            _dispatcherService = dispatcherService;
            _clipboardService  = clipboardService;
            _quarrelClient     = quarrelClient;
            _semaphore         = new SemaphoreSlim(1, 1);

            Source    = new ObservableRangeCollection <BindableMessage>();
            IsLoading = false;

            _messenger.Register <ChannelSelectedMessage <IBindableSelectableChannel> >(this, (_, m) => SelectedChannel = m.Channel);
            _messenger.Register <MessageCreatedMessage>(this, (_, m) =>
            {
                if (SelectedChannel?.Id != m.Message.ChannelId)
                {
                    return;
                }
                _dispatcherService.RunOnUIThread(() => AppendMessage(m.Message));
            });
            _messenger.Register <MessageDeletedMessage>(this, (_, m) =>
            {
                if (SelectedChannel?.Id != m.ChannelId)
                {
                    return;
                }
                _dispatcherService.RunOnUIThread(() => RemoveMessage(m.MessageId));
            });
        }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BindableChannel"/> class.
        /// </summary>
        internal BindableChannel(
            IMessenger messenger,
            IClipboardService clipboardService,
            IDiscordService discordService,
            QuarrelClient quarrelClient,
            IDispatcherService dispatcherService,
            Channel channel) :
            base(messenger, discordService, quarrelClient, dispatcherService)
        {
            _clipboardService = clipboardService;
            _channel          = channel;

            _messenger.Register <ChannelUpdatedMessage>(this, (_, m) =>
            {
                if (Id == m.Channel.Id)
                {
                    Channel = m.Channel;
                }
            });
            _messenger.Register <MessageMarkedReadMessage>(this, (_, m) =>
            {
                if (m.ChannelId != Channel.Id)
                {
                    return;
                }
                AckUpdateRoot();
            });

            CopyIdCommand   = new RelayCommand(() => _clipboardService.Copy($"{Id}"));
            CopyLinkCommand = new RelayCommand(() => _clipboardService.Copy(Channel.Url));
        }
コード例 #5
0
 public RosterService(ApplicationDbContext dbContext, UserManager <Trooper> userManager,
                      IDiscordService discord)
 {
     this._dbContext   = dbContext;
     this._userManager = userManager;
     this._discord     = discord;
 }
コード例 #6
0
        internal BindableGuildChannel(
            IMessenger messenger,
            IClipboardService clipboardService,
            IDiscordService discordService,
            QuarrelClient quarrelClient,
            IDispatcherService dispatcherService,
            GuildChannel channel,
            GuildMember selfMember,
            BindableCategoryChannel?parent = null) :
            base(messenger, clipboardService, discordService, quarrelClient, dispatcherService, channel)
        {
            CategoryChannel = parent;

            if (CategoryChannel is null)
            {
                Permissions = new Permissions();
                var roles = selfMember.GetRoles();
                foreach (var role in roles)
                {
                    Permissions += role.Permissions;
                }
            }
            else
            {
                Permissions = CategoryChannel.Permissions;
            }

            Guard.IsNotNull(channel.PermissionOverwrites, nameof(channel.PermissionOverwrites));
            ApplyOverrides(channel.PermissionOverwrites, selfMember);
        }
コード例 #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GuildSettingsPageViewModel"/>.
        /// </summary>
        public GuildSettingsPageViewModel(ILocalizationService localizationService, IDiscordService discordService, BindableGuild guild) :
            base(new ISettingsMenuItem[]
        {
            new OverviewPageViewModel(localizationService, discordService, guild),

            // Personal Settings
            new SettingsCategoryHeader(localizationService[PersonalSettingsResource]),
            new PrivacyPageViewModel(localizationService, discordService, guild),
            new NotificationsPageViewModel(localizationService, discordService, guild),

            // Server Settings
            new SettingsCategoryHeader(localizationService[ServerSettingsResource]),
            new RolesPageViewModel(localizationService, discordService, guild),
            new EmojisPageViewModel(localizationService, discordService, guild),
            new ModerationPageViewModel(localizationService, discordService, guild),
            new AuditLogPageViewModel(localizationService, discordService, guild),

            // User management
            new SettingsCategoryHeader(localizationService[UserManagementResource]),
            new MembersPageViewModel(localizationService, discordService, guild),
            new InvitesPageViewModel(localizationService, discordService, guild),
            new BansPageViewModel(localizationService, discordService, guild)
        })
        {
        }
コード例 #8
0
 public BillController(IBillRepository billRepository, IDiscordService discordService, IUserService userService, IRecurringBillWorker recurringBillWorker)
 {
     _userService         = userService;
     _billRepository      = billRepository;
     _discordService      = discordService;
     _recurringBillWorker = recurringBillWorker;
 }
コード例 #9
0
        public JackpotMatchManager
        (
            IRepoServiceFactory repoServiceFactory,
            IBetService betService,
            IHashService hashService,
            IRandomService randomService,
            IJackpotDraftService draftService,
            ILogServiceFactory logServiceFactory,
            IBetOrWithdrawQueueManager betOrWithdrawQueueManager,
            IGameModeSettingService gameModeSettingService,
            IBetHubConnections betHubConnections,
            IMatchHubConnections matchHubConnections,
            IDiscordService discordService
        ) : base(repoServiceFactory, betService, hashService, randomService)
        {
            _repoServiceFactory        = repoServiceFactory;
            _betService                = betService;
            _draftService              = draftService;
            _matchHubConnections       = matchHubConnections;
            _discordService            = discordService;
            _betHubConnections         = betHubConnections;
            _gameModeSettingService    = gameModeSettingService;
            _betOrWithdrawQueueManager = betOrWithdrawQueueManager;
            _logService                = logServiceFactory.CreateLogger <JackpotMatchManager>();

            _betQueue = new BetQueue();

            SetUpGameModeAndSetting().Wait();
        }
コード例 #10
0
        internal MyAccountPageViewModel(
            ILocalizationService localizationService,
            IDiscordService discordService,
            QuarrelClient quarrelClient,
            IStorageService storageService,
            IClipboardService clipboardService) :
            base(localizationService, discordService, storageService)
        {
            _quarrelClient    = quarrelClient;
            _clipboardService = clipboardService;

            _isLoggedIn = false;
            _userId     = null;

            SelfUser?user = _quarrelClient.Self.CurrentUser;


            if (user is not null)
            {
                _isLoggedIn = true;
                _userId     = user.Id;

                Email         = new DraftValue <string?>(user.Email);
                Username      = new DraftValue <string?>(user.Username);
                Discriminator = new DraftValue <int>(user.Discriminator);
                AboutMe       = new DraftValue <string?>(user.Bio);

                RegisterDraftValues(AboutMe);
            }

            CopyIdCommand = new RelayCommand(CopyId);
        }
コード例 #11
0
        public CoinFlipManager
        (
            IRepoServiceFactory repoServiceFactory,
            ICoinFlipService coinFlipService,
            IJackpotDraftService draftService,
            ICoinFlipHubConnections coinFlipHubConnections,
            IBetOrWithdrawQueueManager betOrWithdrawQueueManager,
            IBetHubConnections betHubConnections,
            ILogServiceFactory logServiceFactory,
            IBetService betService,
            IMongoJackpotRepoService jackpotRepoService,
            IHotStatusManager hotStatusManager,
            IDiscordService discordService
        )
        {
            _repoServiceFactory        = repoServiceFactory;
            _coinFlipService           = coinFlipService;
            _draftService              = draftService;
            _coinFlipHubConnections    = coinFlipHubConnections;
            _betOrWithdrawQueueManager = betOrWithdrawQueueManager;
            _betHubConnections         = betHubConnections;
            _betService         = betService;
            _jackpotRepoService = jackpotRepoService;
            _hotStatusManager   = hotStatusManager;
            _discordService     = discordService;

            _logService = logServiceFactory.CreateLogger <CoinFlipManager>();
            _betQueue   = new BetQueue();

            Setup().Wait();
        }
コード例 #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LoginPageViewModel"/> class.
        /// </summary>
        public LoginPageViewModel(IDiscordService discordService, ILocalizationService localizationService)
        {
            _discordService      = discordService;
            _localizationService = localizationService;

            LoginWithTokenCommand = new RelayCommand(() => LoginWithToken(TokenText));
        }
コード例 #13
0
ファイル: Startup.cs プロジェクト: Flave229/SaltVault
        public Startup(IHostingEnvironment env)
        {
            _billRepository            = new BillRepository();
            _shoppingRepository        = new ShoppingRepository();
            _peopleRepository          = new PeopleRepository();
            _toDoRepository            = new ToDoRepository();
            _householdRepository       = new HouseholdRepository();
            _discordService            = new DiscordService(new HttpClient());
            _userService               = new UserService(new UserCache(), _peopleRepository);
            _inviteLinkService         = new InviteLinkService();
            _googleTokenAuthentication = new GoogleTokenAuthentication(new HttpClient());
            _recurringBillWorker       = new RecurringBillWorker(_billRepository);

            var builder = new ConfigurationBuilder()
                          .SetBasePath(env.ContentRootPath)
                          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                          .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
                          .AddEnvironmentVariables();

            if (env.IsDevelopment())
            {
                builder.AddApplicationInsightsSettings(developerMode: true);
            }

            var discordWorker           = new DiscordMessageListener(_billRepository, _shoppingRepository, _peopleRepository, _discordService);
            var backgroundDiscordWorker = new Task(() => discordWorker.StartWorker());

            backgroundDiscordWorker.Start();

            Configuration = builder.Build();
        }
コード例 #14
0
        internal OverviewPageViewModel(ILocalizationService localizationService, IDiscordService discordService, BindableGuild guild) :
            base(localizationService, discordService, guild)
        {
            _name = new(guild.Guild.Name);

            RegisterDraftValues(Name);
        }
コード例 #15
0
 public DiscordController(IAuthenticationService authenticationService, IDiscordService discordService, ICookieManager cookieManager, ICookie cookie)
 {
     this.authService    = authenticationService;
     this.discordService = discordService;
     _cookie             = cookie;
     _cookieManager      = cookieManager;
 }
コード例 #16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GuildsViewModel"/> class.
        /// </summary>
        public GuildsViewModel(
            ILoggingService loggingService,
            IMessenger messenger,
            ILocalizationService localizationService,
            IClipboardService clipboardService,
            IDiscordService discordService,
            QuarrelClient quarrelClient,
            IDispatcherService dispatcherService)
        {
            _loggingService      = loggingService;
            _messenger           = messenger;
            _localizationService = localizationService;
            _clipboardService    = clipboardService;
            _discordService      = discordService;
            _quarrelClient       = quarrelClient;
            _dispatcherService   = dispatcherService;

            Source  = new ObservableCollection <IBindableGuildListItem>();
            _guilds = new ConcurrentDictionary <ulong, BindableGuild>();

            OpenGuildSettingsCommand = new RelayCommand(OpenGuildSettings);

            _messenger.Register <UserLoggedInMessage>(this, (_, _) => LoadGuilds());
            _messenger.Register <SelectGuildMessage <ulong> >(this, (_, m) => SelectGuildById(m.Guild));
            _messenger.Register <SelectGuildMessage <IBindableSelectableGuildItem> >(this, (_, m) => SelectedGuild = m.Guild);
        }
コード例 #17
0
ファイル: GunzCord.cs プロジェクト: mhs02/GunzCord
 public GunzCord(
     IDatabaseService databaseService,
     IDiscordService discordService)
 {
     _databaseService = databaseService;
     _discordService  = discordService;
 }
コード例 #18
0
 public DiscordLoggerProvider(DiscordLoggerConfiguration config, IDiscordService discord,
                              string includedPrefixes = "", string excludedPrefixes = "")
 {
     _config  = config;
     _discord = discord;
     _config.IncludedPrefixes = includedPrefixes;
     _config.ExcludedPrefixes = excludedPrefixes;
 }
コード例 #19
0
 public PublishTrades(IOptions <PublishTradesOptions> options, ILogger <PublishTrades> logger)
 {
     _logger          = logger;
     _localImport     = options.Value.LocalImportService;
     _discord         = options.Value.DiscordService;
     _sqlite          = options.Value.SqliteService;
     _refreshInterval = options.Value.RefreshInterval;
 }
コード例 #20
0
 public AccountController(IAuthenticationService authenticationService, ICookie cookie, ICookieManager cookieManager, IDiscordService discordService, IActivityReportService activityReportService)
 {
     _authenticationService = authenticationService;
     _cookie                = cookie;
     _cookieManager         = cookieManager;
     _discordService        = discordService;
     _activityReportService = activityReportService;
 }
コード例 #21
0
 public HomeController(IAuthenticationService authenticationService, IDiscordService discordService, ICookie cookie, ICookieManager cookieManager, IConfiguration configuration)
 {
     this.authService    = authenticationService;
     this.discordService = discordService;
     _cookie             = cookie;
     _cookieManager      = cookieManager;
     _configuration      = configuration;
 }
コード例 #22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="VoicePanelViewModel"/> class.
        /// </summary>
        public VoicePanelViewModel(IMessenger messenger, IDiscordService discordService, IDispatcherService dispatcherService)
        {
            _messenger         = messenger;
            _discordService    = discordService;
            _dispatcherService = dispatcherService;

            _messenger.Register <ChannelSelectedMessage <IBindableSelectableChannel> >(this, (_, m) => SelectedChannel = m.Channel as IBindableAudioChannel);
        }
コード例 #23
0
        internal DisplayPageViewModel(ILocalizationService localizationService, IDiscordService discordService, IStorageService storageService) :
            base(localizationService, discordService, storageService)
        {
            _selectedLanguage = new(CultureInfo.GetCultureInfo(_localizationService.LanguageOverride));
            LanguageOptions   = _localizationService.AvailableLanguages.Select(x => CultureInfo.GetCultureInfo(x));

            RegisterDraftValues(SelectedLanguage);
        }
コード例 #24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SelectableItem"/> class.
 /// </summary>
 public SelectableItem(
     IMessenger messenger,
     IDiscordService discordService,
     QuarrelClient quarrelClient,
     IDispatcherService dispatcherService) :
     base(messenger, discordService, quarrelClient, dispatcherService)
 {
 }
コード例 #25
0
 public EncounterPlayerStatistics(ILogger logger, IEncounterRepository encounterRepository, IScheduledTaskRepository taskRepository, IBossFightSingleTargetDetail bossFightSingleTargetDetailRepository, IDiscordService discord)
 {
     _logger = logger;
     _encounterRepository = encounterRepository;
     _taskRepository      = taskRepository;
     _bossFightSingleTargetDetailRepository = bossFightSingleTargetDetailRepository;
     _discord = discord;
 }
コード例 #26
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ChannelsViewModel"/> class.
        /// </summary>
        public ChannelsViewModel(ILoggingService loggingService, IMessenger messenger, IDiscordService discordService)
        {
            _loggingService = loggingService;
            _messenger      = messenger;
            _discordService = discordService;

            _messenger.Register <SelectChannelMessage <IBindableSelectableChannel> >(this, (_, m) => SelectedChannel = m.Channel);
            _messenger.Register <GuildSelectedMessage <IBindableSelectableGuildItem> >(this, (_, m) => LoadChannels(m.Guild));
        }
コード例 #27
0
 public DiscordMessageListener(IBillRepository billRepository, IShoppingRepository shoppingRepository, IPeopleRepository peopleRepository, IDiscordService discordService)
 {
     _discordService  = discordService;
     _discordCommands = new Dictionary <string, IDiscordCommand>
     {
         { "bills", new ListBillCommand(discordService, billRepository, peopleRepository) },
         { "shopping", new ListShoppingCommand(discordService, shoppingRepository, peopleRepository) }
     };
 }
 public ContractNotificationService(IESIService esiService, IMapper mapper,
                                    IDiscordService discordService, ISlackService slackService, IDataStorageService dataStorageService)
 {
     _esiService         = esiService;
     _mapper             = mapper;
     _slackService       = slackService;
     _discordService     = discordService;
     _dataStorageService = dataStorageService;
 }
コード例 #29
0
 public SilentUpdateController(ILogger logger, IEncounterRepository encounterRepository,
                               IBossFightRepository bossFightRepository, IEncounterPlayerRoleRepository encounterPlayerRoleRepository, IDiscordService discord)
 {
     _logger = logger;
     _encounterRepository           = encounterRepository;
     _bossFightRepository           = bossFightRepository;
     _encounterPlayerRoleRepository = encounterPlayerRoleRepository;
     _discord = discord;
 }
コード例 #30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BindableGuildMember"/> class.
 /// </summary>
 internal BindableGuildMember(
     IMessenger messenger,
     IDiscordService discordService,
     QuarrelClient quarrelClient,
     IDispatcherService dispatcherService,
     GuildMember guildMember) :
     base(messenger, discordService, quarrelClient, dispatcherService)
 {
     _guildMember = guildMember;
 }