#development
1 messages · Page 1852 of 1
could be a bug with the package itself
that's a problem
Hey uh can anyone help me why does my bot keeps getting timed out?
the ping is fine and my other bots on the vps work just fine, its just that this one bot keeps dying randomly after 3-5hrs
My Client is initialised like this
please ping me if you know how can i fix this
wait, thinking about it i dont think so, on localhost it runs just fine, on my server it gives this bug
maybe it could be caused by the different os? im not quite sure
how do i get the mentioned user from a slash command
I think I'm finally about to fix jibakoma : D
Just got to take care of this error:
@drowsy crag scambot
Anyone knows how to update nodejs on ubuntu? I tried using the n module it sais it installed nodejs v16.7.0 but when I do node -v it shows v15.8.0
I'd just purge and reinstall lul
how?
use nvm or
Using Ubuntu
curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
sudo apt-get install -y nodejs
Huh.
u just told me to use nvm
so confused
sudo npm install pm2 -g
oh god no
pm2 update
just do #development message
You still need to update pm2
I installed v16 yesterday and it was required
this worked
pm2 update has the same approch,nvm there are many solutions ;) ,maybe mine wasn't the eaisest
message.channel.send({ content: "Pong" })
Nvm I always forget to scroll. sry
k
pm2 always uses the base node version
how do i get the mentioned user from a slash command
Guys
I need help with a weird bug
I had an old bot
that perfectly work with the token runner command
and i put the same command
in another bot
and it didn't work
and im sure it's the same
ping me when there's answer please
There’s a user option choice type
Hello I wanted to use discord-buttons but I had a problem I put const disbut = require('discord-buttons'); disbut(client); in index.js but I got an error
const emo = {
fun: "🎮",
ticket: "🥴",
utility: "2️⃣",
moderation: "⚙️",
}
// now lets run it
array.forEach(cca => {
let name = cca;
let sName = `${name.toUpperCase()}`
let tName = name.toLowerCase();
let fName = name.toUpperCase();
let e = emo
return menus.push({
label: sName,
description: `${tName} commands!`,
value: fName,
emoji: e[name]
})
});```
emoji aint working 😦
client is not defined, the error is pretty self explanatory
Ah
You know how I can handle that?
Define client
How
Do you know how to instantiate a discord client?
Put the emoji in the label
e[name] + sName
You’re using client before you made an instance of a Discord.Client with the name of client
Ah
emo is not an array
array is not defined
cca is redeclared as name
name is an emoji that is having the case changed
returning a value from a forEach loop
don't mind me just checking junior dev's code
Okey I'm going to go do this and I'll tell you how it works
That just doesn't make sense.
- What is
array? - Why reassign
ccato a variable? Just give it that name (nameinstead ofcca). - All you've done is change the form of the string a bit for the object you push to
menu
They had a problem, found an answer on stackoverflow, it didn't work, now they need help with why copied code doesn't work
const client = new discord.Client(); //Creating discord.js client (constructor)
const disbut = require('discord-buttons');
disbut(client);```
It's good ?
just specify the intents if you are on v13 and youre good
Because I have error ☹️
Ah
I have question
How 
why use discord-buttons
It's for a fun command I need it
Because it puts an error :(
error
C:\Users\Mustikk\Desktop\Projects\Lxyon\index.js:102
const guild = client.guilds.get('878986911908241489');
^
TypeError: client.guilds.get is not a function
at Client.<anonymous> (C:\Users\Mustikk\Desktop\Projects\Lxyon\index.js:102:33)
at Client.emit (node:events:394:28)
at Object.module.exports [as GUILD_MEMBER_ADD] (C:\Users\Mustikk\Desktop\Projects\Lxyon\node_modules\discord.js\src\client\websocket\handlers\GUILD_MEMBER_ADD.js:16:14)
at WebSocketManager.handlePacket (C:\Users\Mustikk\Desktop\Projects\Lxyon\node_modules\discord.js\src\client\websocket\WebSocketManager.js:345:31)
at WebSocketShard.onPacket (C:\Users\Mustikk\Desktop\Projects\Lxyon\node_modules\discord.js\src\client\websocket\WebSocketShard.js:443:22)
at WebSocketShard.onMessage (C:\Users\Mustikk\Desktop\Projects\Lxyon\node_modules\discord.js\src\client\websocket\WebSocketShard.js:300:10)
at WebSocket.onMessage (C:\Users\Mustikk\Desktop\Projects\Lxyon\node_modules\ws\lib\event-target.js:132:16)
at WebSocket.emit (node:events:394:28)
at Receiver.receiverOnMessage (C:\Users\Mustikk\Desktop\Projects\Lxyon\node_modules\ws\lib\websocket.js:970:20)
at Receiver.emit (node:events:394:28)
PS C:\Users\Mustikk\Desktop\Projects\Lxyon>
v13 have components, update
code
client.on('guildMemberAdd', guildMember => {
const guild = client.guilds.get('878986911908241489');
const channel = '879016940071444490';
var userCount = guild.memberCount;
channel.send(`> <@${guildMember.id}> joined to our server.We are ${userCount} members with u!`);
});
i tried client.guilds.find
too
client.guilds is a guild manager
how can i fix?
Look in docs for GuildManager
ok
there's the cache property you can access which is a collection
"just specify the intents if you are on v13 and youre good" how ? @pale vessel
client.guilds.cache.get()
Under client options
new Discord.Client({ intents: here })
You can provide an array of intents
i changed code with cache.get and it works but when comes to channel.send it returns
Channel is a string
You can't use .send() on a string
get the actual channel from the guild
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Invalid Form Body
components[0].components[0].options[0].emoji.name: Invalid emoji
components[0].components[0].options[1].emoji.name: Invalid emoji
components[0].components[0].options[2].emoji.name: Invalid emoji
components[0].components[0].options[3].emoji.name: Invalid emoji```
guild.channels.cache.get(id)
You don't even need the guild, you can use client.channels.cache.get(id)
debug your code dude
console log everything
use a debugger
did you remove emoji: e[name]?
or just learn to learn
Oh okey but for the button you need what intent?
no?
emoji: e[name] + sName
Ah okey thank you
wdym tell me
does anyone know how to make my bot respond with the message.reply() function without pinging the user¿¿
e[tName]
not sName
sName is your command name in uppercase, while your property names are all lowercase
serious question: do you know what you're doing?
kuyaj | Team Peipei | 𝔽𝟠 𝔾𝕦𝕚𝕝𝕕#
When trying to write it to a CSV file i get error with encoding thingy
I'm using Python
if(command === "daily") {
const member = await Economy.findOne({ userId: message.author.id })
const cd = await Cd.findOne({ userId: message.author.id })
const timeout = 8.64e+7;
const timer = cd.get("daily")
if(timer !== null && timeout - (Date.now() - timer) > 0){
const timeEmbed = new Discord.MessageEmbed()
.setAuthor(message.author.tag, message.author.displayAvatarURL({ dynamic: true }))
.setColor("RED")
.setDescription(`${tickno} | You can next collect your daily in **${prettyMS(timeout - (Date.now() - timer))}**`)
.setTimestamp()
return message.channel.send(timeEmbed)
} else {
const bal = member.get('money')
await Economy.updateOne({ userId: message.author.id }, { money: bal + 1000 })
await cd.updateOne({ userId: message.author.id }, { daily: Date.now() })
const embed = new Discord.MessageEmbed()
.setAuthor(message.author.tag, message.author.displayAvatarURL({ dynamic: true }))
.setColor("GREEN")
.setDescription(`${tickyes} | You have collected your daily reward of \`1000\`${coins}`)
.setTimestamp()
message.channel.send(embed)
}
}```
Hey this is showing "cannot read property get of null". Whats the reason?
in member.get('money') i guess
Apparently it's due to this 𝔽𝟠 𝔾𝕦𝕚𝕝𝕕# is there a way i can add this thing too?
i think in cd.get("daily") too
but it is not telling in which line
client.on("presenceUpdate", (oldPresence, newPresence) => {
if(!oldPresence) return
if(!newPresence) return
if (!oldPresence.activities[0].state) return
if (!newPresence.activities[0].state) return
const guild = client.guilds.cache.get("876082294283186186")
const role = guild.roles.cache.get("876084564240531487")
if(newPresence.activities[0].state.includes(".gg/tbs")) {
if(!oldPresence.activities[0].state.includes(".gg/tbs")) {
newPresence.member.roles.add(role)
}
} else if(oldPresence.activities[0].state.includes(".gg/tbs")) {
if(!newPresence.activities[0].state.includes(".gg/tbs")) {
newPresence.member.roles.remove(role)
}
}
});
when some users has the .gg, the bot dosen't add the role :/
and if I remove ```
if(!oldPresence) return
if(!newPresence) return
if (!oldPresence.activities[0].state) return
if (!newPresence.activities[0].state) return
for some users, the bot has an error
Cannot read property get of blank
The blank says what is undefined
Does anybody know why my bot randomly goes offline?
Additional info: Slash commands, hosted on replit
replit turns off your repl after five minutes
those don't work anymore or you didn't set it up properly
I prob added the wrong link in uptime robot
the link should be yourrepl.yourname.repl.co
I have a question
I have a URL like this: /v1/npkn/handle/image/upload
I want to extract the part after handle
I'm using nodejs path to parse URLs
CODE
const { MessageEmbed, Client, Message, Discord } = require('discord.js');
module.exports = {
name: 'rectrole',
description: "If anyone reacts to msg gains role.",
async execute(msg, args, Discord, Client){
const Role = msg.guild.roles.cache.find(role => role.name === "Member");
const channel = '878990757615247410';
const Emoji = '878990351753429073';
const reactionchannel = msg.channel
const reactionEmbed = new MessageEmbed()
.setColor('#ffffff')
.setTitle('REACT TO GET ROLE')
.setDescription('Reacting for get role is important for u to be verified.');
const embed = await reactionchannel.send({ embeds: [reactionEmbed] });
embed.react(Emoji)
Client.on('messageReactionAdd', async (reaction, user) => {
if(reaction.msg.partial) await reaction.msg.fetch();
if(reaction.partial) await reaction.fetch();
if(user.bot) return;
if(!reaction.msg.guild) return;
if(reaction.msg.channel.id == channel){
if(reaction.Emoji.id === Emoji){
await reaction.guild.members.cache.get(user.id).roles.add(Role);
}
}
});
}
}
C:\Users\Mustikk\Desktop\Projects\Lxyon\data\commands\rectrole.js:19
Client.on('messageReactionAdd', async (reaction, user) => {
^
TypeError: Cannot read property 'on' of undefined
at Object.execute (C:\Users\Mustikk\Desktop\Projects\Lxyon\data\commands\rectrole.js:19:20)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
it reacts but doesnt gives role to the member
const { MessageEmbed, Client, Message, Discord } = require('discord.js');
async execute(msg, args, Discord, Client){
here it needs to be defined
Your command handler is not passing the client to the execute function
yes
yw
I did add the right link
Yes
that shouldn't be happening
I set it all up correctly
Keep in mind the error is "No module named 'discord_slash'". I have to re-install it every time after it goes offline
That's expected since replit deliberately reinstalls all your dependencies if you change anything in package.json
anyone help?
ok i just realized
url.split("/image")[1];
skill issue
How do I export a function in js?
export default functionName``` gives me an error `Unexpected token 'export'`
js or node.js?
export default is for typescript no?
not only ts
Oh
js
es6 modules
module.exports = function functionName() {}
or
function functionName() {}
module.exports = functionName
that's node.js
bUt mY cLiEnT wAntS InTeRneT ExPloReR sUpPoRt
Let's be honest, internet explorer's only use was to download other browsers
Sad ie user
ok thanks but now I am using the import, but it doesn't work.
const { functionName } = require('../../Exports/FnIsHere.js')```
you're using require, not import
lmao
I thought import is for ts
for ts and es6 modules
Im in js
If you say module.exports = functionName I'm pretty sure you can't deconstruct it
es6 == js
es6 is js version
lmao me newb
so import {function} from ../../path?
path in "", yes
Context thing ( apps) is not working i did same as vid but the apps option wont come
code:
command: https://srcb.in/hUbxAjG6OM
handler: https://srcb.in/jw5J1No5yB
event: https://srcb.in/DOvcWI3BTK
It'll help to spend more time learning JavaScript.
Instead change the require of index.js in /home/container/commands/economy/daily.cjs to a dynamic import() which is available in all CommonJS modules.
fix?
anyone please
It means you should use import instead of require(...)
like if i wanna import parse-ms then how
To understand how first we need to understand how to use import: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import
For example, you could do import * as ms from "parse-ms"
Context thing ( apps) is not working i did same as vid but the apps option wont come
code:
command: https://srcb.in/hUbxAjG6OM
handler: https://srcb.in/jw5J1No5yB
event: https://srcb.in/DOvcWI3BTK
the slash comamnds work
now that is this 🙂
SyntaxError: Cannot use import statement outside a module
^ same
I think you need to set the type key in your package.json to "module"
how? (:
"type": "module"
oh got it
uh..
Im trying to make a Discord Aotho2 on my website..
and when I login I get this
how do I get that with HTML and get data from it?
like users username, guilds they are in, ect that comes with my scopes..
if I do,
I have require('dotenv').config();
now it says ReferenceError: require is not defined in ES module scope, you can use import instead
I don't know how many do I need to change, any other way?
Try import * as dotenv from "dotenv"
send a POST REQUEST to https://discord.com/api/v9/oauth2/token
with the code you got (in url)
like this
{
'client_id': CLIENT_ID,
'client_secret': CLIENT_SECRET,
'grant_type': 'authorization_code',
'code': code,
'redirect_uri': REDIRECT_URI
}
You'll get a token
save that and use it later for authorization
I suggest doing it in Backend tho
? Whats the difference between backend and front end... I thought frontend is like design and backend is code..
If you're doing it on Frontend use 'grant_type': 'token' instead of 'code'
nvm
forget everything I said
alright :/
Anyone good at content writing? Or flutter? I have a job opportunity, remote, contract base thing.
Ik this not the right place but there good developers here
What type of content writing?
is there a way i can connect to my already exisiting postgres db from vultr?
I recommend looking elsewhere online, as I'd disagree.
is there a way i can connect to my already exisiting postgres db from vultr?
@austere zealot yeah, what exactly are you trying to do
i just got a vutr plan, and i was trying to connect to my already existing db but i have no idea how
where are you hosting your database?
wdym
where is your database located?
you have to host your db?

bruv
wait so i have to get a new plan to host my db?
well you can install postgres on the same machine
but if you have a big project its better to separate them
i dont really have a big project
You said you already have a database
You can use that one
Just use the link / uri
asap question -> is it possible to convert google sheet managed by google form to json? i wanna use data somewhere....
Do you have GCP ?
how do i get the link
im gonna use g apps script cause this is free =p
PS: i was using a few scripts alreday but all broken =p
You can create an app from the GCP dashboard (free for smol)
Then Google sheet becomes like a real time db
You can fetch all as csv then convert to json or whatever
and converting via modifying url doesnt work
im not gonna show how much money i have to google. i use free light version named "apps script". dont even say bout this thing for business, ok?
also i use asyncpg
I'll delete that useless link
same - google says nothing. i was trying to use dis $#it :
/* Source: https://gist.github.com/daichan4649/8877801 */
function doGet(e) {
var sheetName = "2";
var sheetId = "1XK5hkOzBZ1IYtxkPwJKQ__maOUyiwN5Gu7hIlMaIS4Y";
var book = SpreadsheetApp.openById(sheetId);
var sheet = book.getSheetByName(sheetName);
var json = convertSheet2JsonText(sheet);
return ContentService
.createTextOutput(JSON.stringify(json))
.setMimeType(ContentService.MimeType.JSON);
}
function convertSheet2JsonText(sheet) {
// first line(title)
var colStartIndex = 1;
var rowNum = 1;
var firstRange = sheet.getRange(1, 1, 1, sheet.getLastColumn());
var firstRowValues = firstRange.getValues();
var titleColumns = firstRowValues[0];
// after the second line(data)
var lastRow = sheet.getLastRow();
var rowValues = [];
for(var rowIndex=2; rowIndex<=lastRow; rowIndex++) {
var colStartIndex = 1;
var rowNum = 1;
var range = sheet.getRange(rowIndex, colStartIndex, rowNum, sheet.getLastColumn());
var values = range.getValues();
rowValues.push(values[0]);
}
// create json
var jsonArray = [];
for(var i=0; i<rowValues.length; i++) {
var line = rowValues[i];
var json = new Object();
for(var j=0; j<titleColumns.length; j++) {
json[titleColumns[j]] = line[j];
}
jsonArray.push(json);
}
return jsonArray;
}
copied and modified from somewhere. but how to make json from this? url? irdk
didnt yet crashed and only this good
oh, sorry, got smth
dis jason a little works... maybe.... ok.
alright, thanks
i changed it but it still sends that the database does not exit
await asyncpg.create_pool(database="dbname",user="postgres",password="",host="localhost")
``` this is how im connecting to it
why is your host still localhost ?
also I don't code Python
f
{ onCollect: (f: (buttonId: string, user: User) => void) => { onExpire: (f: () => void) => void } } typescript be like
any
okay... this time i was trying to make a hardcore... (pithon ofc). code here:
@bot.listen("on_message")
async def scam(ctx):
msg = ctx.content.lower()
scamlist = 'https://script.googleusercontent.com/macros/echo?user_content_key=Efu2RvJxsVQeh3xv9Vb0RSO-d1RrZCrqjk2D1jQhhvSiWW2C47NXP0mEcyH_e7p4cccugpWX4RfPdkWhvG0kfhRvrC5l9wAqm5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnA1zRMJcOWhp5p8-TrasYiLfc8s82yHYvncMdEYM4VMzrAWyr3_vgWcPkd2qwPRs1bz0TAVXLS4Dleb--x_lwbJ0QrOacq8a_9z9Jw9Md8uu&lib=Mvhguv8KrjGlroshaZkuz2rjldAiTUHuJ'
scam = requests.get(scamlist, headers={"Accept":'application/json '}).json()
data = scam
for word in data:
if word in msg:
await ctx.delete()
error i got :
TypeError: 'in <string>' requires string as left operand, not dict
someone know how to make this magik work?
i know bout this overused variable data = scam but ths shouldnt throw error btw
•~•;
noone knows .py too much?
;;;-;;;
json.dumps() I think
means? this dict have really a few values nested, so.....
that's what .json() does
idk I don't rlly use py
its just a database to filter
(and yes its this connection between google sheets, forms to collect scams and pithon)
no it isnt. and gimme 2 mins to copy a part of jason
here ya have all the db:
[{"Timestamp":"2021-08-06T16:16:08.751Z","put here stean scam: ↓↓↓":"https://steamcommunity.link/tradeoffler/?partner=1174256784&token=J7GrEW-B"},{"Timestamp":"2021-08-06T16:32:03.210Z","put here stean scam: ↓↓↓":"https://dlscord.world/steam/giveaway-nitro"},{"Timestamp":"2021-08-09T08:16:51.098Z","put here stean scam: ↓↓↓":"https://steamcommunity.link/tradofffer/new/?partner=1284276765&token=Qzk13zaHL2"},{"Timestamp":"2021-08-09T15:32:53.842Z","put here stean scam: ↓↓↓":"https://discorb.co/nitro"},{"Timestamp":"2021-08-14T18:25:13.471Z","put here stean scam: ↓↓↓":"https://discrodnitro.org/discrodgift"},{"Timestamp":"2021-08-18T09:16:24.555Z","put here stean scam: ↓↓↓":"https://discord-nitro.link/gift=8634"},{"Timestamp":"2021-08-18T18:58:42.695Z","put here stean scam: ↓↓↓":"https://steancommunity.link/tradeotfer/?partner=1278625821&token=ZssMJ7Uq"},{"Timestamp":"2021-08-18T19:19:28.111Z","put here stean scam: ↓↓↓":"https://steamcommunity.com/tradeoffer/new/?partner=333240728&token=lXk110d0"},{"Timestamp":"2021-08-21T06:40:56.972Z","put here stean scam: ↓↓↓":"https://discorb.ru.com/nitro/gift"},{"Timestamp":"2021-08-22T06:17:54.401Z","put here stean scam: ↓↓↓":"https://discorcl.click/="},{"Timestamp":"2021-08-22T10:15:12.617Z","put here stean scam: ↓↓↓":"https://freenitroi.ru/give-nitro"},{"Timestamp":"2021-08-22T11:16:05.170Z","put here stean scam: ↓↓↓":"https://discorcl.click/gift/steam"},{"Timestamp":"2021-08-22T11:19:45.200Z","put here stean scam: ↓↓↓":"https://discorcl.click/gift/steam"}]
converted from google forms to sheets and then to jason
It really is
Well, I suppose you wanna get a list of the URLs? A list comprehension would do the job, i.e., [i["put here stean scam: ↓↓↓"] for i in data]
You're requesting that file on every message?
That doesn't sound efficient, especially when it's blocking
urls, yes. only urls, not question, timestamp, etc. just this link, yep
and nothing blocks. just i got error, then i'll check
It really blocks, maybe it's negligible for now. It's definitely blocking though
i don't think you quite understand what you're doing
i just wanted to do something good, yep?
and as i see -> i'll need to ask someone else
-_-
asked btw
what do i do to fix this?
nothing. its a bug in ur ide =p
if throw error - just say it. red vawe doesnt yet say anything
so what code do i enter
nothing, run and if error shows in terminal - say it (but i dont think it will)
semicolon? comma? try something
What’s even the sense of defining another var of your environment var?
var a = 1
var b = a
print b
trying to outsmart node's JIT 🧠
uhh..
How can I go to onather commit on github?
Bc I kinda did smth stupid rn
and need to make it go back

I wonder if the environment property can be an object… don’t think so
..
the commits on the insgihts page just says crrunching up the data for like 4 minutes now..
Does your environment file even store an object?
If not process.env.token would be your accessor
(see what I mentioned above)
Check other part of your code
Revert the commit
how
on their website
Use CLI or GitHub desktop
You can't revert commits on web afaik
wwhhyyyy
Right click the commit
thanks
you can actually
just select the desired commit, click on branch selector and create a new branch from there
help
i havent used "??"
i make the token thingy and put just the token in it
thats all
im sorry if im being dumb or something, havent touched bots in a fat minute
You need node 16.6 for Discord.js v13
But that client doesn't look like V13
it is
Well it's wrong then
But the problem is most definitely related to the node version
In this case
You need that to use v16.6 on repl.it
And the ?? operator isn't supported on node 12 which is what repl.it uses
Ah, officially? TIL
Wonder why they use an old version by default
Well, never change a running system 
Yeah. I have a friend who started djs dev a couple of days ago on replit and she only managed to get v16.4. So I asked Tim for his link.
btw i have another one as well
the previous one runs on NIX and relies on fetching their unstable repo, which is slow af
this one runs on bash and downloads the node tarball directly, and you can configure the exact version and file you want
jibakoma is fixed 😄
Tim is OP and needs a nerf
lmao
its a pain tho that you cant change repl.it's PATH variable programatically
you can change it for the script itself, but not for the console
how can I know how long each user has been on call?
no, tim is just trained in the secret brazillian art
gambiarra at its finest
You'd get the time the user joined the voice channel, but I don't think Discord offers data on the join date of the user.
So you could watch for when members join a voice channel and record the timestamp
It is possible but not practically
You'd have to track every channel check if a user is in there, then get the time of when they're in and keep tracking untill they leave then divide the times et voila
If you do it over alot of channels/guilds you'll prob run into ratelimit issues tho
getting whether an user is in a voice channel doesn't cause ratelimit ig
I'm getting the "RuntimeError: PyNaCl library needed in order to use voice" error, I installed PyNaCl but somehow I think the install is not correct, it shows me this:
anyone knows how to fix this
how would i do that
const voteuser = vote.user
voteuser.send('Thx for voting!')
vote.user is probably going to be a user ID, so you'd send a message to a user by ID
e.g. client.users.fetch(...).then((user) => user.send(...))
but i don't have the vote code hh

Then you'll want to use the webhooks API
do you have any tutorial
Doesn’t that only work for approved bots?
should i verify my bot to get votes?
oh ok 😂
Expect this approval taking a few days/weeks
hmm creating a cache for discord is proving to be much more complicated than i thought
Just tried to download the tarball a few days ago and got a file not found error
wut
ffs discord mobile trash
wat
Discord and a slowly mobile connection is pain
I can see my message be sent like 10 times
But couldn’t edit it or do anything else
Pffff
Not sure if that message has made it through
Just tried to download the tarball a few days ago and got a file not found error
It did
Tried to install the GitHub tarball via npm and it failed
djsl?
Yeah
Tried a few days later again, same result
Hmm yeah well as I said I found out I don’t need to deal with caching for the bots size
Just wasn’t sure about it until now
This fucking country and it’s mobile connection outtakes…
Worse than any 3rd world country, I promise 
lmao
you help me ?
he told you how to do it lol
Btw don’t you actually sleep sometimes, Tim? 
I know, but I'm having problems with the callback. I'm getting an array with a "VoiceState " object that gives me the user id, guild information that the user connected to the voice channel, but that's not the problem. Problem is, timestamps keep guild information and not along with the user information are these timestamps when the user joins the guild or when connected to the voice channel?
Tim has an AI trained on his past Discord messages and the discord.js docs that auto-responds while he sleeps.
there is no timestamps for voice, you need to create your own
when a user joins voice, create a timestamp and add it to the voicestate
when the user leaves, get the timestamp from the voicestate and see how much time passed
ok, i created one (if ternary) to be able to detect when a user connected, can i receive the information and pass Date.now()?
lmao
I knew it, he’s a bot
can you help me again?
I created an "if" that takes the value of "if ternary" and the value is "online / offline" and when that "if" is true for "online" it starts a 5 minute setInterval to add coins for a user, but this setInterval does not deactivate when a user leaves the voice channel, how can i deactivate it?
clearInterval
Just add a property to the client’s voice state object.
but it works like this:
if(verific_on_1 === 'online') {
setInterval(function() {
console.log(`adicioned 5`)
})
}
what?
You will want to save the interval somewhere so you can clear it
how do I do that?
I legit told u
You will want to save the interval
what makes u think u want to save a string of 300000?
At the moment the user changes it’s voice state just add a new property to the member/user object including the current timestamp (he joined/left a channel)
If you set a new key to the object will it transfer over to the next time the event triggers?
yes
ok
I get one online when the user is on the voice channel and when he leaves, I get one offline
const verific_on_1 = verific_channel_1_new === channel_1 ? 'online' : 'offline'
ok
I can't do much with that
Adding a property the to client will be there forever as long as he’s cached
ahhh you meant the client
I know, this is just an example for you to understand what I said.
so I'm writing a raw array implementation and I'd need to be able to tell the difference between the number 0 and "null" aka empty. to do this would i need to keep a separate list which specifies if a specific index is empty or not?
I thought u meant the client.on("blabal", parameter => parameter.balba)
You don't give much context but u could do something like:
let indexEmpty = index ?? true // Is empty if value === null is equal to index if not
this isn't really specific to a language but rather the context is an empty element is initialised with a 0
wdym?
I'm working in an osless environment and I'm implementing an array (which is just a sequence of memory registers) and those registers are 0, id want to tell the difference if an element is 0 or is empty
it sounds like a trivial question but it's quite tricky
so you want to know if the memory register is empty?
Well convert the element to a boolean
that'd turn into a 0 😂
null is always null, but 0 is false
No 0 == false
null stays null?
the more you learn
@tulip ledge I can do something like this:
const interval = setInterval(function() {
console.log(`adiconed 5`)
}, 3000000)
interval.clearInterval
?
no clearInterval is a function
actually I have an idea
hm
what if I allocate an extra byte for each element and just before that element, set a 1 or 0 to figure out if its empty or not
that way I save another block allocation
still how are u gonna determine to put a 1 or a 0?
that byte will be set to 1 as soon as the "element" is occupied which would tell me if its truly empty or not
ahhh I get it now
I have direct access to each individual memory register which lets me do that
So you're setting all to 0 but when you store something you put it to 1?
Am I getting it right?
I might go back to high level programming soon before I go crazy with no operating systems
A boolean can be null but not vise verse, yeah
null is something "else" in this context like the fat and ugly kid no one wants to play with 
kekw
null is really just a 0 lmao
but high level languages abstract it to actually check if something is "empty"
0 can be parsed to a boolean, null can’t
Yeah but usually they’re able to check if somethings exists and is not null
aka. ISSET
what type of items does the array hold?
a single type, can be an int for example
there isn't really a null in my environment lmao
is repl good for hosting bots?
I tried switching because i heard it was bad for hosting bots
if its a typed array, then it cant really hold null if its declared as int
so there is no null vs 0
just so you know this is an osless environment with me interacting with each memory register individually
One message removed from a suspended account.
you want to make a sparse array?
there isn't really a null, you could call it 0
One message removed from a suspended account.
a sparse array would be a non-contiguous array, which can hold empty values
a normal fixed-length array cannot hold empty values
because c++ doesn't really have proper arrays (at least ones that don't only accept built in types), I'm making an array which you create with a specific type and length
how doesnt it?
I call them btec arrays
an "array" there is just a sequence of memory registers there is no real catch to it
you might as well just do 0x1 = 1 0x2 = 2 except its made easier with that
so I'm making an abstracted array
yes but what are you trying to do that you cant do with vectors for example?
I don't have access to the standard environment
ah
I have to write them myself lol
on the heap or on the stack?
the heap, wrote a simple heap allocator and deallocator
fixed length and single type?
yeah
then just write the type info in some header no?
I will eventually get to making vectors
and huh?
I'm using templates to define the elements types
for example you want to create an array of int32 of size 10, your array would be something like 41 or 42 bytes long, with first 1-2 bytes defining the array metadata, like type and length, followed by the raw int32 bytes
@tulip ledge
const interval = setInterval(verifications, 10)
function verifications() {
if(verific_on_1 === 'online') {
console.log(`adicioned 5`)
}else {
setTimeout(function() {
clearInterval(interval)
console.log(`stoped`)
})
}
}
yeah exactly
which is why I'm adding a byte before each element to figure out if its empty or not
either a 1 or 0
why do you need this distinction tho?
does not stop even after setting setTimeout. didn't stop with the function itself, so I decided to do that @tulip ledge
arrays of fixed types usually cannot have empty values
well then its a dynamic array with dynamic type
Huh where the fuck did that message go?!
in that case yes, prefix each item with a byte
if you're gonna have variable length items, use the byte to write each item's type and length
a dynamic type array would be a mess to implement lmao (though wouldn't need it anyways)
they're just gonna store a single type no need
I can't really think of a use case where an array would need multiple types here
well, a full byte to hold only 1 bit is kind of a waste of space
another way would be to define a number that you're guaranteed to never use, and use that number to represent empty lol
another way would be to use signed numbers, and have negative values represent empty
since signed only occupies 1 bit, rather than 1 full byte
it is a waste
and I did think of those but they just don't feel right lmao
I might consider though
there pretty much isnt any other option
unless you set a bitfield in the array header or something
as long as the number of items
well im off to bed, good luck!
SyntaxError: INVALID_TYPE: Invalid MessageComponentType │
│ ││ . > at Function.create (/home/ubuntu/real/node_modules/discord-buttons/src/v12/Classes/interfac │
│ ││ . > at /home/ubuntu/real/node_modules/discord-buttons/src/v12/Classes/MessageActionRow.js:18:77 │
│ ││ . > at Array.map (<anonymous>) │
│ ││ . > at MessageActionRow.setup (/home/ubuntu/real/node_modules/discord-buttons/src/v12/Classes/M │
│ ││ . > at new MessageActionRow (/home/ubuntu/real/node_modules/discord-buttons/src/v12/Classes/Mes │
│ ││ . > at Function.create (/home/ubuntu/real/node_modules/discord-buttons/src/v12/Classes/interfac │
│ ││ . > at /home/ubuntu/real/node_modules/discord-buttons/src/v12/Classes/Message.js:10:81 │
│ ││ . > at Array.map (<anonymous>) │
│ ││ . > at ExtendedMessage._patch (/home/ubuntu/real/node_modules/discord-buttons/src/v12/Classes/M │
│ ││ . > at new Message (/home/ubuntu/real/node_modules/discord.js/src/structures/Message.js:44:20)
my bot is dead after sending this
a bit field actually sounds like a great idea, I'll keep that in mind also, though it might get large quickly
can anyone tell me about this errr
send some code
Ur creating a message component somewhere obviously for a button or similar and passing a wrong type to it
oh
in help cmd
There are only 3 types
thnq
Probably I don’t know since I don’t see any code
Well at least the part which contains your message component stuff
this is not showing where is this exactly trouble
Nope but I don’t think there are many places in your code you’re defining message components
am finding
Could also be your button package is outdated
?
Does anyone know the channel and role limit for discord?
how can i update ?
500 channels (all types included), 250 roles
Thank you
Randomly coming up and "knowing" things... You are scary 
Just post the related code in here, not via DM.
Somebody will continue to help u as I need to sleep right now 
in my bot i set status is how many members the bot watching but it shows only 2
Actually that is in 15 servers
Can any one help
send code
One message removed from a suspended account.
Y
where is this exactly trouble anyone can help
You never posted your code for that
'2021-06-25T11:29:04.697236+00:00'
in which format is this datetime
i'm trying to convert it into datetime object
it's a string
datetime.strptime('2021-06-25T11:29:04.697236+00:00', '%Y-%m-%d %H:%M:%S')
I'm using python
Apparently I need to write the correct format here '%Y-%m-%d %H:%M:%S'
Nvm figured it out
What or how would I do to enable all intents on my bots code?
goto developers portal
He means when instantiating a Discord client with v13
^
I may be wrong but isn't it
intents: Object.values(Intents.FLAGS).reduce((a, p) => a | p, 0)
Like this ?
const { Client, Intents } = require('discord.js')
const client = new Client({
intents: [
Intents.FLAGS.GUILDS
]
});
ppl with HUGE brains
people who use the exact flag data type for intents are psychologically impaired
please don't actually do that
we build enumerables and data classes specifically so that we can do relative imports of what's written from the dev docs

Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
i know absolutely nobody who wants to do calculation for each of these
based people will always default their intents as a 513 status
what part of this channel looks like you run commands in it
you have the ability to read the whole convo above but you still ran commands
Okay, so I used
const client = new Client({
intents: [
Intents.FLAGS.GUILDS
]
});```
and that works, well, to the point where I do not get a error, I am trying to have it dm a user who joins the server, my djs and node are updated, but it does not log nor send the user a message when they join, both my Dev Portal intents are enabled, and I used the one above, how can i fix this?
is there not a default flag for intents in d.js
you need members intent
Because you don’t have the guild members intent
It's privileged
oh jfc
Ahhhh
throw new RangeError('BITFIELD_INVALID', bit);
^
RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: undefined.```
Nvm
why does d.js handle intents so cancerous
Figured it out.
do they actually force you to throw the intent flags in a list accumulatively?
yes
Welcome to discord.js
Okay, no I made it worse
Glad I swapped 
This is my error
Well, what’s your code?
const Discord = require("discord.js");
const { Client, Intents } = require('discord.js')
const client = new Client({
intents: [
Intents.FLAGS.GUILDS, Intents.GUILD_MEMBERS, Intents.GUILD_MEMBER_ADD
]
});
Intents.FLAGS
bruh
Intents.FLAGS.BRRRRRR
You need to use Intents.FLAGS.INTENTNAME
v13 fact
surely they've never heard of automatically adding bit shift fields right?
at least gotta give them a reason for a poor design choice like that
They used to be like
intents: [
"GUILD_MEMBERS"
]
in v12
Then they changed it to that shit above
Surely there was a reason which I'm too smol brained to understand
Yeah
Exactly lmao
Okay, it still does not work LOL
Won't Dm the user when they join
Literally, ALL INTENTS ARE ENABLED

Show code once again
const Discord = require("discord.js");
const { Client, Intents } = require('discord.js')
const client = new Client({
intents: [
Intents.FLAGS.GUILD_MEMBERS
]
});```
where you're dming the user
client.on('guildMemberAdd', member => {
member.send(`Welcome to the server, ${member}!`);
console.log(`${member.user.username} has joined`);
});
Doesn't even log it
Try enabling the DIRECT_MESSAGES intent
(Along with your other intents)
Wait I’m big dumb you need to enable the GUILD_MEMBERS intent
(Thanks @earnest phoenix)
isn't he muted ?
It already is.
/rbd/pnpm-volume/cf881cdc-642a-4e14-bf0e-3c1abb6f6bf1/node_modules/discord.js/src/util/BitField.js:152
throw new RangeError('BITFIELD_INVALID', bit);
^
RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: undefined.
at Function.resolve (/rbd/pnpm-volume/cf881cdc-642a-4e14-bf0e-3c1abb6f6bf1/node_modules/discord.js/src/util/BitField.js:152:11)
at /rbd/pnpm-volume/cf881cdc-642a-4e14-bf0e-3c1abb6f6bf1/node_modules/discord.js/src/util/BitField.js:147:54
at Array.map (<anonymous>)
at Function.resolve (/rbd/pnpm-volume/cf881cdc-642a-4e14-bf0e-3c1abb6f6bf1/node_modules/discord.js/src/util/BitField.js:147:40)
at Client._validateOptions (/rbd/pnpm-volume/cf881cdc-642a-4e14-bf0e-3c1abb6f6bf1/node_modules/discord.js/src/client/Client.js:546:33)
at new Client (/rbd/pnpm-volume/cf881cdc-642a-4e14-bf0e-3c1abb6f6bf1/node_modules/discord.js/src/client/Client.js:73:10)
at Object.<anonymous> (/app/index.js:3:16)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32) {
[Symbol(code)]: 'BITFIELD_INVALID'
}```
onst Discord = require("discord.js");
const { Client, Intents } = require('discord.js')
const client = new Client({
intents: [
Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.DIRECT_MESSAGES, Intents.FLAGS.GUILD_MEMBER_ADD
]
});```
I'm sure guild member add isn't a thing
this might work
You already have GUILD_MEMBERS, so you don’t need the partial
intents: [Intents.FLAGS.GUILDS_MEMBERS | Intents.FLAGS.DIRECT_MESSAGES]
are you guys allowed to do this in JS?
const stealthy = install('brains')```
Uhhh
its a combiner term
| acts as a way to conjoin
works at least on ints from what i remember
@earnest phoenix
Wait a minute
Have you created the dm before sending the message ?
His problem is that GUILD_MEMBER_ADD is not an intent
isn't that a partial intent
Also The event isn't firing at all
he needs the typing intents iirc
GUILD_MESSAGE_TYPING | DIRECT_MESSAGE_TYPING
although that might be triggering the typing state of the application instead of reading for the typing
w h y ?
I don’t believe he needs those lol
So I tried with my bot only with "GUILD_MEMBERS" intent and it's working
I'm just logging the members rn
Whats a more "updated" command handler? As mine may just be the issue.
Your command handler shouldn’t matter if it’s just an event firing or not
The user isn’t using a command, so nothing should be passing through your command handler
And you’re not using an event handler from what I saw
You need the channel partial enabled
In theory that’s the issue @earnest phoenix
I don't have a general event handler no.
^^^
Oh, okay.
const client = new Discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES", "DIRECT_MESSAGES"], partials: ["CHANNEL"] });
This should work, correct?
probably
It works, for commands
it didnt before
now just the event isn't working
im trying to make my bot respond to a dm but none of the intents seem to be working
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.DIRECT_MESSAGES] });
Use this;const client = new Discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES", "DIRECT_MESSAGES"], partials: ["CHANNEL"] });
Uh
thanks that worked
Np
You need the GUILD_MEMBERS intent
it worked for me when i used it
Oh whoops I responded to the wrong message
I meant this
The event still doesn't work @wheat mesa
const Discord = require("discord.js");
const client = new Discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES", "DIRECT_MESSAGES", "GUILD_MEMBERS"], partials: ["CHANNEL"] });
const http = require("http");
const express = require("express");
const app = express();
const fs = require("graceful-fs");
const config = require("./config.json");
/*
app.get("/", (request, response) => {
console.log(Date.now() + " Ping Received");
response.sendStatus(200);
});
*/
var server = require("http").createServer(app);
const listener = server.listen(process.env.PORT, function() {
console.log("Your app is listening on port " + listener.address().port);
});
client.on("ready", async () => {
client.user.setActivity(`Alena Staff`, {
type: "WATCHING"
});
console.log(`logged in as ${client.user.tag}`);
});
client.commands = new Discord.Collection();
const commandFiles = fs
.readdirSync("./commands")
.filter(file => file.endsWith(".js"));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
client.commands.set(command.name, command);
}
const cooldowns = new Discord.Collection();
client.on("messageCreate", message => {
let prefix = config.prefix;
if (message.content.indexOf(prefix) !== 0) return;
const args = message.content.slice(prefix.length).split(/ +/);
const commandName = args.shift().toLowerCase();
const command =
client.commands.get(commandName) ||
client.commands.find(
cmd => cmd.aliases && cmd.aliases.includes(commandName)
);
if (!command) return;
if (command.guildOnly && message.channel.type !== "text") {
return message.reply("I can't execute that command inside DMs!");
}
if (command.admin && !config.administrators.includes(message.author.id)) {
return message.reply("You must be an administrator to run this command!");
}
if (command.args && !args.length) {
let reply = `You didn't provide any arguments, ${message.author}!`;
if (command.usage) {
reply += `\nThe proper usage would be: \`${prefix}${command.name} ${command.usage}\``;
}
return message.channel.send(reply);
}
if (!cooldowns.has(command.name)) {
cooldowns.set(command.name, new Discord.Collection());
}
const now = Date.now();
const timestamps = cooldowns.get(command.name);
const cooldownAmount = (command.cooldown || 3) * 1000;
if (timestamps.has(message.author.id)) {
const expirationTime = timestamps.get(message.author.id) + cooldownAmount;
if (now < expirationTime) {
const timeLeft = (expirationTime - now) / 1000;
return message.reply(
`please wait ${timeLeft.toFixed(
1
)} more second(s) before reusing the \`${command.name}\` command.`
);
}
}
timestamps.set(message.author.id, now);
setTimeout(() => timestamps.delete(message.author.id), cooldownAmount);
try {
command.execute(message, args, client);
} catch (error) {
console.error(error);
message.reply("there was an error trying to execute that command!");
}
client.on('guildMemberAdd', member => {
member.send(`Welcome to the server, ${member}!`);
console.log(`${member.user.username} has joined`);
});
});
I didn’t mean the whole thing but that works I guess
Makes sense why it’s not working now
You have your guildMemberAdd event inside of your messageCreate event
Which is not correct
So you need to take your guildMemberAdd event outside of your message event, then it should work
How would I also restrict it so that it only DM's a user if the user joins a specific server?
I'd think something like; client.guilds.cache.get('').then( client.on('guildMemberAdd) )
or something of the sort.
if (look up for settings -> guild ids) has guild id of member
send dms
^^
Pseudocode
Whaaat
it's more like an idea
Yeah
Pseudocode is an artificial and informal language that helps programmers develop algorithms. Pseudocode is a "text-based" detail (algorithmic) design tool. The rules of Pseudocode are reasonably straightforward. All statements showing "dependency" are to be indented. These include while, do, for, if, switch.
first off you need a config contains a list of notify servers
Okay.
Alright
a string doesn't include anything
client.on("guildMemberAdd", (member) => {
member.send("message")
})
that throws a ReferenceError
The .includes() method is for arrays, to see if an array contains a specific entry
but it only sends a message to the user, if they are in a specific server.
check if the guild id is the one you want it to be sent in
@earnest phoenix alright so
on event 'guildMemberAdd' func (async member)
const targetServerList = getIDSomewhere() // array
if (targetServerList.includes(member.guid.id))
return // send dms
this is peudocode btw
you have to implement it yourself
So
client.on('guildMemberAdd', member => {
const targetServerList = ['878722964428816474']
if (targetServerList.includes(member.guid.id))
return
console.log(`${member.user.username} has joined`);
});```
?
Seems about right
Make sure to take your guild member add event out of your message event if you haven’t already btw
^^
If it’s for like a couple servers that’s fine, but more than that and it gets messy
now discord framework for react

Oh god
i honestly dk what to start with
Honestly web dev hurts me
i know nothing about CSS
I know the very basics of CSS
I struggle with HTML
I need to learn web dev eventually though
Doesnt work @wheat mesa @civic scroll
What specifically doesn’t work

The DM
client.on('guildMemberAdd', member => {
const targetServerList = ['878722964428816474']
if (targetServerList.includes(member.guid.id))
return
member.send(`Are you getting this?`)
});```
No error
no
dm
You didn’t spell member.guild.id correctly
lmao, I didn't spell ittt
Unless my discord mobile is cutting it off somehow
LMAO
Waffle, im full of your jokes lol
Get it
nvm
To hard of a joke to explain
Lmao, ill go try it now
Still doesn't work.
this is why you use typescript to code
No error, just doesn't DM.
huh?
Show your full code again
https://glitch.com
});
client.on('guildMemberAdd', member => {
const targetServerList = ['878722964428816474']
if (targetServerList.includes(member.guild.id))
return
member.send(`Are you getting this?`)
});
if jsdoc
You’re sure your guild members intent is on on the dev dashboard?
And you moved the guildMemberAdd event outside of your messageCreate event, right?
Try logging something at the very top of the guildMemberAdd event just to see if it even fires
debugger 👏 breakpoints 👏
glitch had breakpoints
Ah ok
just as not as powerful
Btw, glitch doesn’t want you to host discord bots on their site
iirc
Can get you API banned
API Banned from Discord or Glitch?
From discord
yep.. they have banned uptime robot usage or any external pinging services too
no im just saying that in glitch.com you cannot host a bot using uptime robot (a pinging service)
lol i just wanted to add on because i have researched on it before 🙂
Oh, I have glitch premium-
coool cool then ig you have the "always-on" feature, if im not wrong
Yep
nice
So not against ToS nor is it going "off/on/off/on"
Have you tried logging to see if the event fires?
(I would suggest the debugger, but that’s a lesson for a different time)
Okay.
If the event triggers and doesn’t dm the member, then something is wrong with your code logic, but if it doesn’t fire then it’s a different issue
Didn't fire @wheat mesa
Show your intents again
const Discord = require("discord.js");
const client = new Discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES", "DIRECT_MESSAGES", "GUILD_MEMBERS"], partials: ["CHANNEL"] });
const http = require("http");
const express = require("express");
const app = express();
const fs = require("graceful-fs");
const config = require("./config.json");
/*
app.get("/", (request, response) => {
console.log(Date.now() + " Ping Received");
response.sendStatus(200);
});
*/
var server = require("http").createServer(app);
const listener = server.listen(process.env.PORT, function() {
console.log("Your app is listening on port " + listener.address().port);
});
client.on("ready", async () => {
client.user.setActivity(`Alena Staff`, {
type: "WATCHING"
});
console.log(`logged in as ${client.user.tag}`);
});
client.commands = new Discord.Collection();
const commandFiles = fs
.readdirSync("./commands")
.filter(file => file.endsWith(".js"));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
client.commands.set(command.name, command);
}
const cooldowns = new Discord.Collection();
client.on("messageCreate", message => {
let prefix = config.prefix;
if (message.content.indexOf(prefix) !== 0) return;
const args = message.content.slice(prefix.length).split(/ +/);
const commandName = args.shift().toLowerCase();
const command =
client.commands.get(commandName) ||
client.commands.find(
cmd => cmd.aliases && cmd.aliases.includes(commandName)
);
if (!command) return;
if (command.guildOnly && message.channel.type !== "text") {
return message.reply("I can't execute that command inside DMs!");
}
if (command.admin && !config.administrators.includes(message.author.id)) {
return message.reply("You must be an administrator to run this command!");
}
if (command.args && !args.length) {
let reply = `You didn't provide any arguments, ${message.author}!`;
if (command.usage) {
reply += `\nThe proper usage would be: \`${prefix}${command.name} ${command.usage}\``;
}
return message.channel.send(reply);
}
if (!cooldowns.has(command.name)) {
cooldowns.set(command.name, new Discord.Collection());
}
const now = Date.now();
const timestamps = cooldowns.get(command.name);
const cooldownAmount = (command.cooldown || 3) * 1000;
if (timestamps.has(message.author.id)) {
const expirationTime = timestamps.get(message.author.id) + cooldownAmount;
if (now < expirationTime) {
const timeLeft = (expirationTime - now) / 1000;
return message.reply(
`please wait ${timeLeft.toFixed(
1
)} more second(s) before reusing the \`${command.name}\` command.`
);
}
}
timestamps.set(message.author.id, now);
setTimeout(() => timestamps.delete(message.author.id), cooldownAmount);
try {
command.execute(message, args, client);
} catch (error) {
console.error(error);
message.reply("there was an error trying to execute that command!");
}
});
client.on('guildMemberAdd', member => {
const targetServerList = ['878722964428816474']
if (targetServerList.includes(member.guild.id))
return
member.send(`Are you getting this?`)
console.log(`I'm receiving you houston.`)
});```
Literally the full thing, there ya are.
I’m gonna assume there’s something wrong with your intents
Such as?
I’m not sure, I haven’t tested intents all that much in djs
Try just using all intents
I believe you should just be able to do “ALL”
Nope
Nah you just dum
Any ideas?
I wasn't reading this convo before Waffle's message about djs
Have you logged a member/user under the specified ID?
His guildMemberAdd event isn’t firing entirely
It's not firing at all 🤣
Ah right
Is the members intent enabled on dev portal?
I would assume it is
Because it wouldn't run otherwise
Dumbass me
🤣
Ill try enabling pnpm
Try only setting the members intent
Not restricted to a server?
is anyone familiar with argparse python?
Wdym restricted to a server
Didn’t v12 have a bug where guildMemberAdd didn’t work?
I'm trying to create a simple command line script
Why use V12?
python search.py --twitter "Hello"```
He’s not using it, I was just saying
parser = argparse.ArgumentParser()
twitter = parser.add_argument_group(title="Twitter", description="Search for twitter tweets retweet")
# twitter.add_argument("-t", "--twitter")
twitter.add_argument("-q", "--query", type=str, help="Query for to search for", required=False)
twitter.add_argument("-c", "--count", type=int, help="The number of tweets to look for", default=100,
required=False)
discord = parser.add_argument_group(title="Discord",
description="Searches for messages in a channel for a Discord username")
discord.add_argument("-d", "--discord", type=str, help="Search for Discord member messages in particular channel",
required=False)
discord.add_argument("-u", "--username", type=str, help="Discord username whose messages to be searched",
required=False)
discord.add_argument("-ch", "--channel", type=int, help="The number of tweets to look for",
required=False)
cli_args = parser.parse_args()```
What is the correct way to do it?
my code is above^
It's either -t or --twitter, -twitter isn't valid
typo there
You've tried so hard
You mean the code or
And got so far...
so my permissions checking suddenly broke and i had been debugging for 4 hours just to realize that the permissions int overflows on gateway v9
and that now i have to use ulongs
What problem do you have with it
so that's fun
Aren't permission ints in strings now?
yup
ulongs are native to c# though so the string is converted to a number again
and i overlooked that change
left the type as int32
when i should've updated it to u_int64
Did they not include that change in the changelog
they probably did i'm just blind as shit
React 18 question:
I want to lazily render a component that fetches data from the server and display a fallback component while it's loading.
What's the best way of doing it?
I'm thinking of this:
A useEffect callback that fetches data and re renders the component when mounted. Then I can display a fallback from the component's render function itself.
how do i make my leave a server? (js)
I might not fully understand but
I'd simply put a variable as <Loader />, render it and let fetch() get the data from server
When fetch will resolve the promise (.then) I'll render the new data
<guild>.leave()
that's basically what i said but with more steps

use suspense
it's been fairly stable for me

