tighten timing + reset on start
This commit is contained in:
		
							parent
							
								
									4dbe5e1f4d
								
							
						
					
					
						commit
						af36301c5e
					
				
					 1 changed files with 7 additions and 3 deletions
				
			
		
							
								
								
									
										10
									
								
								index.ts
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								index.ts
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -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(),
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue