@@ -4,7 +4,7 @@ import config from "../../data/config.json"
44import client from "../../main"
55import Command from "../../utils/Command"
66import { CommandSource , SendMessage , StoredNews } from "../../utils/Types"
7- import { Colors , findFuzzy , findFuzzyBestCandidates , parseNewsContent , sendMessage , simplePaginator } from "../../utils/Utils"
7+ import { Colors , findFuzzy , findFuzzyBestCandidates , getLink , parseNewsContent , sendMessage , simplePaginator } from "../../utils/Utils"
88
99
1010const Logger = log4js . getLogger ( "main" )
@@ -23,31 +23,31 @@ let eventWishes: Wish[] = [
2323 {
2424 title : "Event Wish \"Ballad in Goblets\" - Boosted Drop Rate for \"Windborne Bard\" Venti (Anemo)!" ,
2525 roughDate : 1601244000 ,
26- img : "https://static.wikia.nocookie.net/gensin-impact/images/e/e9/Wish_Ballad_in_Goblets_2020-09-28.jpg/revision/latest?cb=20201006234432 " ,
26+ img : "img/banners/1.0/char1.png " ,
2727 duration : "2020/09/28 12:00:00 – 2020/10/18 12:00:00" ,
2828 main : [ "Venti" ] ,
2929 other : [ "Barbara" , "Fischl" , "Xiangling" ]
3030 } ,
3131 {
3232 title : "Event Wish \"Epitome Invocation\" - Boosted Drop Rate for Aquila Favonia (Sword) and Amos' Bow (Bow)!" ,
3333 roughDate : 1601244000 ,
34- img : "https://static.wikia.nocookie.net/gensin-impact/images/3/3d/Wish_Epitome_Invocation_2020-09-28.jpg/revision/latest?cb=20200929014948 " ,
34+ img : "img/banners/1.0/weapon1.png " ,
3535 duration : "2020/09/28 12:00:00 – 2020/10/18 12:00:00" ,
3636 main : [ "Aquila Favonia" , "Amos' Bow" ] ,
3737 other : [ "The Flute" , "The Bell" , "The Widsith" , "The Stringless" , "Favonius Lance" ]
3838 } ,
3939 {
4040 title : "Event Wish \"Sparkling Steps\" - Boosted Drop Rate for \"Fleeing Sunlight\" Klee (Pyro)!" ,
4141 roughDate : 1603209600 ,
42- img : "https://static.wikia.nocookie.net/gensin-impact/images/0/0c/Wish_Sparkling_Steps_2020-10-20.jpg/revision/latest?cb=20201018122142 " ,
42+ img : "img/banners/1.0/char2.png " ,
4343 duration : "2020/10/20 18:00:00 – 2020/11/10 14:59:59" ,
4444 main : [ "Klee" ] ,
4545 other : [ "Xingqiu" , "Noelle" , "Sucrose" ]
4646 } ,
4747 {
4848 title : "Event Wish \"Epitome Invocation\" - Boosted Drop Rate for Lost Prayer to the Sacred Winds (Catalyst) and Wolf's Gravestone (Claymore)!" ,
4949 roughDate : 1603209600 ,
50- img : "https://static.wikia.nocookie.net/gensin-impact/images/b/be/Wish_Epitome_Invocation_2020-10-20.jpg/revision/latest?cb=20201018052455 " ,
50+ img : "img/banners/1.0/weapon2.png " ,
5151 duration : "2020/10/20 18:00:00 – 2020/11/10 14:59:59" ,
5252 main : [ "Lost Prayer to the Sacred Winds" , "Wolf's Gravestone" ] ,
5353 other : [ "Sacrificial Sword" , "Sacrificial Bow" , "Sacrificial Greatsword" , "Sacrificial Fragments" , "Dragon's Bane" ]
@@ -71,15 +71,15 @@ let eventWishes: Wish[] = [
7171 {
7272 title : "Event Wish \"Gentry of Hermitage\" - Boosted Drop Rate for Zhongli!" ,
7373 roughDate : 1606842000 ,
74- img : "https://static.wikia.nocookie.net/gensin-impact/images/4/41/Wish_Gentry_of_Hermitage_2020-12-01 .png/revision/latest?cb=20201129051143 " ,
74+ img : "img/banners/1.1/char2 .png" ,
7575 duration : "2020-12-01 18:00:00 – 2020-12-22 14:59:59" ,
7676 main : [ "Zhongli" ] ,
7777 other : [ "Xinyan" , "Razor" , "Chongyun" ]
7878 } ,
7979 {
8080 title : "Event Wish \"Epitome Invocation\" - Boosted Drop Rates for Vortex Vanquisher (Polearm) and The Unforged (Claymore)!" ,
8181 roughDate : 1606842000 ,
82- img : "https://static.wikia.nocookie.net/gensin-impact/images/a/a2/Wish_Epitome_Invocation_2020-12-01.jpg/revision/latest?cb=20201129051133 " ,
82+ img : "img/banners/1.1/weapon2.png " ,
8383 duration : "2020-12-01 18:00:00 – 2020-12-22 14:59:59" ,
8484 main : [ "Vortex Vanquisher" , "The Unforged" ] ,
8585 other : [ "Lion's Roar" , "The Bell" , "Favonius Codex" , "Favonius Warbow" , "Dragon's Bane" ]
@@ -119,15 +119,15 @@ let eventWishes: Wish[] = [
119119 {
120120 title : "Event Wish \"Invitation to Mundane Life\" - Boosted Drop Rate for Xiao!" ,
121121 roughDate : 1612342140 ,
122- img : "https://static.wikia.nocookie.net/gensin-impact/images/3/36/Wish_Invitation_to_Mundane_Life_2021-02-03.jpg/revision/latest?cb=20210201040314 " ,
122+ img : "img/banners/1.3/char1.png " ,
123123 duration : "After Version 1.3 update – 2021/02/17 15:59:59" ,
124124 main : [ "Xiao" ] ,
125125 other : [ "Diona" , "Beidou" , "Xinyan" ]
126126 } ,
127127 {
128128 title : "Event Wish \"Epitome Invocation\" - Boosted Drop Rates for Primordial Jade Cutter (Sword) and Primordial Jade Winged-Spear (Polearm)!" ,
129129 roughDate : 1612342140 ,
130- img : "https://static.wikia.nocookie.net/gensin-impact/images/6/62/Wish_Epitome_Invocation_2021-02-03.jpg/revision/latest?cb=20210201040313 " ,
130+ img : "img/banners/1.3/weapon1.png " ,
131131 duration : "After Version 1.3 update – 2021/02/23 15:59:59" ,
132132 main : [ "Primordial Jade Cutter" , "Primordial Jade Winged-Spear" ] ,
133133 other : [ "Rust" , "Eye of Perception" , "Favonius Lance" , "Sacrificial Greatsword" , "The Flute" ]
@@ -357,7 +357,7 @@ Note: this command supports fuzzy search.`,
357357
358358 const embed = new MessageEmbed ( )
359359 . setTitle ( wish . title )
360- . setImage ( wish . img )
360+ . setImage ( getLink ( wish . img ) )
361361 . addField ( "Duration" , wish . duration )
362362 . addField ( "Main" , wish . main . join ( "\n" ) , true )
363363 . addField ( "Other" , wish . other . join ( "\n" ) , true )
@@ -368,6 +368,10 @@ Note: this command supports fuzzy search.`,
368368 }
369369}
370370
371+ export function getEventWishes ( ) {
372+ return eventWishes
373+ }
374+
371375export function parseEventWishNews ( news : StoredNews , recent = true ) : void {
372376 const { data } = client
373377 const wish : {
@@ -410,8 +414,10 @@ export function parseEventWishNews(news: StoredNews, recent = true): void {
410414 const lines = page . text . split ( "\n" )
411415 for ( const i in lines ) {
412416 const line = lines [ i ] . trim ( )
413- if ( line . includes ( "Event Wish Duration" ) )
417+ if ( line . includes ( "Event Wish Duration" ) ) {
414418 wish . duration = lines [ + i + 1 ] . trim ( )
419+ wish . duration += lines [ + i + 2 ] ?. trim ( ) ?? ""
420+ }
415421
416422 const mainMatch = line . match ( / .* ?5 - s t a r .* ?(?: w e a p o n s ? | c h a r a c t e r s ? ) ( .* ?) w i l l (?: r e c e i v e | g e t | r e c i e v e ) a h u g e / )
417423 if ( mainMatch )
@@ -435,7 +441,7 @@ export function parseEventWishNews(news: StoredNews, recent = true): void {
435441 eventWishes = eventWishes . sort ( ( a , b ) => {
436442 if ( Math . abs ( a . roughDate - b . roughDate ) < 3600 ) {
437443 if ( a . duration == b . duration )
438- return a . title . includes ( "Epitome" ) ? 1 : - 1
444+ return a . title . includes ( "Epitome" ) ? 1 : b . title . includes ( "Epitome" ) ? - 1 : 0
439445
440446 return b . duration . localeCompare ( a . duration )
441447 } else
0 commit comments