Skip to content

Alaxus-Development/Alaxus-Transcript

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ENGLISH -> Discord (JDA) HTML Transcripts

Discord HTML Transcripts is a node.js module (recode on JDA) to generate nice looking HTML transcripts. Processes discord markdown like bold, italics, strikethroughs, and more. Nicely formats attachments and embeds. Built in XSS protection, preventing users from inserting html tags.

This module is designed to work with JDA.

HTML Template stolen from DiscordChatExporter and this is a Fork from Ryzeon/discord-html-transcripts with the difference that it's compiled for the corretto11 Version and an older Version of JDA (5.0.0-alpha.20).

Installation

<repositories>
    <repository>
	<id>jitpack.io</id>
	<url>https://jitpack.io</url>
    </repository>
</repositories>
<dependency>
    <groupId>com.github.NoPro200</groupId>
    <artifactId>discord-html-transcript-corretto11-jda</artifactId>
    <version>TAG</version>
</dependency>

Example Output

output

Usage

Example usage using the built-in message fetcher.

DiscordHtmlTranscripts transcript = DiscordHtmlTranscripts.getInstance();
textChannel.sendFiles(transcript.createTranscript(textChannel)).queue()

Or if you prefer, you can pass in your own messages.

DiscordHtmlTranscripts transcript = DiscordHtmlTranscripts.getInstance();
transcript.generateFromMessages(messages); // return to InputStream

You can also put the transcript into a variable

DiscordHtmlTranscripts transcripts = new DiscordHtmlTranscripts().getInstance();
try {
	testChannel.sendFiles(transcripts.getTranscript(testChannel, "test.html")).queue();
} catch (IOException e) {
	throw new RuntimeException(e);
}

You Also can save the HTML File by simply write

DiscordHtmlTranscripts transcripts = new DiscordHtmlTranscripts().getInstance();
try {
	transcripts.saveHtmlFile(textchannel, "test.html");
} catch (IOException e) {
	throw new RuntimeException(e);
}

It also returns the FileUpload so you can easely can send it

DiscordHtmlTranscripts transcripts = new DiscordHtmlTranscripts().getInstance();
try {
	FileUpload testFile = transcripts.saveHtmlFile(textchannel, "test.html");
        textchannel.sendFiles(testFile).queue();
} catch (IOException e) {
	throw new RuntimeException(e);
}

You Also can convert the FileUpload in a String by

DiscordHtmlTranscripts transcripts = new DiscordHtmlTranscripts().getInstance();
try {
	FileUpload testFile = testChannel.saveHtmlFile(textchannel, "test.html");
        String htmlString = transcripts.fileUploadToFileContent(testFile);
} catch (IOException e) {
	throw new RuntimeException(e);
}

DEUTSCH -> Discord (JDA) HTML Transcripts

Discord HTML Transcripts ist ein node.js-Modul (recode on JDA), um schön aussehende HTML-Transkripte zu erzeugen. Verarbeitet Discord Markdown wie fett, Kursivschrift, Durchstreichen und mehr. Schöne Formatierung von Anhängen und Einbettungen. Eingebauter XSS-Schutz, der verhindert, dass Benutzer HTML-Tags einfügen.

Dieses Modul ist für die Arbeit mit JDA konzipiert.

HTML-Vorlage gestohlen von DiscordChatExporter und dies ist ein Fork von Ryzeon/discord-html-transcripts mit dem Unterschied, dass es für die corretto11 Version und eine ältere Version von JDA (5.0.0-alpha.20) kompiliert wurde.

Installation

<repositories>
    <repository>
	<id>jitpack.io</id>
	<url>https://jitpack.io</url>
    </repository>
</repositories>
<dependency>
    <groupId>com.github.NoPro200</groupId>
    <artifactId>discord-html-transcript-corretto11-jda</artifactId>
    <version>TAG</version>
</dependency>

Beispielergebnis

output

Benutzung

Beispiel für die Verwendung des integrierten Nachrichtenabrufers

DiscordHtmlTranscripts transcript = DiscordHtmlTranscripts.getInstance();
textChannel.sendFiles(transcript.createTranscript(textChannel)).queue()

Wenn Sie möchten, können Sie auch Ihre eigenen Nachrichten eingeben

DiscordHtmlTranscripts transcript = DiscordHtmlTranscripts.getInstance();
transcript.generateFromMessages(messages); // return to InputStream

Sie können das Transkript auch in eine Variable einfügen

DiscordHtmlTranscripts transcripts = new DiscordHtmlTranscripts().getInstance();
try {
	testChannel.sendFiles(transcripts.getTranscript(testChannel, "test.html")).queue();
} catch (IOException e) {
	throw new RuntimeException(e);
}

Sie können die HTML-Datei auch speichern, indem Sie einfach schreiben

DiscordHtmlTranscripts transcripts = new DiscordHtmlTranscripts().getInstance();
try {
	transcripts.saveHtmlFile(textchannel, "test.html");
} catch (IOException e) {
	throw new RuntimeException(e);
}

Es gibt auch den FileUpload zurück, so dass Sie es einfach senden können

DiscordHtmlTranscripts transcripts = new DiscordHtmlTranscripts().getInstance();
try {
	FileUpload testFile = transcripts.saveHtmlFile(textchannel, "test.html");
        textchannel.sendFiles(testFile).queue();
} catch (IOException e) {
	throw new RuntimeException(e);
}

Sie können den FileUpload auch in einen String umwandeln, indem Sie

DiscordHtmlTranscripts transcripts = new DiscordHtmlTranscripts().getInstance();
try {
	FileUpload testFile = testChannel.saveHtmlFile(textchannel, "test.html");
        String htmlString = transcripts.fileUploadToFileContent(testFile);
} catch (IOException e) {
	throw new RuntimeException(e);
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 63.2%
  • HTML 36.8%