mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
Added exception throw when token or prefix not valid.
This commit is contained in:
parent
4ad6e4a5e9
commit
b6781e1291
3 changed files with 11 additions and 4 deletions
|
|
@ -30,12 +30,17 @@ namespace ServerManagerTool.DiscordBot
|
|||
|
||||
public async Task StartAsync(LogLevel logLevel, string discordToken, string commandPrefix, string dataDirectory, bool allowAllBots, IEnumerable<string> botWhitelist, HandleCommandDelegate handleCommandCallback, HandleTranslationDelegate handleTranslationCallback, CancellationToken token)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(commandPrefix) || string.IsNullOrWhiteSpace(discordToken) || handleTranslationCallback is null || handleCommandCallback is null)
|
||||
if (string.IsNullOrWhiteSpace(discordToken))
|
||||
{
|
||||
return;
|
||||
throw new Exception("#DiscordBot_MissingTokenError");
|
||||
}
|
||||
|
||||
if (Started)
|
||||
if (string.IsNullOrWhiteSpace(commandPrefix))
|
||||
{
|
||||
throw new Exception("#DiscordBot_MissingPrefixError");
|
||||
}
|
||||
|
||||
if (Started || handleTranslationCallback is null || handleCommandCallback is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue