private async Task OnTick() { int playerCount = GetNumPlayerIndices(); using (StreamWriter outputFile = new StreamWriter(Path.Combine(DOJScriptHelper.ScriptLocation() + @"\config", "players.txt"), false)) { outputFile.WriteLine(playerCount); } await Delay(10000); }
public async Task RunBotAsync() { _client = new DiscordSocketClient(); _commands = new CommandService(); _services = new ServiceCollection() .AddSingleton(_client) .AddSingleton(_commands) .BuildServiceProvider(); _client.Log += _client_Log; await RegisterCommandsAsync(); await _client.LoginAsync(TokenType.Bot, DOJScriptHelper.BotToken()); await _client.StartAsync(); await Task.Delay(-1); }