Fix mysql table create

This commit is contained in:
NovaFox161
2021-11-21 19:30:52 -06:00
parent 378cc20cca
commit bf98c12e6b
2 changed files with 22 additions and 21 deletions
@@ -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;