Exemple #1
0
        private async Task ClientOnReady()
        {
            if (AlreadyInitiated)
            {
                return;
            }

            AlreadyInitiated = true;
            $"Bot started! Press Control + C to exit!".Log();

            while (Garden.TheFriendTree == null)
            {
                Garden.TheFriendTree = _client.GetGuild(719734487415652382);
                await Task.Delay(100).ConfigureAwait(false);
            }

            Executor.Recur(async() =>
            {
                if (await GithubChecker.UpdateAvailable())
                {
                    Console.WriteLine("Updating Gardener...");
                    await UpdateProcess.StartUpdate();
                }
            }, TimeSpan.FromSeconds(10), StopToken);


            await _client.SetStatusAsync(UserStatus.DoNotDisturb).ConfigureAwait(false);

            await _client.SetActivityAsync(new CustomActivity($"commit {await GithubChecker.GetRemoteVersionShort()}",
                                                              ActivityType.Watching, ActivityProperties.None, "")).ConfigureAwait(false);

            _client.MessageUpdated += ClientOnMessageUpdated;

            await Garden.OnStart();
        }
Exemple #2
0
 public Task Update()
 {
     return(UpdateProcess.StartUpdate());
 }