This commit is contained in:
Lukian LEIZOUR 2022-11-19 11:47:50 +01:00
parent 8f8309cda0
commit ba94a6caa0

12
app.js
View file

@ -9,8 +9,8 @@ function image_search(query, ctx) {
const images = google.image(query, { safe: false }); const images = google.image(query, { safe: false });
images.then((results) => { images.then((results) => {
var imgLink = results[Math.floor(Math.random() * results.length)].url var imgLink = results[Math.floor(Math.random() * results.length)].url
console.log("--> sent the image for the query: " + query);
bot.telegram.sendPhoto(ctx.chat.id, imgLink, {"caption": "This is a random image for the query : " + query}); bot.telegram.sendPhoto(ctx.chat.id, imgLink, {"caption": "This is a random image for the query : " + query});
console.log("--> sent the image for the query: " + query);
}); });
} }
@ -31,6 +31,11 @@ bot.command('anime', ctx => {
bot.telegram.sendMessage(ctx.chat.id, 'List of anime :\nKonosuba 1 : \nhttps://mega.nz/folder/M4gFRYbT#jiHwPRtkf7YyN6-MoguQcw\nKonosuba 2 :\nhttps://mega.nz/folder/JgZgiZbS#S0J1SoUd_TFKKun6SSJgmQ', {}) bot.telegram.sendMessage(ctx.chat.id, 'List of anime :\nKonosuba 1 : \nhttps://mega.nz/folder/M4gFRYbT#jiHwPRtkf7YyN6-MoguQcw\nKonosuba 2 :\nhttps://mega.nz/folder/JgZgiZbS#S0J1SoUd_TFKKun6SSJgmQ', {})
}) })
bot.command('github', ctx => {
console.log(ctx.from)
bot.telegram.sendMessage(ctx.chat.id, 'Link of the Gihhub repository :\n -https://github.com/Ninja-Jambon/chaise_bot', {})
})
bot.command('search', ctx => { bot.command('search', ctx => {
console.log(ctx.from) console.log(ctx.from)
image_search(ctx.message.text.slice(+8), ctx) image_search(ctx.message.text.slice(+8), ctx)
@ -41,10 +46,5 @@ bot.command('s', ctx => {
image_search(ctx.message.text.slice(+3), ctx) image_search(ctx.message.text.slice(+3), ctx)
}) })
bot.command('github', ctx => {
console.log(ctx.from)
bot.telegram.sendMessage(ctx.chat.id, 'Link of the Gihhub repository :\n -https://github.com/Ninja-Jambon/chaise_bot', {})
})
//bot launch //bot launch
bot.launch(); bot.launch();