forked from adam/discord-bot-shtik
more shtikbot error handling
This commit is contained in:
parent
8fa439b232
commit
32242c9cb4
22
Features.cs
22
Features.cs
@ -23,14 +23,16 @@ namespace silverworker_discord
|
|||||||
ytdl.FFmpegPath = "ffmpeg";
|
ytdl.FFmpegPath = "ffmpeg";
|
||||||
ytdl.OutputFolder = "";
|
ytdl.OutputFolder = "";
|
||||||
ytdl.OutputFileTemplate = "tiktokbad.%(ext)s";
|
ytdl.OutputFileTemplate = "tiktokbad.%(ext)s";
|
||||||
var res = await ytdl.RunVideoDownload(link.ToString());
|
try
|
||||||
if (!res.Success)
|
|
||||||
{
|
{
|
||||||
Console.Error.WriteLine("tried to dl, failed. \n" + string.Join('\n', res.ErrorOutput));
|
var res = await ytdl.RunVideoDownload(link.ToString());
|
||||||
await message.AddReactionAsync(Emote.Parse("<:problemon:859453047141957643>"));
|
if (!res.Success)
|
||||||
await message.Channel.SendMessageAsync("tried to dl, failed. \n" + string.Join('\n', res.ErrorOutput));
|
{
|
||||||
}
|
Console.Error.WriteLine("tried to dl, failed. \n" + string.Join('\n', res.ErrorOutput));
|
||||||
else
|
await message.AddReactionAsync(Emote.Parse("<:problemon:859453047141957643>"));
|
||||||
|
await message.Channel.SendMessageAsync("tried to dl, failed. \n" + string.Join('\n', res.ErrorOutput));
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
string path = res.Data;
|
string path = res.Data;
|
||||||
if (File.Exists(path))
|
if (File.Exists(path))
|
||||||
@ -51,6 +53,12 @@ namespace silverworker_discord
|
|||||||
await message.AddReactionAsync(Emote.Parse("<:problemon:859453047141957643>"));
|
await message.AddReactionAsync(Emote.Parse("<:problemon:859453047141957643>"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.Error.WriteLine(e);
|
||||||
|
await message.AddReactionAsync(Emote.Parse("<:problemon:859453047141957643>"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public static async void deheic(SocketUserMessage message, Attachment att)
|
public static async void deheic(SocketUserMessage message, Attachment att)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user