From 4c312a8172ff2c24fda3d0e4ac11dc288149fa79 Mon Sep 17 00:00:00 2001 From: "Adam R. Grey" Date: Sun, 24 Oct 2021 08:36:26 -0400 Subject: [PATCH] slightly more error resistant --- Program.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Program.cs b/Program.cs index 9759303..ef33c8b 100644 --- a/Program.cs +++ b/Program.cs @@ -40,7 +40,6 @@ namespace silverworker_discord await _client.LoginAsync(TokenType.Bot, config["token"]); await _client.StartAsync(); - _client.Ready += () => Task.Run(() => { Console.WriteLine("Bot is connected! going to sign up for message received and user joined in client ready"); @@ -152,7 +151,14 @@ namespace silverworker_discord string path = res.Data; if(File.Exists(path)) { - await message.Channel.SendFileAsync(path); + try + { + await message.Channel.SendFileAsync(path); + } + catch(Exception e) + { + await message.Channel.SendMessageAsync($"aaaadam!\n{JsonConvert.SerializeObject(e)}"); + } File.Delete(path); } else