-
Notifications
You must be signed in to change notification settings - Fork 3
/
bot.js
109 lines (84 loc) · 2.84 KB
/
bot.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
require("dotenv").config()
const { getArgs, textMenu } = require("./src/utils")
const { closeDesc, readDesc, mainMenu } = require("./src/features/etc")
const { reviewByUsers, detailReviewByUser } = require("./src/features/review")
const { suggestions, detailSuggestion } = require("./src/features/recomendations")
const { trendingManga, allTimePopulerManga, popularManhwa, top50Manga, searchManga, detailManga } = require("./src/features/manga")
const { trendingAnime, popularAnime, upcomingAnime, allTimePopulerAnime, top50Anime, topMovies, searchAnime, detailAnime } = require("./src/features/anime")
const { Telegraf } = require("telegraf")
const express = require('express')
const app = express()
const port = process.env.PORT
const bot = new Telegraf(process.env.BOT_TOKEN)
bot.command(["/start", "/menu"], (ctx) => {
ctx.reply(textMenu())
})
bot.command(["/trending_anime", "/ta"], (ctx) => {
trendingAnime(ctx, 0)
})
bot.command(["/popular_anime", "/pa"], (ctx) => {
popularAnime(ctx, 0)
})
bot.command(["/upcoming_anime", "/ua"], (ctx) => {
upcomingAnime(ctx, 0)
})
bot.command(["/all_time_populer_anime", "/atpa"], (ctx) => {
allTimePopulerAnime(ctx, 0)
})
bot.command(["/top_50_anime", "/t50a"], (ctx) => {
top50Anime(ctx, 0)
})
bot.command(["/top_movies", "/tm"], (ctx) => {
topMovies(ctx, 0)
})
bot.command(["/trending_manga", "/tma"], (ctx) => {
trendingManga(ctx, 0)
})
bot.command(["/all_time_populer_manga", "/atpm"], (ctx) => {
allTimePopulerManga(ctx, 0)
})
bot.command(["/popular_manhwa", "/pmh"], (ctx) => {
popularManhwa(ctx, 0)
})
bot.command(["/top_50_manga", "/t50m"], (ctx) => {
top50Manga(ctx, 0)
})
bot.command(["/search_anime", "/sa"], (ctx) => {
searchAnime(ctx, 0, getArgs(ctx.message.text))
})
bot.command(["/search_manga", "/sm"], (ctx) => {
searchManga(ctx, 0, getArgs(ctx.message.text))
})
bot.command(["/recommendations", "/rcm"], (ctx) => {
suggestions(ctx, 0, getArgs(ctx.message.text))
})
bot.command(["/reviews", "/rvs"], (ctx) => {
reviewByUsers(ctx, 0)
})
bot.command(["/forum"], (ctx) => {
ctx.reply("You can access forum on the web", {
"reply_markup":{
"inline_keyboard": [[{"text":"Go to Forum", "url": "https://anilist.co/forum/overview"}]]
}
})
})
bot.command(["/about"], (ctx) => {
ctx.replyWithMarkdown("DaAkuu (Daftar Anime Kuu) is unofficial anilis.co bot.\n\nYou can visit our repository on GitHub to contribute or submit issue.",{
disable_web_page_preview: true,
"reply_markup":{
"inline_keyboard": [[{"text":"Open GitHub", "url": "https://github.com/Shiyinq/daakuu"}]]
}
})
})
bot.on("callback_query", (ctx) => {
let dataQuery = ctx.callbackQuery.data
let [callFunction, page, search] = dataQuery.split("-")
eval(callFunction)(ctx, page, search)
})
bot.launch()
app.get('/', (_, res) => {
res.send('Bipp bipp!')
})
app.listen(port, () => {
console.log(`Listening on port ${port}`)
})