Ejemplo n.º 1
0
        public AcquireToken(ICredentialsManagement credentialsManagement)
        {
            Credentials credentials = credentialsManagement.Load();

            FullRequestTokenUrl = RequestTokenUrl.Replace("#ClientID#", credentials.CliendId).Replace("#RedirectUrl#", Uri.EscapeUriString(RedirectUrl)).Replace("#Scope#", Uri.EscapeUriString(string.Join(" ", Scope.List.Where(x => x != Scope.CHAT).Select(x => x.Name))));
            FullRequestTokenUrl = FullRequestTokenUrl.Replace(" ", "").Replace(Environment.NewLine, "");
        }
Ejemplo n.º 2
0
Archivo: Bot.cs Proyecto: ckorn/cuddle
        public Bot(ILogger logger, IEmoteCache emoteCache, IBadgeCache badgeCache, IMessageFormatManager messageFormatManager, ICredentialsManagement credentialsManagement)
        {
            this.logger               = logger;
            this.emoteCache           = emoteCache;
            this.badgeCache           = badgeCache;
            this.messageFormatManager = messageFormatManager;
            messageConverter          = new MessageConverter(this.emoteCache, this.badgeCache);
            badgeConverter            = new BadgeConverter(this.badgeCache);
            var clientOptions = new ClientOptions
            {
                MessagesAllowedInPeriod = 750,
                ThrottlingPeriod        = TimeSpan.FromSeconds(30)
            };
            WebSocketClient customClient = new WebSocketClient(clientOptions);

            client    = new TwitchClient(customClient);
            twitchAPI = new TwitchAPI();
            this.credentialsManagement = credentialsManagement;
        }