wunsch-bot.js aktualisiert

This commit is contained in:
M_Viper 2024-09-19 15:33:59 +00:00
parent 2fb94ad103
commit 74ab51d9a1
1 changed files with 57 additions and 3 deletions

View File

@ -87,7 +87,8 @@ function getCategoryKeyboard() {
[{ text: 'Survival', callback_data: 'category_survival' }],
[{ text: 'WWE', callback_data: 'category_wwe' }],
[{ text: 'Musik', callback_data: 'category_musik' }],
[{ text: 'Bollywood', callback_data: 'category_bollywood' }] // Bollywood Kategorie hinzugefügt
[{ text: 'Bollywood', callback_data: 'category_bollywood' }],
[{ text: 'Hörspiele & Comics', callback_data: 'category_hoerspiele_comics' }] // Neue Kategorie hinzugefügt
]
})
};
@ -178,6 +179,57 @@ function archiveLogs() {
// Scheduler für die tägliche Archivierung um Mitternacht
schedule.scheduleJob('0 0 * * *', archiveLogs);
// /help Befehl für alle Kanäle
bot.command('help', async (ctx) => {
const helpMessage = `📋 *Hilfemenü*\n\nHier ist eine kurze Anleitung, wie du einen Wunsch äußern kannst:\n\n` +
`1⃣ Verwende den Befehl /wunsch, um den Wunschprozess zu starten.\n\n` +
`2⃣ Wähle eine Kategorie aus, die deinem Wunsch entspricht. 🗂️\n\n` +
`3⃣ Du wirst aufgefordert, einen Link zum Cover oder Spotify anzugeben (dies ist optional). 📎\n\n` +
`4⃣ Gib den Titel deines Wunsches ein. ✍️\n\n` +
`5⃣ Dein Wunsch wird an die Gruppe weitergeleitet und du erhältst eine Bestätigung. ✅\n\n` +
`Für weitere Informationen, besuche bitte unsere Anleitung:`;
const inlineKeyboard = {
reply_markup: JSON.stringify({
inline_keyboard: [
[{ text: 'Anleitung', url: 'https://git.viper.ipv64.net/M_Viper/telegram-film-wunsch-bot' }] // Hier den Link zur Webseite anpassen
]
})
};
await ctx.reply(helpMessage, inlineKeyboard);
});
// /info Befehl für alle Kanäle
bot.command('info', async (ctx) => {
const botInfo = `🤖 *Bot-Informationen*\n\n` +
`🔢 **Version:** 1.3.9\n\n` +
`👨‍💻 **Ersteller:** M_Viper\n\n` +
`📝 **Lizenz:** MIT Lizenz\n\n` +
`📅 **Erstellt am:** 2024-07-15\n\n` + // Füge hier das Erstellungsdatum hinzu
`🛠️ **Letztes Update:** 2024-09-19\n\n\n` + // Füge hier das letzte Update hinzu
`📈 **Funktionen:**\n\n` +
`- Wunschliste verwalten\n` +
`- Bot-Anleitungen bereitstellen\n` +
`- Benutzeranfragen bearbeiten\n\n` +
`🔧 **Wartung:** Regelmäßig aktualisiert und gewartet`;
const inlineKeyboard = {
reply_markup: JSON.stringify({
inline_keyboard: [
[
{ text: '🌐 Webseite besuchen', url: 'https://m-viper.de' },
{ text: '📧 Kontakt', url: 'https://t.me/M_Viper04' }
]
]
})
};
await ctx.reply(botInfo, inlineKeyboard);
});
// Callback-Query-Handler
bot.on('callback_query', async (ctx) => {
const data = ctx.callbackQuery.data;
@ -249,7 +301,8 @@ bot.on('callback_query', async (ctx) => {
'category_survival': 'Survival',
'category_wwe': 'WWE',
'category_musik': 'Musik',
'category_bollywood': 'Bollywood'
'category_bollywood': 'Bollywood',
'category_hoerspiele_comics': 'Hörspiele & Comics' // Neue Kategorie hinzugefügt
};
const category = categoryMap[data];
const categoryMessage = await ctx.reply(`Du hast die Kategorie ${category} ausgewählt. Bitte gib einen Link zum Cover oder zu Spotify ein. Falls du keinen Link angeben möchtest, trage einfach ein X ein (optional).`, { disable_notification: true });
@ -259,7 +312,7 @@ bot.on('callback_query', async (ctx) => {
waitingForLink: true, // Warten auf den Link
categoryMessageId: categoryMessage.message_id // Speichern der ID der Kategorie-Nachricht
};
// Entferne die Auswahl-Buttons und die /wunsch-Nachricht
if (userStates[chatId]?.commandMessageId) {
await ctx.deleteMessage(userStates[chatId].commandMessageId).catch(e => logError(new Error(`Failed to delete command message: ${e.message}`)));
@ -267,6 +320,7 @@ bot.on('callback_query', async (ctx) => {
}
await ctx.deleteMessage(ctx.callbackQuery.message.message_id).catch(e => logError(new Error(`Failed to delete category message: ${e.message}`))); // Lösche die Kategorieauswahl-Nachricht
}
} catch (error) {
logError(new Error(`Error handling callback query: ${error.message}`));
}