#development
1 messages · Page 1811 of 1
channel.setName('not_general')
.then(newChannel => console.log(`Channel's new name is ${newChannel.name}`))
.catch(console.error);
``` Why is "catch" not working here?
const guildToJoin = await client.guilds.fetch(guild.id);
guildToJoin.channels.cache.get(0);
will guildToJoin.channels.cache.get(0); always return a channel that i can send an invite to?
You may be looking for collection.first()
But it's not guaranteed that the client can send message to it
if the bot has invite permission will it have permission? i was thinking i might need to watch out for "channel categories" or whatever they are called. can i send an invite to those?
Sending an invite would require the send messages permission, no?
i just need to create the invite to the channel and then DM it to a member
looks good though
send the link after uploading :)
is there a way to do this without cache? i have that disabled for channels
i prob will post it somewhere in #memes-and-media
because it's honestly a really good informative video
PHP is an extremely tricky programming language to learn as I've slowly found out over time and it's worth addressing a lot of its problems
tbh im stuck between nodejs + express and php
i don't know which should i choose for professional backend coding...
Fetch the guild's channels
all of them?
Yeah
it can cause rate limit...
how to grow a discord server ?
so here's my advice
dang
imagination + creativity
Maybe, but it's one request
Don't do NodeJS or Express for backend
I really strongly advise against it because they [JavaScript] never were truly designed for it in the first place
yep
if you want backend, learn Java or PHP
its a growing server with just 20 members
did everything
but still cant grow it
so i don't know why big companies use nodejs for their backend
; )
i've been coding in PHP for over 11 years
i promise you, you're gonna lose your shit
i'm still learning new stuff in it every day
So... ok
i still don't understand a lot about it
XD
but if you want a backend for specifically websites
go with PHP.
otherwise, stick to smth like Java or C# as a general backend route
i mean like discord...
as in bots?
it has a client side and backend
no
huh
Discord uses a bunch of langs for backend
Discord is a stack
JS, Elixir, Rust, Python and C++
i mean like discord, a backend that clients can communicate with it
as in an API?
honestly you can write an API in just about any modern programming language
look into erlang
performance is important here...
so
erlang
also most modern languages are super fast now
there are very few rare exceptions to it
I haven't heard that before.
because the development industry has adopted new standards for high performing languages
also, hardware has just become so advanced that it's not really a concern anymore
CPUs are so advanced at handling huge amounts of processing time that you have ~1MB. file differences of script file sizes deviating by a few nanoseconds
i wrote the same api with python and nodejs
python process a post request in 500ms
but nodejs do it in 30ms
because Python and nodeJS are vastly different
yes they are
i want a good lang for backend
just this :/
because of that i got stuck between php and nodejs
it depends on what you're trying to make a backend for
api
is it for a website API? or a general API
general api
it really does depend
don't use either then
both things you're suggesting are mainly used for web APIs
use C++, C# or Java
or you could try using erlang as suggested
ok thanks for your time ;)
cheers
Elixir is a nice Erlang substitute.
If you really care about performance though, take your pick: https://www.techempower.com/benchmarks/
personally not a huge fan of elixir
but it definitely exists as an option too yeah
that's quite surprising for performance
webman is a thing?
I've heard of workerman before, which is an incredibly fucking good async PHP framework https://github.com/walkor/workerman
it's impressive for what it can do
Yeah PHP is full of surprises lol
How can I make this in CSS? that the Button has something like a 'log' field
huh
animate or transition ?
Ah so you want to put that red button there, something like a notification?
yeah, it will show the current log
should have a field like this
animation ease infinite
As long as the notification button is a parent of the bigger button then the animation doesn't matter. Can you show us the CSS style for the big buttons
.shard-button{
font-family: Tahoma, Verdana, sans-serif;
margin-left: 7px;
margin-right: 7px;
margin-top: 2px;
margin-bottom: 2px;
border-style: solid;
border-width: 4px;
border-radius: 7px;
padding: 2px 2px 2px 2px;
text-align: left;
font-size: 1em;
}
.shard-button.animated{
animation: beat 1.5s ease 0s infinite;
}
.shard-button.animated::before, .shard-button.animated::after {
content: "";
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
background-color: inherit;
opacity: 0.4;
border-radius: inherit;
}
.shard-button.animated::before {
z-index: -2;
animation: beat-before 1.5s ease 100ms infinite;
}
.shard-button.animated::after {
z-index: -1;
animation: beat-after 1.5s ease 200ms infinite;
}
/*Colors & key Frames*/
try float, but you could also make the shard-button a flexbox
My goal is to insert a button in the shard button
ye, just give the inner button float: right
or, put the inner button in a div and give the div float: right
<p class="shard-button animated green"><b>Shard 1 | Online</b></p>
I used the p, using a div than a p causes a bigger Button
I mean, the p only has that look because of all the margin you've added
You should use flexbox to position and size your elements
- {
margin: 0;
paddgin: 0;
box-sizing: border-box;
}
this is needed
for a button
you can do with a tag
and add padding to it
Then overwrite the selector p
p
{
margin: 0;
padding: 0;
}
Or just for this class p.shard-button
looks uggly 
changed to this Style, having Problems when adding Icons, they never show up 
Received
yeah, a lot of typos, I started learning html, css yesterday
Does anyone know why my bot is stuck on this for sometimes like 30 minutes+?
webhook = await channel.createWebhook(name, {
avatar: avatar
});
The colors do not go well together tbh, but the design itself is nice 
maybe it got ratelimited lol
could you log out webhook
@tulip ledge creating webhooks uses http
i wonder why the server didnt time out
true
but like rn I tried it
it worked for a bit
and now it's stuck again
try {
webhook = await channel.createWebhook(name, {
avatar: avatar
});
this.webhooks[channel.id] = webhook;
} catch (e) {
console.log(e)
}
it's also not giving an error
so it's literally stuck there
How do I handle the rate limit when changing the channel name?
you manually set cooldowns on map, and check if a cooldown exists, when on exists reject the request
do client.on('debug', consoel.log)
then we can see if your Bot has any ratelimits
I do not fully understand
429 hit on route /channels/734541084314828840/webhooks
yeah, your Bot is ratelimmited, thats way it cant create any webhook
any idea how I would fix it?
and do you know the numbers?
and is it channel specific or just all around?
if(client.cooldown.has(channel.id)) return;
channel.edit...
client.cooldown.set(channel.id, true)
setTimeout(()=>{
client.cooldown.delete(channel.id)
}, cooldownexpiretime)
channel specified
Thanks
you can read the ratelimit info on client.on('ratelimit')
wait
Is client.cooldown something inside discord.js?
nope
I have this but it didn't return anything when it got ratelimited
const path = require("path");
const Event = require(path.join(process.cwd(), "util", "Event.js"));
const chalk = require("chalk");
module.exports = class ReadyEvent extends Event {
constructor(client) {
super(client, {
name: "rateLimit"
})
}
async run(info) {
console.log(`Rate limit hit ${info.timeDifference ? info.timeDifference : info.timeout ? info.timeout : "Unknown timeout"}`)
}
}
you have to create a map client.cooldown = new Map();
oh so is there a way to view the rate limit of the channel?
How many minutes does the ratelimit take?
channel edit on name is 5 minutes
but i think i can do 2 in a row
every channel has a edit name cooldown of "2 times in 10 minutes"
I just accidentally almost disabled and deleted a VPS of a client 
how I can do this?
const objA = {
a: 10,
b: 10
}
const objB = {
a: 5,
b: 5
}
And I want to get those a, b from both object using the { a, b } but the problem is they will have same variable name.
const {a, b} = objA;
const {a, b} = objB;
How I can do something like
const {a as a2, b as b2} = objA;
?
const {a: a2, b: b2} = objA; 

Your solution
Exdee
too much syntaxes from esXX
O also wanna help me bully voltrex
how do I setInterval this? this is open source btw https://sourceb.in/9wspPo79Wo
eh? you don't know how to use setInterval?
its
setInterval(function, time);
At each time interval (in milliseconds) the function will get executed
nope just started js
But it doesn't execute until after the time is up
then from there it will execute every x time
example
const myInterval = setInterval(() => {
console.log("This will get logged each 3 seconds")
}, 3000)
This will run until clearInterval on that interval object is called
i.e.
clearInterval(myInterval);
imagine, they just asked "how to use setInterval" and u ask....
exdee
anyone have experience with docker
wondering if its safe to leave bot token in container when putting it on dockerhub
from what I can tell you cant see the code; but I have no experience
[ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './types' is not defined by "exports" in C:\Users\name\Documents\GitHub\demonandbadboy\node_modules\dotenv\package.json
can someone help?
@hidden coral #support message
well do u know tampermonkey?
its a script injector which can even use to expose things which u are not supposed to see in a website soooooo
What does that have to do with anything
He did literally say the hackers had access to his account, soooo...
Its safe if you arent dumb
I don't see your point
Dont use an easy to guess password or share your password and you should be straight
not to mention doesn't repl have 2fa
just enable that
I don't think it does
I am not shocked
Then again, I'm signed in via my GitHub account
repl sucks
Around 2 years of using repl, haven't had my shit stolen
[ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './types' is not defined by "exports" in C:\Users\name\Documents\GitHub\demonandbadboy\node_modules\dotenv\package.json
can someone help?
ahh yes Github Co Pilot makes your code a Minefield, like it uses Open source code, and can copy/paste it into your code (possible licensing issues)
also your code gets send to Github and stored.
for me?
no
ok
For those with color blind, is the button readable? I have doubt on it
the secondary type I guess
Custom emoji 
Voting perk code?
Do it yourself
@earnest phoenix
but we wont code it for you
help with code != giving you the code
Yea, help with code you've already written
We wont write it for you or give you the code
if you want to get premade code, pay someone here to do it
Like make it
If you want me to make it give me money other then that ask for help

We won't write code for you, if you have a specific problem we will try and help you solve it
Look much better
Not a bad idea using buttons and select menus
How does the select menu work exactly tho
Do you just list all the songs displayed and have them select one and then it uses it to search for that song?
Yea, I max the selection to only 1
when it got selected, song played
For playing song, not so, but other thing might be useful
Mmm well
What if you wanna play multiple songs by the same artist
you could do something like -play Artist and it lists all the songs found from youtube or whatever with that artist
You can select on other song after 1 selected
I can even repeat select 1 song, as long I do .editReply
since the selection will reset again
[ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './types' is not defined by "exports" in C:\Users\name\Documents\GitHub\demonandbadboy\node_modules\dotenv\package.json
can someone help?
HTTPError [AbortError]: The user aborted a request.
0|Topaz RPG | at RequestHandler.execute (/root/TopazRPG/node_modules/discord.js/src/rest/RequestHandler.js:107:21)
0|Topaz RPG | at processTicksAndRejections (internal/process/task_queues.js:95:5) {
0|Topaz RPG | code: 500,
0|Topaz RPG | method: 'put',
0|Topaz RPG | path: '/channels/864227199921946644/messages/864525935785410562/reactions/%E2%9C%85/@me'
0|Topaz RPG | }
Anyone knows how to fix?
Yeah, with the buttons, I can pretty much eliminate the music commands for other commands
Anyone have any idea why I'm getting these errors? The code runs just fine.
More specifically. How fix good yes?
xD
I know. I have a database somewhere else, but I simply don't know how to use it
I have never used databases
Just curious @vivid fulcrum . What should I do with my database endpoint?
oh
I use plox.host
Pretty neat service tbh
3.25$ for 3 months of hosting + 2 database slots
So I'm not really in a hurry to get the database working xD
So. Any ideas on either the errors or the database? xD
can i fix these timeout errors, since they are level INFO i guess they are not severe, but i'd like to fix them, but for me it seems like its not happening on my side 
i mean a couple seconds later they connect successfully again and everything works, but this happens from time to time
im guessing its remote mongodb?
you could increase the timeout value to something a bit more stable
has anyone seen binary payloads that start with
d9 d9 f7 a3
that is a buffer is it not?
anywhere, trying to track down this encoding/format
was sent as HTTP body with content-type of application/json
Probably some kind of buffer
no worries ty anyway
thats ÙÙ÷£ in utf8
its mongodb atlas yes
Omg its tim
uwu divided by euro
owo?
at least not devided by zero
I'm in weird situation. VScode and tsc says there is no such (Interaction, MessageButton etc) class in Discord.js. But when I look at node_modules, I can see that class
it is typescript file
hmm?
downloading @types/discord.js can fix it
npm i -D @types/discord.js
then add the types to tsconfig.json
wait discord.js doesn't do that?
Djs stinky
Uncaught Exception: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './types' is not defined by "exports" in C:\Users\gamin\Downloads\demonandbadboy-main\demonandbadboy-main\node_modules\dotenv\package.json```can someone help me
Quick before erwin comes: detritus stinky too
there is no @types/discord.js
detritus is better than d.js, even more if you use TS
nah he is lurking around on the detritus discord
and his first message today was frick
frickroll
if you updated djs without restarting your vsc, hit cntrl + shift + p then type reload window or restart ts server
Cannot find module 'dotenv/types'
restart ts server is preferable
already did that

@summer torrent according to djs package.json they already include typings in v12 (the typings repo is archived and the latest version there is v11)
are you sure you're not on djs v11?
i restarted my pc too
Well if you have problems with Discord.js maybe it's time to move to another library
/s
discljord
"DISK-le-yord"
is that a lib for clojure (def didn't look that up)
yes
Asynchronous JS code makes a performance difference and other fun jokes you can tell yourself
Promises spawn a micro thread to perform the task, so they are better than callbacks as callbacks impose single threaded
is discord's api compatible with scratch the child's development tool

asking for uh.. afriend
source for this?
someone made something for scratch awhile back.
i think this is it, I havent tested it.
https://scratch-for-discord.netlify.app/
Make your own discord bot in 5 minutes using blocks with no coding required. Try your bot online and export it on your computer or server.
yeah
Trying to find the src for runMicrotasks one sec
you can use BDFD or the lib dbd.js more customizeable
is it possible to not match the red square
You could append a ? after the *
thx,makes sense
Can't seem to find the exact source where it actually spawns a thread, but the logic behind it is that the thread doesn't get paused to run async functions like a sync fs call would, so it has to spawn it in a micro thread to run in an async context
from what i can find, microtasks are just another step in the event loop
it isnt a thread
after nextTick and before timers

JS has a super weird implementation of Promises then
I still can't find where I saw this
JS is wack in general yet we all love it
js doesnt have threading at all, every single part of it is single threaded
the only way to thread is to explicitly spawn a separate instance of v8, in a separate process or separate c++ thread/js context
worker_threads
oh my god
what is SharedArrayBuffer then
thats the only shared memory option
but its a pure buffer
you cant share js objects between worker threads without ipc
or serialization
I guess I should have figured since the docs state that the messages you send between children and the parent port has to be cloneable
some objects can be "transfered"
which makes them cease to exist in the original worker
but its pretty limited, mostly arraybuffers and stuff
wish that wasn't the case
yeah well, what can we do
Idk. Fork node I guess
highly doubt its that simple
i dont know anything about how v8 is built, but im pretty sure its not made to be thread safe
trying to thread it will likely introduce a shit ton of memory violations
perhaps on the end user's side. Promises could fuck with a lot of stuff
from v8 devs:
There are two options: (1) use different isolates on each thread (then the scripts can run in parallel) and (2) use one isolate and use v8::Locker to lock the isolate before you use it (then only one thread at a time can execute scripts)
having only 1 thread execute at a time defeats the purpose of threading
I am trying to match nested stuff ik that is possible with while loops but i still want to try
if add \w as alternative I get another results
How do I make css button fill my whole div? I use width:100%, but the Problem is, when schrinking the Browser, the style gets weird
If you want to match any character except for some, then you can do [^characters]
depends, what gets weird?
text makes button overflow to the right?
looks like this 🙈
whitespace: nowrap
Could be my monitor tho
Reconsider using red text
it should look like this
oof... missing the -
if you're giving width:100% to the text itself, that wont work because the text is inline
white-space: nowrap;
use nowrap like fake said
wy?
Doesn't match the overall light style
whey
Use decent backgrounds if you're using a light style
I begun yesterday learning css & html
Errr... well that has nothing to do with the color selection
Red text isn't something to use lightly as using red is a design principal to capture user attention as danger
like this?
Dark text color on a light background and vise versa
colors can be changed at anytimes xD
heart beats are very dangerous. Stop your heart from beating
light theme hater
shhh it is
for what you have going on
What's the problem?
btw dude came here for css help, not for design help xD
I just can't help myself
lol
xD
when this is the correct way. It looks this
#development message
someone send google a pic of discord light theme
true
Also that blue line at the top is ???, unless other elements outside of that ss has that blue shade, change it to the green or red like the button colors
Looks like bootstrap
true
I am trying to match nested brackets with regex and ended up using while loop
is it?
Needed something to start lol
start from scratch :^)
yes, btw back to my problem. How can I solve it white-space: nowrap; doesnt seem to work
If it is then why aren't you using more of the css classes it provide 😭😭
where link?
huh... it does work being applied on the right selector
wait a sec
But \w works?
I need inspiration.
I added it on the Button Class, should I overwrite it with inline styles?
here: https://regexr.com/61qnp
It also requires a full reload aka. CTRL + F5 to clear the cache
I am not using the Boostrap Class, its my own css, just the Card is from Bootstrap
yeah did
meh without seeing the code I can't really help tho
and the element it's being applied on
\[.*(\[.+\]).*\]
that way it'll match all square brackets inside square brackets
is that what you wanted?
.shard-button{
font-family: Tahoma, Verdana, sans-serif;
margin-left: 7px;
margin-right: 7px;
margin-top: 2px;
margin-bottom: 2px;
border-style: solid;
border-width: 4px;
border-radius: 7px;
padding: 2px 2px 2px 2px;
text-align: left;
font-size: 1em;
background-color: #36393f;
border-color: #36393f;
display: flex;
}
.shard-button.log{
color: #ED4245;
background-color:#202225;
border-color: #202225;
border-width: 10px;
border-top-width: 1px;
border-bottom-width: 1px;
margin: 0px 3px 0px 3px;
padding: 0px;
float: right;
white-space: nowrap;
width: 100%;
}
``` DO you need the html part?
(?<=\[.*)(\[.+\])(?=.*\]) here's an alternative version
not really ,but thx for the help,I will use while loop for now 😄
Oh wow you're making things more complex then needed
explain again what you want pls
the previous one
note the capture group in this case
I want to match nested groups ,so [ab[ab[ab]]] [ab],should match as group
gonna send you an example, will take a few secs
as "a" group or as "N" groups?
either way, my first solution will work for that
since capture groups will get all matches
if you want to include the parent group, just use \[.+\]
n group
okay thx
\[.+\] = will match all square bracket groups WITH content inside
\[.*(\[.+\]).*\] = will match all square bracket groups INSIDE square brackets
(?<=\[.*)(\[.+\])(?=.*\]) = will match all square bracket groups INSIDE square brackets (non-capturing version)
all 3 can be used to grab all matches, even if inside other matches
thx 🤗
when I remove display: flex, then it uses the whole button
one sec please
<style>
.inner
{
display: table;
}
.row
{
background-color: lightgrey;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
margin-bottom: 5px;
padding: 5px;
}
.row:last-child
{
margin-bottom: 0;
}
.row > div
{
border-radius: 3px;
display: table-cell;
vertical-align: middle;
}
.shard
{
background-color: rgba(0, 0, 0, 0.5);
padding: 5px;
white-space: nowrap;
color: #ffffff;
}
.status
{
padding: 0 10px;
}
</style>
<div class="wrapper">
<div class="inner">
<div class="row">
<div class="shard">Shard 0</div>
<div class="status">Heart died due 120bpm heartbeat</div>
</div>
<div class="row">
<div class="shard">Shard 1</div>
<div class="status">Heart died due 120bpm heartbeat</div>
</div>
<div class="row">
<div class="shard">Shard 2</div>
<div class="status">Heart died due 120bpm heartbeat</div>
</div>
</div>
</div>
as example
Python binding to the Networking and Cryptography (NaCl) library
NaCl (pronounced "salt") is a new easy-to-use high-speed software library for network communication, encryption, decryption, signatures, etc. NaCl's goal is to provide all of the core operations needed to build higher-level cryptographic tools.
that moment when you want to pun so hard that you find NaCl in "Networking and Cryptography"
Example above
Colorization is optional of course
Add with: 100%; if the table should be 100% of its parent
(to .inner)
if you use flex you don't really need to use 100%
lmao
We still wanna support IE6!!
As there might be one of a billion clients still using it
so...basically banks and millenium-old enterprises?
Younger people can not understand why 
I'm not as young as you might think
Where’s grandpa Tim if I need him
it's just that...no one use IE anymore
Err still a small percentage
only people who are really afraid of changes
At least using my tools
And the user agent history shows they’re somehow refusing any browser updates
is there a away how I can stop this?
weird, bc it minimizes the button, but does not scale down the font
ah, its because of white-space: nowrap 💡
I meant to use it on the shard number only
As a website can scale the text to the right should still be able to transform
As written in my example above your basic structure is way more complex than needed
But I’m driving now means I can’t really get into your code anymore
okay, thx
wait wtf
Why not just use columns??
<div class="wrapper">
<div class="inner container">
<div class="row">
<div class="col-4">
<div class="shard">Shard 0</div>
</div>
<div class="col">
<div class="status">Heart died due 120bpm heartbeat</div>
</div>
</div>
</div>
</div>
ur using bootstrap right
How should I columns if they aren’t defined?
As written in my example I’m working with dieplay not flex
oh
I didn't see the css
I just saw row and thought bootstrap
Anyways it doesn’t really matter in that case
Using flex works as well with an div acting as row, applying the background and radius to it
It’s always up to the coder to decide which way he goes
I still prefer to use CSS2.0 for much more compatibility but in this case the result is 100% the same
not to start with the endless discussion again
npm WARN deprecated cheerio-select-tmp@0.1.1: Use cheerio-select instead
npm ERR! code 1
npm ERR! path D:\OneDrive\Bureaublad\Heimerdinger-master\node_modules\sqlite3
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@14.16.0 | win32 | x64
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: C:\Users\Yarne\AppData\Local\Programs\Python\Python39\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack File "<string>", line 1
npm ERR! gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack ^
npm ERR! gyp ERR! stack SyntaxError: invalid syntax
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack at ChildProcess.exithandler (child_process.js:308:12)
npm ERR! gyp ERR! stack at ChildProcess.emit (events.js:315:20)
npm ERR! gyp ERR! stack at maybeClose (internal/child_process.js:1048:16)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\OneDrive\\Bureaublad\\Heimerdinger-master\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd D:\OneDrive\Bureaublad\Heimerdinger-master\node_modules\sqlite3
npm ERR! gyp ERR! node -v v14.16.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
help pls
Use cheerio-select instead
This isn't discord.js server
Sorry
This is supposed to block the command from being used when someone has the blacklisted role, but it doesnt work and no errors?
Any ideas or suggestions
Why are you instantiating a new client?
is this right
(express)
app.enable('trust proxy');
app.set('trust proxy', 1);
Cuz im negative iq, my devs are offline and i really need this
async execute(...) {
if (message.member.roles.cache.has(id)) return;
...
}```
I wonder why no lang has implemented something akin to @SingleInstance where it errors during compilation if it is instantiated more than once
it would be trivial to implement that in code why do you need compiler support for something like that
idk, it was an example
It sounds like something to implement for those who want their code to be "correct", even though it's pretty trivial
singletons don't sound very correct to me
Never used to work in commands (module exports) only in index.js where most of the code is
if you're passing along objects to functions that need them it doesn't really matter if you create an extra object
The proper way is to use the existing client
You can use the client parameter that you have in your execute method (alternatively message.client, if you didn't have that)
Something like this? Sorry if im being annoying haha
Looks good
Im pretty sure i got the wrong id
The ID you used would only work for a specific server though
Since IDs are unique in general
Yeah thats for my discord im developing atm.
for the muted role
it is the correct id
but it doesnt do anything 😭
Should i add member to the excecute?
@quartz kindle Because I know you like performance Poggers:
Buffered I/O: Random Read (uniform) size span of 1.67 GB, for 20.026606515s, 3280 IOPS
Direct I/O: Random Read (uniform) size span of 1.67 GB, for 20.004066132s, 23676 IOPS
7x the IO operations with direct IO :P
It can’t do anything if you throw in a return after the statement
If you wanna log the event then return after your message being sent
wdym direct io
like using what vs what code
Ah, but the ,new command still continues and tells me i already have a ticket open, which is in the same command.
@rustic nova
Aurel be having a hard time 😔
Not sure if this is the correct place, but does anyone knows how to set a static image for when the server gif icon isn't playing?
For example this server : https://discord.gg/clashofclans
It has a perfectly looping gif but a static image too
Direct IO basically means you bypass the OS page cache and instead manually manage the memory for disk io etc... So every time you call for a disk read etc... To the os, its always a actually disk task rather than the os's internal pool
It's just the first frame that's a static image and the rest is the gif
Generally can remoce alot of overhead, especially in a random access point of view whete traditionally the os would fetch more than it needs treating it as a sequential task
in what lang are you doing this?
not js i assume?
Ok let me try that
Le rust
ah yes
But you can do it i. JS
Would recommend using io uring setup though to make it actually performant
And also carries with it some memory alignment stuff you need to make sure ya dont oof
You kinda need io uring to make it generally performant to atleadt on par or better than os buffered
Becuase its the async and parallel side to it that give it the extra performance because you're able to designate more memory that would otherwide have been taken uo by the page cache
well, that wont work in js then
Js no like uring?
Or is it becUse of Js's massive perfprmance penalty when using native extensions cuz jit ™️
is your keyboard having issues
Mobile
you can do it in native, so basically not js
I mean you can expose it to js
I would imagine node will eventually add some support for it no? Then again probably not
theres this, from 2 years ago https://github.com/zbjornson/node-io-uring
Oof
const Logger = require('leekslazylogger');
const log = new Logger();
const { MessageEmbed } = require('discord.js');
const fs = require('fs');
const { join } = require('path');
const Discord = require('discord.js');
const client = new Discord.Client;
module.exports = {
name: 'new',
description: 'Create a new support ticket',
usage: '[brief description]',
aliases: ['ticket', 'open'],
example: 'new my server won\'t start',
args: false,
async execute(client, message, args, {config, Ticket}) { //Right Here!
if (message.member.roles.cache.has("864612793352585226")) return;
console.log("\x1b[32m", "Successfully blocked a ticket (user is blacklisted) from:", message.member.displayName)
message.reply("Debug plz ignore")
const guild = client.guilds.cache.get(config.guild);
const supportRole = guild.roles.cache.get(config.staff_role);
if (!supportRole)
return message.channel.send(
new MessageEmbed()
.setColor(config.err_colour)
.setTitle(':x: **Error**')
.setDescription(`${config.name} has not been set up correctly. Could not find a 'support team' role with the id \`${config.staff_role}\``)
.setFooter(guild.name, guild.iconURL())
);
let tickets = await Ticket.findAndCountAll({
where: {
creator: message.author.id,
open: true
},
limit: config.tickets.max
});
if (tickets.count >= config.tickets.max) {
let ticketList = [];
for (let t in tickets.rows) {
let desc = tickets.rows[t].topic.substring(0, 30);
ticketList
.push(`<#${tickets.rows[t].channel}>: \`${desc}${desc.length > 30 ? '...' : ''}\``);
}
let m = await message.channel.send(
new MessageEmbed()
.setColor(config.err_colour)
.setAuthor(message.author.username, message.author.displayAvatarURL())
.setTitle(`:x: **You already have ${tickets.count} or more open tickets**`)
.setDescription(`Use \`${config.prefix}close\` to close unneeded tickets.\n\n${ticketList.join(',\n')}`)
.setFooter(guild.name + ' | This message will be deleted in 15 seconds', guild.iconURL())
);
return setTimeout(async () => {
await message.delete();
await m.delete();
}, 15000);
}
let topic = args.join(' ');
if (topic.length > 256)
return message.channel.send(
new MessageEmbed()
.setColor(config.err_colour)
.setAuthor(message.author.username, message.author.displayAvatarURL())
.setTitle(':x: **Description too long**')
.setDescription('Please limit your ticket topic to less than 256 characters. A short sentence will do.')
.setFooter(guild.name, guild.iconURL())
);
else if (topic.length < 1) topic = 'No topic given';
Can anyone help me out?
At line 14 is the thing im trying to do, basically have a "ticket mute" role which will just dump the command if you got the role.
No errors in console and it doesnt work, am i missing anything?
Cheers!
How do you add a button with node.js to tickets and stuff?
Added sorry!
why
performance
half of those requires are not even being used lol
unless thats not the full code
if you dont see "Successfully blocked a ticket (user is blacklisted) from:" in your console, then either the user has that role, or your problem is not in that file
Hm
Its not, forgot to add ... at the end sorry.
Ill keep digging for more errors
Cant find anything sadly
would there be a way of canceling the command from being run without actually modifying the command file?
if i put setTimeout() on a loop callback or something
it would wait for the time to end right 
setTimeout doesn't block, so it wouldn't wait.
Of course, you could make it block by converting it to a promise and resolving it.
You could also use setInterval or crontab if you're going to do repeating tasks
Check curl -h or something
I’m on phone
From Facebook Graph Api (https://developers.facebook.com/docs/reference/api/) :
Publishing: You can publish to the Facebook graph by issuing HTTP POST requests to the appropriate connection URLs,
Google -> curl "-f" with quotes
Ahh got it
how do i make a hint like a string is: "AbCD"
then
it will result: "A_C_" 
im kinda stuck at like showing the entire string
Make 2 strings, one being the full answer and the other being only "_____", then replace a random index with the corresponding letter from the answer
Ye
Between 0.000...1 and 0.999...9
Then multiply by length
Which will get u between 0 and length - 1 after floored
string.split("").map(x => {
let rand = Math.random() // no floor
rand > 0.5 ? "_" : x;
}).join("");
if you want to make it harder just make 0.5 smaller
@errant flax test this out
Tbf, it's best if you do random based on revealed char count
Since there's a very very little chance that all characters might hit below the threshold and be revealed
Split the string, choose random indexes and call it a day
Ye
Like 30% of the total count or whatever
If word has 10 chars reveal 3 random indexes
@lyric mountain or split the string, map it to objects storing the index and the char, sort randomly, replace first percentage of chars with _ then join the array
@lament rock the method KuuHaKu said was more complicated
first you'll have to pick random indexes based on the percentage
then there's a chance you'll pick the same index twice
You can do it procedurally you know..
here's my method:
// little trick to trigger devs:
var
str = "code913";
function obfuscate(string, percentage = 30) {
let arr = string.split("")
.map((char, index) => { return { char, index }})
.sort(_ => Math.random > 5 ? 1 : -1);
return arr.map(obj => Math.floor(percentage / 100 * arr.length) >= obj.index ? "_" : obj.char);
}
obfuscate(str);
@lament rock i hope this works
You'd still end up with possibly all chars being revealed
I'd increment a reveal amount and try to spread out the reveals as much as possible
Do node workers work inside other workers
let answer = "rickroll"
let rem = [...Array(answer.length).keys()]
for (let i = 0; i < answer.length * 0.6; i++) {
rem.splice(Math.floor(Math.random() * rem.length), 1)
}
let hint = ""
for (let i = 0; i < answer.length; i++) {
if (rem.includes(i)) hint += answer.charAt(i)
else hint += "_"
}
return hint
Also don't use var
var gud
Is there currently any issue with the site? Its not sending me http requests when someone votes
Check pins
workers can spawn other workers iirc
Um which one
Ohh
So by neutral
does this mean its being working on or the issue isnt that much anymore or what does it mean lmao
Time to completely fill my server with V8 instances :D

//rewriting my bot from the group up because it was very bad at scaling
Idk how to scale a Discord bot efficiently unless you have threads running the commands or have a separate thread to process incoming gateway messages and parsing to JSON to post to parent port. For commands, things would have to be pretty low level since high level libs are mostly class based and their data would not be cloneable to send over ipc. Having a separate thread to handle gateway messages is easy to do.
There are some cool low level libs like CloudStorm and SnowTransfer to write more performant bots. (the official ones are still on API v6, but I've forked them and updated them to v9 wink wink nudge nudge nah jk)
how do i link a font from google and how do i use the font 
check w3schools for custom fonts I guess
google fonts should provide a cdn link you can ref in your css
wait use it where?
Paste the link tag that Google gave inside your head tag
Also don't use CSS imports
IIRC they didn't support parallel so it'll load slow

i dont understand a single thing
I host my bot on a vps but when I close putty it doesn't respond how do I fix this
You might want to use a terminal multiplexer like screen/tmux or process manager like pm2
why does this happen tho
how do i do a backpsace in html/css 
wat
like \n?
I don't know the details, it's just the way it is. When you logout from your SSH session, it sends SIGHUP to running jobs. You can overcome this with nohup and daeomonizing the process, or disown. I haven't really tried them though. With terminal multiplexers, you can detach the shell process and re-attach it later.
That might be an option too
like in js u do "\n"
Also that’s called a linebreak (just for future reference)
Try line-height
I think that's for text, never mind
Does changing the padding via CSS not work?
Change line-height for p
Some googling brought this up:
display: block;
margin: 10px 0;
}```
that works thx! 

<br><br><br>
I wonder why you margin 10px up and down as the default element height is 19px/20px already 
(node:33) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
embed.fields[1].value: This field is required
embeds[0].fields[1].value: This field is required
I'm so confused.
I literally made 20 checks on everything.. if there is no value.. I add an alternative value.. and it's still erroring that.
const profile = new MessageEmbed()
.setThumbnail(bot.users.cache.get(user.id).displayAvatarURL({ dynamic: true, size: 4096, format: 'png' }))
.setTitle(`${bot.users.cache.get(user.id).username}'s Profile`)
.addField("**:notepad_spiral: - Bio:**", social.bio)
.addField("**Attitude Badges:**", `${ifStaff ? staff : ""} ${moderator ? certifiedmoderator : ""} ${bugBuster ? bugbuster : bugHunter ? bughunter : ""} ${premium ? supporter : ""} ${earlySupporter ? earlySupporterBadge : ""}` || "None")
return await message.channel.send(profile);
Just log the target field right before sending it
What do you mean?
Technically it’s the second field without a value but make sure social.bio isn’t empty, too
Ah.. social.bio already has a default value.. I did add the || "None".. but doesn't seem to make a difference. 😂
It doesn’t as the value before “” is defined and not null
It does, for sure, my bad.. but I'm checking for 5 different things.. I can't put them all as None or else there will be 5 Nones.
“” || “None”
Will be “” since “” is an empty string and not null
Yea but empty strings have no value and discord can’t use that
`${ifStaff ? staff : ""} ${moderator ? certifiedmoderator : ""} ${bugBuster ? bugbuster : bugHunter ? bughunter : ""} ${premium ? supporter : ""} ${earlySupporter ? earlySupporterBadge : ""}`
How am I supposed to do it for all of those? There will be 5 None
but isn't None better than empty?
Try to set a value of null instead of “”
Dude, I know that, but suppose one is true and one is false, it will show None <badge>
Not sure if that works but try it
It works like that, I tried.
hey man this is a learning experience for me I was just trying to get involved
If premium is true and the others are false, it will become None None None <badge> None
No worries man, I'm learning as well.
Not sure how now. 😐
null instead of “”
Try that
Keep “None”
hey while this channel has some javascript users
how hard is it to set up a more sorted out command handler?
(`${ifStaff ? staff : " "}${moderator ? certifiedmoderator : " "}${bugBuster ? bugbuster : bugHunter ? bughunter : " "}${premium ? supporter : " "}${earlySupporter ? earlySupporterBadge : " "}`) || "None"
for example economy file moderation file utilities file etc
Well none will never appear as the empty string “ “ is defined and not null 

That’s why I suggested to replace “ “ by null
Not as string of course
Not sure how JS handles that inside ` `
Oh
Can’t spell that damn name…
Template iter… something something
template strings
Ah nvm then
template strings
Then check the values before adding them to the field
Put the values into an array and use join inside the field set
If the array is empty display none
(`${ifStaff ? staff : ""}${moderator ? certifiedmoderator : ""}${bugBuster ? bugbuster : bugHunter ? bughunter : ""}${premium ? supporter : ""}${earlySupporter ? earlySupporterBadge : ""}`) || "None"
that should work, you don't really need empty spaces if the badges are emojis
But the result of the template string should be “”
if it's "" then it's going to be replaced by "None"
Does “” || “None” check if the string is empty, too?
|| checks if the first value is falsey, and an empty string is falsey
Thought it just checks if the var is defined and not null
Oh an empty check, too
Learned something new I guess 
Other and probably better way is to just use if statements
let badges = "";
if (badgeCheck) badges += "badge";
// More checks
.addField("Badges", badges || "None");
more readable and all that
nope
ifStaff ? staff : ""
God thank PHP to differentiate between isset and empty
that can't be translated to val ?? ""
Of course it can
If( isset( val ) ) val else “”
val ?? “”
isset checks if val exists and is not null
Should be similar on JS
If defined and not null
I guess 
If not JS is even more trash… but we know the answer already
how do i make a specific part of the text to red like:
I am red
i want to color the "red" text to color red but how do i do that without overwriting the other text?
in html 
Well
I'm back..
You could wrap it in another tag and give it a class
Would this work?
<span style=“color: red;”>red</span>
what tag 
Well
As inline element
span is basically like a paragraph tag right 
hey!
Is ytdl-core really still broken?
I am getting tired of this freaking package
it's been almost 2 months now since that it broke
It’s an in-line format element
Does nothing if you don’t assign any format to it
Just tried, won't work.
well what happened
Wrap the part in a <span> with a css class
Then customize the class style with css
.addField("**Attitude Badges:**", (`${ifStaff ? staff : ""} ${moderator ? certifiedmoderator : ""} ${bugBuster ? bugbuster : bugHunter ? bughunter : ""} ${premium ? supporter : ""} ${earlySupporter ? earlySupporterBadge : ""}`) || "None")
is there any type of official server or anythiong?
You’re still adding unnecessary spaces
@feral aspen your code is wet
keep it DRY (Dont Repeat Yourself)
Which will end up being interpreted into not being empty
yeah but what was the output
“ “ || “none”
The output is like "" || "None"
👍
Will be “ “
If I added space, yes.
Nothing.
It errored.
(node:33) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
embed.fields[1].value: This field is required
embeds[0].fields[1].value: This field is required
Code ^^^
${} ${} the spaces between
Yes.
discord ignores spaces sometimes
${ifStaff ? staff : ""}${moderator ? certifiedmoderator : ""}${bugBuster ? bugbuster : bugHunter ? bughunter : ""}${premium ? supporter : ""}${earlySupporter ? earlySupporterBadge : ""}
As googlefeud wrote before, remove them
If it is false between two true.
There we go
Moment.
they can put a || "none :(" after the template string
There is a space in " " so I think that's considered as true.
bruh
Defined, not empty, not false, not null
Well.. I learned something today, and it worked. 🎉
👍
also the way you're putting the badges in the template string is very bad
how do i make my page "long" like u can scroll all the way down if u know what i mean 
I'd use #development message
how to add a scrollbar in a page*
overflow: shown;
On parent element (most likely body)
Default is overflow: auto which enables scrollbar when content overflows
oh if my body content is like a bunch of stuff it will automatically add it 
Magically 🪄
oh ye it does :KEKA:
@errant flax Did you know you can customize the scrollbar? (tho it only works in chromium based browser iirc)
wuz tht
also how do i resize an image without overwriting the resolution if u know what i mean 
nvm fixed my issue
How can I serve images statically with express
they have docs, maybe in there
I tried using
app.use('/images', express.static(join(__dirname, './images')))
and then do
app.get('/', (req, res) => {
res.status(200).sendFile('urcute.jpg')
})
and I just get an error
do I have to actually do localhost:port/images/urcute.jpg
when sending the file?
I think yes
Or make a index file where it shows what images u can get if ur just on the images section yk
I wanna serve an image on the root tho
so ican just send blah.is-a-qt.tech and it sends the image
Response.sendFile sends a file from disk
you have to provide the full path
I am providing a full path
I just tried providing the full path and it yelled at me for not proviidng the full path
Already tried that omg
TypeError: path must be absolute or specify root to res.sendFile
at ServerResponse.sendFile (C:\Users\dyeaa\Documents\Github\tyrian\node_modules\express\lib\response.js:425:11)
at C:\Users\dyeaa\Documents\Github\tyrian\index.js:8:21
at Layer.handle [as handle_request] (C:\Users\dyeaa\Documents\Github\tyrian\node_modules\express\lib\router\layer.js:95:5)
at next (C:\Users\dyeaa\Documents\Github\tyrian\node_modules\express\lib\router\route.js:137:13)
at Route.dispatch (C:\Users\dyeaa\Documents\Github\tyrian\node_modules\express\lib\router\route.js:112:3)
at Layer.handle [as handle_request] (C:\Users\dyeaa\Documents\Github\tyrian\node_modules\express\lib\router\layer.js:95:5)
at C:\Users\dyeaa\Documents\Github\tyrian\node_modules\express\lib\router\index.js:281:22
at Function.process_params (C:\Users\dyeaa\Documents\Github\tyrian\node_modules\express\lib\router\index.js:335:12)
at next (C:\Users\dyeaa\Documents\Github\tyrian\node_modules\express\lib\router\index.js:275:10)
at SendStream.error (C:\Users\dyeaa\Documents\Github\tyrian\node_modules\serve-static\index.js:121:7)
process.cwd() + "path"
I just get this
Tried that as well
oh
still get this same error
Absolute path
res.sendFile(require('path').resolve(path))
path.resolve converts relative to absolute path
Eg. ~ resolves to /home/user
On *nix systems
Or use __dirname, can you tell us your file structure? Where is the file which starts the express server, where is the image located?
Although statically serving images at /images and redirecting to /images/image from root requests should work too
If I use sendFile will it embed in discord?
I want it to embed in discord so that might be an issue
You need to add meta in ur index.html
I think it would
You don't
Embedding images doesn't require opengraph
App.get("/") ...
0|index | Require stack:
0|index | - /home/misty/Voltrex/index.js
0|index | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
0|index | at Module.Hook._require.Module.require (/home/misty/.nvm/versions/node/v15.11.0/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:61:29)
0|index | at require (internal/modules/cjs/helpers.js:88:18)
0|index | at Object.<anonymous> (/home/misty/Voltrex/index.js:1:17)
0|index | at Module._compile (internal/modules/cjs/loader.js:1063:30)
0|index | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
0|index | at Module.load (internal/modules/cjs/loader.js:928:32)
0|index | at Function.Module._load (internal/modules/cjs/loader.js:769:14)
0|index | at Object.<anonymous> (/home/misty/.nvm/versions/node/v15.11.0/lib/node_modules/pm2/lib/ProcessContainerFork.js:33:23)
0|index | at Module._compile (internal/modules/cjs/loader.js:1063:30) {
0|index | code: 'MODULE_NOT_FOUND',
0|index | requireStack: [ '/home/misty/Voltrex/index.js' ]
0|index | }
I do not understand what I am doing wrong.
I assume it is having trouble finding the image once its on the server and being hosted.
But I don't get why
did you put the right filepath?
I am pretty sure yea
it works when its on my pc
but once I move it up to the server it has issues
what are you doing stepdocker
OML
lmaooooo
where are you stuck?
if you learn docker more you will love it
yeah
already love it
at the firs t ytry
I tried using socket
Docker*
But it doesn’t work on windows without WSL iirc
And I don’t wanna setup WSL
it doesnt work on windows without hyper virtualisation enabled in bios
Docker can run on either the legacy Hyper-V backend
or the WSL backend
I have hyper v enabled iirc
did you have windows 10 Pro?
bcs this is one of the consumer versions that give you hyper-V access
well just a few edits in the registry and you're on pro 
few?
Has anyone experience with discord webhooks with discord.js? They seem to backlog when you send too many messages to it, which is fine, but when it starts to send out the backlogged stuff it's out of order. They get sent randomly
Err, did you await your requests?
are you hitting ratelimits?
It's most likely a webhook ratelimit for that specific webhook, yes
My bot is replying after so many time
Negative
It's a livechat, I just keep sending it new messages
Even when it gets ratelimited/gets backlogged
could be part of the issue
Await them




