tighten timing + reset on start

This commit is contained in:
Skye 2023-03-11 00:11:26 +09:00
parent 4dbe5e1f4d
commit af36301c5e
Signed by: me
GPG key ID: 0104BC05F41B77B8

View file

@ -31,11 +31,15 @@ const configuration = new Configuration({
});
const openai = new OpenAIApi(configuration);
client.on("ready", () => {
client.on("ready", async () => {
console.log(`Logged in as ${client.user?.tag}!`);
const channel = await client.channels.fetch(process.env.CHANNEL ?? '');
if (channel?.type != ChannelType.GuildText)
return
channel.send("\\Smolhaj Reset");
});
let resetTime = 0;
let resetTime = Date.now();
client.on("messageCreate", async (message) => {
if (message.channelId != process.env.CHANNEL) return;
@ -65,7 +69,7 @@ client.on("messageCreate", async (message) => {
timestamp: Math.max(Date.now() - 5 * 60 * 1000, resetTime),
}).toString(),
before: SnowflakeUtil.generate({
timestamp: recieved + 500,
timestamp: recieved + 250,
}).toString(),
});