public static async Task <TimedEvent> Create(int interval, Library steamAppsNewsLibrary)
        {
            var result = new TimedSteamAppNewsUpdate(interval, steamAppsNewsLibrary);

            result._steamNewsClient = await SteamNewsClient.Create();

            return(result);
        }
Пример #2
0
        private static async Task MainAsync()
        {
            Console.WriteLine("Starting...");

            string decodedToken = System.Text.Encoding.ASCII.GetString(Convert.FromBase64String(Token));

            _discord = new DiscordClient(new DiscordConfiguration
            {
                Token     = decodedToken,
                TokenType = TokenType.Bot
            });

            await _discord.ConnectAsync();

            AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnProcessExit);

            Console.WriteLine("Getting Channel...");
            var _jibberJabber = await _discord.GetChannelAsync(630368958498734099);

            Console.WriteLine("Getting pinned message...");
            var pinnedMessage = await _jibberJabber.GetMessageAsync(692849775690645555);

            var timedLocalTimeUpdate = new TimedLocalTimeUpdate(30000, pinnedMessage);

            Console.WriteLine("Starting local time updater!");
            timedLocalTimeUpdate.Start();

            var steamAppNewsLibrary = await Library.Create(LibraryType.SteamAppNews);

            var timedSteamAppNewsUpdate = await TimedSteamAppNewsUpdate.Create(3600000, steamAppNewsLibrary); //3600000 = 1 hour

            Console.WriteLine("Starting steam app news updater!");
            timedSteamAppNewsUpdate.Start();

            _commandList = await CommandList.Create(_discord, steamAppNewsLibrary);

            Console.WriteLine("Listening to new messages!");
            _discord.MessageCreated += async e => { await _commandList.Run(e); };

            Console.WriteLine("Setup complete!");
            await Task.Delay(-1);
        }