#development
1 messages ยท Page 1544 of 1
They are seperate tabs...
yeah, but where are you running your code on?
I meant vscode
Terminal then
Doesn't detail it, though
Not on the editor
Yeah ik
those errors are just good when compiling, which you'd usually have a watch for that
But this extension highlights the line in red and shows the error next to it
rather than hovering?
Yes
i thought it threw the error from compilation, not just syntax, if it was the former i'd be interested in it
hovering vs reading right away doesnt seem to give much benefit, but thats purely opinion based
i personally prefer to keep the workspace cleaner, adding more text doesnt seem like a good idea
at least for me
I'd recommend intellij font
I have ligatures too
But there is none in the ss
I hate this ejs error because it's an invalid error
And I can't get rid of it
some vsc theme suggestions? currently use material theme but its boring
im using material theme ocean constrast or something
atom one dark looks nice
glasscord ๐
Come on, SynthWave '84 looks cool
how about discord light theme 
Discord light is just every color reversed
lol get a hdr monitor and use light mode
Can you use glasscord on Linux
yes as long as your wm has a blur provider
atom one dark + glasscord
looks pretty good
uhm why do i get this error ```js
internal/validators.js:124
throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type function ([Function (anonymous)])
at validateString (internal/validators.js:124:11)
at join (path.js:375:7)
at Object.<anonymous> (C:\Users\Lucas\Desktop\discordbots\MCBlock\index.js:19:27)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
code: 'ERR_INVALID_ARG_TYPE'
}```
ye but where
try reading harder
i cant find where i did it wrong
have you tried checking the error
yes duh
'The "path" argument must be of type string. Received type function'
still works for most electron apps though
this is the only line where i have path
const { join } = require('path');
ok so how are you using join()
Show us MCBlock\index.js, line 19
And whatever's related to that
wait, how can i use join() with aliases
+startbot
wdym aliases
like someone told me to do js join(cmd => cmd.alias, `command`, `${file}`) but that gives error
command aliases
Ok well, that's... a function
that's not how join works
join() is used for paths
yes i know
What are you trying to do?
define alias
i cant even with this channel
im having a stroke
someone told to do js const alias = require(join(cmd => cmd.alias , "command", `${file}`)); but that gives error ofc
you need to hold the commands in a map or discord collection
the alias is in the file
so you can find the commands by their aliases
"someone" is stupid
so I don't know what the hell join is supposed to do here but this ain't it
can i do like command.alias ?
Can you show us your entire function that reads commands
you don't need to worry about aliases here
maybe we can figure out what the heck you're trying to do
you can add them at any time
lol i already have my bot i need to add aliases now
do commands already work?
yes
show us your message event
nah not the message event
we need to see the index.js file
where it loads the commands
or wherever the commands are loaded i cba
wait
nvm
i send new one
F
The good one is not sended bcz of my eifi
Wifi*
I hope u have enough on the ondex.js
no we need to see the code that's loading commands
Can you not try to send again...?
Where's the jojo "continue" gif when we need it
did you used the css loader for vsc?
yup
i can give you my css file if you want
it's a slightly modified template from the repo
what did you modified?
just a few colors
i was on my phone i can send now https://sourceb.in/kBM0lLWwNk
did Dice blocked me lol
I... hmm.
No, actually, this is very little code for a command loader
oh lol
Take a look at this https://anidiots.guide/first-bot/a-basic-command-handler
because what you're doing right now really isn't worth keeping, tbh.
im fine with it, just want to make it a tiny bit less glass like
can you not just tell how i can make it respond to aliases too bcz mhy command handler is fine
And for command aliases take a look at https://discordjs.guide/command-handling/adding-features.html#command-aliases
The thing is, what you're doing right now to try to load aliases is completely pointless
you can also completely disable blur and make it just allow transparency
And the best I can do is show you tutorials that do it so you can understand
i tried to use that but they use something else
Then you'll have to adapt it
Then use that something else
@umbral zealot u cant just say how i can make it respond to aliases too?
I can... I pointed you to the guide that shows you how aliases work
if u can can you pls do it rn
I'm not going to do this work for you or write your code. You're the developer, do it yourself.
Aka "gimme za code"
but i tried and that didn't worked and i already tried a few ways
idk how but ive managed to already break it, or its just my Monitor adjusting the brightness
yea found the issue it sometimes doesnt load properly
mfw people star a message I wrote 2 months ago telling people to learn javascript... ๐
i didn't only tried that, i tried that after it didn't worked when tried a few times
yes officer, this jojo reference right here
But you have to write more code, what you have is not sufficient.
The entire idea of using path.join is completely ridiculous, whoever told you to do that should not be trusted with anything important.
They might be looking at the wrong tutorial
@umbral zealot now i tried this to define command ```js
const args = message.content.slice(fetchprefix.prefix.length).trim().split(/ +/);
const commands = client.commands
const name = args.shift().toLowerCase()
const command = commands.get(name) || commands.find(c => c.aliases && c.aliases.includes(name));``` but now it doesn't respond and it doesn't even give a error
@umbral zealot ?
Hey guys
Yo
I have this error, can someone help me?
Require stack:
- /home/container/node_modules/canvas/lib/bindings.js
- /home/container/node_modules/canvas/lib/canvas.js
- /home/container/node_modules/canvas/index.js
- /home/container/src/utils/CanvasTemplates.js
- /home/container/src/index.js
- /home/container/src/loaders/ListenerLoader.js
- /home/container/src/loaders/index.js
- /home/container/src/Monika.js
- /home/container/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)
at Function.Module._load (internal/modules/cjs/loader.js:687:27)
at Module.require (internal/modules/cjs/loader.js:903:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/container/node_modules/canvas/lib/bindings.js:3:18)
at Module._compile (internal/modules/cjs/loader.js:1015:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
at Module.load (internal/modules/cjs/loader.js:879:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:903:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/container/node_modules/canvas/lib/bindings.js',
'/home/container/node_modules/canvas/lib/canvas.js',
'/home/container/node_modules/canvas/index.js',
'/home/container/src/utils/CanvasTemplates.js',
'/home/container/src/index.js',
'/home/container/src/loaders/ListenerLoader.js',
'/home/container/src/loaders/index.js',
'/home/container/src/Monika.js',
'/home/container/index.js'```
Friend said Canvas thats PAIN
Dumb link lol
Python: if I raise Exception (or raise CustomCommandError / whatever else), I get a CommandInvokeError. Is there any way to retrieve the original error type?
what
there's a bug on linux w electron where the window loads too fast for the transparency to work properly for whatever reason
idk how to fix it with glasstron
i run it on windows
oh
guys is there a way to log into a specific shard from outside the shard ? using djs 12
if i delete the css and copy a new one in it works for the first time
if i close vsc and start it again it just loads the normal theme
you should open up a communication system between those two servers instead
either open up a http server on where you're running the shard 0
why not api/gateway?
or open up a websocket server at your backend where you serve your dashboard, ^
logging in without sharding would work or not ?
like at one place sharding is happening
but at the dashboard its logging in without it
would that work ?
depends on how you implement the dashboard i guess
if you rely on having a Bot instance running it could be annoying
again,
you should open up a communication system between those two servers instead
either open up a http server on where you're running the shard 0
or open up a websocket server at your backend where you serve your dashboard
any other solution is not scalable and not recommended
what do bots like mee6 do ?
exactly what i said
ok
they communicate with their servers
In case this is useful to anyone, I got it with:
err.__dict__["original"]
try npm rebuild
and then npm i canvas
so I should make an api sort of thingy at shard 0 and send data on dashboard requests
yeah thats common sense
why is it happening??
are you relying on cache
let messageUser = await Messages.findOne({
userID: message.author.id,
});
if (!messageUser) {
messageUser = new Messages({
userID: message.author.id,
messages: 0
});
await messageUser.save().catch(e => console.log(e));
};
await Messages.findOne({
userID: message.author.id
}, async (err, dUser) => {
dUser.message += 1;
await dUser.save().catch(e => console.log(e));
})
here
it is in main.js
it would have been 100x easier if I could do broadCast eval from dashboard only
but life is hard
so i have this to run commands ```js
const args = message.content.slice(fetchprefix.prefix.length).trim().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;
try {
client.commands.get(command).run(client, message, args);
} catch (error){
console.error(error);
}``` but if i use a command it says `cannot read property 'run'of undefined` , how can i fix it?

anyone??
command is undefined
where did u add commands ?
did u do something like this ?
client.commands = new Discord.Collection();
fs.readdir("./commands/", (_err, files) => {
files.forEach((file) => {
if (!file.endsWith(".js")) return;
let props = require(`./commands/${file}`);
let commandName = file.split(".")[0];
client.commands.set(commandName, props);
console.log(`๐ Command loaded: ${commandName}`);
});
});
uhm u can see my index.js https://srcb.in/9e7zwojsmD
only a bit
wow noone helping me
ok
What do you need help with
do ```js
command.run(client, message, args);
instead of
```js
client.commands.get(command).run(client, message, args);
@timber fractal
or change to
client.commands.get(command.name).run(client, message, args);
What do you need help with
the command is an object
see above i sent the things
nvm i fixed it
K
pretty common
Like 2 weeks?
2 maybe 3 weeks
which discord presence for vscode is the best
huh?
Repl best lol
discord presence for vscode?
rich presence
like mine?
You mean like the buttons and stuff?
Nvm
speaking of buttons, i need to figure that out
the one by noel right
Hmm
the one i have rn
yes
youve been noticed
Anyone Indian bot developers here?
Wow that's nice
though, legit, whats the thing about CRP that you mentioned @sacred trout ?
which you do with the SDK, yes
Lol idk
Research
yeah thats a different thing
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
Idk this
i assume i could use it for the fancy thingies
hi
but i'll probably have to deploy it on an app
rpc is an old deprecated protocol for communicating with the discord client
game sdk is being actively maintained though
probably
bot km trucksbook discord me please
node should be able to run cpp tho, right?
let me check that rq
please help
oh, i see
Sup Ervin where did your bot reached in servers
What with
where did my what?
The bot
you mean how many servers its in?
romana?
The genshin one
Yes
No I don't speak Romanian sorry
pretty pog
should be hitting 1k in a few hours
Aah yes my man lucky
xD
Ggs!
ty
gg erwin
I like your pfp
im gonna attempt to get some ads rolling soon, but they are so expensive
and being outbid last second is pretty annoying
I can agree
I m thinking to write my whole boy again in typescript
@golden condor bot that would show me at odds how many kilometers I did in the trucksbook
The problem Is idk typescript
ts is definitively worth it
hwat
ts is javascript
Yea but better
ts just has types, thats about it
ts is js but js isn't ts
Lol
I wanna do that but ts will just scream at me
//js
let a = 1;
//ts
let a:number= 1;
Bruh then ts is better
you theoretically don't need that type declaration
bad example, but puts the idea out
Sometimes Js makes no sense
yeah, inferred types
dont do that as its basically the same as pleonasm, but it shows the point
bot that would show me at odds how many kilometers I did in the trucksbook
Hm ima see to Typescript today rip my today's sleep Adios guys
types are highly needed when working with something like discord's api, at least for me
Oh
who needs sleep anyway
since the entirety of the api is reliant on entities
not only that, strong typed languages are good overall if you plan to move to cpp or some other strong typed lang, its a good practice so you're used to shapes
@golden condor https://trucksbook.eu/company/105388
does notable member let you change your nick?
@golden condor no trukyapp
no
i dont think it has any perks apart from the fancy color
No perks that I know of
o
Unless there is tags and we don't know
which is my favorite color, so im not complaining at all
instal please me
cyan is pretty pog
there isn't a bot for it
well, theres something that hasnt been done in the bot community
finally a unique thing

@golden condor Well, I saw it on a discord channel
Possibly a custom bot
I am hoping we get tag perms that would be pretty noice
or at least some tags
@golden condor I give you in private to see?
thats likely more for mods, doubt we have an actual need for it, it'd probably conflict with the mini-modding rule
Yeah nvm we aren't getting tag perms LMAO
there isn't a public one
nor do i think we deserve changing nicknames, its the only thing that boosting grants you apart from purple color
Feel as though bot reviewers are more likely to get tags first
would be nice to have, but i dont think it fits the bill
i need more data

but i cant think of anything else to add
do you know programming language?:
@opal plank no
Before you make a Discord Bot, you should have a good understanding of JavaScript. This means you should have a basic understanding of the following topics:
- proper syntax
- debuging code
- basic features (vars, arrays, objects, functions)
- read and understand docs
- nodejs module system
As much as we d like to assist everyone with making their bots, we rarely have the time and/or patience to handhold beginners through learning javascript. We highly recommend understanding the basics before trying to make bots, which use advanced programming concepts.
Here are good resources to learn both Javascript and NodeJS:
Javascriptinfo: https://javascript.info/
Codecademy: https://www.codecademy.com/learn/javascript
FreeCodeCamp: https://www.freecodecamp.org/
Udemy: https://www.udemy.com/javascript-essentials/
Eloquent JavaScript, free book: http://eloquentjavascript.net/
You-Dont-Know-JS: https://github.com/getify/You-Dont-Know-JS
NodeSchool: https://nodeschool.io/
CodeSchool: https://www.codeschool.com/courses/real-time-web-with-node-js
Evie s Accelerated JS: https://js.evie.dev/
Please take a couple of weeks/months to get acquainted with the language before trying to make bots!
Just link the message lul
this should be a copypasta at this point
i have tag thats copy paste
lul
@opal plank
thanks
no preblomo
Hey how to make a website for our bot?
@opal plank please can you make me one for discord
i only do contractual/paid work, sorry
yes, money, but here is not the place to talk about that stuff
Lol
no idea whats going on anymore
10 euro for a bot lul
I accidently renamed all the variables present in node_modules. And now everything is messed up. What do I do now?? ๐ฆ
Delete mode modules
Can I prevent this to happen? I'm using vscode and working on a react project.
I wanted to rename the div to button. But it did that everywhere
Just dont do a global replace-in-files
set up your .gitignore properly
Do it in the sources folder
vsc is going to ignore everything that's in the gitignore
Btw, why'd u rename all divs to Button?
Shift F6 then
Or right-click + refactor
Also iirc, if you change the opening tag then the closing tag changes too
I already hv a git repository, but hvnt yet commited anything. Can this be an issue?
Yes if you care about your progress
na na, I mean in this regards - renaming tags
No
Click + delete button
rm -rf /node_modules
./
^
rm -rf /
(DONT)
lmfao
thanks.
don't... actually run that
LOL, kidding. ik that
๐ฅฒ
anyway
you just need to set up your .gitignore
i usually steal one from visual studio
and it works:
(i have over 1k modules)
node_modules
private
*.lock
.vscode
.DS_Store
lib
.eslintcache
*.local
I do have set this
4 apocalypse knights
rm -rf /
chmod 777 -R /
delete system32
apply force on CPU
:(){ :|:& };:
rm -rf / does mac really allow this?
Only if u do sudo ig
surely they would add some extra protection
mac's audience are people who aren't tech savvy per se
so surely they would add protection to prevent dumb people from running that
(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])
email validation regex, just fyi

Perhaps you should put a warning sign on commands
for some people who don't know what they do
because people will run stuff lol
its their fault for running it ยฏ_(ใ)_/ยฏ
Yeah well it's also the person's fault for posting it
dont run stuff you found randomly in a discord channel?
Did u really ran that?
say that to all vampires here
[\w\d]+@{1}[a-z\d]+(\.[a-z]){1,2} 
.endsWith("@gmail.com")
Lul
Bro I knew what I did it's funny lol
Thank you i was eating so sorry i didnโt responded
are you sure thats where the error is coming from
its the console output
click on main.js to the side of the error
did you use a linter? iirc es-lint marks the error
rm -rf --no-preserve-root / should work if ๐ developers didn't add extra protection.
let vid = "youtube.com/watch?v=vQ7Pg1_YYDo"
let typeVid = "mp3"
let infoYT;
async function getInfoFromVid(vidUrl, typeOfVid) {
return await ytdl.getBasicInfo(vidUrl).then((infoYT)=>{ return infoYT.videoDetails.title + " | " + infoYT.videoDetails.ownerChannelName + "." + typeOfVid;})
}
infoYT = getInfoFromVid(vid,typeVid);
console.log(infoYT)
function escapeFile(input) {
return input.replace(/\"|\||\/|\\|:|\*|<|>|!|\?/g," ");
}
ytdl(vid)
.pipe(fs.createWriteStream(escapeFile(await getInfoFromVid(vid,typeVid))));
thats my code
like i defined fs and ytdl etc at the top
when i eval it, i get this
are you in an async function
i think
share your entire file
const fs = require("fs");
const ytdl = require("ytdl-core");
let vid = "youtube.com/watch?v=link removed"
let typeVid = "mp3"
let infoYT;
async function getInfoFromVid(vidUrl, typeOfVid) {
return await ytdl.getBasicInfo(vidUrl).then((infoYT)=>{ return infoYT.videoDetails.title + " | " + infoYT.videoDetails.ownerChannelName + "." + typeOfVid;})
}
infoYT = getInfoFromVid(vid,typeVid);
console.log(infoYT)
function escapeFile(input) {
return input.replace(/\"|\||\/|\\|:|\*|<|>|!|\?/g," ");
}
ytdl(vid)
.pipe(fs.createWriteStream(escapeFile(await getInfoFromVid(vid,typeVid))));
Hnmm
getInfoFromVid(...).then(result => {
//consume the result with createWriteStream and whatnot
});
iirc you can't wait synchronously for a promise in js
but i did .then at return await ytdl.getBasicInfo(vidUrl).then((infoYT)=>{ return infoYT.videoDetails.title + " | " + infoYT.videoDetails.ownerChannelName + "." + typeOfVid;})
๐ถโโ๏ธ ๐ฆฝ
Why are you mixing up await and .then
because i dont really understand promise and async
It's time to read up on em then
Imagine promises being "do this for me" and await being "do this for me but I'll stay here to see the result"
Show updated code
const fs = require("fs");
const ytdl = require("ytdl-core");
let vid = "youtube.com/watch?v=link removed"
let typeVid = "mp3"
let infoYT;
async function getInfoFromVid(vidUrl, typeOfVid) {
return ytdl.getBasicInfo(vidUrl).then((infoYT)=>{ return infoYT.videoDetails.title + " | " + infoYT.videoDetails.ownerChannelName + "." + typeOfVid;})
}
infoYT = getInfoFromVid(vid,typeVid);
console.log(infoYT)
function escapeFile(input) {
return input.replace(/\"|\||\/|\\|:|\*|<|>|!|\?/," ");
}
ytdl(vid)
.pipe(fs.createWriteStream(escapeFile(getInfoFromVid(vid,typeVid).then((res)=>{return res}))));
its not a string
You're not using then correctly
so i should first do toString(input)?
no
// here res is the string returned from getInfoFromVid
})}:```
Also all those functions seem to be used only once, that's a bad practice. There's no need to create a function if you are going to be calling it only once
i will call them more often, but i just started the code
does the properties of dataset on an element always returns a string?
just the regular html dom element
Yo,
How can i restrict a command only for a specific role?
check if the person who sent the message has the role
How?
what language and lib are you using?
Discord.js v12
message.member.roles.cache.has("roleId")
Replace roleId with the actual role ie
id*
you can also check for a name or other properties using .find
Isnt this correct
client.on("message", message => {
if (message.member.roles.cache.has("roleId"));
if (message.content == ",pticket") {
just change the id
No because you don't so anything after the if statement
you just do nothinf
nothing* jesus I hate typing on mobile
Can i still use both of these "if" lines?
Kinda looks weird
If with semicolon lul
super helpful message
put the second if statement inside the first one
if (...) {
if (...) {
}
}
or alternatively: if (... && ...)
It is actually, ifs do nothing if you end it with a semicolon, you either need to use return or brackets
So yeah, if with semicolon lul
client.on("message", message => {
if (message.content == ",pticket") {
if (message.member.roles.cache.has("802999483239235584")) {
That ID looks wrong also
That's not what's there
oh wtf
Just as a note, but is that command supposed to be runnable only in one server?
Yeah
Its a private bot for my hosting company
i want to make priority tickets for donators
Nvm then
xD
Did it work after u changed the id?
Nope
Also, are you using a different message listener for every command by chance?
Also, does the command have any arguments?
Nice catch google
the command is working just fine without the "role check"
Creates the ticket and everything
Double check the id
Was the yes for the arguments or the message listeners?
Copy it and put in this format in the chat: <@ID>
If it pings the role then it's right
@daring socket
id dosent ping the role
Check if the id is right then
<@&ID_HERE> @harsh blade
i ltierally just told you
if (message.member.roles.cache.has("<@&802875302748356628>")) {
no
no not like that
bruh
i know that
That is to check if the id is valid
ik that but i got confused sorry
I don't mean that
I mean to check if the id is valid via discord chat
Like, if it pings the role then it's valid
if (message.member.roles.cache.has("802875302748356628")) {
aint working
its cached in client
no errors
Lul erwin that not what I meant
then explain it good pls
It's literally to manually check if you didn't misscopy the id
Like, try to see if it pings
why would you need to do that?
If it does, u copied the right id
what?
He misscopied before
i did copy the correct id
oh
this time
Then something else is wrong, you're showing two lines of your code, and they look right without any context
im still unsure what they are event attempting to do
restrict a command to a role
client.on("message", message => {
if (message.content == ",pticket") {
if (message.member.roles.cache.has("802875302748356628")) {
const Logger = require('leekslazylogger');
const log = new Logger();
const { MessageEmbed } = require('discord.js');
const fs = require('fs');
const { join } = require('path');
module.exports = {
name: 'new',
description: 'Create a new support ticket',
usage: '[brief description]',
aliases: ['priorityticket', 'pticket'],
example: 'new my server won\'t start',
args: false,
async execute(client, message, args, {config, Ticket}) {
const guild = client.guilds.cache.get(config.guild);
at first it seemed they only wanted to know how to send a role mention
No, that's something else, I was checking if he got the right id
That's why the mention
Why... do you have... a message listener... inside a command file
That's just wrong on so many levels. I have no clue how you managed to get this crap working lol
Oh my
i second this comment
I Tried to add it to a seperate command file but it didnt work
cuz u did it wrong
How?
let me foward you do the guide
cuz literally 80% of people here use a command handler
and this one
you're simply making a module and importing it with require()
thats it
require() will just bring you that object, the same that modules.exports export
Alr, ive modified the command to be in a command file and i get this error
if (message.member.roles.cache.has("802875302748356628")) {
^
ReferenceError: message is not defined
Ive tried defining message which then told me to define client which then told me to define discord and so on
so i gave up on that
You should not have a client.on("message") within another handler
just follow the guide, one step at a time, and read thoroughly
instead of just shoveling code.
i read those and checked it against my code but i see nothing wrong?
Can't i like fetch the role id from config.js
show codeโข๏ธ
its too long to send
That code works
just fine
but i wanna make it "specific role only"
if(!message.member.roles.cache.has("role_id")) return;
Iโm on phone so it doesnโt make me download those files
Awoo does rock
@harsh blade #development message You can use this
Itโll return and not work for that user if they donโt have the role
if (!message.member.roles.cache.has("802875302748356628")) return;
^
ReferenceError: message is not defined
Same issue
Did you put it under line 23?
My bad
.setTitle(':x: **Error**')
This is line 23
Put it under this
Np
Hey guys
Quick question
Does anyone know how to make a server specific variable?
That doesn't change on other servers
anyone knows code for bot to send an embed/message whenever it joins a server. In the channel it can send
if you expecting spoonfed code, no
you need to use 'guildCreate' event
I think you can make a json file...
and then send a message on one of the channels inside the guild
you could have an object or a map, then store anything you want inside
rip my bot got declined
yea I wanna be spoonfed too lazy
read #rules-and-info
if you got a specific question, im more than happy to help
otherwise, sorry, but no
F
never use util.inspect with both getters and showHidden on a discord.js client
lmao
dont you tempt me js boi

good luck

lmao
out of curiosity, what would happen?
Uh lol
whats the new honerable member role?
Honerable helpers?
I did this and it was a nightmare
guys help
bot.user.setPresence({ activity: { name: ${bot.users.cache.size} members , type: 'WATCHING'}, status: 'online' })
Right now I just use showHidden
it say this error
ReferenceError: bot is not defined
have you tried reading the error
what did you define your client as
i want make how much users on all Server
bot is no defined read the error
so?
can you gave my a code how to make status on bot
With users size
client.user.setPresence({ activity: { name: ${client.users.cache.size} members , type: 'WATCHING'}, status: 'online' })
Try
does that even work
aye aye fit like me dev friends
TypeError: Cannot read property 'setPresence' of null
client.user is undefined
undefined yea
Help my if you wnt
you need to make sure you're logged in before using that method
i dont undrestand??
e.g. use it in the ready event
matthew did you have a stroke
what
why did you say undefined bruh
oh idk maybe I did
wait for the ready event
<o/
dont try to set presence as soon as you delcare client
discord.js should have protection against that
after all it is designed to babysit you
when you try to access user before the promise is fullfilled? not sure tbh
but if you have a static presence you can just provide it in client options
Guy's i need someone who has a big picture in githup
tf is a github big picture
big picture in github
githup?
Yupp
never heard of that one before
lmao
ohhh
๐๐๐๐
what do you mean by big picture
Sry
I mean he can fix errors and know alot about it
oh big picture as in experience
I have error when i use git push
Yeahh
no he wants a photograph
Wtf bruh
a big photo of github
I want to upload files to github
When i use git push it say. Failed to push. Repository dont find. Or something like that
anyone has any idea how to reward voting on guild base as opposed to just specific user?
you could set up some logic with a vote command or something

or maybe use the last guild the user sent a message on
oh
that seems like a neat and simple solution
am I limited only for vote during the last 12 hours
Remote already exists
How i can set another one?
I think I'll use this
thanks
Rm?
that's to remove a remote
you sure you removed the previous remote?
Im trying to install discord-rpc with npm
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jusmi\AppData\Roaming\npm-cache_logs\2021-01-24T23_53_35_427Z-debug.log
C:\Users\jusmi\Desktop\DiscordRPC>npm install discord-rpc
npm ERR! code EJSONPARSE
npm ERR! file C:\Users\jusmi\Desktop\DiscordRPC\package.json
npm ERR! JSON.parse Failed to parse json
npm ERR! JSON.parse Unexpected end of JSON input while parsing near ''
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jusmi\AppData\Roaming\npm-cache_logs\2021-01-24T23_53_47_817Z-debug.log
This is my error
fixed
rpc has been deprecated, use SDK
oh ok
It's still against the tos because of its nature
With the cheerio module, I try to extract the desired information from the html information from the dak.gg site, but strangely the data value is not returned and the class name is correct.
Well, it's part of the source code
getHtml()
.then(html => {
let ulList = [];
const $ = cheerio.load(html.data);
const $bodyList = $("div.overflow-hidden").children("div.container.p-0");
$bodyList.each(function(i, elem) {
ulList[i] = {
title: $(this).find('div.profile-header__info.m-3 span').text(),
url: $(this).find('div.profile-header').attr('data-renew-url'),
image_url: $(this).find('div.profile-header__icon').attr('src'),
image_alt: $(this).find('div.profile-header__icon').attr('alt'),
};
});
const data = ulList.filter(n => n.title);
return data;
})
.then(res => log(res));
Have anyone encountered the problem of member mentions in embeded message show as "@inavlid-user" on mobile app? But works fine on pc? Any known fixes?
there's nothing you can do
it's a client bug
you'll have to wait for discord devs to fix it
the mobile devs are heavily incompetent so don't expect it anytime soon
https://pastebin.com/P8CRZuSm
How come when i react to the message, nothing happens?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
I see, thanks ^^ ill just use normal message instead of embed
I replied to cyr xD
lol
One message removed from a suspended account.
nah it's a reported bug on the mobile client
there's been talk for about a week now
I found an error that just appeared
I noticed the mentions show up eventually but takes time
hasn't that "bug" been around since forever
my program is waiting for a response from this fetch forever. it was working before. are the discord service having issues?
await msg.guild.members.fetch({user: allPlayerIds})
at C:\Users\Box\IdeaProjects\team-up-bot\node_modules\discord.js\src\managers\GuildMemberManager.js:265:16
at Timeout._onTimeout (C:\Users\Box\IdeaProjects\team-up-bot\node_modules\discord.js\src\client\BaseClient.js:83:7)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7) {
[Symbol(code)]: 'GUILD_MEMBERS_TIMEOUT'
}
what is allPlayerIds
was about to ask that
have you two become more active since getting notable member? or is it just easier to notice you now
likely the latter
pog
i havent been around that much today, and im gonna gtfo to sleep now c ya
idk what allPlayerIds is, but if its an array of user IDs, you're limited to 100 at a time without the guild members intent
I had a bot id in the array and that was causing it to timeout
i havent been here much at all either, but im always here
i lurk a lot, thats what i meant to say
i was finally able to code my status
SDK is a bitch to fuck around with
like, my status here in my profile, and it pulls metrics from my bot

and it auto updates
Still no response from discord :( I need my intents
Yup
Sent the application last Sunday
Well replied
Sorry, it's 4am
Hmm, I haven't gotten anything. I'd assume they would at least tell me, even if it was denied?
Yeah, I guess they don't do replies on weekends anyways
@commands.command()
async def rank(self,message,ctx, user:discord.User = None):
if user is not None:
db = sqlite3.connect('leveling.sqlite')
cursor = db.cursor()
cursor.execute(f"SELECT user_id,exp, lvl FORM levels WHERE guild_id = '{ctx.message.author.guild.id}' amd user_id = '{ctx.message.author.id}'")
result = cursor.fetchone()
if result is None:
await ctx.send(f"{user.mention} is not yet ranked!")
else:
await ctx.send(f'{user.mention} is currently level {str(result[2])} and has {str(result[1])} XP')
cursor.close()
db.close()
elif user is None:
db = sqlite3.connect('leveling.sqlite')
cursor = db.cursor()
cursor.execute(f"SELECT user_id,exp, lvl FOR levels WHERE guild_id = '{ctx.message.author.guild.id}' amd user_id = '{ctx.message.author.id}'")
result = cursor.fetchone()
if result is None:
await ctx.send(f"{user.mention} is not yet ranked!")
else:
await ctx.send(f'{user.mention} is currently level {str(result[2])} and has {str(result[1])} XP')
cursor.close()
db.close()```
Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "rank" is not found
please help
bruh
also you shouldn't use f-strings for database queries
well the command isn't found
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
the whole code
you use on message and commands.command()?
yea?
i'm sure you need to process the commands first, iirc
cause cogs
since you're using events
@slender thistle don't you need to process commands or something in order to use commands with message event?
what do i do?
Do it last outside of any ifs
where?
ctx.drawImage(background, x, y) //Draw Background
ctx.font = applyText(canvas, message.author.username.toUpperCase())
ctx.fillStyle = '#000000'
ctx.fillText(message.author.username.toUpperCase(), canvas.width / 2.5002, canvas.height / 6.5)
//Curve Profile Picture
ctx.beginPath();
ctx.arc(125, 125, 100, 0, Math.PI * 2, true);
ctx.closePath();
ctx.clip();
const pfp = await Canvas.loadImage(message.author.displayAvatarURL({ format: 'png' }));
//Draw PFP
ctx.drawImage(pfp, 25, 25, 200, 200)```
How can I make the drawImage draw directly in the center of the canvas?
calculate the center of the canvas?
Yeah but what param is it
drawImage(image, x, y, width, height)
Is there any special differences between .findOneAndDelete() and .deleteOne(). I'm referring to MongoDB specifically.
i'm pretty sure findOneAndDelete() returns the deleted document after deleting it
Probably will need to offset it too
if you pick the very middle, thats where it'll start drawing
not the middle of whatever image or what you're doing on
if you placing an image or something, fairly certain you'll need to offset it by diving the image lenght/height /2
Yeah there's that too
That is just changing how zoomed in the pfp is
what do you mean
1st one is with the / 2 and stuff that is canvas height - pfp height
second one is 25, 25, 200, 200
This looks like a cog, is the cog loaded?
lots of information needed
yes
are you sure it is?
f setup(client):
client.add_cog(Level(client))
print("Fun cog is loaded")
class Level(commands.Cog):
def init(self, client):
self.client = client
uhh how do i put something in the center of a container?
like vertical and horizontal
so drawImage(image, canvas.width / 2 - 200 / 2, canvas.height / 2 - 200 / 2, 200, 200)?
YEs
you can try debugging bot.cogs
image disappeared when I tried that
@gilded olive are you using teyvat api?
it's a list of str so you can use the .join method on it
how big is the image






