Updated transcription library

This commit is contained in:
Toastie (DCS Team) 2024-10-29 22:52:02 +13:00
parent 0dd6913dd8
commit 9f15236878
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4
6 changed files with 41 additions and 34 deletions

View file

@ -85,7 +85,7 @@ public class CloseCommand : ApplicationCommandModule
await using FileStream file = new FileStream(Transcriber.GetPath(ticket.id), FileMode.Open, FileAccess.Read);
DiscordMessageBuilder message = new DiscordMessageBuilder();
message.WithEmbed(embed);
message.AddEmbed(embed);
message.AddFiles(new Dictionary<string, Stream> { { Transcriber.GetFilename(ticket.id), file } });
await logChannel.SendMessageAsync(message);
@ -106,7 +106,7 @@ public class CloseCommand : ApplicationCommandModule
await using FileStream file = new FileStream(Transcriber.GetPath(ticket.id), FileMode.Open, FileAccess.Read);
DiscordMessageBuilder message = new DiscordMessageBuilder();
message.WithEmbed(embed);
message.AddEmbed(embed);
message.AddFiles(new Dictionary<string, Stream> { { Transcriber.GetFilename(ticket.id), file } });
await staffMember.SendMessageAsync(message);

View file

@ -84,7 +84,7 @@ public class TranscriptCommand : ApplicationCommandModule
await using FileStream file = new FileStream(Transcriber.GetPath(ticket.id), FileMode.Open, FileAccess.Read);
DiscordMessageBuilder message = new DiscordMessageBuilder();
message.WithEmbed(new DiscordEmbedBuilder
message.AddEmbed(new DiscordEmbedBuilder
{
Color = DiscordColor.Green,
Description = "Ticket " + ticket.id.ToString("00000") + " transcript generated by " + command.Member.Mention + ".\n",
@ -101,7 +101,7 @@ public class TranscriptCommand : ApplicationCommandModule
await using FileStream file = new FileStream(Transcriber.GetPath(ticket.id), FileMode.Open, FileAccess.Read);
DiscordMessageBuilder directMessage = new DiscordMessageBuilder();
directMessage.WithEmbed(new DiscordEmbedBuilder
directMessage.AddEmbed(new DiscordEmbedBuilder
{
Color = DiscordColor.Green,
Description = "Transcript generated!\n"

View file

@ -15,7 +15,19 @@ namespace SupportChild;
internal static class SupportChild
{
// Sets up a dummy client to use for logging
public static DiscordClient discordClient = new DiscordClient(new DiscordConfiguration { Token = "DUMMY_TOKEN", TokenType = TokenType.Bot, MinimumLogLevel = LogLevel.Debug });
private static readonly DiscordConfiguration config = new()
{
Token = "DUMMY_TOKEN",
TokenType = TokenType.Bot,
MinimumLogLevel = LogLevel.Debug,
AutoReconnect = true,
Intents = DiscordIntents.All,
LogTimestampFormat = "yyyy-MM-dd HH:mm:ss",
LogUnknownEvents = false
};
public static DiscordClient discordClient { get; private set; } = new(config);
private static SlashCommandsExtension commands = null;
private static void Main()
@ -52,7 +64,6 @@ internal static class SupportChild
{
await discordClient.DisconnectAsync();
discordClient.Dispose();
Logger.Log("Discord client disconnected.");
}
Logger.Log("Loading config \"" + Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "config.yml\"");
@ -81,16 +92,10 @@ internal static class SupportChild
Logger.Log("Setting up Discord client...");
// Setting up client configuration
DiscordConfiguration cfg = new DiscordConfiguration
{
Token = Config.token,
TokenType = TokenType.Bot,
MinimumLogLevel = Config.logLevel,
AutoReconnect = true,
Intents = DiscordIntents.All
};
config.Token = Config.token;
config.MinimumLogLevel = Config.logLevel;
discordClient = new DiscordClient(cfg);
discordClient = new DiscordClient(config);
Logger.Log("Hooking events...");
discordClient.Ready += EventHandler.OnReady;

View file

@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<Version>3.0.2.2</Version>
<Version>3.1.0.0</Version>
<ApplicationIcon>ellie_icon.ico</ApplicationIcon>
<TargetFramework>net8.0</TargetFramework>
<StartupObject>SupportChild.SupportChild</StartupObject>
@ -19,7 +19,7 @@
<PackageIconUrl>https://cdn.discordapp.com/attachments/765441543100170271/914327948667011132/Ellie_Concept_2_transparent_ver.png</PackageIconUrl>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageProjectUrl>https://toastielab.dev/Emotions-stuff/SupportChild</PackageProjectUrl>
<PackageVersion>3.0.2</PackageVersion>
<PackageVersion>3.1.0</PackageVersion>
<LangVersion>default</LangVersion>
</PropertyGroup>
@ -31,16 +31,15 @@
<PackageReference Include="DSharpPlus" Version="4.5.0" />
<PackageReference Include="DSharpPlus.Interactivity" Version="4.5.0" />
<PackageReference Include="DSharpPlus.SlashCommands" Version="4.5.0" />
<PackageReference Include="Gress" Version="2.1.1" />
<PackageReference Include="JsonExtensions" Version="1.2.0" />
<PackageReference Include="MiniRazor.CodeGen" Version="2.2.1" />
<PackageReference Include="MySqlConnector" Version="2.3.7" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Polly" Version="8.4.1" />
<PackageReference Include="Polly" Version="8.4.0" />
<PackageReference Include="RazorBlade" Version="0.6.0" />
<PackageReference Include="Superpower" Version="3.0.0" />
<PackageReference Include="Tyrrrz.Extensions" Version="1.6.5" />
<PackageReference Include="WebMarkupMin.Core" Version="2.17.0" />
<PackageReference Include="YamlDotNet" Version="16.1.0" />
<PackageReference Include="YoutubeExplode" Version="6.4.0" />
</ItemGroup>
<ItemGroup>

View file

@ -24,19 +24,22 @@ internal static class Transcriber
Channel channel = await discordClient.GetChannelAsync(new Snowflake(channelID));
Guild guild = await discordClient.GetGuildAsync(channel.GuildId);
ExportRequest request = new ExportRequest(
Guild: guild,
Channel: channel,
OutputPath: GetPath(ticketID),
Format: ExportFormat.HtmlDark,
After: null,
Before: null,
PartitionLimit: PartitionLimit.Null,
MessageFilter: MessageFilter.Null,
ShouldDownloadMedia: false,
ShouldReuseMedia: false,
DateFormat: "yyyy-MMM-dd HH:mm"
);
ExportRequest request = new(
guild,
channel,
GetPath(ticketID),
null,
ExportFormat.HtmlDark,
null,
null,
PartitionLimit.Null,
MessageFilter.Null,
true,
false,
false,
"en-US",
true
);
await exporter.ExportChannelAsync(request);
}

Binary file not shown.