slightly more error resistant

This commit is contained in:
Adam R. Grey 2021-10-24 08:36:26 -04:00
parent d362fe8503
commit 4c312a8172

View File

@ -40,7 +40,6 @@ namespace silverworker_discord
await _client.LoginAsync(TokenType.Bot, config["token"]); await _client.LoginAsync(TokenType.Bot, config["token"]);
await _client.StartAsync(); await _client.StartAsync();
_client.Ready += () => Task.Run(() => _client.Ready += () => Task.Run(() =>
{ {
Console.WriteLine("Bot is connected! going to sign up for message received and user joined in client ready"); Console.WriteLine("Bot is connected! going to sign up for message received and user joined in client ready");
@ -151,8 +150,15 @@ namespace silverworker_discord
{ {
string path = res.Data; string path = res.Data;
if(File.Exists(path)) if(File.Exists(path))
{
try
{ {
await message.Channel.SendFileAsync(path); await message.Channel.SendFileAsync(path);
}
catch(Exception e)
{
await message.Channel.SendMessageAsync($"aaaadam!\n{JsonConvert.SerializeObject(e)}");
}
File.Delete(path); File.Delete(path);
} }
else else