Exemple #1
0
        private static async Task Main()
        {
            var client = await DiscordSettings.GetClient();

            var services = DiscordSettings.ConfigureServices(client);
            await DiscordSettings.InstallCommands(client, services);

            SocialScoreWatcher.Bind(client);
            // CoronaWatcher.Bind(client);
            MuteWatcher.Bind(client);
            VoiceChat.Bind(client);
            GovernanceVoteWatcher.Bind(client);
            EditWatcher.Bind(client);
            QuickReportWatcher.Bind(client);
            StarboardWatcher.Bind(client);
            QuickChatWatcher.Bind(client);
            SlurWatcher.Bind(client);
            DadbotWatcher.Bind(client);

            await Task.Delay(10000);

            var crawler = new Crawler(client);

            await Task.WhenAny(Task.Delay(TimeSpan.FromDays(2)), crawler.StartAsync());

            throw new Exception("Restart me!");
        }
Exemple #2
0
        public async Task ChangeNickname([Remainder] string nick)
        {
            var user  = (IGuildUser)Context.User;
            var score = await Score.GetScoreDataAsync(Context.Client, user.Id);

            if (score.ScoreLevel < 4)
            {
                throw new Exception("You must be a class of 4 or higher to change your nick.");
            }

            if (!DadbotWatcher.CanChangeNick(user.Id))
            {
                var target   = Format.Sanitize(user.Nickname ?? user.Username);
                var duration = DadbotWatcher.GetTimeLeft(user.Id).ToHumanReadableString();
                throw new Exception($"Sorry {target}, but you can't change your nickname for another {duration} (due to Dadbot).");
            }

            await user.ModifyAsync(u => u.Nickname = nick);

            await ReplyAsync("Your nickname was updated.");
        }