Retrieve the last message (reply to a specific user) the bot sent

Hello! I'm coding a personal ChatGPT bot for my guild, and one of the payload fields to sent to openai should contain the last message the bot sent to the user for contextual purposes. The problem is: i'm trying several methods to fetch the last message (specficially the last reply to the user that invoked the bot, if exists) the bot sent in the server (any channel) to relay to openai API, but none worked correctly. Currently i'm stuck with this code https://github.com/vico93/falastrao_bot/blob/gpt/main.js but obviously it dont work. How can i achieve this?
GitHub
falastrao_bot/main.js at gpt · vico93/falastrao_bot
Simples chatbot pro Discord usando markov chain. Contribute to vico93/falastrao_bot development by creating an account on GitHub.
3 Replies
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View
Vico
Vico17mo ago
discord.js@14.7.1, and Node.JS v18.14.0 oh that's hard never did this before Okay i will need to search how to use that
d.js docs
d.js docs17mo ago
guide Additional Information: Collections read more