mirror of
https://github.com/JustusPlays78/DiscordBot.git
synced 2025-04-29 14:49:03 +00:00
added embeds
This commit is contained in:
parent
ec9bd5700d
commit
516660a21d
6
.idea/misc.xml
generated
Normal file
6
.idea/misc.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="JavaScriptSettings">
|
||||||
|
<option name="languageLevel" value="FLOW" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,34 @@
|
|||||||
|
import {EmbedBuilder} from "discord.js";
|
||||||
|
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setColor('#ffffff')
|
||||||
|
.setTitle('Changelog')
|
||||||
|
.setURL('https://github.com/JustusPlays78/ES_AIRAC_PACKAGE_UPDATER/releases')
|
||||||
|
.setAuthor({ name: 'Sevenity', iconURL: 'https://sevenity.net/images/logo.png' })
|
||||||
|
const date = new Date();
|
||||||
|
|
||||||
|
export function createChangelogEmbed() {
|
||||||
|
|
||||||
|
embed.addFields({
|
||||||
|
name: 'Fixes',
|
||||||
|
value: "ACP: Gänge gingen nicht \n Webseite: Discord war kein Mensch",
|
||||||
|
inline: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
embed.addFields({
|
||||||
|
name: 'Neue Features',
|
||||||
|
value: "Elevator \n Webseite: AltV-Direct Connect",
|
||||||
|
inline: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
embed.addFields({
|
||||||
|
name: 'Sonstiges',
|
||||||
|
value: "Wohnung: Schlüssel verändert",
|
||||||
|
inline: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
embed.setFooter({ text: date.toLocaleString("de-DE")});
|
||||||
|
return embed;
|
||||||
|
}
|
||||||
|
|
52
text.js
52
text.js
@ -1,16 +1,60 @@
|
|||||||
import fetch from "node-fetch";
|
import fetch from "node-fetch";
|
||||||
|
import {EmbedBuilder} from "discord.js";
|
||||||
|
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setColor('#ffffff')
|
||||||
|
.setTitle('Changelog')
|
||||||
|
.setURL('https://github.com/JustusPlays78/ES_AIRAC_PACKAGE_UPDATER/releases')
|
||||||
|
.setAuthor({ name: 'Sevenity', iconURL: 'https://sevenity.net/images/logo.png' })
|
||||||
|
const date = new Date();
|
||||||
|
|
||||||
|
|
||||||
export async function fetchText(url){
|
export async function fetchText(url, accessToken){
|
||||||
try {
|
try {
|
||||||
const response = await fetch(url);
|
const response = await fetch(url, {
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'Authorization': `Bearer ${accessToken}`,
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`HTTP-Fehler! Status: ${response.status}`);
|
throw new Error(`HTTP-Fehler! Status: ${response.status}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const text = await response.text();
|
const text = await response.text();
|
||||||
return text; // Den Text zurückgeben
|
return text;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Fehler beim Abrufen der Datei:', error);
|
console.error('Fehler beim Abrufen der Datei:', error);
|
||||||
throw error; // Fehler weiterwerfen
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getChanges(result){
|
||||||
|
const lines = result.split('\n');
|
||||||
|
let dayChangesArray = [];
|
||||||
|
let days = [];
|
||||||
|
let daysChangeString = [];
|
||||||
|
|
||||||
|
for (let line of lines) {
|
||||||
|
if (line.startsWith('## ')) {
|
||||||
|
const Day = line.replace('## ', '');
|
||||||
|
days.push(Day);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//console.log(JSON.stringify(changes, null, 2));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
class DayChanges {
|
||||||
|
constructor(id,day,fixes,features,otherChanges) {
|
||||||
|
this.id = id;
|
||||||
|
this.day = day;
|
||||||
|
this.fixes = fixes;
|
||||||
|
this.otherChanges = otherChanges;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user