Closed Bottersnike closed 7 years ago
When running the bot for the first time, if videoUrls.txt does not exist as a file, every command will spit out the following error:
videoUrls.txt
[Error] An error occured during the video check -System.IO.FileNotFoundException: Could not find file 'C:\Users\***\Documents\Visual Studio 2015\Projects\discord-bot\stem-bote\bin\Debug\videoUrls.txt'. File name: 'C:\Users\***\Documents\Visual Studio 2015\Projects\discord-bot\stem-bote\bin\Debug\videoUrls.txt' at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost) at System.IO.StreamReader..ctor(String path, Encoding encoding) at System.IO.File.InternalReadAllLines(String path, Encoding encoding) at System.IO.File.ReadAllLines(String path) at stembote.stembote.caryVideoChecker(Object source, ElapsedEventArgs e) in C:\Users\***\Documents\Visual Studio 2015\Projects\discord-bot\stem-bote\Program.cs:line 395
Manually creating the file fixes this, however, it would be nice were it automated.
Possible fix: Before
var logFile = File.ReadAllLines(videoUrlsFile);
check if the file really exists and if not, create it first.
I can't see any valid reason for this to occur on every message, but I do see why this may occur every minute.
When running the bot for the first time, if
videoUrls.txt
does not exist as a file, every command will spit out the following error:Manually creating the file fixes this, however, it would be nice were it automated.
Possible fix: Before
check if the file really exists and if not, create it first.