reset convo
This commit is contained in:
parent
7d928a549a
commit
4dbe5e1f4d
1 changed files with 4 additions and 1 deletions
5
index.ts
5
index.ts
|
@ -35,10 +35,13 @@ client.on("ready", () => {
|
||||||
console.log(`Logged in as ${client.user?.tag}!`);
|
console.log(`Logged in as ${client.user?.tag}!`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let resetTime = 0;
|
||||||
|
|
||||||
client.on("messageCreate", async (message) => {
|
client.on("messageCreate", async (message) => {
|
||||||
if (message.channelId != process.env.CHANNEL) return;
|
if (message.channelId != process.env.CHANNEL) return;
|
||||||
if (message.webhookId) return;
|
if (message.webhookId) return;
|
||||||
if (message.author.bot) return;
|
if (message.author.bot) return;
|
||||||
|
if (message.content == "\\reset") resetTime = Date.now();
|
||||||
if (message.content.startsWith("\\")) return;
|
if (message.content.startsWith("\\")) return;
|
||||||
if (message.channel.type != ChannelType.GuildText) return;
|
if (message.channel.type != ChannelType.GuildText) return;
|
||||||
if (message.content == "die") process.exit(1);
|
if (message.content == "die") process.exit(1);
|
||||||
|
@ -59,7 +62,7 @@ client.on("messageCreate", async (message) => {
|
||||||
try {
|
try {
|
||||||
const msgs = await message.channel.messages.fetch({
|
const msgs = await message.channel.messages.fetch({
|
||||||
after: SnowflakeUtil.generate({
|
after: SnowflakeUtil.generate({
|
||||||
timestamp: Date.now() - 5 * 60 * 1000,
|
timestamp: Math.max(Date.now() - 5 * 60 * 1000, resetTime),
|
||||||
}).toString(),
|
}).toString(),
|
||||||
before: SnowflakeUtil.generate({
|
before: SnowflakeUtil.generate({
|
||||||
timestamp: recieved + 500,
|
timestamp: recieved + 500,
|
||||||
|
|
Loading…
Reference in a new issue