コード例 #1
0
ファイル: Debug.cs プロジェクト: Seizure/ImgurTaggingBot
        public void RunCore()
        {
            Logging.Log.Instance.DiscordLibraryLevel.Level = System.Diagnostics.SourceLevels.Warning;
            Console.Write("Discord Authentication Token > ");
            string DiscordAuthorizationToken = Console.ReadLine();
            string ImgurAuthenticationSecret = "Q", OAuthAccessToken = "Q", OAuthRefreshToken = "Q";

            Console.Write("Imgur Authentication ID > ");
            string ImgurAuthenticationID = Console.ReadLine();

            Console.Write("Imgur Authentication Secret > ");
            ImgurAuthenticationSecret = Console.ReadLine();
            Console.Write("Imgur OAuth Access Token > ");
            OAuthAccessToken = Console.ReadLine();

            /*
             * Console.Write("Imgur OAuth Refresh Token > ");
             * OAuthRefreshToken=Console.ReadLine();
             */
            SingleThreadReadWriteLock ShutdownLock = new SingleThreadReadWriteLock();

            Discord.DiscordInterfacerMain         _Discord;
            Imgur.ImgurInterfacer                 _Imgur;
            Application.CacheingTaglistRepository RepositoryTaglists;
            Program Core = new Program(
                new ProcessLatestCommentsActivity(
                    _Imgur = new Imgur.ImgurInterfacerMain(
                        new DataAccess.SettingsRepositoryMain(@"DataAccess\Settings1.xml"),
                        ImgurAuthenticationID, ImgurAuthenticationSecret,
                        "wereleven", 77530931,
                        OAuthAccessToken, OAuthRefreshToken, "bearer",
                        DateTimeOffset.UtcNow + TimeSpan.FromDays(11),
                        TimeSpan.FromSeconds(11), 0.1F, 140, "#",
                        ShutdownLock
                        ),
                    new DataAccess.SettingsRepositoryMain(@"DataAccess\Settings1.xml"),
                    RepositoryTaglists = new CacheingTaglistRepository(new DataAccess.TaglistRepositoryMain(@"DataAccess\Taglists.xml")),
                    new ProcessCommentActivity(
                        new Imgur.ImgurCommandParser("@Tagaroo2", _Imgur),
                        new ProcessTagCommandActivity(
                            _Imgur,
                            _Discord = new Discord.DiscordInterfacerMain(
                                DiscordAuthorizationToken,
                                388542416225042435UL, 388542416225042439UL,
                                388542416225042439UL, "/",
                                2000
                                ),
                            RepositoryTaglists
                            )
                        )
                    ),
                _Imgur,
                _Discord,
                new DataAccess.TaglistRepositoryMain(@"DataAccess\Taglists.xml"),
                new DataAccess.SettingsRepositoryMain(@"DataAccess\Settings1.xml"),
                ShutdownLock
                );

            Core.Run();
        }
コード例 #2
0
ファイル: Debug.cs プロジェクト: Seizure/ImgurTaggingBot
        public async Task RunDebugImgUR()
        {
            Console.Write("Authentication ID > ");
            string ImgurAuthenticationID = Console.ReadLine();
            string ImgurAuthenticationSecret = "Q", OAuthAccessToken = "Q";

            /*
             * Console.Write("Authentication Secret > ");
             * ImgurAuthenticationSecret=Console.ReadLine();
             * Console.Write("OAuth Access Token > ");
             * OAuthAccessToken=Console.ReadLine();
             */
            Imgur.ImgurInterfacer ClientImgur = new Imgur.ImgurInterfacerMain(
                new DataAccess.SettingsRepositoryMain(string.Empty),
                ImgurAuthenticationID, ImgurAuthenticationSecret, "Q", 3, OAuthAccessToken, "Q", "bearer", DateTimeOffset.MaxValue, TimeSpan.FromSeconds(11), 0.1F, 140, "#",
                new SingleThreadReadWriteLock()
                );
            IDictionary <string, IList <IComment> > Results = await ClientImgur.ReadCommentsSince(DateTimeOffset.UtcNow.AddMonths(-1), new HashSet <string>(){ "TruFox" }, 10);

            foreach (IComment Result in Results.Values.First())
            {
                Console.WriteLine("On {0} at {1}:", Result.ImageId, Result.DateTime);
                Console.WriteLine(Result.CommentText);
                Console.WriteLine("Replies - {0}", Result.Children.Count());
                Console.WriteLine();
            }
        }