private void ConfigureOutput(ICommandInteraction writer) { var streamToEventConverter = new StreamToEventConverter(); var streamToEventConverterForError = new StreamToEventConverter(); var utf8WithoutBom = new UTF8Encoding(false); Engine.Runtime.IO.SetOutput(streamToEventConverter, utf8WithoutBom); Engine.Runtime.IO.SetErrorOutput(streamToEventConverterForError, utf8WithoutBom); streamToEventConverter.BytesWritten += bytes => writer.Write(utf8WithoutBom.GetString(bytes).Replace("\n", "\r\n")); streamToEventConverterForError.BytesWritten += bytes => writer.WriteError(utf8WithoutBom.GetString(bytes).Replace("\n", "\r\n")); }