#development
1 messages ยท Page 742 of 1
@restive furnace hehe lol
CoPy PaStA
hi
How do I pick a random text channel from a server?
what lang
With DiscordJS :
// (guild = guildObject)
let randomChannel = guild.channels.filter(c => c.type === 'text').random()
It would be better if you learn the basics of the language instead of diving in so deep.
Why do I keep getting this error?
UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
roles[11]: The set already contains this value
I didn't get it before the outage.
can you provide the code?
The whole error is
(node:1195) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
roles[11]: The set already contains this value
at item.request.gen.end (/rbd/pnpm-volume/5e67cf9e-ab38-4576-ac99-0726c5933577/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15)
at then (/rbd/pnpm-volume/5e67cf9e-ab38-4576-ac99-0726c5933577/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:215:21)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
(node:1195) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:1195) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
is is possible to install node.js to shared hosting windows
I don't know what the error is i tried it on my end it works
@compact raft shared hosting windows?
yes @pliant adder
explain what shared hosting windows is... @compact raft
no more explanation
then i can't help you
i mean what i show u more
@surreal sage?
What is that
@compact raft depends, possibly yes
If you have access to ssh and permissions
If all you have is a plesk control panel, then probably not
I need little help with finding Pokemon API, that have generation 8 Pokemons already added. I need this for my bot.
const serverembed = new Discord.RichEmbed()
const msg = await message.channel.send("Pinging...")
.setTitle('Axyx - Status')
//fields
.addField('Internet Ping', `${msg.createdTimestamp - message.createdTimestamp}ms`, true)
.addField('Host', 'Storage: 1GB \n RAM: 128MB \n Hosting Service: Cubes.HOST', true)
msg.edit(`${msg.createdTimestamp - message.createdTimestamp}ms`)
message.channel.send(serverembed);``` it does not work, well, i want the "msg" in the "Internet Ping" field, How do i let the "ping" in the embed without sending it without the embed?
wdym?
you see const msg right?
.addField('Internet Ping', `${msg.createdTimestamp - message.createdTimestamp}ms`, true)``` that message should be here
i want it to
but it just sends it without the full embed now
ik
That belong to the RichEmbed
yep
Which means you call them on a RichEmbed object
ok
You can chain them because they return the object itself
But you can't just put .setTitle() out of nowhere
title is required ik
All you have to do
it isnt required (title on embed)
Is simply put the regular message above the embed code
just simply msg.edit(embed)
im gonna try with eval
um.why u cant directly test on ur bot??
im doing the update ver rn
with new help embeds
and a reboot cmd for me
do i have to remove message.channel.send(serverembed)?
wait what
i dont understand
msg.edit(serverembed)
ik
but
where does the message of the ping go to?
i want it at js ${msg.createdTimestamp - message.createdTimestamp}
do i have to put there just the full: js msg
gonna try
Try to use meaningful names for your variables
Mixing up message and msg is confusing for both you and anyone else reading your code
did not work the: js const serverembed = new Discord.RichEmbed() const msg = await message.channel.send("Pinging...") .setTitle('Axyx - Status') .setColor('#ff1493') //fields .addField('Internet Ping', msg, true) .addField('Host', 'Storage: 1GB \n RAM: 128MB \n Hosting Service: Cubes.HOST', true) msg.edit(serverembed)
well msg is the pinging message
and message is the full message
Yes
Of course it didn't work
I've told you that you can't randomly call .setTitle()
it would be serverembed.setTitle()
You're confused because you've seen them being used like this
let embed = new Discord.RichEmbed()
.setTitle("something");```
That works because it's chained to the line above
ah ok
You have code inbetween those
Which means you're no longer calling the method on the embed object
gonna try serverembed.settitle thin
better to just move your msg declaration
const serverembed = new Discord.RichEmbed()
const msg = await message.channel.send("Pinging...")
serverembed.setTitle('Axyx - Status')
serverembed.setColor('#ff1493')
//fields
serverembed.addField('Internet Ping', msg, true)
serverembed.addField('Host', 'Storage: 1GB \n RAM: 128MB \n Hosting Service: Cubes.HOST', true)
msg.edit(serverembed)``` nope
@quartz kindle that hosting is mine so i have fully access and i have cpanel access also
You could've done that without having to put serverembed each time, but that should work
You're doing it using eval
Depending on how you implemented your eval command
It might not work the same way
You could also check your console
i do but i cant copy paste
As there's most likely more info there on why it didn't work
so if i dont use eval it works or its just the full await
hello
well im gonna upload it then
anybuddy help me to setup my bot to my windows shared hosting
Why does this push the last id twice? Whereas in the logs, it only logs the last id once in the for loop.
roles = new Array();
console.log(roles)
for (i = 0; i < Object.keys(db.server.configs.rolePers[message.author.id]).length; i++) {
let Role = db.server.configs.rolePers[message.author.id][i];
let role = message.guild.roles.get(Role);
if (role) {
roles.push(Role);
console.log(role.id)
console.log(Role)
}
}
console.log(roles)
restart
there is a startup error from the const msg await
so it is the await i think
yes
Who are you talking to right now? Me or someone else?
If it's an async function
to me
As I've already restarted it many times.
Did you put that in an async function
In a message event.
Not you ๐
idk
Ok then, confusing to me since I am slow in my head.
could removing await help?
Well yes, but it would be better for you to just make the function async so that await would work
Either way,
client.on('message', message => {
if (message.channel.type === 'dm') return;
fse.readJson(`databases/${message.guild.id}.json`, (err, db) => {
if (err) return console.log(err);
if (!db.server.configs.rolePers) return;
if (!db.server.configs.rolePers[message.author.id]) return;
if (Object.keys(db.server.configs.rolePers[message.author.id]).length === 0) return;
roles = new Array();
console.log(roles)
for (i = 0; i < Object.keys(db.server.configs.rolePers[message.author.id]).length; i++) {
let Role = db.server.configs.rolePers[message.author.id][i];
let role = message.guild.roles.get(Role);
if (role) {
roles.push(Role);
console.log(role.id)
console.log(Role)
}
}
console.log(roles)
for (i = 0; i < roles.length; i++) {
if (message.member.roles.has(roles[i])) {
roles.splice(i,1);
}
}
if (roles.length === 0) return;
console.log(roles)
return message.member.addRoles(roles, `Role Persist.`)
});
});
I get these logs
[]
642314547813679104
642314547813679104
642314644865810442
642314644865810442
[ '642314547813679104', '642314644865810442' ]
[ '642314644865810442' ]
What is the problem there?
Show where you've put the code @surreal sage
I don't see what the problem there would be.
wdym with where
Your code is put somewhere in some kind of function
You're gonna have to add "async" to the function declaration
if (command === "status") {
const serverembed = new Discord.RichEmbed()
const msg = await message.channel.send("Pinging...")
serverembed.setTitle('Axyx - Status')
serverembed.setColor('#ff1493')
//fields
serverembed.addField('Internet Ping', msg, true)
serverembed.addField('Host', 'Storage: 1GB \n RAM: 128MB \n Hosting Service: Cubes.HOST', true)
msg.edit(serverembed)
}``` this?
yeah......
Well you'd have to make that async then
how cuz i dont know how
replace await with async or async const
client.on("messageCreate", async (msg) => {
// I'm now allowed to use "await" here, yay
});```

client.on("messageCreate", async (msg) => {
if (msg.content === 'a.status') {
const serverembed = new Discord.RichEmbed()
const msg = await message.channel.send("Pinging...")
serverembed.setTitle('Axyx - Status')
serverembed.setColor('#ff1493')
//fields
serverembed.addField('Internet Ping', msg, true)
serverembed.addField('Host', 'Storage: 1GB \n RAM: 128MB \n Hosting Service: Cubes.HOST', true)
msg.edit(serverembed)
}
});``` this good?
why not just move your msg declaration and properly chain your richembed methods
unneeded code dupe
or js client.on("messageCreate", async (msg) => { const serverembed = new Discord.RichEmbed() const msg = await message.channel.send("Pinging...") serverembed.setTitle('Axyx - Status') serverembed.setColor('#ff1493') //fields serverembed.addField('Internet Ping', msg, true) serverembed.addField('Host', 'Storage: 1GB \n RAM: 128MB \n Hosting Service: Cubes.HOST', true) msg.edit(serverembed) });
no
wait idk
gonna try
@summer acorn what's the issue, your logs seem right for the code you've provided
Well, since I already have all the roles in the array, the entire array should be spliced, but it either thinks I don't have the last role, or it doesn't go through the loop enough times.
Oh
It goes through the for loop once too little
For some reason.
Oh wait, I think I might see why that is happening now.
Yeh
Nevermind,
let ROLES = roles;
for (i = 0; i < ROLES.length; i++) {
if (message.member.roles.has(roles[i])) {
roles.splice(i,1);
console.log(roles)
}
}
That gave the exact same outputs
Yeh
No
expected outcome
It's the way large/complicated data is stored
An array will save a reference to the address with the data
Putting up a new variable and setting it to that array
Sets it to the same adress
Meaning they will both edit eachother
Oh.
This happens in javascript but also in java, python, ..
Then what should I do?
Just use a different aproach
What I need is the length of the original array.
Such as adding the roles the member doesn't have to a new array
Without editing the other array
i mean splicing while in a loop using index just doesnt work
imagine array [0, 1, 2, 3]
if you do splice(1, 1) you get [0, 2, 3]
and splice(2, 1) will remove 3, not 2
Alright, I just made it so that if the if statement returns false, it will push, rather than true = splice. Thanks for the help.
http://prntscr.com/q7tyl8 this gives me a error
idk why
im going to use the easy way for cmds
it's saying command isn't defined
Read the errors people
think you should know how to read errors
learn the basics of coding in your programming language before doing disocrd bots
No one will spoon feed you until your code is perfect
As @modest maple said, firstly learn node.js, then read the errors, THEN AFTER ask here
:(

well i know that it cant find the the const or something of command
or something blocks the command of like using it

i care that someone HELPES me
What's the error
Hastebin
Strange
maybe its the node modules
wait what
if i remove the 2 commands
it works..
ok now we know
it are the commands
if (command === "help")
if(message.author.id !== botConfigs.ownerID) {
const ownerhelpembed = new Discord.RichEmbed()
.setTitle('Owner Help Menu')
.setColor('#ff1493')
.setAuthor('Axyx Owner')
.setThumbnail('https://cdn.discordapp.com/avatars/636812729222692880/a334d8a64b9081a9484ab14848898169.png')
.setFooter('CDevelopers Bot - Prefix: ax')
//fields owner
.addField('Owner Commands', 'Set my status: `axsetstatus <status>` \n Send a update embed to the server: `axupdatesend <message>` \n Execute a code: `axeval <code>` \n Shut me off: `axshutdown`', false)
//fields cmds
.addField('Chat Moderation', 'Clear the chat: `axclear (2 > 100) \n Lock a channel: `axlockdown (1m,1h,1d,1)', false)
.addField('Moderation', 'Kick a user: `axkick @user <reason>` \n Ban a user: `axban @user <reason>` \n Mute (tempmute) a user: `axtempmute @user (1m,1h,1d) <reason>` \n Warn a user: `axwarn @user <reason>`', false)
.addField('Utility', 'Send a announce-embed: `axannounce #channel #hex-color <title> <message>` \n Bug Report: `axbugreport <bug>`', false)
message.channel.send(ownerhelpembed);
} else {
const regularhelp = new Discord.RichEmbed()
.setTitle('Help Menu')
.setColor('#ff1493')
.setAuthor('Axyx')
.setThumbnail('https://cdn.discordapp.com/avatars/636812729222692880/a334d8a64b9081a9484ab14848898169.png')
.setFooter('CDevelopers Bot - Prefix: ax')
//fields cmds
.addField('Chat Moderation', 'Clear the chat: `axclear (2 > 100) \n Lock a channel: `axlockdown (1m,1h,1d,1)', false)
.addField('Moderation', 'Kick a user: `axkick @user <reason>` \n Ban a user: `axban @user <reason>` \n Mute (tempmute) a user: `axtempmute @user (1m,1h,1d) <reason>` \n Warn a user: `axwarn @user <reason>`', false)
.addField('Utility', 'Send a announce-embed: `axannounce #channel #hex-color <title> <message>` \n Bug Report: `axbugreport <bug>`', false)
message.channel.send(regularhelp);
}```
@wheat jolt
the problem is the command
smh
๐ Read ๐ The ๐ Docs ๐ Learn ๐ The ๐ Programming ๐ Language ๐ First
๐ stop ๐ clapping ๐ ๐คฃ
throw error now
nvm
it works
nvm
it like crashes
client.on("message", async function (message) {
if (command === "shutdown") {
if(message.author.id !== botConfigs.ownerID) return;
message.reply('Shutting down.....')
process.exit()
}})
``` problem with this?
or 1 } and 1 )
oh my god
) ~{~
totally forgot
i think i got to reprogram this fully
cuz you guys dont want to help
Maybe try to remove the Function and try again
WHAT
learn how df async works
i tried that too
if you knew even a little bit about the programming language and read the docs you wouldnt have this issue
bro
i just did somethings
and the full problem = command thing or.... THE STUPID HELP COMMAND
can you try actually making a command handler
learn the programming language basics first, then read the docs
CD search up what a referenceerror is
i dont even program in JS much
tell me the error RN
and i know whats wrong
learning more about javascript will help you in the long run
:((((
and im not gonna tell you it until you learn the JS basics
and LEARN TO READ THE DOCS
chillfish ngl I don't feel you're help screaming they learns js and read docs
what more can you do when hes refusing to go away and learn the basics of his programming language and refusing to read up on the documentation
im gonna try to fix
just stop
if you tell me what the prob is
you don't help them in that situation
again still you too
Hello there
We do not give you the code to fix it
but i can still learn from it
I need help with developing a bot that checks how many players are in my minecraft server and then sends back Number of players and their names
cmd /getplayers
dont ask 2 ask please
mhmm?
blame discord
what is this error
(node:28560) UnhandledPromiseRejectionWarning: Error: Something took too long to do.
at H:\DISCORD BOT\GULAM-BOT\node_modules\discord.js\src\client\ClientManager.js:40:57
at Timeout._onTimeout (H:\DISCORD BOT\GULAM-BOT\node_modules\discord.js\src\client\Client.js:436:7)
at listOnTimeout (internal/timers.js:536:17)
at processTimers (internal/timers.js:480:7)
(node:28560) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:28560) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Discord arent letting any new connections join
Wait for a while till they resolve api issues
me ? @patent prism
yes
Is this because api errors/latency? INFO - discord.gateway. received_message : Shard ID None session has been invalidated. (probably yes)
I think Discord stopped bots from logging in
they closed api log in eys
go to inspect
look where it has <div> class="<class name here>"
then its just . + <class name>
messasge ๐คฃ
any error you see? ```js
if (command === "help") {
if(message.author.id !== botConfigs.ownerID) {
const regularhelp = new Discord.RichEmbed()
.setTitle('Help Menu')
.setColor('#ff1493')
.setAuthor('Axyx')
.setThumbnail('https://cdn.discordapp.com/avatars/636812729222692880/a334d8a64b9081a9484ab14848898169.png')
.setFooter('CDevelopers Bot - Prefix: ax')
//fields cmds
.addField('Chat Moderation', 'Clear the chat: axclear (2 > 100) \n Lock a channel: axlockdown (1m,1h,1d,1)', false)
.addField('Moderation', 'Kick a user: axkick @user <reason> \n Ban a user: axban @user <reason> \n Mute (tempmute) a user: axtempmute @user (1m,1h,1d) <reason> \n Warn a user: axwarn @user <reason>', false)
.addField('Utility', 'Send a announce-embed: axannounce #channel #hex-color <title> <message> \n Bug Report: axbugreport <bug>', false)
message.channel.send(regularhelp);
}
if (command === "help") {
if(message.author.id !== '449250687868469258') {
const adbed = new Discord.RichEmbed()
.setColor('#ff1493')
.setTitle('Extra Commands')
//fields owner
.addField('Owner Commands', 'Set my status: `axsetstatus <status>` \n Send a update embed to the server: `axupdatesend <message>` \n Execute a code: `axeval <code>` \n Shut me off: `axshutdown`', false)
message.channel.send(adbed);
}
}}
or is it the api that it cant send embeds
message is not defined
read the error
you cant call upon the object 'message' when it doesnt exist to that part of the code

it does not give a error and it does not send
learn to debug your code
the if statement makes it fail..
CDeveloperToday at 2:34 PM
http://prntscr.com/q7vt50 oops
you sent us that error
with that code
messasge
go through your code step by step, inspect your variables and see where it goes wrong
@surreal sage its not working because of the if statements. if any other user tries the command, it will work
wich statement
yall need to learn how to debug you can't just rely on other people to fix your code
the ones where you compare ids
cry is right
im gonna use botConfigs.ownerID then
oh god do you really not understand what the fuck that if statement means
if anyone but you runs the command, actually do the command
i see
i dont think hes actually learn js before coding a bot
same lol
//help
if (command === "help") {
const regularhelp = new Discord.RichEmbed()
.setTitle('Help Menu')
.setColor('#ff1493')
.setAuthor('Axyx')
.setThumbnail('https://cdn.discordapp.com/avatars/636812729222692880/a334d8a64b9081a9484ab14848898169.png')
.setFooter('CDevelopers Bot - Prefix: ax')
//fields cmds
.addField('Chat Moderation', 'Clear the chat: `axclear (2 > 100) \n Lock a channel: `axlockdown (1m,1h,1d,1)', false)
.addField('Moderation', 'Kick a user: `axkick @user <reason>` \n Ban a user: `axban @user <reason>` \n Mute (tempmute) a user: `axtempmute @user (1m,1h,1d) <reason>` \n Warn a user: `axwarn @user <reason>`', false)
.addField('Utility', 'Send a announce-embed: `axannounce #channel #hex-color <title> <message>` \n Bug Report: `axbugreport <bug>`', false)
message.channel.send(regularhelp);
}
if (command === "help") {
if(message.author.id !== botConfigs.ownerID) return
const adbed = new Discord.RichEmbed()
.setColor('#ff1493')
.setTitle('Extra Commands')
//fields owner
.addField('Owner Commands', 'Set my status: `axsetstatus <status>` \n Send a update embed to the server: `axupdatesend <message>` \n Execute a code: `axeval <code>` \n Shut me off: `axshutdown`', false)
message.channel.send(adbed);
}
}}
``` fixed lol
its a rlly bad way of going about suff
oops forgot ; at return
btw when the new bots getting approved?
........
@wary valve 1 week+
no u
what
okay?
but why are u giving live news here lmao
@wary valve you are in the wrong channel my guy



yup yup yup can someone do axhelp in #commands
i want to be sure about owner only
I need help with developing a bot that checks how many players are in my minecraft server and then sends back Number of players and their names
cmd /getplayers
ask your question
no one knows what you're having trouble with when you just say "i need help"
develop it for me
no
for money? sure
we are here to help you with your code, not to give you code
it was fixed
@vast holly 1 week+
#502193464054644737 says up to a week and more
x:
beat u too it shiv
I mentioned #502193464054644737 so I win objectively
oof
lol
[discord.js]
i'm storing my prefix in a .json file, if i wanted to use multiple prefixes, how would i do it?
you know how to get content out a txt file of a website? like Version <thattext> (on website txt: 1.0.0)
Databases
@unique nimbus like
Store each servers prefix in a database and make it customizable
mongodb is a database
there are others
noone will guide you through database basics
.js
pick a database and read guides and documentation
i personally reccommend mongodb, its easy and integrates very well with js
you could also go with a variation of sql like mysql or sqlite, but thats a different story
Ohh
Actually i am new in coding i need to learn more
If any experienced coder will i can do easily
@earnest phoenix if you need help with mongoose i can help
how??
@pliant adder come DMS
it picks the color of its color
ok
Anyone know paginator for discord.py? There was Libneko, but this is not longer working
You can make one 
to who ur talking ?
the person that was right above my message.
ok
@broken jay I guess you can make your own, it should be manageable if you understand lists and stuff
Just make a list object of embeds and keep track of the page number and count per message that should be easy to do
I can try... I'll make suggestion too to discord.py, they would add better in-built paginator. Current one is not very good...
ok, i tried everything to make multiple prefixes
if it didnt work, you didn't
i tried making an array in the .json file
i tried making two different values in the .json file
i tried putting in lowercase the recived message, nothing
do you use your own command system or discord.pys?
discord.js
How to remove this
well that
Undefined
@earnest phoenix you're using a field, you can't remove that
@rugged minnow why๐
the field requires two values
thats why I make my own system, so I have more options
Ya
in javascript is:
.addField("test", "test1", true);
as @rugged minnow said
The third param is optional
Thank
and by default is false
yeah, the third one is optional, i don't use it
@earnest phoenix use a description
well, i still can't find a way to use multiple prefixes
if i try to use the || it still doesn't work
have an array
tried that
@earnest phoenix you can add ** ** as field value
still doesn't work
Which won't be displayed as anything and remove undefined
Or get an invisible unicode character
ok at least show us your code
you can add ** ** as field value
this goes in my notebook
or a snippet of the embed
are you talking to me?
wait idk
@rugged minnow one way is to use an array, use a for loop, check the start of the message for the prefix save it if it is, break and go on
I just made it in 6 lines
this is the base script
or use some() and includes() for a one liner
Those work as well
@rugged minnow yeah you need to change the part where it checks the prefix duh
^
well i tried that
if its an array it cant be done the same way as a string
it's storing the value from the .json in a variable
i should be using some() and includes() as Tim said
if (!prefixlist.any(p => message.content.startsWith(p))) return
because i'm trying to make it not case sensitive
then toLowerCase it

and in your original code it doesnt check for casing
you should get basic custom prefix working first before moving on
imho well

json is for stationary information
yes
like tokens and etc.
internet explorer config
Eww Internet explorer
ok
i tried this, it only detects the lowecase
but i don't want to make it case sensitive
I dont think you can ...startsWith(prefix || prefix.toUpperCase() || 1 || 2 || ...)
nope
then just don't use toUpperCase smh
@rugged minnow thats not how startsWith works
you should lowercase the message and have the prefix lower case then you only need one check
or any function
yeah but then the args then would get lowercase too @amber fractal
What do you even mean...
toLowerCase is non-destructive.

Damn I'm slow
yup
^^^^^^
No it's mine
oh
its just sharex
i know
I was told to change the subdomain to oliy
also, prefix == true so prefix || prefix.toUpperCase() returns prefix
it used to be images
I use ShareX too ๐
@compact oriole why is there two of the same lel
you can delete from local after upload
how do u have a custom domains
is there auto upload?

yes
i buy my domain
why even upload
how much is a domain
they differ
Because I don't want space taken on my pc
why do you need to save them
what's rhe chippest
idk
Because I take screenshots of things I go back to a lot
ah
affax how much do u pay
10 dollars a year
Found the auto upload
Now it only uploads and doesnt even save to my pc
at any point xd
that's what mine does
i just paste stuff directly to discord, without saving
I just love ShareX
ok nevermind
I can nuke Digitaloceans bandwith
same tim
the solution was actually pretty simple
The creator of it is in this discord
The creator if ShareX?
Yeah
i'm so bad at coding ๐
hello, im asking for how to send a private message to the members ?
in which lib
depends on your library, check your library documentation for more information
the orginial one
what language & lib
english
no coding language i meant sorry lmao
what
ShareX isnโt on Mac ;-;
@compact oriole https://is-just-a.dev if i rember rigjt og there
rip its down
affax.dev aint ;D
they have invlaid ssl
I use autorenewed free ssl
i dont have even any domain xD
https://i-am.affax.dev/l8UZi0Uz.png so close ;D
@restive furnace get one for free of freenom
@compact oriole you leaked your ip
no
ok
thats my server
and also, you cant do anything with ips xd
other than ddos
@empty owl idk why, but freenom blocked my ip
but they cant stealio anything
location but itโs like not accurate
^
Vpn?
u can block ddosses
too
xd
(differ than firewall cuz firewall blocks all inbound traffic on the port)
I donโt even host my web on my computer tho
i have too op vps 4vcpu, 16gb ram xd
Then how would someone ddos
who cares about anyone ddosing you
wouldnโt they just ddos ur vps
they would have no reason to
and yeah if u have line 10 gbps internet, its almsot impossible to ddos
Some people just be like that
ah
well if people are ddosing some random kid's vps then it's their fault for bein a dick
and they probably don't care
Lmao
so idk why people are fucking their shit up to prevent ddos attacks when it will literally never happen
most of the ddossing happens bcs of that, but some ddos happens w/out vps owner being annoying
funny
cloudflare
then it's their fault for not implementing basic security measures
you wouldn't give away root pass/ have root login enabled, duh
also if you haven such a capable vps why are you making discord bots lmao, it has so much more potential (unless you're hosting something else)
whats a ${thing} to see how long the bot is online?
thx?
y
We don't spoonfeed
well, most discord libraries have an uptime method
nope
${uptime}?
i just said that
ahhh
how to remove 3x 0 from that
${client.readyTimestamp - 000}?
i want to make a second so is this good if i want ${client.readyTimestamp - 000} seconds
timestamps are in miliseconds
ik
1 second = 1000 miliseconds
${client.readyTimestamp 1 * 1000} seconds?
...
bruh
idk how
do you know math?
i do, but not on javascript
its literally the same
just replace numbers with variables
var a = 1000;
console.log(a / 1000)```
like this? ```js
// Example: toFixed(2) when the number has no decimal places
// It will add trailing zeros
var num = 10;
var result = num.toFixed(2); // result will equal 10.00
// Example: toFixed(3) when the number has decimal places
// It will round to the thousandths place
num = 930.9805;
result = num.toFixed(3); // result will equal 930.981```
...
nah
also, while we are here
a timestamp is the amount of time passed since 1 jan 1970
you probably want this instead
well, that will work yes
but you dont need to create a variable
you can literally do / 1000
client.uptime / 1000
now while we are here in development 
^
TypeError: Cannot read property 'send' of undefined```
what
channel not found
but it logs message.mentions.channels.first() as a textchannel
.first().id
yeah lol
.addField("Propriรฉtaire du serveur", message.guild.fetchMember(message.guild.owner.user).tag) in my code i have this line but the output is undefined a solution please
please mention me if you have a solution (@cobalt mesa)
fetchMember returns a promise I assume
yes, it does
and to get the tag how do i do with fetching the owner
message.guild.owner.user.tag
at first i had this but on big servers the owner is not cached so i have the fetch
yes
await it or resolve it outside of the embed
.addField("Propriรฉtaire du serveur", await message.guild.fetchMember(message.guild.owner.user).tag) like this ??
and else how resolve it outside of the embed please @earnest phoenix
sorry for my questions but I never used fetch
the owner is uncached in big guilds
ah
yes but on big servers the owner is uncached and i don't get him
also loon, yes except you need to incase the await part in (), (await myAsyncMethod()).property
@wheat jolt #commands owner.user.tag undefinied
to get it outside of the embed you can also await it or you can use then(func)
oh ok
just I didn't understand when you say that I have to put in () can you explain again please
you have to incase the await invocation in () because otherwise you would be calling the property on the promise itself
await method().property you would be calling property on the promise
(await method()).property you would be calling property on the object the promise returns
ah yes
in my case like that suddenly (await message.guild.fetchMember(message.guild.owner.user)).tag
well
you can't access the owner object because the owner is not cached
use ownerID
(await message.guild.fetchMember(message.guild.ownerID)).tag ??
no
without .user and capitalise the D
(await message.guild.fetchMember(message.guild.ownerID)).user.tag
yup
i got this error when i test on this server
(node:1015) UnhandledPromiseRejectionWarning: Error: Invalid or uncached id provided. at Guild.fetchMember (/rbd/pnpm-volume/b0f90734-0105-435a-affc-58be85749d40/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/structures/Guild.js:653:38)
a solution ??
how to add time stamp to cmds
to the embed?
yes
yes but how to correct this
is your only goal here to get the owner's tag?
Guild#owner exists I think?
@cobalt mesa it appears there is a bug in djs stable
you need to fetchUser from the client
tag and avatarUrl but if i know how to get the tag it same for avatarUrl
fetchMember wont work
the fetchMember method sends the input to the userResolver, which has this line: if (typeof user === 'string') return this.client.users.get(user) || null;
so the resolver returns null, because the user is not cached
which then gets rejected here
user = this.client.resolver.resolveUser(user);
if (!user) return Promise.reject(new Error('Invalid or uncached id provided.'));```
so try using client.fetchUser(guild.ownerID)
yup
it returns a user object tho, not a member object
if you need the actual member object, you can then get it from the guild after fetching it
.addField("Propriรฉtaire du serveur", (await bot.fetchUser(bot.guild.ownerID)).user.tag) like this ??
RichEmbed#setTimestamp iirc
.addField("Propriรฉtaire du serveur", (await bot.fetchUser(message.guild.ownerID)).user.tag) ??
Looks good
no need for user
why
fetchUser returns a user
it's available since it is server
ah sorry i have miss the change client into message ๐
in any case thank you very much because it's been several days that I was looking for how to do and there you just solve my problem so thank you very much
๐
the owner has no avatar ??
it's possible
the avatar won't to show
you shouldn't make so many requests
ah sorry
let myvar = await ...
and then you can use the object from there
outside of the embed that is
ok
idk but if i specify a user it wont react or do anything ```js
if (command === "warn") {
if (!message.member.hasPermission("MANAGE_MESSAGES")) return message.channel.send("You don't have permission!");
let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
if (!rUser) return message.channel.send("Please provide a valid Ping or user id");
let repCH = message;
let reason = args.join(" ").slice(22);
let reportEmbed = new Discord.RichEmbed()
.setTitle("Warnings")
.setColor("#15f153")
.addField("Warned User", `${rUser} with ID: ${rUser.id}`)
.addField("Warned By", `${message.author} with ID: ${message.author.id}`)
.addField("In channel", repCH.channel)
.addField("Time", repCH.createdAt)
.addField("Reason", reason)
let channel = message.guild.channels.find(ch => ch.name === 'logs');
if (!channel) {
message.channel.send("Can't find a 'logs' channel.");
return;
}
message.delete().catch(O_o => { });
channel.send(reportEmbed);
}```
what
.catch(O_o => { }) 
anybody know what's causing this? it's giving little information so I really don't know why
nixos in nix-shell, here's my shell.nix if it helps ```nix
let
moz_overlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz);
nixpkgs = import <nixpkgs> { overlays = [ moz_overlay ]; };
in
with nixpkgs;
stdenv.mkDerivation {
name = "universe";
buildInputs = [
# Rust
nixpkgs.latest.rustChannels.stable.rust
# Stuff that rust sometimes need
pkgs.gcc
pkgs.binutils
pkgs.openssl
];
}```
how do i print a list of members with a certain role? (JavaScript)
what lib
turns out it was an issue on how I basically copied the target dir from my arch install to nixos which nix didnt like
running cargo clean then building again seems to have fixed it
How to get value from <input> tag using querySelector ? (html)
just select it using the element/class/id/whatever
then use .value
unless you dont know how to use querySelector at all
it should change the status type but it does not js if (command === "setmode") { if(message.author.id !== botConfigs.ownerID) return; let args = message.content.split(' ').splice(1).join(' ') if(args !== "online") { client.user.setStatus('online') } else if(args !== "dnd") { client.user.setStatus('dnd') } else if(args !== "idle") { client.user.setStatus('idle') } else if(args !== "invincible") { client.user.setStatus('invincible') } const e = new Discord.RichEmbed() .setTitle('Status Mode Set!') .setColor('#ff1493') message.channel.send(e) }
!== means NOT EQUAL
also you should use switch
yes
but it does not work
=== is a strict equality
no error
show
@surreal sage as cry suggested with that many else ifs you should use switch
how do i print a list of members with a certain role? (JavaScript)
@flint scaffold Eris or discord.js
discord.js im quite sure
well
you have to filter if the members has the role using Array#filter and then mapping by a string and then join it
or just fetch the role then https://discord.js.org/#/docs/main/stable/class/Role?scrollTo=members
nvm
@cobalt mesa because it's avatarURL
Tries to add feature that requires new module
Bot won't run, module not found error
Sudo previously required for it to run properly for some reason
Fixed it by removing sudo
mfw I fixed my bot by not running it as root
Is it just me who is experiencing MongoDB issues? Because if I do many commands that update the collection quickly, it will delete all the documents excluding the id but it changes the id from a String to a ObjectID.
Are there currently problems with vServers located near Frankfurt am Main? My bot is on a vServer there and does not play any music, i.e. it cannot enter the channel, it tries again and again, as if the internet connection was too weak.
How to make a prefix non-case sentivite? (my prefix is 'eevee', and i want 'Eevee' to work too)
-moreinfo
If you want people to be able to assist you, please provide more information, such as what library and language you're using, the code in question and what you are trying to do and/or what is causing the error.
(discord.js)
how do you handle that prefix right now
in the if statement do if (!message.content.toLowerCase().startsWith(prefix))
guys i know this is rly stupid but how do you use pip to get discord.py on windows? i got a fresh copy of python 3.8 and pip comes with it. (write @wispy vine so I can see it)
Just a brief note: I wouldn't advise using 3.8 just yet as alot of modules arnt yet compatible with it as of now maybe wait a little longer till using 3.8 and instead use 3.7
@earnest phoenix do message.content.toLowerCase().startsWith(prefix.toLowerCase())
well if the prefix was Eevee, it wouldnt work
that is, if your bot allowes changing prefixes per server
__
anyway, which would be faster, or better, a Set, or a discord collection?
The prefix is 'eevee'
And 'Eevee', 'EEVEE', 'eEvEe'... Works
ok thank
and, just saying, if the prefix was Eevee, it wouldnt work
but wh
doesnt matter
@modest maple use 3.6 ftw
im 3.7
but i noticed alot of modules dont yet support 3.8
alot of google's modules dont work either
Should probably get to 3.7 some time soon
Not much rlly changed
3.8 added the walrus operator which has protentially effected alot of modules
My friend found out the hard way after updating to find tensor flow stopped working
Oof
hi
hey, do you need anything?
bot.on('message', message => {
if (message.content.startsWith('/dm ') && message.mentions.users.size) {
var v=message.toString().split(' ').shift().shift().join(' ') // Takes the DM content from the message
var member=message.mentions.users[0] // The mentioned user
member.send(v) // send that user a DM
}
})
i'm using this code but message not sent!
when i say
/dm @granite pagoda test message
then nothing sent?
in the if statement, ur checking if /dm and any users are mentioned
maybe remove && message.mentions.users.size and make another if statement if any mentions of a user are specified in the if statement that is checking if the command is in the message content
I'm not gonna spoonfeed you
no not at all
well, what I am saying is
if idk then?
in the if statement you provided (if (message.content.startsWith('/dm ') && message.mentions.users.size)), you're checking if the command is "/dm" and if a user is mentioned
I'm saying is add another if statement if there is no mentioned users after the if block
That doesn't matter
but if user mensioned then ?
Yes
Should be a Collection
an extended map basically
I don't think you can index the map the way you're trying
Try logging message.mentions.users[0]
And you'll probably see the issue
@compact raft try message.mentions.users.first()
how to get a emoji id with :emoji:<idthing>
from a other server
\:emoji:
<:emoji:id>



