#development
1 messages · Page 1928 of 1
how
how do i loop ik i'm stoopid
oh
k
i'll try
with the verification done, i can be more free at coding
i need a music player package that doesnt use youtube links
i used to use discord music player, does that still work?
like doesnt have yt support
client.guilds.cache.forEach
```?
or is there a package that can disable that?
basically i need a new music package
ik
im trying to avoid youtube support in my code
Depends what sources you want to support. You can use SoundCloud as a default source instead of yt since most bots default to yt
All bots route Spotify through yt btw
or whatever their default source is
but like is there a package i can use? something similar to discord music player?
ok
I've never heard of that package. I would just use soundcloud-scrapper if soundcloud is something you're interested in
no its fine, ill just use discord music player
oh yeah i forgot that was a thing
I also made a lightweight LavaLink rewrite in node, but eh.
you cant
you can only play one song at a time and good luck figuring out the ws of spotify
the other bots who plays spotify songs are only getting song metadata and searching it on yt and playing it from yt
just looking at spotifys ws connection makes me question tf is this
its so confusing
i prob can clone spotify but i have to figure out its ws most importantly
the api is fine, the ws is the most confusing
(node:498) UnhandledPromiseRejectionWarning: TypeError: guild.members.cache.fetch is not a function
remove the cache
without cache gives errors too
and these are blasting the console with 98 rejected ids so i can't get the errors from before
i'll remove the cache and send that error
whats guild?
ik i'm noob, don't judge me```js
client.guilds.cache.forEach(async (guild) => {
const member = await guild.members.fetch(message.member);
console.log(member)
})
ok
it blasted the console but first it appeared my data
like fetched
(node:639) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Member
dont do this
then
you have one member and looking up that member in each guild
i exist
oh
well they probably dont exist in each guild
then what can i do?
const guildsWithMemberInIt = client.guilds.cache.reduce(async (acc, guild) => {
try {
await guild.members.fetch(message.member);
return acc.concat(guild);
}catch(ex) {
}
});
that might work
const guildsWithMemberInIt = []
client.guilds.cache.forEach(async (acc, guild) => {
try {
await guild.members.fetch(message.member);
guildsWithMemberInIt.push(guild);
}catch(ex) {
}
});```
Need to use a for loop
[]
when i console the array it doesn't give anything, should I console it inside the try? I consoled it outside of try
Oh wait, do i need any intent to do this?
?
pushing things into an array in any kind of loop is a smell
including forEach
pls help
with
check if the user is in any server
how
what language
js
ah i'll wait for someone good with js to help
they didn't like reduce
forEach is a code smell too
map or reduce can always replace it
Dude what the fuck are you on about
there are so many array functions
i never use most of those
if you had to only have one array function it would be reduce
some of them are quite useless
reduce right feels like it could be fit into reducewith an extra param stating the direction
i bet they fought about that at the spec meetings
i wonder if reduceRight is more efficient than reversing the array and then reducing
it wont modify the original array with the reverse() which is better
idk
most of those methods exist for convenience, not performance
for example a loop with push and a reverse at the end is way faster than a loop with unshift
concat is much slower than making a new array and spreading the old one into it
Imagine thinking these are many functions, you should take a look into PHP
yes php is even worse
There’s like function for any need
tell php to decide if they want the array as a first or second parameter
and stop mixing it up
Omg that discussion again
Even if that’s a thing, yeah it’s usability and the inbuilt possibilities are far ahead of Js
the most important thing is that the program makes sense
at least for applications
systems programming is different
I also think parameters can be passed as options with PHP 8, no more sort order then
But I’m not sure if that counts for all functions
Mail me your address, gonna send you over some php enthusiasts bringing you back on the right way, Tim

sjsjs
ccpp > ccpp c plus plus
im not hating
im making fun of it
its different
:^)
imagine if they made it php to avoid being confused with harry potter
hp
Horse power, Sir!
it was more likely because of hewlett packard
or whatever the name is
the hp that makes laptops
honestly the name is ingenious
My gosh
Comparing it to HP is like comparing something to shit
And I mean shit, yes shit shit, the shit leaving your butt
There isn’t anything worse than HP not even Java

It’s a little off our discussion but it was important to say that
lmao
database download worked out successfully btw
Quick restart and some fine tuning and I’m still getting a nice response time
just the network performance wasn’t great at all but yeah at least I had a consistent connection
ayy
I NEED Role Mangament bot command ideas
pls help
Mangament
anyone?
Fetching all members in all guilds? Why?
Also requires the right intent
As well as privileged intent
not all members
but... why are you fetching like that...
getting one member, when it leaves a server the bot will check if the user is available in other servers
idk
might want to use oauth instead
its easy to get rate limited, isnt it?
yes, if you dont respect ratelimits
oauth?
fetching every guild's member in the same time
ok
you can get all of a users guilds in one request
too much work especially since the user has to authenticate + trust they won't revoke the token
oh and you constantly have to refresh the token
but yeah there isn't a good way of doing this
just depends on what you really need I guess.
the best way for it is, get the guild member intent and let guild members be cached, and get user via cache instead of fetching
huge increase in ram usage though
What’s the purpose of checking if the user is a member in another guild?
Sounds for me like tracking.
if you really insist you could... store ids in a database
could go out of sync quickly though
^ was about to suggest that
without message intent, probably not worth doing, as you cannot update as often too.
unless it doesnt need to be 100% accurate
oh wait if the user ain't in any bot's servers, the bot can't track the user
right?
you can only request basic data about them
so it's possible to fetch them?
Only to get very basic informations
if you have the ID such as username, tag, creation date etc
But since you used the word track, any more discussion is useless
Tracking is a no go
from the cache?
yes
only if the user is cached
he wanted to get user's mutual server
theres no efficient way to do that
what are you storing?
Could I get advice on this https://github.com/link-discord/inspector/blob/main/src/commands/blacklist.ts
I kinda think I could code this better but idk how
im just like super unsatisfied with the result
lol
what do you use those user ids for?
to get the user's bot information like the profile, cards, etc..
why do you need to store the ids for that?
no, i store the coins and that in the db with user ids
i mean what do you do with those ids?
then thats not only ids l
you said only ids...
i don't store anything more from discord
are those coins global or per guild?
global
and discord asked you to do that? where did they said that? email?
?
was this told specifically to you?
you got an email saying that?
i got in the email the same thing that is in my ticket
but they said i can inform them if any inconvenience so i let them know that i can't implement it?
well the only thing i can think of is that you did not explain what your bot does and how it works very well in your verification form
because thats not a thing they care about
my bot literally stores shit for 1 year, and i wrote that in my verification, and it was verified
If you wanna delete any user related data then add a last_seen timestamp, create a routine and remove all users which weren’t seen for 31 days
so i explain it to them?
If that’s a concern for you
you made them think your bot is storing much more user information than it actually is
oh
lol
or you can lie you implemented it 
nah
anyhow, the only way to do what they said is to store guild ids and user ids together
so that when a user leaves, you check if that user has other guild ids
i'll let them know if they misunderstood and if no ._. i'll come back here
.addStringOption((option) => option.setName('channelid')
.setDescription('Insert the id of the channel where your message is located at!')
.setRequired(true)
.addStringOption((option) => option.setName('messageid')
.setDescription('Insert the id of the message that you want to post!')
.setRequired(true))
post.js:12
.addStringOption((option) => option.setName('messageid')
^
Someone help me out with this shit
Yeah same here, tracking usage statistics until I delete them containing user IDs
Not any issue regarding the verification since I explained how and why
yeah
i told them i delete info if a user hasnt interacted with the bot for over 1 year
although i didnt actually do that yet, gonna do it now in january for the first time
Which is what I suggested him a few seconds ago
because i didnt have any kind of tracking setuo before
Tbh just logging member/ in the reason is plenty.
Makes sense if your bot is in many guilds and you need to reduce the database size
Tf
i only added createdAt and lastSeenAt timestaps after like 2 years of running
welp, pretty sure it has to do with the way i wrote it. anyone has a clue
What to do when my bot is getting unknown interaction errors, even when the first thing on client.on("interactionCreate") is await interaction.deferReply()?
you didnt post the error?
It happens like every other time my bot receives a command...
Huge network latency?
It was just so you know whats the case here
I have tried it on vps and at home, same issues
it's there
post.js:12
.addStringOption((option) => option.setName('messageid')
^
Is your code unresponsive then?
wooops
my bad lmao
TypeError: option.setName(...).setDescription(...).setRequired(...).addStringOption is not a function
you are trying to do option.addStringOption()
which doesnt exist
The commands work sometimes, and sometimes they dont. Even when making the same command multiple times in a row, its really weird. I timed everything I do after the deferReply and looking at the results, I can say that the problem is not my code or a database connection or anything like that...
show full code
where is the error actually coming from?
from the defer itself, or from the response after defering?
Defer itself.
then you are receiving interactions too late
log their timestamps
So back to network latency
Yea it seems that the network is the only thing here
I mean it could theoretically also be an issue caused by Discord
Yea, but everyone else's bot is working...
it could also be websocket congestion
Is there a way to be sure?
what other events do you listen to?
I listen to interactionCreate, guildCreate, guildDelete, and ready
are your intents also setup to only receive those events?
My intents are only "GUILDS"
how long do your interaction responses take on average?
why a folder called gitignore?
What do you mean by that? Are you basically speaking of the code after the deferReply?
gitignore is a file
not a filder
its a text file with the names that you dont want on the repo
https://github.com/link-discord/inspector/blob/main/src/commands/blacklist.ts#L91
Everytime for whatever reason when I run the regex, both the links and domains are null
const domains = this.domainRegex.exec(domain)
const links = this.linkRegex.exec(link)
console.log({ domains, links })
yes
I tested the regex before and it worked but idk why its not working in my code
Its just the names like node_modules
Under one second
Slash command I did: /blacklist add domain: google.com
My output:
yep
can you test if your code is blocking the process? ie if you run 3 commands at once, do they all respond simultaneously, or does the next one have to wait for the previous? try asking 2 other people to run the command at the same time
interaction.client.guild.iconURL()
is this correct?
im not sure if this is a good place to put this but
I am trying to get when a interaction was created using interaction.createdTimestamp
while it shows some base of consistency of some kind im not getting the proper data from the unix timecode.
I simply want the minutes from when it was created so my listener doesnt listen to buttons from x amount of time ago
this is my code
Please note the weird numbers are from when i tried to grab it from getHours() though they are completely wrong/incorrect
I'll try it out!
Everytime I do the regex test function it works but when I do the regex exec function it doesn't
Client doesn't have the guild property
The client has no guild property
Yeah nvm
f how do i access guild with interaction
i tried
also read the docs
It responded simultaneously to everyone.
ok so the only option left would be network issues
everything else looks fine
could be either your vps or discord
try logging the raw events and their timestamps
to see if you can find any pattern
I'll try it out. What would I be looking for?
i try to
first of all console.log interaction.createdTimestamp
to see which format it uses
could be a string instead of a number or a number in seconds instead of millis
it seems like it is in MS
i misread the graph they shown
alright, so then just compare it to Date.now()
How can I get my hands on the timestamp on a raw event?
age = Date.now() - timestamp
was just about to write that xD
client.on("raw", event => {
if(event.t === "INTERACTION_CREATE") { console.log(event.d) }
})```
Oh, so it is only on interactioncreate event, sry
i did that and its still weird
not sure what Date.now() returns but
doesnt look right
you can also log guild events for good measure
maybe a large guild blocks the websocket for a while
the interaction is from 3-4 hours ago
you can also log your own Date.now()
ow?
I am actually getting guildDelete events from unavailable guilds, but checking for guild.available in guildDelete and guildCreate.
that was for thedev
ye thats normal
are you logging interaction create for buttons?
huh?
i am logging when someone presses a button using the interactionCreate event
every time a button is clicked, it creates a new interaction
☠️
so tje createdTimestamp is always fresh
is there a away to get around this?
you have to check the timestamp of the message the buttons are attached to
createdAt?
thats why copilot was trelling me to use createdAT
Okay, i just thought to mention that because it takes like 15 seconds longer for the bot to have the ready event because its garbage collecting or something like that
it still returns less then 500
welp i g2g
@boreal iron Do you have any ideas?
Unfortunately I’m driving, can’t really go deep into code suggestions
Okay, if you come up with some ideas and you have time and are not driving, let me know
If that happens like a lot of times create a new test app in the dev portal, create some slash commands, invite it into your guild and see if the issue persists
No distracted driving
Close discord right now
I'll do that rn
I agree
Shh
If the issue persists it’s probably a network issue on your side
I’m good at writing, drinking, calling, eating at the same time, oh yeah and driving
Not good enough to answer this question unfortunately
await i.update({ content: `${cool.content}`, components: [] });
so this is how i update a message content inside a interaction, how do i delete this message and not update it. i.delete doesn't exist
btw
collector.on('collect', async i => {
that's how i is defined
that's what i am trying to do
Is that from a button?
mhm
Woah interactions and collectors 
Isn't there button.message?
fuckin hate it
ima check real quick
Well slash commands aren’t that bad
Or interactions in general
ik i am just being lazy
timestamp of the message right? like interaction.message.createdAt
It's not network issues 😩
Shhh being lazy for this particular project
And i work at this one kinda late so my brain is kinda fucked by then
it waits for the missing guilds to arrive, and gives up after 15 seconds
not really related to garbage collection
yea but i just thought because of this
but then of course, under it is this
thats just discord.js bullshit finalizers
yea so how do we fix my prob :D
I made a test app and a few commands, i am getting the events instantly on there
its has to be either the code or something weird
try running the same code on the test app
another test you can try, create a separate client for interactions, without the guilds intent
I cant see what would we accomplish with this
So without any intents?
it will prove if the issue is with your code or not
With exactly your code as I suggested
In a different app without all guilds
Just your Test guild
yes
that would test if the guild events are interfering with interaction events
Yee step by step
do interaction events have an intent? or do they bypass intents?
No intent afaik
I dont think they have intent
so ye no intents
ill test the code on the test bot token first
👍
But they been requiring the authorization using the scope
An intent doesn’t make sense as you have to receive the event
Since without a bot scope there’s no gateway connection
you can have interactions via webhook, so you dont really need the bot scope
(not sure the js way of doing this so referring to python) how do i do something like for entry in entries
lol yeah that’s what I explained 
regarding this, the code is working absolutely blazingly fast on the test bot
i'm getting from my database a list of entries
Do you actually fetch a database, file or anything similar when receiving an interaction event?
another way i know in python i know i could do
for i in range(0, len(entries)):
title=entries[i].title
pfp = entries[i].pfp``` etc etc
if entries is an array, use of
Yes, but I have timed it and I tested the deferring before fetcing
im trying to make my ejs render a card for each entry
for in is for keys
for of is for values (but only works on arrays)
I am now very curious on what happens with no intents
Well you registered for no events means you basically receive no event other than ready
You are correct
So wtf do we do about this? The code works on a bot with 1 guild but not on the main bot
I tested the exact code on the test bot
With same intents ?
I just tested with no intents on the main bot and received no interactionCreates
yes
Test bot had the same code and "GUILDS" intent, just like the main bot.
Test bot works really fast, main doesnt
so you dont get interactions without guilds?
Test bot used the same db too...
That seems to be the case.
And i used global commands, not guild commands
I'll test again on the test bot this time.
Test bot is getting interactions
with no intents
Did you invite it with the right scope?
yea, bot and application.commands
Well then everything is ok
Yea but why didnt the main bot get interactions with no intents ::DDD
did you log the raw events?
are you getting spammed with anything?
besides the initial guild creates
Log your ready event please
And a timestamp from starting the processs to receiving the ready event
Only these
Yes i logged them, what about them?
Yeah just log the time in ms in your ready event and in the beginning of your process
I mean app
Useless auto correct
In your Main bot
You said you didn’t receive any interaction event without intents
I somehow believe your bot wasn’t even ready when you tried that
Makes sense for you to believe that
Means it couldn’t receive events
But once it is they will be delivered immediately
All missed
Okay so testing: no intents, timestamps and when i get the second timestamp, i will try to make a command
main bot with guilds
Just share the timestamps
With intents: start: 1637800974, ready: 1637800994
start is logged under the client.login and ready is logged the very first thing in client.on ready
Doesn’t the ready event always sends the guilds with it?
I didnt have the "guilds" intent so no guilds for me
you mean the actual websocket ready?
Yeah
it gives an array of guild ids basically
Do you have anymore ideas?
Ok so unresponsive or unavailable guilds aren’t the issue then regarding that timings
did you test if the issue persists on yout main bot without the intent?
Without the intents on the main bot, the commands are not working
Huh
I might've misunderstood, I'll test the raw events now.
Okay so no intents, main bot, raw events are working. But the client.on("interactionCreate") isnt working.
then its discord.js being stupid
Main bot right scope as well?
just fire it yourself
Yep, i invited it again just to be completely sure
?
ill emit interactionCreate on raw interactioncreate?
i dont remember by head, but check the djs source code and make the raw event go through their constructors then emit it yourself
it has to be converted to discord.js interaction object
anyway im going to be now
good luck!
:D thanks
Yeah for real… specifying no intent results in interaction events being dropped, too
I mean wtf
Oh wow down to Edge, great
That is really weird
Indeed
Are you looking into this anymore?
Hmm not much more to suggest
if thats the output, then why is ejs rendering an extra field
Something time consuming if I had to would end up specifying a webhook URL for receiving the interactions and to check if you send a commands you immediately receive that webhook or if there’s a delay too
context - i'm attempting to recreate the top.gg homepage with tailwind 
But that’s probably the last thing to do
Yea i thought of that today too...
may i ask, in v-shaped model, can we add new requirements after software development phases was completed? like update the software?
message.reply(lvlUpdate).then(msg => msg.delete({timeout: 4500})).catch(err => {})
you can do like i sent
it catches with no response
It’s probably worth the try to ask about your issue in the discordjs server, explaining your issue and what you tried detailed in one message to see if somebody can help
lol
Wasn’t for u
True, I'll write that message tomorrow... But thank you so much for this debugging! Thanks to @quartz kindle too.
For our good night sleep, it seems that the raw event might fire a bit earlier than the client.on interactionCreate, so it might be the way to go
:D
If Erwin would be here he would tell you to switch to detritus and all issues would magically disappear

:D Whats detritus :D
A ts lib
And is that any good
For people wanna use ms ts shit show
I like ts
Personal preferences
True
Tbh
alr so my forEach loop is adding one extra loop
Oh no did I advertise it after blaming anyone who did after all that time?
Shame on me

:D I had to look it up
No no no!!!1!
Yeah understandable
Before that event, I'll have a full discord api wrapper with axios :D
Still think it’s code or network related
Can’t imagine why there’s always a delay just for you
Same feelings
I mean it happens quite some time and I also have that issue sometimes
But not that frequently
Yea for me its like the commands rarely work...
But the webhook endpoint thing is interesting, i might test it tomorrow
It'll for sure give some interesting results
If you haven’t found any other solution it’s worth a try before contacting the discord support
But they will probably say it’s an issue related to your code or lib instead of troubleshooting it
I assume
Yeah probably
And at the end the issue is in their code
But doesnt the test bot working prefectly with the code prove that the code has nothing wrong with it?
Ahhhhh, it would be so easy with the old type prefix commands, nothing would be wrong
Does the issue only happen for global commands?
What are you thinking?
Actually nothing tbh I’m out of ideas tho, not sitting in front of the code staring on it makes it hard
The event is the same so it’s actually nonsense
Can i send a dm
:D just thought that you could look at it when you are home
Gonna take a shower and sleep after tbh
Look at it when you have time and motivation to do so
Sure why not
yes
detritus is amazing
I can confirm with firsthand experience
Oh no what did I do
I’m not entirely sure what your problems are, but it might..?
I read a little bit back but not far enough to get to the gist of what your issue is
How can I fix this error for my Discord bot?
internal/fs/utils.js:332
throw err;
^
Error: ENOTDIR: not a directory, scandir './commands/.DS_Store/'
at readdirSync (fs.js:1047:3)
at /Users/User319183/Desktop/profanityblocker.js/handlers/command.js:5:26
at Array.forEach (<anonymous>)
at module.exports (/Users/User319183/Desktop/profanityblocker.js/handlers/command.js:4:32)
at /Users/User319183/Desktop/profanityblocker.js/index.js:15:37
at Array.forEach (<anonymous>)
at Object.<anonymous> (/Users/User319183/Desktop/profanityblocker.js/index.js:14:13)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32) {
errno: -20,
syscall: 'scandir',
code: 'ENOTDIR',
path: './commands/.DS_Store/'
}
user@user-IMac profanityblocker.js %```
you're running your bot from the wrong directory probably
(assuming you use relative pathing)
Nah ds_store files are exclusive Mac OS files
You’re trying to scan a directory which actually is a file
You have to exclude, filter or ignore these files when scanning for directories
Or remove them as they’re useless on any non Mac OS anyways
If you’re on Mac don’t thread them as folders, they aren’t
Generally they are hidden files in Mac like any files starting with a dot in their name
hmm
the opposite of sqrt is pow
It basically is just straight up
o dang
Now I feel dumb
people will level like crazy though
cause idk whats going on
you need exponential gain
Oh
only after like
level 50
lmfao
2500~ xp for level 10
eh
seems good
anyway
lets flip this bitch
Does the amount of xp earned go up every level or is the amount of xp just go up and you can take ages to reach the next level if you get high enough
If u use dynamically calculated levels u can even alter the used equation
yea
which is nice
easy way to alter everyones level without having to change anything in the db

Just calculate the level on the fly
people find ways
If u use fibonacci as growth equation, after level 20 everything becomes impossible
so
mmm yes good idea
Scary
Get spooked
Math.pow(xp * (Math.sqrt(5 ** 5) - 1))
don't blame em
Err, why sqrt of 5^5?
** is pow
so yea
So sqrt is the inverse
@lyric mountain it would be this then?
Y = sqrt(x / (5^2 + 1)
Y^2 = x / (5^2 + 1)
Y^2 * (5^2 + 1) = x
So exp = level ** 2 * (5 ** 2 + 1) ig
bingo
U could also use the actual number instead of that parens since it's a hardcoded value
26
exp = level ** 2 * 26
Take a break, yeah
Hello i full the applictaion of the bot When will you take the roll here and download the bot at top.gg
@here
What
basically on the main bot which has the guilds, interactions come so late to the bot that I don't have any time left to answer them, so i get unknown interaction. Then when I run the same code on a bot with 1 guild, it works flawlessly.
some topgg bot reviewer will take a look on ur bot and itll take abt a week or so also #support next time
can some one help me with this
regex
Anybody know how to separate words with each " " for example , I typed "title" "bla bla bla" "blo blo blo" , it will result as
Option 1 is : title
option 2 is : bla bla bla
option 3 is : blo blo blo
I was thinking of using the split() method , but I don't know exactly what to split
just .split(" ") would work
I used that
console.log('"hello world" "hello magic" "hello args"'.split(" "))
``` , it resulted in ```[ '"hello', 'world"', '"hello', 'magic"', '"hello', 'args"' ]```
The result I am looking for is like
```[ '"hello world"', '"hello magic"', '"hello args"' ]```
then you're looking more for regex matching
like "".match(/"[aA-zZ ]+"/gm)
that should return an array of all matches
Ok ima try that
Thanks it works! I really been thinking about it for a while now. Thanks again!
No problem
uh I have regex problem
Discord
Dev
regex /\n/gm
code text.replace(regex," ")
problem nothing happens
Ik i save it into a new var
remove the m flag
let me describe my whole problem,since it it little bit complicated
I want to convert html to plain text without any libary
Text
<span style="..."> text
Test
</span>
Goal is to remove the line break and only output the text
remove the m flag
it detects it but doesn't want to replace it with "" other work
show code
if the file is using windows style line breaks, you have to replace \r\n
I formatted the html using vscode,it could be ,let me try
perfect ,it works now,regexr.com doesn't show \r\n in text sadly
👍
thx tim you saved hours 
tim always does that
time is a myth, tim is a god
lol

haha thats true
hello, i was wondering how to make a say command that can say more than one word, because i have a say command but it just says one word
its just experience, im the dude who already wasted all those hours for you

listen to the old men kids
yes, listen to this old man ^
You’re older, Sir, don’t blame me!
Oops didn't mean it here
you
Wtf no
That proves you’re older… almost forgot anything 5 min after a conversation

Aye I’m at ~10 min, still got some time until I’m down to 5
nice
yes
too many bots
What Tim and I wanted to say would be, was there ever a time it wasn’t broken?
One message removed from a suspended account.
One message removed from a suspended account.
Luca has already broken
yeah no starboard or -bots command now
It had been answering twice
thats what is unique about it
Maybe they fixing it
more like 3-4 times lmao
tf is that?
Probably self promote
Hmm mb sorry
Tf 💀
Tag style stuff users can use in the commands: $text will take any args after the trigger and send them
I thought you were talking about your new bot feature lol
Not a discord thing just something I added
@quartz kindle @boreal iron Today the bot has been working perfectly fine, even when I did no changes
Could be a slow connection or something, honestly I’ve never heard of that issue
I have lived it many times lol
I got a issue, think about it, try to solve, fail, reset all changes, works fine
I had high ping on a bugged shard once - not sure what caused it - but restarting fixed it
lol probably not a code issue then
idk anymore :D
I didn't know you can do that
Anyways if it works, it works that’s all what matters
Well mobile network being down every few meters…
So no chat for me today
anyone could know whats up? suddenly on my pc monitor faded lines of white objects appear on the screen on the right side of the object
kind of as if the object was moving fast
its not some weird effect on the os since screenshotting and checking on my phone revels no weird shadow lines
doesnt seem like a burn in since the lines immediately follow the bright object with them
Hello I want to make a sweater with a bar system, but I have a problem
function Pourc(max, current, current2) {
good = ``
pk = ``
no = ``
let blue = Math.round(current * 10 / max)
let white = Math.round(current2 * 10 / max)
let red = 10 - blue - white
return good.repeat(blue) + pk.repeat(white) + no.repeat(red)
}```
On image 2 blue, 2 white and 0 red normally but there is red
if anyone else has this issue in the future make sure your VGA cable is tightly connected and try moving it around a bit
npm ERR! gyp info find Python using Python version 3.8.10 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/root/Byetrain1/level/node_modules/integer/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/root/.cache/node-gyp/16.13.0/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/16.13.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/16.13.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/root/Byetrain1/level/node_modules/integer',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: not found: make
why are my modules not installing onto my vps?
You need to install build tools
if youre on ubuntu/debian, just run
apt install build-essential
I have an issue with my bot. I have a dev server for it, and I want a role to be added to any guild owner that is using the bot.
Here's what I have so far(I put it in a task to try and fix it; did not work)
@bot.event
async def on_ready():
#Starts tasks
print("Starting tasks. . .")
unpunish.start()
#check_alpha_testers.start()
#Declares important variables and makes the global
print("Declaring variables. . .")
global home_guild
global alpha_tester_role
home_guild = bot.get_guild(898590388053483550)
alpha_tester_role = get(home_guild.roles, id=alpha_tester_role_id)
print("DokBot is now operational.")
@tasks.loop(seconds=60)
async def check_alpha_testers():
for guild in bot.guilds:
guild_owner = guild.owner
if str(guild_owner.id) in str(home_guild.members):
await guild_owner.add_roles(get(home_guild.roles, id=alpha_tester_role.id))
(check_alpha_testers is commented out because that was the task that wasn't working) Whenever the bot get's to the code, it gives this:
Starting tasks. . .
Declaring variables. . .
DokBot is now operational.
Unhandled exception in internal background task 'check_alpha_testers'.
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/tasks/__init__.py", line 101, in _loop
await self.coro(*args, **kwargs)
File "main.py", line 1051, in check_alpha_testers
await guild_owner.add_roles(get(home_guild.roles, id=alpha_tester_role.id))
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/member.py", line 777, in add_roles
await req(guild_id, user_id, role.id, reason=reason)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/http.py", line 250, in request
raise NotFound(r, data)
I know that the bot is probably targeting the wrong guild to add the roles. How do I solve this?
sure, shoot your flare
use probably levelled up on third message
then it went above alas the negative number
also u don't need that much parens btw
replace (5 ** 2 + 1) with 26
gotta reduce calculations whenever possible
when first - xp becomes less or equal than zero increase the level
ye, it's doing that actually
do this
console.log('${nextLevel} - ${first - xp}')
use ` instead of '
show the output
bruh
^
it's a template string
not a subtraction
it is supposed to write like 1 - 19, 1 - 3, 2 - 7, etc
add + 1 to (nextlevel) at first
then print it again
here
yes, keep sending messages
see if it reaches 2
what would be the most logical way to schedule daily emails with Python
crontab
alr
so we have a little equation issue
change log to this:
console.log('Lvl ${currentLevel} (${xp} XP) | Need ${first} XP to next level')
we'll find out in a sec
ye
just renamed it to make more sense
round shouldn't cause such issues tho, since it'll at most round +/- 1
thing is, "first" is not showing the proper value
u said 1 -> 2 should be 26 right?
ok, it's not an equation issue
lvl 2 should be 104
ok, I think I found the issue @earnest phoenix
you were right abt the Math.round
when it reaches ~7 xp it jumps to the next
104
let test = Math.floor(Math.sqrt(xp / 26));
if (message.author.id === "431487139298017282") {
let required = (current + 1) ** 2 * 26
console.log(`Lvl ${test} (${xp} XP) | Need ${required} XP to next level`)
}
probably
yes
isn't 2 -> 3 working too?
left side is current xp
right side is xp to next
just do toNext - xp
I forgor to add subtraction
let test = Math.floor(Math.sqrt(xp / 26));
if (message.author.id === "431487139298017282") {
let required = ((current + 1) ** 2 * 26) - xp
console.log(`Lvl ${test} (${xp} XP) | Need ${required} XP to next level`)
}
as it seems it's getting rounded somewhere
floor it
ah ic
for required? nope
it should floor only at level
This is more of a JS problem, but when storing a string in a SQL database, when attempting to get the data the date is converted to a double.
let day = new Date().getDate();
let year = new Date().getFullYear();
let month = new Date().getMonth();
let time = month.toString() + "/" + day.toString() + "/" + year.toString();
console.log("time: " + time); // outputs 10/25/2021
con.query(`SELECT * FROM playtime WHERE id='` + args[2] + `'`, (err, rows) => {
if (err) throw err;
if (rows.length < 1) {
message.reply("There isn't any data for that user!");
} else {
for (var i = 0; i < rows.length; i++) {
console.log(rows[i].time); // outputs 0.000197921820880752
}
}
})
replace var with let on loop
aight
Yeah careful with SQL
just don't subtract xp
cause of sql injection?
yes
aight. yea that function is more of a test. i have some sql methods that use prepared statements
let test = Math.floor(Math.sqrt(xp / 26));
if (message.author.id === "431487139298017282") {
let required = ((test + 1) ** 2 * 26)
let remaining = required - xp
console.log(`Lvl ${test} (${xp} XP) | ${remaining}/${required} XP to next level`)
}
nhe again 
sorry, I'm doing driver update while we talk
so I'm mixing stuff
actually, it gotta be:
Math is fun though
let test = Math.floor(Math.sqrt(xp / 26));
if (message.author.id === "431487139298017282") {
let required = ((test + 1) ** 2 * 26)
console.log(`Lvl ${test} | ${xp}/${required} XP to next level`)
}
for that
Modeling equations for xp curves can be pretty fun if you know what you want
yes, if u REALLY want to zero the xp relative to current level u gotta offset it
like this:
let test = Math.floor(Math.sqrt(xp / 26));
let offset = (test ** 2 * 26)
let required = ((test + 1) ** 2 * 26)
if (message.author.id === "431487139298017282") {
console.log(`Lvl ${test} | ${xp - offset}/${required - offset} XP to next level`)
}
this will offset both values to zero on current level xp
ye, this one I'm sure
nice
cuz offsets
234 - 104 = 130
ye
so u subtractr next max with current max
also nah, I make such mistakes a lot
Math.round is one hell of a trap
it was you who noted it first
nice

needed parens lol
learning about kill signals is cool

I may now use this forbidden knowledge to send a kill signal to everyone I hate >:) /s
hi so i am working with vanilla javascript
document.getElementById('main').appendChild(div1);
document.getElementById([i]).appendChild(div2);
document.getElementById([i]).appendChild(p);
document.getElementById([i]).appendChild(p1);
document.getElementById([i]).appendChild(a);
let bruh = document.getElementsByClassName('bookContainer')
const testElement = document.querySelector('div');
const lineBreak = document.createElement('br');
testElement.appendChild(lineBreak);
console.log(bruh)
i append the div from the javascript, but it's not formated html and it leads into problems
can u guys help out with that
firefox is stoopid still doesnt support manifest v3 for extension uploads
is there a way to create server events in discordjs?
Using the client events?
wdym, i mean the new section “events” in servers
OH, I have never tried that before, no, but I don't think so.
probably in the future
Its a new feature so its probably not implemented on djs
Is it in the Raw API?
expect it to be added by 2023 in d.js lmao
I dont kneo
I’m waiting for interaction forms to become real
its unreleased feature for bots rn
Message component input?
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
there
@hollow depot
guild scheduled events
oh i didnt find this in docs, thank you
no problemo
whats the error bruh
literally read?
token regeneration fixed the error

Say it
My bot is like a scam link detector and stuff
rn im just checking links
should I check domains too?
what I mean is
check google.com too
instead of just https://google.com
i think you should
Yea
aka links that are not clickable
yes
ok thats all I needed thanks lol
<3
Pog


