docs: Use Timeout.Infinite instead of -1 so that intent is clearer (#1443)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
using Discord.WebSocket;
|
||||
@@ -43,7 +44,7 @@ namespace _01_basic_ping_bot
|
||||
await _client.StartAsync();
|
||||
|
||||
// Block the program until it is closed.
|
||||
await Task.Delay(-1);
|
||||
await Task.Delay(Timeout.Infinite);
|
||||
}
|
||||
|
||||
private Task LogAsync(LogMessage log)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Discord;
|
||||
@@ -45,7 +46,7 @@ namespace _02_commands_framework
|
||||
// Here we initialize the logic required to register our commands.
|
||||
await services.GetRequiredService<CommandHandlingService>().InitializeAsync();
|
||||
|
||||
await Task.Delay(-1);
|
||||
await Task.Delay(Timeout.Infinite);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using _03_sharded_client.Services;
|
||||
using Discord;
|
||||
@@ -45,7 +46,7 @@ namespace _03_sharded_client
|
||||
await client.LoginAsync(TokenType.Bot, Environment.GetEnvironmentVariable("token"));
|
||||
await client.StartAsync();
|
||||
|
||||
await Task.Delay(-1);
|
||||
await Task.Delay(Timeout.Infinite);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user