eX
eX
DIAdiscord.js - Imagine a bot
Created by keekztah on 6/22/2023 in #djs-questions
applied Tags
but thatd be a good question for someone else
44 replies
DIAdiscord.js - Imagine a bot
Created by keekztah on 6/22/2023 in #djs-questions
applied Tags
depends how you use it. if you use cron to send the same message every 10 seconds, technically yes thats api abuse. but if you send a message every hour, or every day, or one time 5 minutes after a particular event, it wouldnt be api abuse
44 replies
DIAdiscord.js - Imagine a bot
Created by keekztah on 6/22/2023 in #djs-questions
applied Tags
using a 3rd party library, like cron, yes. or (a less good idea) using a timeout fuction to execute something after some time
44 replies
DIAdiscord.js - Imagine a bot
Created by keekztah on 6/22/2023 in #djs-questions
applied Tags
@ me if you need anything else, gonna be tabbed out into a different window
44 replies
DIAdiscord.js - Imagine a bot
Created by keekztah on 6/22/2023 in #djs-questions
applied Tags
yep
44 replies
DIAdiscord.js - Imagine a bot
Created by keekztah on 6/22/2023 in #djs-questions
applied Tags
simply comparing the two "versions" of the thread
44 replies
DIAdiscord.js - Imagine a bot
Created by keekztah on 6/22/2023 in #djs-questions
applied Tags
if (oldThread.appliedTags !== newThread.appliedTags && newThread.appliedTags.includes('This Tag')) {
// if the appliedTags on the "old version" of this thread are not the same as the appliedTags on the "new version" of this thread, AND the newThread has the appliedTag "This Tag", run this code
}
if (oldThread.appliedTags !== newThread.appliedTags && newThread.appliedTags.includes('This Tag')) {
// if the appliedTags on the "old version" of this thread are not the same as the appliedTags on the "new version" of this thread, AND the newThread has the appliedTag "This Tag", run this code
}
44 replies
DIAdiscord.js - Imagine a bot
Created by keekztah on 6/22/2023 in #djs-questions
applied Tags
that can be avoided by comparing the oldThread.appliedTags to the newThread.appliedTags
44 replies
DIAdiscord.js - Imagine a bot
Created by keekztah on 6/22/2023 in #djs-questions
applied Tags
also, beware that the message will likely send every time the thread is updated, because the appliedTags will be the same, since this is within the threadUpdate event. (so if the thread is renamed, etc itll resend)
44 replies
DIAdiscord.js - Imagine a bot
Created by keekztah on 6/22/2023 in #djs-questions
applied Tags
if you console.log(newThread.appliedTags), you should see ['132456789', '987654321'] if there were 2 tags applied. when you run
if (newThread.appliedTags.includes('123456789')) {
// Do this any time This Tag exists
}
if (newThread.appliedTags.includes('123456789')) {
// Do this any time This Tag exists
}
it will look at each value in newThread.appliedTags (123456789 and 987654321), and if any of them match 123456789, itll execute the code
44 replies
DIAdiscord.js - Imagine a bot
Created by keekztah on 6/22/2023 in #djs-questions
applied Tags
no, the [0] just means look at the first array value only.
44 replies
DIAdiscord.js - Imagine a bot
Created by keekztah on 6/22/2023 in #djs-questions
applied Tags
if (newThread.appliedTags.includes('This Tag')) {
// Do this any time This Tag exists
}
if (newThread.appliedTags.includes('This Tag')) {
// Do this any time This Tag exists
}
or something alongthose lines
44 replies
DIAdiscord.js - Imagine a bot
Created by keekztah on 6/22/2023 in #djs-questions
applied Tags
correct, thats what i was saying before. if theres more than 1 tag, youll need to loop through the array of appliedTags
44 replies
DIAdiscord.js - Imagine a bot
Created by keekztah on 6/22/2023 in #djs-questions
applied Tags
im sorry what
44 replies
DIAdiscord.js - Imagine a bot
Created by keekztah on 6/22/2023 in #djs-questions
applied Tags
try returning the .send() function
if (newThread.appliedTags[0] === '1107649018902884393') return newThread.send({ content: 'working', ephemeral: true});
if (newThread.appliedTags[0] === '1107649018902884393') return newThread.send({ content: 'working', ephemeral: true});
or
if (newThread.appliedTags[0] === '1107649018902884393') {
channel.send({ content: 'working', ephemeral: true});
}
if (newThread.appliedTags[0] === '1107649018902884393') {
channel.send({ content: 'working', ephemeral: true});
}
44 replies
DIAdiscord.js - Imagine a bot
Created by keekztah on 6/22/2023 in #djs-questions
applied Tags
also, i dont think you can send a willy nilly ephemeral message... only in response to an interaction
44 replies
DIAdiscord.js - Imagine a bot
Created by keekztah on 6/22/2023 in #djs-questions
applied Tags
but yes, comparing the entire value of the array would work as well, so long as they cant select more than one tag
44 replies
DIAdiscord.js - Imagine a bot
Created by keekztah on 6/22/2023 in #djs-questions
applied Tags
or if (newThread.appliedTags[0] === '1107649018902884393') newThread.send({}) is usually better in my book as well, but not sure itd make any difference
44 replies
DIAdiscord.js - Imagine a bot
Created by keekztah on 6/22/2023 in #djs-questions
applied Tags
also, appliedTags is an array[] so if there can only be one tag, itll always be appliedTags[0], if there can be multiple tags on the thread, youll need to loop thru the tags to see if the tag youre looking for exists
44 replies