mirror of
https://github.com/DreamExposure/DisCal-Discord-Bot.git
synced 2026-05-06 09:10:09 -05:00
Fix mysql table create
This commit is contained in:
+21
-21
@@ -44,31 +44,31 @@ class DisplayCalendarCommand : SlashCommand {
|
||||
guild.getCalendar(calendarNumber).flatMap { cal ->
|
||||
CalendarEmbed.overview(guild, settings, cal, true).flatMap { embed ->
|
||||
event.interaction.channel.flatMap {
|
||||
it.createMessage(MessageCreateSpec.builder()
|
||||
.addEmbed(embed)
|
||||
.build()
|
||||
).flatMap { msg ->
|
||||
val nextUpdate = ZonedDateTime.now(cal.timezone)
|
||||
.truncatedTo(ChronoUnit.DAYS)
|
||||
.plusHours(hour + 24)
|
||||
.toInstant()
|
||||
it.createMessage(
|
||||
MessageCreateSpec.builder()
|
||||
.addEmbed(embed)
|
||||
.build()
|
||||
)
|
||||
}.flatMap { msg ->
|
||||
val nextUpdate = ZonedDateTime.now(cal.timezone)
|
||||
.truncatedTo(ChronoUnit.DAYS)
|
||||
.plusHours(hour + 24)
|
||||
.toInstant()
|
||||
|
||||
val staticMsg = StaticMessage(
|
||||
settings.guildID,
|
||||
msg.id,
|
||||
msg.channelId,
|
||||
StaticMessage.Type.CALENDAR_OVERVIEW,
|
||||
Instant.now(),
|
||||
nextUpdate,
|
||||
calendarNumber,
|
||||
)
|
||||
val staticMsg = StaticMessage(
|
||||
settings.guildID,
|
||||
msg.id,
|
||||
msg.channelId,
|
||||
StaticMessage.Type.CALENDAR_OVERVIEW,
|
||||
Instant.now(),
|
||||
nextUpdate,
|
||||
calendarNumber,
|
||||
)
|
||||
|
||||
DatabaseManager.updateStaticMessage(staticMsg)
|
||||
.then(event.followupEphemeral(getCommonMsg("success.generic", settings)))
|
||||
}
|
||||
DatabaseManager.updateStaticMessage(staticMsg)
|
||||
.then(event.followupEphemeral(getCommonMsg("success.generic", settings)))
|
||||
}
|
||||
}
|
||||
|
||||
}.switchIfEmpty(event.followupEphemeral(getCommonMsg("error.notFound.calendar", settings)))
|
||||
}
|
||||
}.switchIfEmpty(event.followupEphemeral(getCommonMsg("error.perms.elevated", settings)))
|
||||
|
||||
@@ -6,6 +6,7 @@ CREATE TABLE IF NOT EXISTS static_messages
|
||||
type SMALLINT NOT NULL,
|
||||
last_update DATETIME NOT NULL,
|
||||
scheduled_update DATETIME NOT NULL,
|
||||
calendar_number TINYINT NOT NULL,
|
||||
PRIMARY KEY (guild_id, message_id)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8;
|
||||
|
||||
Reference in New Issue
Block a user