#development
1 messages · Page 630 of 1
stop blaming the programming language for your shortcomings
both have pros and cons but that doesnt mean its the programming language's fault
A good developer doesn't blame the programming language for bugs.
JS sucks :^)
JS is imo simple language
but c# is better and faster
then use C#
i must use java
why
simple commonsense
because im working on an IRC bot delivers messages from game to dc just works with the java
If Java sucks, there woudnt be a game developed from Java imo
As I said stop blaming the programming language for you own fault
a programming language just follow the developer's code
and who wrote that code?
is it the Java program who wrote that code? lmao
also there is an option to make a C# wrapper that irc bla bla you do
thats why make a wrapper
why not make a Java server and just use websockets to send messages
imo a lot of possibilities if you just stop on complaining Java sucks
it doesnt need to be in event
it needs to be in global scope
but not the literal global variables
just in global of that file
@digital sparrow how to move file?
wtf i delete it where u know?
bc when you delete a message to quickly the message stay here
with a fcking ghost ping on the channel
and #265156361791209475 exists
oh
@dusky sedge?
Does this solution know?
]]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.
Anyone help me to createa bot
@ember matrix #502193464054644737
Just stick to one channel when asking questions, don't spam all the channels to get answers, you have already got your answer in #general
Python or JavaScript for beginners, then you can dive later into java. I recommend codecademy for you @ember matrix.
Really, it doesnt matter which language you learn first
@drowsy sentinel python
result[0].noprefix then this is undefined
yeah but if the code is complaining about noprefix is undefined, then it is undefined
its probably an issue with flow or something you forgot to clean or add or something
specially if thats an public bot, users may have found a way to break your bot
causing that noprefix to be undefined
then did you actually console.log noprefix on that ?
console.log the whole result[0]
not the var noprefix
where did you put that?
where in the if result 0
please include the whole code if possible
oh
the culprit is if(result[0].noprefix)
you put false in the settings
then that wont work
if(result[0].noprefix)
that line will never execute
var noprefix = result[0].noprefix
because you literally said the code to not execute that if its falsy
eh
How to add line is canvas npm
change the Y position
I want a thick line
ctx.strokeStyle = 'rgba(0,0,0,0.5)'
ctx.beginPath()
ctx.lineTo(50, 102)
ctx.lineTo(50 + text.width, 102)
ctx.stroke()
Code
@quartz kindle
Sorry
For ping
How do I check if a channel is nsfw? (with nodejs)
textchannel should have a readonly nsfw boolean.
channel.nsfw
@pallid zinc ctx.lineWidth
Thanks
ok thx
ctx.lineWidth = 100;
what do you mean line height?
can anyone give some advice on how to make a web dashboard for my bot?
learn how to run a webserver, how to use oauth2, how to use html+css, how to connect to your database
What webserver should I use?
I'm fine with coding the website UI but the webserver and etc I need help with
Apache2 
my role??!
Which role
you can run a webserver inside your bot using something like express
or you can run a separate webserver (recommended) using something like nginx on linux
the separate webserver needs to have access to your database, so if you use something like sqlite, the server should be in the same machine as the bot
you should always reverse proxy your internal web app
Does anyone have any idea how to use webhooks with amazon ec2 t2.micro
Hi i want sort this for example a user data : { ID: 'userInfo_403159739178942464', data: { niveau: 1, testing: 0 } }
My copde does not work and i test every solution but does not work : ```let lvl = db.startsWith('userInfo_', { sort: '.data' })
let content = ""
try {
for (let i = 0; i < 10; i++) {
let user = bot.users.get(lvl[i].ID.split('_')[1])
content += `${i + 1}. ${user} ~ ${lvl[i].data}\n`
}
let embed = new Discord.RichEmbed()
.addField(`Classement par Niveau PVM`, content)
.setColor("RANDOM")
message.channel.send(embed)
} catch (err) {
console.log(err);
}```
@quartz kindle startsWith work now 😉
But i can't arrive to make my ranking
Hello
Hello
What is your code?
if (db.has(`capsE_${msg.guild.id}`) === false) return;
if (db.has(`capsE_${msg.guild.id}`) === true) {
let x = /\w*[A-Z]\w*[A-Z]\w*/g;
if (msg.content.match(x)) {
if(msg.content.length > 4) {
if (!msg.member.hasPermission("ADMINISTRATOR")) {
msg.delete()
var y = await msg.channel.send('*Caps detected!*')
y.delete(5000)
return
}
}
}
}
});```
This @cursive dagger
Hi who can help me please : https://discordapp.com/channels/264445053596991498/272764566411149314/586525421223542792
Is there an error in the console? @earnest phoenix
no @opaque eagle
@late hill me ?
No
@earnest phoenix
If you don't get any errors, check if the code is even executed
Using some logs for example
@late hill fixed
You should also check if the message was sent from a guild
Nobody can help me ?
its hard to help you if you provide that little context
even I cant understand what you are trying to achieve
@lofty hamlet what's even your problem?
My code does not work and i test every solution but does not work :
what is does not work
what is solution you did
I want make a ranking with my db
what is the error
uh
lots of missing context
Just use json? Idk
And my code is here : https://discordapp.com/channels/264445053596991498/272764566411149314/586525421223542792
No
I use quick.db
can you send a screenshot instead of an channel link
or just send the code here
literally just read that page
The code is in this channel
Just click here
@sinful lotus no my system is different
I dont see how its different if you just want to sort it
I want make a ranking with this : { ID: 'userInfo_403159739178942464', data: { niveau: 1, testing: 0 } }
No
I want sort .niveau
then do db.startsWith('userBalance', { sort: true, sortBy: '.niveau' });
documentation never used .data
the examples there are pretty straight forward 👀
Yes i have try this db.startsWith('userInfo_', { sort: true, sortBy: '.niveau' }) but he send all of db of user i want he send juste .niveau
And just a top ten
literally follow the example code in the documentation
if it returns you the object
I have try a lot of system
why not access the object value?
Im literally pointing you in the r ight d irection

they have a documentation and I HAVE READ IT
/* In this example, assume the data is stored as follows:
{ ID: 'userInfo_1', data: { username: 'User', balance: 9000 } }
{ ID: 'userInfo_2', data: { username: 'User1', balance: 500 } }
{ ID: 'userInfo_3', data: { username: 'User2', balance: 10 } }
{ ID: 'userInfo_4', data: { username: 'User3', balance: 4000 } }
{ ID: 'userInfo_5', data: { username: 'User4', balance: 300 } }
{ ID: 'userInfo_6', data: { username: 'User5', balance: 50 } }
{ ID: 'userInfo_7', data: { username: 'User6', balance: 9999 } }
{ ID: 'userInfo_8', data: { username: 'User7', balance: 700 } }
*/
// NOTE: Sorting is optional.
db.startsWith('userBalance', { sort: true, sortBy: '.balance' });
/* Output:
[ { ID: 'userInfo_7', data: { username: 'User6', balance: 9999 } },
{ ID: 'userInfo_1', data: { username: 'User', balance: 9000 } },
{ ID: 'userInfo_4', data: { username: 'User3', balance: 4000 } },
{ ID: 'userInfo_8', data: { username: 'User7', balance: 700 } },
{ ID: 'userInfo_2', data: { username: 'User1', balance: 500 } },
{ ID: 'userInfo_5', data: { username: 'User4', balance: 300 } },
{ ID: 'userInfo_6', data: { username: 'User5', balance: 50 } },
{ ID: 'userInfo_3', data: { username: 'User2', balance: 10 } } ]
*/
this code means
just use json. Dont make it overcomplicated
get the data that starts with USERBALANCE then sort them, then sort them by .balance
as you can see the .balance there starts from high to low
you clearly dont get the point
it's starting to sound like he's spamming that link
the example code shows .balance THAT DOESNT MEAN COPY IT
He send the sort db of the user but he send the all of db af the user
cause thats how it works
{ ID: 'userInfo_40315973917891233124', data: { niveau: 0, testing: 0 } }```
{ ID: 'userInfo_403159739178942464', data: { niveau: 1, testing: 0 } }
you have this data
you just need to change .balance to .niveau
then .splice the 1st 10 data from it
how hard is that if you just listened to me
quick db's
.startsWith(str, [options]) -> array
returns an array, meaning you can use array methods to it
array have .slice()
which accepts a start value and end value
where in in yoru case .slice(0, 10)
Hu
look at the example, then look what they did on that .startsWith() method, then adapt it to your code not copy it
Yes i have my array
Sort
And now i want a top 10 with juste the value of .niveau
Hum
then use .slice() method
I can't if i use console.log he send the values sorted but i use in a message he say it's empty @sinful lotus
uhmm what
are you sending it through an embed? if you get an error that it's empty, then your embed is wrong
@hushed quarry yes i send in an embed
your embed is wrong
No but in console.log he send the values sort
Just use plaintext for testing
But when i make this in an embed he is empty
your embed is wrong then
make it a simple embed, one that works, then add to it slowly and see where it fails
Now he send [object] [Object]
Hu ok so
array(text)?
array is not a function
Array(text)
Hu
VPS + PM2 good? or what?
@west spoke already : object object
turn it into string before sending it in an embed
^
use .map(x => x.property).join('\n')
Really idk what's saya mean but it should be work
@sinful lotus hu ?
.map returns a new array with the function you specified
then makes them a string via .join()
so you can use it on an embed
How i can map 🤔
array.map(x => `**${++index}.** [${x.title}](${x.url})`).join('\n')}
¯_(ツ)_/¯
.map returns a new "array" depending on function you use
.join() makes them a single string
VPS + PM2 Good?
@digital sparrow the VPS is where you run your bot, you need it, and PM2 is a decent process manager
personally i find pm2 to be kind of limiting, but it's good for beginners
thats just an example
thats my object
x is my object
title and url is the property
nevermind man
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map @lofty hamlet
my node-gyp has some errors
configure command gives errors
gyp info spawn args ]
gyp: binding.gyp not found (cwd: C:\Users\Win7\Desktop\Klas÷rler\JavaScript\Test) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node_modules\node-gyp\lib\configure.js:345:16)
gyp ERR! stack at ChildProcess.emit (events.js:200:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure"
gyp ERR! cwd C:\Users\Win7\Desktop\Klasörler\JavaScript\Test
gyp ERR! node -v v12.4.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
gr8
nobody knows anything
@hushed quarry yes but he send always object object
then parse the array into something you can send
how may i fix it
im bad at copying
you might find more success opening an issue on their github repo so someone there can help you
i cant
why not
im having good times with node-gyp for 2 weeks
cannot install bettersqlite integer or sth
im totally done
no more djs
so if i run only pm2 without vps is worth?
(node:15377) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token o in JSON at position 1
Lmao i want juste make a fucking ranking with quick db wtf
I am since 2h
i dont understand
read @lofty hamlet
tbh all you need is provided on you
I would rather blame the lack of experience with JS in your problem
we pointed you to lot of sources
gave you examples
even documentation link
@digital sparrow pm2 is just a process manager. You can use it on a vps or on your computer, doesnt matter
Using it or not using it doesnt have anything to do with running on a vps or not
So i rip buy vps or no?
If you want a reliable service yes
Its the only reliable way to run something 24/7
And you can get 2 years for free
1 on google and 1 on amazon
i dont understand
What dont you understand?
Hi the limit of the reactions is 25 or it is for one server or all servers or just the channel who the command is execute ?
some people have never heard of punctuations
how to move file form vps to pc or pc to vps?
You just connect to your VPS with FileZilla then you drag and drop files
idk how
download filezilla
put as ip your vps ip
as username put root
as password put your vps password
and as port put 22
or not root lol
just use root
ok thx you my hater 💌
lmao just download filezilla and r e a d
so how to move file vps to pc?
how wtf
mate
i can hardly believe youre not trolling
you completely ignore everything we say
i dint understod
Go google so
🙌
wtf
🙌
si
lmao
HOW USE FILLEZILA
google it
Hey, does someone know, how to create an Embed like this for your own website?
@lunar knot iirc its meta tags
okay thanks
Open graph
anybody know any c++
@late hill the latency of node.js's event loop probably
🤔
well if anybody answers ping me pls
There's also just event loop latency
I kniw next no nothing c++
not to brag or anything but i can write a C++ program that prints hello world so
P95 is probably 95th percentile
@queen violet What do you want to know about C++?
;
Why
How do I mention a role in Javascript?
Several answers said roleObject.mention() should work but those are over 2 years old so I figured that it's deprecated and that's why it hasn't worked.
have you tried reading the docs
there is no such thing as mention()
I use them most of the time but they can be difficult to navigate.
^
It doesn't tell me how to mention a roleObject.
I can view its properties and change stuff about it, but unless I've missed it a couple times it doesn't tell me how to mention it.
I might just be stupid.
Is it just <@roleObject.id>?
@&
<@> is user
<@&> is role
<#> is channel
<!@> is nickname
@spare shoal you still there?
Yeah
You can also just use .toString() on role object, user objects, guild member objects, and channel objects
And probably more
function sleep( millisecondsToWait )
{
var now = new Date().getTime();
while ( new Date().getTime() < now + millisecondsToWait )
{
}
}
if(message.content.startsWith(`${prefix}hec`)){
if(!mUser){message.channel.send("zimi pe cine sa hecuiest boule")}else {
message.channel.send("ii dau flood lu "+ mUser)
let passwordarray = ["s#rfAF4g", "f5$#FG","eGR2!F^","S#@d.H&*","Vbw%^&754","f#r$T45","9Am4_d].F6n","3g#WRF","32asLJH%","@95rD.vwGb","s*1.ad3Op","qyYWQ9%gRh"]
var parola = passwordarray[Math.floor(Math.random()*passwordarray.length)]
let emailarray = ["@yahoo.com","@gmail.com","@outlook.com","@hotmail.com"];
var email = emailarray[Math.floor(Math.random()*emailarray.length)]
let da = ["***","****","*****","******","*******","********","*********"]
var asta = da[Math.floor(Math.random()*da.length)]
message.channel.send("**Email:** ``"+mUser.username+asta+email+"``\n**Parola:** ``"+ parola+"``").then(mesajnou =>{
sleep(1000);
mesajnou.edit("**IP:** ``127.0.0.1``")
sleep(1000);
mesajnou.edit("**Adresa:** ``dracu stie``")
})
}
}```
i tried to make it wait before editing the message
but instead of waiting one second and then editing and repeat
it sends the message, waits 2 seconds and edits at the same time
why
please use async/await and don't use vars
but how
idk
ok
this function
the fuck
will loop until the time has elapsed
and as while is synchronous
it will block the entire thread
until the time has elapsed
hardcoding passwords, best way of security
best password is 123abc
I can make it better by doing !123abc!
because epic gaming moments
Use promises and resolve after a certain amount of time
Ok, newbie here. I wanna add something to this to increase the value of my json file by 1
if(msg.startsWith(prefix + "cheese")){
message.channel.send(${message.author.username} made a cheese :cheese:);
message.channel.send("Total cheeses: " + bot.total.total);
}
use fs.
But constant changing of JSON files is something you don't really wanna do.
What is the best host with around 10GB ram?
You get what you pay for
What
@earnest phoenix restart bot, this server had a outage and your bot probably wasn't kicked at all
How can I make my bot get the user object of any user if I have their ID using the api?
Even if they don't share a server with the bot...
What lib?
No just the api endpoints
/api/users/{user_id} iirc
yep
...
Does anybody know a placeholder that will say what the channel that the command was ran from was called like if you run it in a channel called #test in the code the placeholder would have that code
I’m using discord.js
Reword that please?
If command was executed in a channel called #test, get that channel
That's what they technically mean
client.on('message', message => {
if (message.content.startsWith('test')) {
function channelSend(message, 'test')
message.channel.send('test')
}
}
function channelSend(message, command) {
const channel = message.guild.channels.find(channel => channel.name === "channelname")
channel.send('The command ' + command + ' has been ran!')
}
I didn't test, I'm guessing it is something like this.
IDK though
Ok so I’m working on a ticket system for my bot. The tickets name is the username of the person I wanted to ask is there a placeholder where I could compare it to the users username and have an if else output
Spoonfeed...
let me try my coed
@shy turret I’ll try it I have my bot restarting now
If only you didn't spoonfeed, my fam
It sent the same message for both even tho it shouldn’t have so it doesn’t work
The %close command it sent test for a channel with my username and without
Even though it shouldn’t have
So should I do msg.content.startsWith(msg.author.username) ?
If that's what you need
Well it doesn’t work it sends the error message for both even the one with my username
client.on('message', message => {
if (message.content.startsWith('test')) {
message.channel.send('hi')
command = 'test'
channelSend(message, command)
}
});
function channelSend(message, command) {
const channel = message.guild.channels.find(channel => channel.name === "channelname")
channel.send('The command `' + command + '` has been ran!')
}
When you send the message test (starts with), it will say in a channel named channelname a message and also reply to the command in the message channel.
@feral slate oh use == not =
Or ===
yah ^
I’ll try that right now
Depends on use case
Easily Googleable
it transfers text to numbers like
10 would be 10 and 1ooo0 is 10.
What...
nvm
@feral slate I think you can put bot.on('message', msg=>{ only once if u want to.
Adviced to
== and === don’t work
if (msg.content.startsWith === msg.author.username ) {
I’ll try that
also, you shouldnt be listening to multiple message events
Msg.content.startsWith === msg.author.username doesn’t work just tested it
Where?
if (msg.content.startsWith === msg.author.username ) {
msg.channel.send('test')
}
proper*
startsWith is not a property, its a function
what's after that if?
A space
lmao
what's after if (msg.content.startsWith === msg.author.username ) {?
then it just goes to the } else { thing
the brackets are not wrong
Msg.channel.send(‘test’)
the startsWith is wrong
if (message.content.startsWith('test')) { this is my code
and you shouldn't have .on("message") multiple times in your code
if(msg.content === "%close"){ also means it needs to be "%close" and there can't be any parameters (if u are using parameters)
I’m aware because all I want it to do is delete the ticket channel if it is called your username
Else it just say an error message
client.on('message', message => { is in my code...
bot.on('message', message => { with }); at the end is also cool for you
The reason I have .on multiple times is that sometimes I disable parts and that would just break the code
then just use it once?
Switch or if statements still would work
you can disable a part using comment blocks lol
just... use comments or booleans which are literally on/off states?
example........
the problem with listening to the same event multiple times is that it multiplies the amount of work your bot does
client.on('message', message => {
if (message.content.startsWith('!help')) {
message.channel.send('one command')
return
}
if (message.content.startsWith('!userinfo')) {
message.channel.send('second command')
return
}
});
only 1 listener with 2 commands
Do u happen to know another programming language? @shy turret
async def has_user_voted(author_id):
import urllib
voteurl="https://discordbots.org/api/bots/543966796944769044/votes"
for line in urllib.request.urlopen(voteurl):
json=line
if author_id in json:
return True
else:
return False
I'm getting a 401 for this
Do I need to do anything for it?
I am logged in and I can see it fine.
Does dblapi have something similar I can do for this?
you need to provide your token in the authorization header
that's an user ™ issue ™
Yeah, I figured...
imagine being a professional batch programmer
i recently updated to node.js 12.4.0 from node 11.15.0 and this happened
i've removed it, reinstalled it, and rebuilt it twice
kek
{
node: '12.4.0',
v8: '7.4.288.27-node.18',
uv: '1.29.1',
zlib: '1.2.11',
brotli: '1.0.7',
ares: '1.15.0',
modules: '72',
nghttp2: '1.38.0',
napi: '4',
llhttp: '1.1.3',
http_parser: '2.8.0',
openssl: '1.1.1b',
cldr: '35.1',
icu: '64.2',
tz: '2019a',
unicode: '12.1'
}
@opaque eagle
R u sure u re-installed it?
yes
idk tbh, sry
its fine
Anyone else having authentication issues right now?
Dont ask here?
im pretty sure im stupid, but im trying to color the warn and error messages but always make an error. This is my 4th attempt..
client.on('warn', '\x1b[33m' + console.warn);
client.on('error', '\x1b[31m' + console.error);
]]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.
ah ok
well im trying to color warnings and errors in my console to see them better.
I'm using discord.js
code:
client.on('warn', '\x1b[33m' + console.warn);
client.on('error', '\x1b[31m' + console.error);
lol
console.log('\x1b[33m%s\x1b[0m', stringToMakeYellow); //yellow```
Colors reference:
Reset = "\x1b[0m"
Bright = "\x1b[1m" Dim = "\x1b[2m" Underscore = "\x1b[4m"
Blink = "\x1b[5m"
Reverse = "\x1b[7m"
Hidden = "\x1b[8m"
FgBlack = "\x1b[30m"
FgRed = "\x1b[31m"
FgGreen = "\x1b[32m"
FgYellow = "\x1b[33m"
FgBlue = "\x1b[34m"
FgMagenta = "\x1b[35m"
FgCyan = "\x1b[36m"
FgWhite = "\x1b[37m"
BgBlack = "\x1b[40m"
BgRed = "\x1b[41m"
BgGreen = "\x1b[42m"
BgYellow = "\x1b[43m"
BgBlue = "\x1b[44m"
BgMagenta = "\x1b[45m"
BgCyan = "\x1b[46m"
BgWhite = "\x1b[47m"```
console.error(color)
oh
i think its that, not sure
ill try
never used console.error
tried it, but sorta weird
while running the error was the color but crashed the bot
lmao what
that's just the error doing it's job
I don't think you correctly handled it
You can use a npm module
yes
welp ok
And what is client.on('error' i didn't found anything about it, on discord.js docs and on google
Oh its very very old
It took me like 3 seconds. lol
Would it cut down on CPU usage more by running a sync or async in my setInterval in djs? 
I'm talking about function wise.
Run a sync or async
Cause this person wants their api queried every 10 seconds, and if there's a change it needs to continue down the list.
https://pastebin.com/k5Vhzs7i its my code. points and give plus leaderboard is working but Idcard is not working but no errors in console
I had it async, but for some reason it ended up reaching 100% CPU usage.
sync it's staying around 1-3%
GO
GOD
What
Change it to == 'idcard'
Ok
You force it to lowercase, but you check it against something with an uppercase letter at the beginning.
Hmm
Did that work?
i'm trying to submit a bot to discordbots.org but it says i need to join this discord first.
How to send message to all the member of guild
message.guild.members.forEach(member => member.send('hi'))
@pallid zinc
For d.ja
js*
Thats api abuse and a dick move
And doing it in this server will even get you banned iirc
yes, it is bvannable and they will remove the bot from their site
the better way would be to do an @ everyone
this way people can disable notifications if they want too
Who can tell me what's going on with the game messages from the bots?
@earnest phoenix discord is bad. Game messages sometimes disappear. Restart the bot to fix it
Thank you
async is just a wrapper around promises
you cannot change the fact JS = single thread
laughs in workers
thats why workers is invented afterall
thanks very cool
cool
@modern sable pls fix
Using JDA, I want to get the image/icon relevant to the game a user is playing. However, in RichPresense both getLargeImage and getSmallImage are often null, even though an icon is visible in Discord for the activity of that user. Any ideas how to get the relevant image/icon for a game by its application ID?
it probably is null because there's no image for the game 
Yeah, I doubt Fortnite and Destiny 2 have "no image".
However, their RichPresense has no image URLs in JDA...
because discord itself doesn't give it
i assume JDA does hacky stuff and tries to fetch the image from discord's cdn from the id
So the question remains, how to get the image for a game, e.g. using the application ID...?
hm
https://cdn.discordapp.com/app-icons/{application_id}/{asset_id}.webp?size={size}
i think that might work, though it might also be what JDA does too
Yeah, but the asset ID is something I don't have if it's not present in the rich presence 😦
I can see in the Game SDK that devs can provide it, but I can't see how to retrieve that information.
oh the property itself is null?
yes
It's only not-null if the activity itself has a special image. It's not always the actual icon for the game.
Example with an icon:
GameData(id=445956193924546560, name=Rainbow Six Siege, icon=https://cdn.discordapp.com/app-assets/445956193924546560/446301881636225042.png)
Example without an icon:
GameData(id=438122941302046720, name=Grand Theft Auto V, icon=null)
But both have visible icons when I check the user list in the Discord client
@heady zinc huh?
bot dmed me without explicit command
oh
ah
actually i think i know why
i remember finding out that games presence in discord was hardcoded as fuck
lemme try to find it
I need to get the list of assets first
Now I just need to find the right documentation for what "type" is in that context.
i assume 1 is large and 2 is small
proly, but I need to see if JDA has support for this somewhere before I implement my own handler
Thx for the help 😃
well you found it by yourself in the end so all thanks goes to you 😩
https://cdn.discordapp.com/app-icons/{application_id}/{asset_id}.webp?size={size} was the trigger, otherwise I wouldn't have searched for "asset ids".
!help
Hello
Hello
I found this in a website.
Welcome(client, {
privatemsg : "Default message, welcome anyway",
publicmsg : "Default Public Message where you can flag use @MEMBER to mention the newcomer",
publicchannel : ["recepción",]
})
Im using the discord-welcom npm
And he publicmsg don't work
How bot Play#4329 ??
with magic
explain
you mean like a progress bar?
calculate the percentage of progress then create a bar with the width percentage (which is the percentage of progress) of the max width of the bar
Ok
don't use the webhooks. you won't get them if your web server is offline. use their oauth api (even though it's a pain to implement)
How would the oauth api work then, I mean how to check if I got a new patreon?
read their docs. they have plenty of examples on getting it to work
including what the api gives as a response
I'd recommend finding a library that does the job for you though
just make sure you check declined_since in the response because they'll literally give you declined patrons + active patrons
@pale marsh that's no fun
it looks like there was a library for java
But it's not as time consuming ¯_(ツ)_/¯
but then I've found the webhooks and webhooks are usually realtime?
if your web server is offline, you will not get them
they resend the request after 1hrs, 3hrs and so on, if the webserver doesnt respond with 200
up to 5 tries or sth
if this involves patreon perks for your users, i don't think your users would want to wait an additional hour to get their perks tho
but w/e you do you
mhm
patreon webhooks aren't reliable enough to entirely rely on it
they don't always have discord id
Weird
oh yeah i forgot about that, that too
but adding support for it would still save time for some of your users
That's on purpose?
it's because not all your patrons have their discord account linked
if your patron doesn't have their discord id linked at the time they subscribe, then yeah it won't show
Gotcha
so yeah you should mostly use the oauth api, and as justin said check declined_since
these fuckers will even give you people who aren't even your patrons but only subscribed to your page 
i have an explicit check to see how much they donated, it's really annoying
yeah patreon's api is a dumpster fire
Wdym?
Awaiting a message isn't a Discord API thing... some libs provide it, but it's just programming logic underneath the syntactic sugar.
symbol: variable BOT
location: class Main
6 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
1 actionable task: 1 executed
Compilation failed; see the compiler error output for details.
4:18:39 PM: Task execution finished 'Main.main()'.
should i run with?
wait i think i fix that ]
nvm, fix i have a small issue in the code 
how do I check in discord.js, if anyone has a role (with ID)
?
So that only the role with the ID 475686675898568 the Say command can
Discord.js
What
Version
I'll assume stable
Node.js Version?
Then the link I sent
Ok
Their roles are a collection mapped by role id
Oof
A collection extends a map
No
That only the role Developer of the support server of the bot can use the Say command
@amber fractal
With ID?
Yes
Ok
The collection is mapped by id
Map.prototype.has(3745646775567)
?
or Map.prototype.has("3745646775567")?
Map.prototype.hasRole("3745646775567") ? @amber fractal
So, or?
what
Map.prototype.hasRole("3745646775567")
<GuildMember>.roles.has(id)
What is guildmember?
If you are trying to get roles of someone in a server from a different server you need to fetch the server
msg.author.roles.has(46555665)?
msg.member.roles.has(3675676678) ?
essentially
Okay
but the id is a string
?
What?
do u even know the basics of JS??
OK
a string '928' an int 822
The ID should be between ""
This is no role id
oh
It is a example id
ok
The right id is: 563784176063479809
msg.member.roles.has("563784176063479809")
?
Anyone know how to check if a user has nitro (games)?
DiscordJS doesnt support this so
Ask the User
Finna ask 4000 users brb
Good luck helping people learn getting spoonfed
also, if it violates tos why would they put it in their docs
To make sure the docs are fully documented
premium_type? integer the type of Nitro subscription on a user's account identify
Also it's probably there since the times when Discord didn't care about selfbots
eh
wasaap cool people
The Documentation in discord developer is a bit confusing for me
like i'd want to start doing cool stuff but the documentation doesn't explain well how to use a method
how do i remove the undefined
^
.addField("Name of the command", "desc")
@opal gust what method
im just learning js through a friend and discord.js website
i used that without the first part
@hushed quarry any method like let's say i want to get the user id
i dont want a separate title each time
it isn't explained how to use it
i had to use other websites to find a way but i want to understand how to use the documentation
you only used the first part
@graceful granite use .setDescription('**Commands**')
ok
field need to have 2 entries
but how do i get bot commands then a list of my commands
in that darker grey tone
@earnest phoenix
if you coded your bot, you should know how to access your commands
?
are you using a command framework or did you code it
i coded it
how are your commands set up
@hushed quarry don't want to annoying but did you get what i meant?
but i would like my field bot commands to have the list of commands under it
@opal gust you need to authenticate with an Authorization header set to your token
then do the corresponding method
(for bots, prefix the token with "Bot " -- space included)
@graceful granite you need to show code for me to understand what you're trying to do
found a way i can do it how i like not sure why but i got errors
i didnt before i added in a new line at the bottom and errors came up
it worked fine untill i added that bottom line, and its not the "" or ''
addField() takes 2-3 args and not 4?
hm?
yeah but i added a hyper link surely that doesnt count as an arg
Instead of putting 2 strings
Combine them as 1
If you want a newline put \n between them
didnt fix my error
Show current code & perhaps show the error 😂
You have another one in the bottom field
You could also send it all in one message
I think channel.send("regular message content", embed) works in discord.js
yes it does
oh thx
@graceful granite You can use \n if you want a newline in the embed field
thx x)
Anybody know a possible reason why my bot isn't getting all presence updates I expect? Or how to troubleshoot such an issue? I'm using JDA and I'm not receiving any presence updates for several users. Setting a logging breakpoint in net.dv8tion.jda.core.handle.PresenceUpdateHandler#handleInternally shows that I do not get all presence updates. What do I do now?
Same on d.js
You're only getting actual presence updates i.e. changing from online to idle to dnd etc
status changes arent going through for some reason
Is that only since recently?
😅 I thought I broke something when my bot was suddenly added to 10 huge guilds.
Is there any issue or support ticket etc I can track about this?
not that I know of
A Twitter message or anything else?
I'll tweet @cosmic surgeapp and see what happens... Don't have high hopes though 😦
Damn, I pinged a random user with that
Oops
(sry)
Happens
I just wrote a small d.js test and it's definitely a Discord issue/change.
ok i broke lavalink https://i.imgur.com/utixvKr.png what do i do
yes
it worked like 10 mins ago
i know 403 is forbidden
but the vid worked before
can u like curl the youtube link
and see if google thinks that you are a bot or something
from my bot?
from the machine that runs the bot
one guy
has the same issue
in the official jda server
- lavaplayer server
let me send you an invite
i got a long-ass thing when curling
2eGUuA that's the support server
how can i tell? looks fine to me
some people report 403 errors there too
yes with a quick read it seems that this happens when you use ytsearch a lot
do you have a dynamic ip
no
look at this, it's the legit way to search for youtube videos
you need an api key from google
does lavalink use your key
no
or it just scraps youtube
that's the issue
does your bot play the youtube video if you put the link directly
okay you just have to implement this class https://github.com/Kaaz/DiscordBot/blob/master/src/main/java/emily/util/YTSearch.java
that doesn't get you blocked from google
you will have to edit it a bit
too bad my bot is in c#
which part does the magic
the screenshot from the error above is java
There was a java.lang.something line
my bot uses a wrapper to communicate
yeah lavalink is written in java @bright meadow
k
yes but do you use it for lavalink
oh then it isn't an issue with the key
i thought lavalink was trying to search the video without the api key
nope
what lavalink version do you use
and now windows won't move the jar to the correct directory
ok now it works! epic.
guys I'm planning to make an online dashboard. My website is currently built in PHP (Laravel) so should I use something like forms to update data ? (don't bother me w/ php pls 🙏)
Forms works, but using client side js to send is prob better bq no reload so it's faster
async function createCanvas() {
const image = await fsn.readFile("https://cdn.glitch.com/b2838ab8-1d50-4644-b583-c093a6be8b39%2Fimageedit_1_9745658379.jpeg?v=1549225671662");
return new Canvas(300, 400)
.addImage(image, 0, 0, 300, 400)
.setColor("#FFAE23")
.setTextFont("28px Impact")
.setTextAlign("center")
.addText("kitten!", 150, 370)
.toBufferAsync();
}
};``` how do i make bot send the canvas
@fiery stream save it and attach it
