mirror of
https://github.com/ultrasn0w/huso.git
synced 2025-12-13 08:49:53 +01:00
💣💣💣
This commit is contained in:
2
huso.go
2
huso.go
@@ -20,7 +20,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
husoVersion = "1.5"
|
||||
husoVersion = "1.6"
|
||||
registerSecret = "綾波レイ"
|
||||
seasonStrJikan = "seasons/"
|
||||
userApiJikan = "users/"
|
||||
|
||||
16
labersack.go
16
labersack.go
@@ -63,19 +63,19 @@ func SendAppointBroadcast(creator string, app *Appointment) {
|
||||
}
|
||||
}
|
||||
|
||||
func AnnounceBomb(app *Appointment, timer time.Duration) {
|
||||
func AnnounceBomb(animeId, meetingUnix int64, timer time.Duration) {
|
||||
time.Sleep(timer)
|
||||
AnnounceAppointmentSoon(app)
|
||||
AnnounceAppointmentSoon(animeId, meetingUnix)
|
||||
}
|
||||
|
||||
func AnnounceAppointmentSoon(app *Appointment) {
|
||||
if app != nil && discc != nil {
|
||||
watchData, err := GetAnimeWatchFromDb(app.Anime)
|
||||
func AnnounceAppointmentSoon(animeId, meetingUnix int64) {
|
||||
if animeId != 0 && discc != nil {
|
||||
watchData, err := GetAnimeWatchFromDb(animeId)
|
||||
if err != nil {
|
||||
color.Errorln(err.Error())
|
||||
return
|
||||
}
|
||||
anime, err := SearchAnime(app.Anime)
|
||||
anime, err := SearchAnime(animeId)
|
||||
if err != nil {
|
||||
color.Errorln(err.Error())
|
||||
return
|
||||
@@ -90,10 +90,10 @@ func AnnounceAppointmentSoon(app *Appointment) {
|
||||
msgStart.WriteString(fmt.Sprintf("<@%d>", uData.DiscordID))
|
||||
}
|
||||
|
||||
msgs := fmt.Sprintf("⏰ Appointment starting <t:%d:R>!\n[%s](%s%d) at\n<t:%d:F>", app.Time.Unix(), anime.Title, *husoWebAnimeUri, app.Anime, app.Time.Unix())
|
||||
msgs := fmt.Sprintf("⏰ Appointment starting <t:%d:R>!\n[%s](%s%d) at\n<t:%d:F>", meetingUnix, anime.Title, *husoWebAnimeUri, animeId, meetingUnix)
|
||||
msge := discordgo.MessageEmbed{
|
||||
Description: msgs,
|
||||
URL: fmt.Sprintf("%s%d", *husoWebAnimeUri, app.Anime),
|
||||
URL: fmt.Sprintf("%s%d", *husoWebAnimeUri, animeId),
|
||||
Thumbnail: &discordgo.MessageEmbedThumbnail{URL: anime.ImageLargeURL},
|
||||
Color: 7187428,
|
||||
Footer: &discordgo.MessageEmbedFooter{
|
||||
|
||||
@@ -38,9 +38,9 @@ func Arbeit() {
|
||||
} else {
|
||||
cleared++
|
||||
}
|
||||
} else if time.Now().Add(20*time.Minute).Before(a.Time) && time.Now().Add(40*time.Minute).After(a.Time) {
|
||||
} else if time.Now().Add(40*time.Minute).Before(a.Time) && time.Now().Add(60*time.Minute).After(a.Time) {
|
||||
// This has not happened and is happening soon
|
||||
go AnnounceBomb(&a, time.Until(a.Time.Add(-20*time.Minute)))
|
||||
go AnnounceBomb(a.Anime, a.Time.Unix(), time.Until(a.Time.Add(-25*time.Minute)))
|
||||
}
|
||||
}
|
||||
if cleared > 0 {
|
||||
|
||||
Reference in New Issue
Block a user