v3.2.2 push 1

This commit is contained in:
DJj123dj
2023-02-24 14:49:36 +01:00
parent 05c97909d4
commit dc14a39c4e
9 changed files with 112 additions and 50 deletions
+26 -1
View File
@@ -239,12 +239,37 @@ exports.NEWcloseTicket = async (member,channel,prefix,mode,reason,nomessage) =>
}
/**
*
* @param {discord.TextChannel} channel
* @param {Number} limit
* @returns
*/
const getmessages = async (channel,limit) => {
const final = []
var lastId = ""
while (true) {
const options = {limit:100}
if (lastId) options.before = lastId
const messages = await channel.messages.fetch(options)
messages.forEach(msg => {final.push(msg)})
lastId = messages.last().id
if (messages.size != 100 || final >= limit) {
break
}
}
return final
}
const transcriptHandler = async () => {
if (!bot.tsconfig.sendTranscripts.enableChannel && !bot.tsconfig.sendTranscripts.enableDM) return false
const APIEvents = require("../api/modules/events")
const messages = await channel.messages.fetch({cache:true})
const messages = await getmessages(channel,5000)
await require("../transcriptSystem/manager")(messages,guild,channel,user,reason)
APIEvents.onTranscriptCreation(messages,channel,guild,new Date())
}