Updated transcription library
This commit is contained in:
parent
0dd6913dd8
commit
9f15236878
6 changed files with 41 additions and 34 deletions
|
@ -85,7 +85,7 @@ public class CloseCommand : ApplicationCommandModule
|
||||||
|
|
||||||
await using FileStream file = new FileStream(Transcriber.GetPath(ticket.id), FileMode.Open, FileAccess.Read);
|
await using FileStream file = new FileStream(Transcriber.GetPath(ticket.id), FileMode.Open, FileAccess.Read);
|
||||||
DiscordMessageBuilder message = new DiscordMessageBuilder();
|
DiscordMessageBuilder message = new DiscordMessageBuilder();
|
||||||
message.WithEmbed(embed);
|
message.AddEmbed(embed);
|
||||||
message.AddFiles(new Dictionary<string, Stream> { { Transcriber.GetFilename(ticket.id), file } });
|
message.AddFiles(new Dictionary<string, Stream> { { Transcriber.GetFilename(ticket.id), file } });
|
||||||
|
|
||||||
await logChannel.SendMessageAsync(message);
|
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);
|
await using FileStream file = new FileStream(Transcriber.GetPath(ticket.id), FileMode.Open, FileAccess.Read);
|
||||||
|
|
||||||
DiscordMessageBuilder message = new DiscordMessageBuilder();
|
DiscordMessageBuilder message = new DiscordMessageBuilder();
|
||||||
message.WithEmbed(embed);
|
message.AddEmbed(embed);
|
||||||
message.AddFiles(new Dictionary<string, Stream> { { Transcriber.GetFilename(ticket.id), file } });
|
message.AddFiles(new Dictionary<string, Stream> { { Transcriber.GetFilename(ticket.id), file } });
|
||||||
|
|
||||||
await staffMember.SendMessageAsync(message);
|
await staffMember.SendMessageAsync(message);
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class TranscriptCommand : ApplicationCommandModule
|
||||||
await using FileStream file = new FileStream(Transcriber.GetPath(ticket.id), FileMode.Open, FileAccess.Read);
|
await using FileStream file = new FileStream(Transcriber.GetPath(ticket.id), FileMode.Open, FileAccess.Read);
|
||||||
|
|
||||||
DiscordMessageBuilder message = new DiscordMessageBuilder();
|
DiscordMessageBuilder message = new DiscordMessageBuilder();
|
||||||
message.WithEmbed(new DiscordEmbedBuilder
|
message.AddEmbed(new DiscordEmbedBuilder
|
||||||
{
|
{
|
||||||
Color = DiscordColor.Green,
|
Color = DiscordColor.Green,
|
||||||
Description = "Ticket " + ticket.id.ToString("00000") + " transcript generated by " + command.Member.Mention + ".\n",
|
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);
|
await using FileStream file = new FileStream(Transcriber.GetPath(ticket.id), FileMode.Open, FileAccess.Read);
|
||||||
|
|
||||||
DiscordMessageBuilder directMessage = new DiscordMessageBuilder();
|
DiscordMessageBuilder directMessage = new DiscordMessageBuilder();
|
||||||
directMessage.WithEmbed(new DiscordEmbedBuilder
|
directMessage.AddEmbed(new DiscordEmbedBuilder
|
||||||
{
|
{
|
||||||
Color = DiscordColor.Green,
|
Color = DiscordColor.Green,
|
||||||
Description = "Transcript generated!\n"
|
Description = "Transcript generated!\n"
|
||||||
|
|
|
@ -15,7 +15,19 @@ namespace SupportChild;
|
||||||
internal static class SupportChild
|
internal static class SupportChild
|
||||||
{
|
{
|
||||||
// Sets up a dummy client to use for logging
|
// 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 SlashCommandsExtension commands = null;
|
||||||
|
|
||||||
private static void Main()
|
private static void Main()
|
||||||
|
@ -52,7 +64,6 @@ internal static class SupportChild
|
||||||
{
|
{
|
||||||
await discordClient.DisconnectAsync();
|
await discordClient.DisconnectAsync();
|
||||||
discordClient.Dispose();
|
discordClient.Dispose();
|
||||||
Logger.Log("Discord client disconnected.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Log("Loading config \"" + Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "config.yml\"");
|
Logger.Log("Loading config \"" + Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "config.yml\"");
|
||||||
|
@ -81,16 +92,10 @@ internal static class SupportChild
|
||||||
Logger.Log("Setting up Discord client...");
|
Logger.Log("Setting up Discord client...");
|
||||||
|
|
||||||
// Setting up client configuration
|
// Setting up client configuration
|
||||||
DiscordConfiguration cfg = new DiscordConfiguration
|
config.Token = Config.token;
|
||||||
{
|
config.MinimumLogLevel = Config.logLevel;
|
||||||
Token = Config.token,
|
|
||||||
TokenType = TokenType.Bot,
|
|
||||||
MinimumLogLevel = Config.logLevel,
|
|
||||||
AutoReconnect = true,
|
|
||||||
Intents = DiscordIntents.All
|
|
||||||
};
|
|
||||||
|
|
||||||
discordClient = new DiscordClient(cfg);
|
discordClient = new DiscordClient(config);
|
||||||
|
|
||||||
Logger.Log("Hooking events...");
|
Logger.Log("Hooking events...");
|
||||||
discordClient.Ready += EventHandler.OnReady;
|
discordClient.Ready += EventHandler.OnReady;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<Version>3.0.2.2</Version>
|
<Version>3.1.0.0</Version>
|
||||||
<ApplicationIcon>ellie_icon.ico</ApplicationIcon>
|
<ApplicationIcon>ellie_icon.ico</ApplicationIcon>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<StartupObject>SupportChild.SupportChild</StartupObject>
|
<StartupObject>SupportChild.SupportChild</StartupObject>
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
<PackageIconUrl>https://cdn.discordapp.com/attachments/765441543100170271/914327948667011132/Ellie_Concept_2_transparent_ver.png</PackageIconUrl>
|
<PackageIconUrl>https://cdn.discordapp.com/attachments/765441543100170271/914327948667011132/Ellie_Concept_2_transparent_ver.png</PackageIconUrl>
|
||||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||||
<PackageProjectUrl>https://toastielab.dev/Emotions-stuff/SupportChild</PackageProjectUrl>
|
<PackageProjectUrl>https://toastielab.dev/Emotions-stuff/SupportChild</PackageProjectUrl>
|
||||||
<PackageVersion>3.0.2</PackageVersion>
|
<PackageVersion>3.1.0</PackageVersion>
|
||||||
<LangVersion>default</LangVersion>
|
<LangVersion>default</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
@ -31,16 +31,15 @@
|
||||||
<PackageReference Include="DSharpPlus" Version="4.5.0" />
|
<PackageReference Include="DSharpPlus" Version="4.5.0" />
|
||||||
<PackageReference Include="DSharpPlus.Interactivity" Version="4.5.0" />
|
<PackageReference Include="DSharpPlus.Interactivity" Version="4.5.0" />
|
||||||
<PackageReference Include="DSharpPlus.SlashCommands" 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="JsonExtensions" Version="1.2.0" />
|
||||||
<PackageReference Include="MiniRazor.CodeGen" Version="2.2.1" />
|
|
||||||
<PackageReference Include="MySqlConnector" Version="2.3.7" />
|
<PackageReference Include="MySqlConnector" Version="2.3.7" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<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="Superpower" Version="3.0.0" />
|
||||||
<PackageReference Include="Tyrrrz.Extensions" Version="1.6.5" />
|
|
||||||
<PackageReference Include="WebMarkupMin.Core" Version="2.17.0" />
|
<PackageReference Include="WebMarkupMin.Core" Version="2.17.0" />
|
||||||
<PackageReference Include="YamlDotNet" Version="16.1.0" />
|
<PackageReference Include="YamlDotNet" Version="16.1.0" />
|
||||||
|
<PackageReference Include="YoutubeExplode" Version="6.4.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -24,18 +24,21 @@ internal static class Transcriber
|
||||||
Channel channel = await discordClient.GetChannelAsync(new Snowflake(channelID));
|
Channel channel = await discordClient.GetChannelAsync(new Snowflake(channelID));
|
||||||
Guild guild = await discordClient.GetGuildAsync(channel.GuildId);
|
Guild guild = await discordClient.GetGuildAsync(channel.GuildId);
|
||||||
|
|
||||||
ExportRequest request = new ExportRequest(
|
ExportRequest request = new(
|
||||||
Guild: guild,
|
guild,
|
||||||
Channel: channel,
|
channel,
|
||||||
OutputPath: GetPath(ticketID),
|
GetPath(ticketID),
|
||||||
Format: ExportFormat.HtmlDark,
|
null,
|
||||||
After: null,
|
ExportFormat.HtmlDark,
|
||||||
Before: null,
|
null,
|
||||||
PartitionLimit: PartitionLimit.Null,
|
null,
|
||||||
MessageFilter: MessageFilter.Null,
|
PartitionLimit.Null,
|
||||||
ShouldDownloadMedia: false,
|
MessageFilter.Null,
|
||||||
ShouldReuseMedia: false,
|
true,
|
||||||
DateFormat: "yyyy-MMM-dd HH:mm"
|
false,
|
||||||
|
false,
|
||||||
|
"en-US",
|
||||||
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
await exporter.ExportChannelAsync(request);
|
await exporter.ExportChannelAsync(request);
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue