Do some stuff
This commit is contained in:
		
							parent
							
								
									127a02e8f2
								
							
						
					
					
						commit
						678db465bf
					
				
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							|  | @ -134,3 +134,4 @@ config.json.old | ||||||
| config.json.disabled | config.json.disabled | ||||||
| .ssh/* | .ssh/* | ||||||
| !.ssh/.gitkeep | !.ssh/.gitkeep | ||||||
|  | testing/ | ||||||
|  | @ -1,5 +1,4 @@ | ||||||
| You are ChatGPT, a large language model trained by OpenAI. | You are ChatGPT, a large language model trained by OpenAI. | ||||||
| Answer as concisely as possible. | Answer as concisely as possible. | ||||||
| Knowledge cutoff: 2021 | Your knowledge cutoff is the year 2021, but the current time is in the future. | ||||||
| You do not have access to the current date or time. | You do not have access to the current date or time. | ||||||
| The maximum number of characters in your response is exactly 2000 characters, which is a limitation of Discord. |  | ||||||
							
								
								
									
										23
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								index.js
									
									
									
									
									
								
							|  | @ -118,9 +118,10 @@ client.on('messageCreate', async (message) => { | ||||||
| 			started: new Date(), | 			started: new Date(), | ||||||
| 		}; | 		}; | ||||||
| 	} | 	} | ||||||
|  | 	message.channel.sendTyping(); | ||||||
| 	var typing = setInterval(() => { | 	var typing = setInterval(() => { | ||||||
| 		message.channel.sendTyping(); | 		message.channel.sendTyping(); | ||||||
| 	}, 1000) | 	}, 5000) | ||||||
| 	// Add the message to the session
 | 	// Add the message to the session
 | ||||||
| 	sessions[message.channelId].messages.push({ | 	sessions[message.channelId].messages.push({ | ||||||
| 		"name": `${message.author.id}`, | 		"name": `${message.author.id}`, | ||||||
|  | @ -138,7 +139,25 @@ client.on('messageCreate', async (message) => { | ||||||
| 		sessions[message.channelId].messages.push(output); | 		sessions[message.channelId].messages.push(output); | ||||||
| 		// Send the bot's response
 | 		// Send the bot's response
 | ||||||
| 		clearInterval(typing); | 		clearInterval(typing); | ||||||
| 		message.reply(output.content); | 		// If output.content is longer than 2000 characters, upload it as a txt file
 | ||||||
|  | 		if (output.content.length > 2000) { | ||||||
|  | 			message.channel.send({ | ||||||
|  | 				files: [{ | ||||||
|  | 					attachment: Buffer.from(output.content), | ||||||
|  | 					name: "output.txt" | ||||||
|  | 				}] | ||||||
|  | 			}); | ||||||
|  | 		} else { | ||||||
|  | 			message.channel.send(output.content); | ||||||
|  | 		} | ||||||
|  | 	}).catch((err) => { | ||||||
|  | 		message.channel.send({ | ||||||
|  | 			"embeds": [{ | ||||||
|  | 				"title": "Error", | ||||||
|  | 				"description": err, | ||||||
|  | 				"color": 0xFF0000 | ||||||
|  | 			}] | ||||||
|  | 		}) | ||||||
| 	}); | 	}); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue