name fix
This commit is contained in:
@@ -250,11 +250,11 @@ export class QuixoticBot {
|
||||
}
|
||||
|
||||
// Public method for external API calls
|
||||
public async sendAudioFile(chatId: number, audioUrl: string, title: string): Promise<void> {
|
||||
return this.sendAudioFileInternal(chatId, audioUrl, title);
|
||||
public async sendAudioFile(chatId: number, audioUrl: string, title: string, performer?: string, thumbnail?: string): Promise<void> {
|
||||
return this.sendAudioFileInternal(chatId, audioUrl, title, performer, thumbnail);
|
||||
}
|
||||
|
||||
private async sendAudioFileInternal(chatId: number, audioUrl: string, title: string): Promise<void> {
|
||||
private async sendAudioFileInternal(chatId: number, audioUrl: string, title: string, performer?: string, thumbnail?: string): Promise<void> {
|
||||
try {
|
||||
console.log(`📤 Sending: ${title} to chat ${chatId}`);
|
||||
|
||||
@@ -262,8 +262,9 @@ export class QuixoticBot {
|
||||
try {
|
||||
await this.bot.sendAudio(chatId, audioUrl, {
|
||||
title: title,
|
||||
performer: 'SoundCloud',
|
||||
performer: performer || 'SoundCloud',
|
||||
caption: `🎵 ${title}`,
|
||||
thumbnail: thumbnail,
|
||||
parse_mode: undefined
|
||||
});
|
||||
console.log(`✅ Audio sent: ${title}`);
|
||||
|
||||
@@ -219,7 +219,7 @@ app.post('/api/telegram-send', async (req: Request, res: Response) => {
|
||||
console.log('🚀 Telegram send request received');
|
||||
|
||||
try {
|
||||
const { userId, audioUrl, title }: { userId?: string; audioUrl?: string; title?: string } = req.body;
|
||||
const { userId, audioUrl, title, performer, thumbnail }: { userId?: string; audioUrl?: string; title?: string; performer?: string; thumbnail?: string } = req.body;
|
||||
console.log(`📤 Sending to user ${userId}: ${title}`);
|
||||
|
||||
if (!userId || !audioUrl || !title) {
|
||||
@@ -233,7 +233,7 @@ app.post('/api/telegram-send', async (req: Request, res: Response) => {
|
||||
}
|
||||
|
||||
const chatId = parseInt(userId);
|
||||
await botInstance.sendAudioFile(chatId, audioUrl, title);
|
||||
await botInstance.sendAudioFile(chatId, audioUrl, title, performer, thumbnail);
|
||||
console.log('✅ Audio sent successfully');
|
||||
|
||||
res.json({ success: true, message: 'Audio sent successfully' });
|
||||
|
||||
@@ -31,6 +31,7 @@ interface TrackInfo {
|
||||
author: string;
|
||||
length: number;
|
||||
available: boolean;
|
||||
thumbnail?: string;
|
||||
}
|
||||
|
||||
export class SoundCloudService {
|
||||
@@ -131,7 +132,8 @@ export class SoundCloudService {
|
||||
title: track.title,
|
||||
author: track.user?.username || 'Unknown',
|
||||
length: Math.floor(track.duration / 1000),
|
||||
available: track.streamable
|
||||
available: track.streamable,
|
||||
thumbnail: this.getHighQualityThumbnail(track.artwork_url || track.user?.avatar_url || '')
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('Error getting track info:', error);
|
||||
|
||||
Reference in New Issue
Block a user