daily
parent
93f765b88c
commit
c46c1f6c01
@ -0,0 +1,49 @@
|
|||||||
|
import { PrismaClient } from '@prisma/client'
|
||||||
|
import { CommandContext, CommandOptionType, SlashCommand, SlashCreator } from 'slash-create'
|
||||||
|
|
||||||
|
export default class DailyCommand extends SlashCommand {
|
||||||
|
constructor(creator: SlashCreator) {
|
||||||
|
super(creator, {
|
||||||
|
name: 'daily',
|
||||||
|
description: 'send daily message',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'hour',
|
||||||
|
description: 'the hour to send the daily message IN UTC!!',
|
||||||
|
type: CommandOptionType.INTEGER,
|
||||||
|
min_value: 0,
|
||||||
|
max_value: 24,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'minute',
|
||||||
|
description: 'the minute to send the daily message IN UTC!!',
|
||||||
|
type: CommandOptionType.INTEGER,
|
||||||
|
min_value: 0,
|
||||||
|
max_value: 59,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'message',
|
||||||
|
description: 'the message to send',
|
||||||
|
type: CommandOptionType.STRING,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(ctx: CommandContext) {
|
||||||
|
const p = new PrismaClient()
|
||||||
|
await p.dailyMessage.create({
|
||||||
|
data: {
|
||||||
|
hour: ctx.options.hour,
|
||||||
|
minute: ctx.options.minute,
|
||||||
|
text: ctx.options.message,
|
||||||
|
channel: ctx.channelID,
|
||||||
|
guild_id: ctx.guildID
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return `done!`
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue