Skip to content

Commit

Permalink
change default language for title
Browse files Browse the repository at this point in the history
  • Loading branch information
M4ss1ck committed Dec 27, 2024
1 parent db0c461 commit 484867f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
13 changes: 8 additions & 5 deletions src/middleware/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,20 +391,22 @@ actions.action(/afm_\d+_\d+_\d+_\d+/i, async ctx => {
const results = await getAnime(parseInt(animeId))
if (!results) return ctx.answerCbQuery('Anime not found').catch(e => logger.error(e))
const anime = results.Media
const englishTitle = anime.title.english ?? 'English title not found!'
const nativeTitle = anime.title.native
const romajiTitle = anime.title.romaji
const note = `Native: ${nativeTitle}\nRomaji: ${romajiTitle}\nAdded from the menu`
await prisma.anime
.upsert({
where: {
name_userId: {
name: anime.title.romaji.trim(),
name: anime.title.english.trim(),
userId: user
}
},
create: {
name: anime.title.romaji.trim(),
name: anime.title.english.trim(),
season: parseInt(season),
episode: parseInt(episode),
note: englishTitle + '\nAdded from the menu',
note,
onAir: anime.nextAiringEpisode?.airingAt ? true : false,
user: {
connectOrCreate: {
Expand All @@ -418,7 +420,8 @@ actions.action(/afm_\d+_\d+_\d+_\d+/i, async ctx => {
}
},
update: {
note: englishTitle + '\nUpdated from the menu',
note,
onAir: anime.nextAiringEpisode?.airingAt ? true : false,
}
})
.then(() => ctx.answerCbQuery('Anime added/updated!').catch(logger.error))
Expand Down
4 changes: 2 additions & 2 deletions src/middleware/novels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -691,12 +691,12 @@ novel.action(/nfm_\d+_\d+/i, async ctx => {
.upsert({
where: {
name_userId: {
name: novel.title.romaji.trim(),
name: novel.title.english.trim(),
userId: user
}
},
create: {
name: novel.title.romaji.trim(),
name: novel.title.english.trim(),
volume: 1,
note,
releasing: /releasing/i.test(novel.status) ? true : false,
Expand Down

0 comments on commit 484867f

Please sign in to comment.