#development
1 messages · Page 722 of 1
for javascript you'd use node.js, for c#/any other .net language you'd use .net core
What's up, Shinya

No chatting here.
I hope you saw their question
shivuwu do you know how i get the url from the from a attachment?
@cedar brook please dont minimod
message.attachments[0]['url'] give me a error
Yeah Attachment object isn't a dict
I am not. @loud salmon

;-;
you were telling people what to do and to stop chatting
when they werent actually breaking any rules
Read topic please.
can you explain me how i get the url?
I am just trying to don't break rules.
I do know the topic
and they were chatting about bot development
they were just being polite
and saying hello to each other first
@glossy vigil Tried <Attachment>.url yet?
with <> ? no
The, hello Spider, what's up?
Not literally my fam
lets see
message.attachments is a list consisting of discord.Attachment objects
By doing message.attachments[0] you get a first item from that list, which will be an instance of discord.Attachment
Now, that instance should have property url
Or on <1.3.0 versions, stringify the object 
print(message.attachments[0]['<Attachment>.url'])
this like?
Nop
Attachment object (message.attachments[0]) is not a dictionary
it's a separate object with its own attributes
ah 😮
And what I meant by <Attachment>.url is Attachment object should have an attribute url, which by itself should return a link
Hi, how i can get the id of all personn of a discord ?
How ? 
how i get from message.attachment[0]
to <Attachment> then?
A simple iteration, get member.id 
why do people not know how to do their research
it's discord
its spam i know
why do people think everyone's working in the same language they're working in
cry, we all are genius thats why
message.attachments[0] is already the Attachment object
<Attachment> in my messages is supposed to be replaced by your Attachment object, which you get by getting the first item of list message.attachments
You don't literally put <Attachment> in your code, nor do you get it
It just stands for "Attachment object"
So I want a sertain message to go into a embed that will track when someone says something and end up in a Embed saying Completed or Uncompleted If its uncompleted they didnt type A
If its completed they did Can someone help make that and Dm me
and no, it's not a key that you access in a dict
i can not handle this as a list, not as a dict.
how than?
message.attachment.url don´t works too 😂
I am stupid i know
How did you get the Attachment object itself
print(message.attachments)
That doesn't exist
why are you disregarding everything that's being said
you already got told you have to use message.attachments
however, since it's a list of attachment objects, you need to get one out of it, by indexing
NonType
what
How did you get the first item of message.attachments
or really anything from that list
Oh well, your i variable inside the loop is an Attachment object
and that object has attribute url
ok.
now i have understand 😮
... I just hope you don't send a message per attachment...
Every Discord.PY Bot Tutorial:
@client.command```
ME:
```python
if message.content.startswith('&rng'):
print("[FLAME] RNG Command Sent")
args = message.content.split(" ")```
why? cause its the only method that works
ok
No
Every discord.py commands ext tutorial:
@bot.command()
You are not supposed to name an instance of commands.Bot anything other than bot or anything similar
Especially if you, for some unknown stupid reasons, use both discord.Client AND commands.Bot in your code
console.log(i.id)
}``` does not work, no error
Don't you need to use i.user
I do use what ?
.id seems to be an attribute of an User object
you can use id on a guild member too
members is a collection, which implements a map
interesting
yeah py's version of that is a dictionary
KK
So I can pretty much say that dict is a JS Map?
arent dicts more like objects in js
if (member.id != bot.user.id && !member.user.bot) console.log(member.username)
});```
Good track?
people here have to understand not everything is going to be first try, run it, see if it does what you expect, if not, go back and see where you went wrong
foreach provides you with three arguments
look at the doc page i sent you
{
"guildid": "",
"premium": "",
"cooldown": "",
"binds": [
{
"bindID": 0,
"bindGID": 0,
"bindROID": 0,
"bindALLWDRLS": 0
}
]
}```
Any ideas how to use NodeJS to add a 'binds' *object*?
I can't quite figure it out.
I can add and remove lot of role of personn ona discord who have 1500 peronns ?
Or my bot get banned ?
LMmmh ok what is the rate limit ?
arent ratelimits flexible
?
yes, they are
ratelimits aren't static
they adapt to how much you respect them (which if you don't it leads to an api ban) and can change anytime
SoI can add a role to 1700 people?
🤦
yes, just add a 2-3 sec delay per person
if u really want to not get rate limited
itll only take a hour 😛
anyone know how to answer my question above?
if (member.user[sender.id]) {
if (Dresseur[member.user.id].Points <= 350) {
message.member.addRole("538459462734839829")
} else if ((Dresseur[member.user.id].Points >= 351) && (Dresseur[member.user.id].Points <= 650)) {
Dresseur[member.user.id].Grade = "Dresseur Novice (351 - 650)"
message.member.addRole("502550139693563906")
message.member.removeRole("538459462734839829")
} else if ((Dresseur[member.user.id].Points >= 351) && (Dresseur[member.user.id].Points <= 1000)) {
Dresseur[member.user.id].Grade = "Dresseur Branché (651 - 1 000)"
message.member.addRole("502549651560464395")
message.member.removeRoles(['538459462734839829', '502550139693563906'])
}
}
});```
For exemple
I want make this
If i add timeout of 4-5 seconds i have legit ?
I do not want to be deprived of API
oh god
@sudden geyser what ?
lel
{
"guildid": "",
"premium": "",
"cooldown": "",
"binds": [
{
"bindID": 0,
"bindGID": 0,
"bindROID": 0,
"bindALLWDRLS": 0
}
]
}```
Any ideas how to use NodeJS to add a 'binds' *object*?
let binds = {}
@frozen cedar
Also why is there an array in binds
{
"guildid": "",
"premium": "",
"cooldown": "",
"binds": {
"bindID": 0,
"bindGID": 0,
"bindROID": 0,
"bindALLWDRLS": 0
}
}```
wym?
isnt that propper formatting?
the array i already have in binds is an example of what i want to push into the object
@short siren
also just setting another array variable doesnt help, i gotta be able to push it into the json as a whole
I need to know how to turn this
{
"guildid": "",
"premium": "",
"cooldown": "",
"binds": [
{
"bindID": 0,
"bindGID": 0,
"bindROID": 0,
"bindALLWDRLS": 0
}
]
}```
into this
{
"guildid": "",
"premium": "",
"cooldown": "",
"binds": [
{
"bindID": 0,
"bindGID": 0,
"bindROID": 0,
"bindALLWDRLS": 0
},
{
"bindID": 1,
"bindGID": 0,
"bindROID": 0,
"bindALLWDRLS": 0
}
]
}```
Ohh, That's what you were trying to do
@frozen cedar It's an array so you can just push
i can push a whole object?
that's what object oriented programming is all about
you can push anything you want
let target = {
"guildid": "",
"premium": "",
"cooldown": "",
"binds": [
{
"bindID": 0,
"bindGID": 0,
"bindROID": 0,
"bindALLWDRLS": 0
}
]
}
const source = { "bindID": 0, "bindGID": 0, "bindROID": 0, "bindALLWDRLS": 0 }
target.binds.push(source)
console.log(target);```
Mine doesn't look that neat as it was quick ignore inlines
oop ftw
well my clear command broke itself
F
@lofty hamlet Make sure you're doing it right
Don't just setTimeout() your loop lmao
I get this problem a lot in the mysql database, I use keyv to upload data, discord.js
2019-11-03T21:41:09.382506+00:00 app[worker.1]: (node:22) UnhandledPromiseRejectionWarning: Error: Incorrect string value: '\xF0\x9D\x90\x98\xF0\x9D...' for column 'value' at row 1
2019-11-03T21:41:09.38252+00:00 app[worker.1]: at PromiseConnection.execute (/app/node_modules/mysql2/promise.js:102:20)
2019-11-03T21:41:09.382524+00:00 app[worker.1]: at sql (/app/node_modules/@keyv/mysql/src/index.js:19:30)
2019-11-03T21:41:09.382526+00:00 app[worker.1]: at connected.then.query (/app/node_modules/@keyv/sql/src/index.js:39:19)
2019-11-03T21:41:09.382529+00:00 app[worker.1]: at <anonymous>
2019-11-03T21:41:09.382531+00:00 app[worker.1]: at process._tickCallback (internal/process/next_tick.js:189:7)
2019-11-03T21:41:09.382724+00:00 app[worker.1]: (node:22) 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: 1)
2019-11-03T21:41:09.382846+00:00 app[worker.1]: (node:22) [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.
and I don't know why it is
are you trying to save emojis?
@quartz kindle no
what are you trying to save then?
but I have never saved what they write, that I remember
normally it's only true or false
double check it then, because that error says its not
or links
what kind of links?
images
and now i had to remove error messages from my clear command just to get it to work again
the error messages which told it that if it did not have an argument filled out
One message removed from a suspended account.
@distant plank the reason for the error is that the underlying database that keyv is using (keyv is not a database, its just an interface) does not support or is not configured to support certain characters, like multibyte characters
so you need to find exactly what characters are causing this error, can be an emoji, a character in a different language, or some weird character
and then report this error to the keyv developers
or check if the underlying database can be configured to accept multibyte characters
for example in an sql database, you would need to change the encoding from utf8 to utf8mb4 or something
@quartz kindle I think it's because I have a function, that when you delete a message, save the deleted message so I can show it with a command. maybe they use emojis
One message removed from a suspended account.
One message removed from a suspended account.
or, if your situation accepts it, check your data and remove such characters from it before saving
One message removed from a suspended account.
One message removed from a suspended account.
@sage bobcat no, i dont use mongo
One message removed from a suspended account.
@sage bobcat only in that I use it
xD
@quartz kindle how can I delete the characters ?, or make them not appear in the database but if when it is obtained or something?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
@sage bobcat snipe command :C
a hacky way would be to check the length of each character
One message removed from a suspended account.
One message removed from a suspended account.
idk if it will work, never tested it
I have another question :v
I have a code that is to detect spam, in Spanish
But it makes the bot slower, is there a way to simplify it or not more ping, giving the same result?
var affectbotsenadis = await keyv.get(
"spam" + "affectbots" + "enadis" + serverid
);
var delmsgenadis = await keyv.get(
"spam" + "delmsg" + "enadis" + serverid
);
var getsupsafeenadis = await keyv.get("supsafe" + "enadis" + serverid);
var getenadis = await keyv.get(
"spamprotection" + "enadis" + channelid + serverid
);
let messagewom = message.content.toLowerCase();
let messagewod = messagewom
.normalize("NFD")
.replace(
/([^n\u0300-\u036f]|n(?!\u0303(?![\u0300-\u036f])))[\u0300-\u036f]+/gi,
"$1"
)
.normalize();
if (messagewod.includes("acaba") || message.content.includes("unio"))
return;
else if (messagewod.includes("unanse") && messagewod.includes("server"))
avise();
else if (messagewod.includes("unir") && messagewod.includes("server"))
avise();
else if (messagewod.includes("uniros") && messagewod.includes("server"))
avise();
else if (messagewod.includes("unios") && messagewod.includes("server"))
avise();
else if (messagewod.includes("unanse") && messagewod.includes("server"))
avise();
else if (messagewod.includes("unete") && messagewod.includes("server"))
avise();
else if (messagewod.includes("une") && messagewod.includes("server"))
avise();
else if (messagewod.includes("unanse") && messagewod.includes("servidor"))
avise();
else if (messagewod.includes("une") && messagewod.includes("servidor"))
avise();
else if (messagewod.includes("unir") && messagewod.includes("servidor"))
avise();
else if (messagewod.includes("uniros") && messagewod.includes("servidor"))
avise();
else if (messagewod.includes("unios") && messagewod.includes("servidor"))
avise();
function avise() {
if (affectbotsenadis == "false") {
if (message.author.bot) return;
}
if (getsupsafeenadis == "true") {
if (message.member.hasPermission("MANAGE_MESSAGES")) return;
}
if (getenadis == "disable") return;
if (delmsgenadis == "true") {
message.delete();
} else {
if(message){
message.react("⚠");
}
}
const embed = new Discord.RichEmbed()
.setDescription(message.author + ", Cuidado con ese spam")
.setColor("RED");
message.channel.send(embed);
}
what makes it slow is keyv
you have several database queries for each message
thats very bad performance
:o, how is that used
get what you need from the database once, and save it into a variable
then use that variable everytime
what do you mean?
a variable will not lose its value unless you change it, or the process dies
oh
bruh
oh god that codeblock
there was worse
when in doubt, add another else if
ok so im working on a rest image api similar to nekos.life but with more images, more endpoints and no registration required. thought i would post about it here since all my projects never take off :/
anyone interested in using it in their bot
im also writing a node wrapper
Is this an ad I smell
I will gladly buy knowledge.
if anyone has jojo's dvd's ill gladly pay 100 sheckles
btw Riku can you DM me the api
its not up yet, im still working on it
okay
@zinc condor what's it called?
i like the logo XD
icon... profile... i dunno what to call it
its more logo like than anything tbh
beating an already popular service is ambitious and yeah id classify that as an ad
the problem with making things anonymous is you have to be prepared for anything
anonymous? wym
yep
also if it does take off are you ready to scale

you should look into creating file servers/clusters in that case
well i mean... i have a vps on google cloud and a cdn ready, the vps has max bandwith of 4000gb per month
so with my locale system it's all stored in a db, and i was wondering whether i should cache the data or not
if it is cached, it uses more memory, but it means the bot wouldn't be querying the db for every message
if it isn't, it's less memory but for every valid command message it'll be querying the database
to be clear, all it'll be caching is a map with sever_id => locale ie. 454409434676854786 => en_uk
tony, databases can handle thousands of i/o operations per second
if its 16gb of files i have that means i can take 250 users requesting every single image 250 times a month
if your bot is especially large id suggest just not querying unless your db is blocking
i have 20k servers vysion
LOL ok then uhhh
dunno how many are active but a fair bit
i honestly think it comes down to what you prefer
well my rewrite is supposed to cut down on memory usage and clutter
cache sounds better imo
the tradeoff of memory usage vs db queries is not something in my control
then again more db queries could equal more memory usage
waIT i have cdn too so it can take 250 users and more due to the cdn caching the images
i use a really high-traffic db that handles loads REALLY well
but yeah
i'm not sure what's better, caching or querying constantly
well i can explain the locale logic if it helps?
k
i assume you have a json/other language file
well in that case, if the locale doesn't change often definitely go for caching
on message:
getLocale(server id)
if cache has server_id
return locale_id from cache
if not
query db for locale_id
set cache as server_id:locale_Id
return locale_id
the db just stores the locale id like en_uk
yeah that sounds reasonable
then i access the file ie. locales/en_uk.js
to be fair, if servers are not setting their locale often this would be a good choice
you know what they all say though, try it and see
it doesn't get changed much
if you're monitoring performance and see anything different then you know what's better ig
most people stay on en_us
hmm
also anything is better really, i currently somehow manage 10gb memory usage
what about if the server locale from the db is different than en_us
wait is there a tool to track how many times a certain api endpoint has been hit
@zinc condor pretty simple to track it
that would cut down on the amount you would have to save to memory greatly
on request: have a variable and +1 it
yeah i was gonna use statsd but thats extensive for something pretty simple
prometheus is a thing
yeah if it checks default, but i don't know the best way to implement it
An open-source monitoring system with a dimensional data model, flexible query language, efficient time series database and modern alerting approach.
hmmm
most people use en_us and some change it
i mean think about it this way
easy enough :/ ill set this up
if more people are using en_us but only some servers are changing their locale
do you update it when the user changes locale
you would check for if the server's locale is not en_us
and if not, cache it
wait nvm
wait i have an idea
that would require a query every time LOL
based off that, i could check if the cache has the server, if not, i assume its en_us
if its in there i use that
big brain time
that would mean iterating over the cache
idk if that would cause more memory usage or not
it's just a map
oh a map
so map.has really
smh yeah
i think that'd be decent then
there's no "amazing" way to do it
i have to try not to butcher my db and i need to keep memory low
dunno how to reduce memory usage generally though
i set up a message sweep but idk
clustering
nah jk
in all seriousness i think you should go for caching judging on what you talked about
alright
honestly who, who cares
my api has more debug and error endpoints then my actual feature endpoints
oh and i have one endpoint that just sends jojo images and memes
OH SO YOU ARE APPROACHING ME
you mean an image manipulation api
lmao
:/
2 gigs of collected jojo static images
not even collected for the api
they were on my desktop
for like a year and a half
and i just kept adding to it
where do you see your api 1 year from now
large, with a collection of servers or dead
uhm..... yes
large i guess
imo id agree
what have you done specifically
when making an api like this you needa prepare
nekos.life generally has a bad reputation now
on ksoft we deny bots for using it's nsfw endpoints
apis have their lifetimes unfortunately
Yep
the idiots api died for example
nekos.life is where I go to do my research
you may have heard of pomf & mixtape
@sudden geyser oi bad
they died bc 4chan and copyright
nah, not that research
well i have a vps with enough bandwith to have 250 people load every single image once and i setup a cdn so less bandwith is used
can i have a source on that chief
bruh what you're making sounds like that
im making nekos.life but with MORE images
@sudden geyser ah yes, wrong organic tissue types. It's nearly impossible for cat ears to be put on a human
lul sure
You better watch what you say before I convert you to a cat girl
if it does gain popularity feel free to come back and get help with scaling
i have 8 thousand
owo
and i doubt they have that much
well ok what im having as a "feature" is an endpoint request area for people to request endpoints to be added, they can also attach images which helps their chances of the endpoint being added
sounds a bit overcomplicated but ok
Like I could suggest a catboy endpoint along with an example image?
yeah
you could also attach a zip
which is thrown into the endpoint
so people can add their own images to endpoints after review
Sounds a bit over complicated for just an endpoint. How about having a form on the main page and allowing devs to suggest endpoints like that?
or just both
also fetch the list of endpoints and list them on the main site so people know what exists and what doesnt
yeah im doing that
along with their statuses like pending, active, removed, etc
yeah
when you go to the api url it shows you all the stuff aswell
i removed the img because lewd stuff is on there :/
Uh need help i even tried to make the brief description shorter and it still didn't work, if anyone can help me please dm and explain how i can fix this. I would appreciate it
@earnest phoenix for brief description just put a intro to your bot Example: A basic Moderation & Support bot coded in Blah Blah Blah
Should work
you just exposed your bot client id
Who honestly cares
xd
👻
Sometimes my bot just says [object Object] [object Object] when I do any command. What could it be?
only sometimes though
no
lul you didnt get the joke
i get this too many times

oh wow it worked thank you so much riku
no problem :3
@coral trellis
Where is NSFW command? ...
hug, kiss, hit are NSFW commands? No. Why did you reject my bot?
It mentions NSFW in the description
I said it contains NSFW commands. What's wrong with that?
I will have to. Thanks for the answer 
Does using command handler help decrease bot ping?
it can
How to fix this problem ??
message.member.voiceChannel.join().then(function(connection) {
})
@lunar crystal
probably stupid question but is there still a way to detect when someone has voted without webhooks
cos when i use the example on the dblapi.js docs it logs this
Webhook running at http://0.0.0.0:3000/dblwebhook
or is that normal
Yes its normal
Then you need to paste that url in your bots edit page webhook address in the website, but replace 0.0.0.0 with your servers external ip address or your project url if using glitch/heroku/etc
if its running ont he same port yea
if you have a webhook running on a port nothing else is on
should be fine
alright thanks
is it possible to get the message when someone response the bot's in DM ?
lol
If you're shooting yourself over C++, you should take a look at JS before it was tolerable.
To shoot your foot in js you need to shoot every single dependency your foot was built with
betterToenail.js
you go to shoot yourself in the foot
first you have to import 30 node dependencies
one for bullet metal, one for bullet explosive, one for bullet casing, one for trigger... etc
then before you go to fire, you get stuck in an endless loop of dependency updates as one of them has a vulnerability and a fix available
😄
@sudden geyser begs the question, when did JS become tolerable, or are you all using it because its the most supported language? 🙂
theres a reason im using C++ lol
- emc5 or emc6 too
at one point, js was just microsofts 'extend, embrace, extinguish' tool for stomping out netscape
i think if there wasnt firefox and chrome, it might have stayed that way and js may have been a forgotten dead language
Yeah i think google's V8 engine is one of the reasons why js was revived
im still no fan of untyped languages, though
although iirc newer js does help a lot with regard to that
Im used to it, so for me its weird to use typed langs
i originally wrote the discord part of my bot in php
if you think js is bad, try that 🙂 especially with an abandoned lib
of course, but like most languages, not natively
you hafve to use a symfony lib on top of guzzle
in C++ you use ASIO and websocketpp, or uwebsockets
php ws comparison 
LOL
lol
if discordphp was on that list, it can do most of those things
but, its abandoned
it took serious work just to make it stable
wheres that table please?
i want to see if the lib im using now is on it
https://discordapi.com/unofficial/comparison.html is it this one?
and nope it isnt, no C++ ones
who do i speak to, to get extra libraries added there? i can name two you dont have that are in active development, and another thats dead
Ask in the discordapi forums or something idk
Or maybe they have a github for that page
Like they do for docs
Wait is discordapi.com even affiliated with discordapp.com?
discordapi.com -> discordapp.com/developers/docs/ -> blocked site because school admins bad.
I don't know, but I doubt
it looks like they'd reverse engineered api docs before discord officially made it public
now its public, theyve taken down their docs and redirected the address
however archive.org still has their old docs if anyones interested, they seem interesting 🙂
Did people reverse enginner discords own client to start developing bots?
Then discord said fuck it, and made bots official?
Not surprising, if thats how it went
Anyone know how to get server creation date using discord.py?
use the appropriately named property
👀
Does anyone know how to get the 27s, aka the time the song has been played?
I'm dumb, how do I see that?
@earnest phoenix thank u 😄
connection is not defined like it says
your bot failed to join the voice channel
Sorry I give u the wrong one 😬
well... yeah
you don't define the connection anywhere
of course it's going to complain
C'est un peu dégueulasse @lunar crystal
"Je suis prêt à caresser des gens"
C'est genre chelou de fou
This is outside from function thats why its not defined connection
@earnest phoenix do you have any sources for that image above
as in...?
It's funny either way xd
it is
those are his tweets
yeah but i meant links to the tweets lol
idk those
but they're old
http://web.archive.org/web/20130729213507id_/http://itc.conversationsnetwork.org/shows/detail58.html
Whether you're already a PHP user, or haven't yet taken the plunge, you'll enjoy this interview with its humble creator--a true pioneer of the open-source movement. You'll also hear what's in the works for the next major release, PHP 5.0, and why Rasmus believes the Web will ...
one of his quotes
on his old blog
can i ask here for discord aouth2 support or it isn't allowed?
whats the issue with it? xD
Well that would fit this channel 
^
i can't get the access token with curl
dashboard
Are you sending the client secret
i did it some time ago but now it doesn't work lol
yes
i can't get a good response even trying a request with postman
it says invalid client but everything is ok lol
User's login system
yes
to make a dashboard you usually want to authenticate the user
you need oauth2 to login
always
the thing is i did it some time ago without any issue but now it doesn't work
i also tried some examples from github and same happens
you could just use an otp but thats not very user friendly
anyways just make sure you are providing the right id and secret
Is your token valid?
it should
well where i'm stuck is getting the authorization token
this makes no sense for me (i will regenerate the secret code so np about the pic)
as you can see in the screenshot client id and client secret are both the same
yes
that's exactly what i'm doing
i got the code from /authorize
then i'm doing exactly what it says with /token
but the response is an error
shrug
f
One message removed from a suspended account.
One message removed from a suspended account.
if you want to do it like that, yes
One message removed from a suspended account.
as long as you provide a valid string to the function, yeah
One message removed from a suspended account.
its just args[0] if you dont count setavatar as an arg
One message removed from a suspended account.
One message removed from a suspended account.
args.join[0] makes no sense
join is a function
args.join(' ') if you want to join them with spaces
but you are providing a link anyways
why join??
Can't you just split the message content and then get the second item from the array
thats what args are
What is .join for, then 
i was wondering that too
One message removed from a suspended account.
first element of the array
That would give you the command name
if you dont remove the command from the argument array first
depends on your command handler/parser
One message removed from a suspended account.
args[1] then
0 ?!
I recommend you learn js before asking questions here
join[0] makes no sense and you, the person who coded it, should know what args[0] means
@sage bobcat
Learning Javascript will be whats going to be most helpful to you
You wont get anywhere you want to be by following a guidebot tutorial
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Some noroles have proven themselves to be smarter and/or more mature than 80% of this server
Just because they don't have any roles does not mean you are free to disregard all of their words
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
after calculating some things
im gonna use google cloud platform for the storage for images
on my api
ol ive been using gcs for years
yeah
what worries me is 20 bucks is for 1000 gb out
while my vps itself has a 3tb bandwith limit
i dunno if i should use google or just use my vps to host the files
wait my bandwith overage limit after 3tb is 0.01$ per gig after 3tb
i think im ok for now but if this thing grows ima have to switch to google
legendarystars
@proud valley what?
he's advertising
worst advertising I've seen

hi
hi
Is there a reference documentation to better unerstand discord api other than its orginal api page
the original api of discord?
Yes
well, it's explained pretty good on discord's api webpage
Wait what are the discordapi endpoints? I've never actually been able to find them.
@sage bobcat im a whitename who's been a developer longer than u, I was cert dev and web mod here. I can tell you to learn Javascript because you lack the knowledge of basic array functions. You also say your repository is Typescript but there isnt a single ts file in your repository.
I wouldnt be so quick to deflect your criticism with "whitename" as if me having a white name doesnt mean im a dev.
Im simply telling you that itd be more beneficial for you to gain a base of knowledge in the language you are trying to use before you attempt to seek help in a subject area you dont understand. I tell you to learn js first because once you know things like basic array functions your abilities will grow tenfold and you can spend less time explaining your issue in a dev chat, and more time actually creating features
One message removed from a suspended account.
Understandable
One message removed from a suspended account.
One message removed from a suspended account.
imo you should discuss this in DMs guys
I don't think you dont know anything, Im just saying that args is something that you defined so you above anybody should know how this works. And not knowing basic array functions tells me that you probably copypasted your args variable. Im not trying to discourage you im literally just saying that you should try to learn everything you can about the language so youre not wasting time asking devs to help you, and you can instead spend that time actually developing your features. I didn't intend to offend you if that's how you took it. Don't get so easily offended, and don't try to deflect all criticism with poor excuses like not using variables that you defined using array methods that you do not understand. Once you learn more about the language, your eyes will be opened to much more and you wont normally have problems like this in the future!
One message removed from a suspended account.
I did but then he wrote me off as "uh dumb whitename telling me to learn js i already know js" when he clearly does not know. Im just saying, when you talk in this chat, it is nobody's responsibility to baby you or explain basic concepts. When you ask for help here, expect constructive criticism
Chill tanner lol
And in this case the constructive criticism is to learn array methods so you wont have problems with these types of issues
root@debian-s-1vcpu-1gb-lon1-01:~/Sublime# npm install sqlite3
> sqlite3@4.1.0 install /root/Sublime/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build
sh: 1: node-pre-gyp: not found
npm WARN discord.js@11.5.1 requires a peer of @discordjs/uws@^10.149.0 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js-commando@0.10.0 requires a peer of sqlite@^2.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN sublime@0.0.1 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! sqlite3@4.1.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the sqlite3@4.1.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-11-04T19_11_29_750Z-debug.log
root@debian-s-1vcpu-1gb-lon1-01:~/Sublime# ```
Getting this error whenever running `npm install sqlite3` (or any package for that matter)
I can't install any packages.
thanks!
Now i'm getting an even more confusing error when running node .
root@debian-s-1vcpu-1gb-lon1-01:~/Sublime# node .
sequelize deprecated String based operators are now deprecated. Please use Symbol based operators for better security, read more at http://docs.sequelizejs.com/manual/tutorial/querying.html#operators node_modules/discord-leveling/node_modules/sequelize/lib/sequelize.js:245:13
═[Discord-Leveling Database Loaded -V1.1.0]═[Support server: https://discord.g/3456346]=
FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal.
1: 0x9d33e0 node::Abort() [node]
2: 0x9d4596 node::OnFatalError(char const*, char const*) [node]
3: 0xb32b8a v8::Utils::ReportApiFailure(char const*, char const*) [node]
4: 0x7fa4602aef69 Require(v8::Local<v8::Object>, char const*) [/root/Sublime/node_modules/better-sqlite3/build/better_sqlite3.node]
5: 0x7fa4602afe8e Integer::Init(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Object>) [/root/Sublime/node_modules/better-sqlite3/build/better_sqlite3.node]
6: 0x7fa4602b2348 RegisterModule(v8::Local<v8::Object>, v8::Local<v8::Object>) [/root/Sublime/node_modules/better-sqlite3/build/better_sqlite3.node]
7: 0x9affd7 [node]
8: 0x9af1f2 node::binding::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&) [node]
9: 0xb9ec19 [node]
10: 0xba0a07 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node]
11: 0x136d639 [node]
Aborted```
v12.11.1
Does your projects root folder have a package.json or no
it does
Can you send it?
sure
{
"name": "sublime",
"version": "0.0.1",
"description": "The next generation of Discord Bots.",
"main": "index.js",
"scripts": {
"run": "node index.js"
},
"keywords": [
"bot",
"discord",
"sublime"
],
"author": "Croft",
"license": "ISC",
"dependencies": {
"@sentry/node": "^5.7.0",
"better-sqlite3": "^5.4.3",
"canvas": "^2.6.0",
"configcat-node": "^2.2.1",
"dblapi.js": "^2.3.0",
"discord-anti-spam": "^2.0.2",
"discord-economy": "^1.1.6",
"discord-leveling": "^1.1.0",
"discord.js": "^11.5.1",
"discord.js-commando": "^0.10.0",
"nekos.life": "^2.0.4",
"node-fetch": "^2.6.0",
"quick.db": "^7.0.0-b22",
"sequelize": "^5.21.0",
"sqlite": "^3.0.3",
"sqlite3": "^4.1.0",
"weather-js": "^2.0.0"
}
}
https://github.com/JoshuaWise/better-sqlite3/issues/120 check this (scroll down to the bottom, the owner suggests a possible fix)
Why do you have sequelize and quick.db and 2 different sqlites?
3 different sqlites
Lmao
lol
So apparently theres an issue with my bot as when it doesn't have a managed role, and when the bot checks for permissions (and it has the required permissions but doesn't believe it does apparently) it shows an error, is there a solution for this?
Code Example im using is below: (discord.js)
if (!msg.guild.member(bot.user).hasPermission(["MANAGE_ROLES", "MANAGE_CHANNELS"])) return msg.reply("**I do not have perms!**")
you could use <message>.guild.me instead of <message>.guild.member(<client>.user) because the first represents your bot in the guild as a member already
and you say it has an error but you never posted the error
@quartz kindle Regarding what you told me yesterday about storing the cache, I don't know how I can do it for all the servers that the bot is. since if I use only the variable I get as undefined
var affectbots;
var delspammessage;
var supsafe;
let serverid = message.guild.id;
affectbots = await keyv.get("affectbots" + "enadis" + serverid);
delspammessage = await keyv.get("spam" + "delmsg" + "enadis" + serverid);
supsafe = await keyv.get("supsafe" + "enadis" + serverid);
client.commands.get("spam").execute(message, keyv, affectbots, supsafe, delspammessage);
Hey, using d.js is there a way to iterate through all clients created by sharding before the ready event is fired?
Let cache = {}
client.on(message, message => {
let guildcache = cache[message.guild.id]
If(!guildcache) {
guildcache = cache[message.guild.id] = {}
}
let affectbots = guildcache.affectbots
if(!affectbots) {
affectbots = guildcache.affectbots = await keyv(...)
}
})
Basic caching scheme
o
If cahe doesnt exist, load from keyv and save in the cache
thanks!
Subsequent requests will be loaded from cache
@earnest phoenix I'm saying it's an error because apparently a mod is saying it doesn't have permissions even though it does, but when it has its managed role and has the permissions there, it wont say that
That's very difficult to understand
the code works
Where does it say that it's missing permissions
The bot's message you coded or in your console 
Because manage channels can be overwritten per channel
maYbe
@late hill The bot message I coded, and ask the moderator who rejected my bot because im not sure
oh
maybe permissions are being checked by channel?
your message checks the overall guild permission
@quartz kindle ```JS
guildcache = cache[message.guild.id]
if (!guildcache) {
guildcache = cache[message.guild.id] = {}
}
affectbots = guildcache.affectbots
if (!affectbots) {
affectbots = guildcache.affectbots = await keyv.get("affectbots" + "enadis" + serverid)
}
delspammessage = guildcache.delspammessage
if (!delspammessage) {
delspammessage = guildcache.delspammessage = await keyv.get("spam" + "delmsg" + "enadis" + serverid)
}
supsafe = guildcache.supsafe
if (!supsafe) {
supsafe = guildcache.supsafe = await keyv.get("supsafe" + "enadis" + serverid)
}
I had never used anything like that
Yes, but dont use global variables
Unless you defined those before
And yes, you can set a value to multiple variables at once like that
a = b = 5
Both a and b will be 5
@quartz kindle Do I have to use that code for every time I use it?
@quartz kindle your so wholesome
you help all the kiddos of the next generation learn to code
You get a gold star!
tim is the peak of this channel
^^ true ^^
give Tim an award or we will have an uprising
Yeah Tim is honestly a legend tho
Lol
Like i'd legit donate if i had money
same
Yeah too bad we all broke from paying for vpss so people can take advantage of our work
lol
Where?
Hello 👋
Does somone have a discord bot writed with discord.js with more than 2500 serveurs (shards) ?
@quartz kindle affectbots = undefined
Did you change them to local variables?
Member#roles#has
got it
[
{
"Name":"The NERVA Association",
"Id":5246058,
"EmblemUrl":"http://www.roblox.com/asset/?id=4240795913",
"EmblemId":4240795913,
"Rank":255,
"Role":"Holder",
"IsPrimary":false,
"IsInClan":false
},
{
"Name":"State of Firestone",
"Id":2803360,
"EmblemUrl":"http://www.roblox.com/asset/?id=4265490349",
"EmblemId":4265490349,
"Rank":20,
"Role":"Middle Class Citizen",
"IsPrimary":true,
"IsInClan":false
},
{
"Name":"Περίοικος",
"Id":4625738,
"EmblemUrl":"http://www.roblox.com/asset/?id=2719690491",
"EmblemId":2719690491,
"Rank":10,
"Role":"Perioikoi Metioikoi",
"IsPrimary":false,
"IsInClan":false
},
{
"Name":"Greek City-State of Lakedaimon",
"Id":2939482,
"EmblemUrl":"http://www.roblox.com/asset/?id=2160193304",
"EmblemId":2160193304,
"Rank":40,
"Role":"Perioikoi",
"IsPrimary":false,
"IsInClan":false
}
]```
How would I sort through to find which of these has the ID I want?
array.find()
np
@quartz kindle what?
console.log("b")
try {
message.member.removeRoles(element.drolesetID)
}catch(error) {
}
} else {
const result = binds.filter(id => id.groupID == element1.Id);
console.log("b")
if(result.length < 1) {
message.member.removeRoles(element.drolesetID)
}
}```
the second else statement is being triggered
and it gets in the if statement
but doesnt remove the role
idk why
result.length ! < 1 i Guess
Ah wait, I got it
Waifus.me is a very kawaii image API, it can be used for discord bots, and apps and everything else.
i finished my api :/
@zinc condor good
:3
Lemme check it out 
ye
@zinc condor cool api :))
thank:3
:333
sorry it was down for a sec
i was adding cors stuff
since sum stuff was not working cuz of that
@sudden geyser as ive explained before I don't know what channel permissions that the moderator used had
I know, but that could have been the reason.
It's also good to check by channel permission in general
If that could've been the reason, then why did the moderator reject my bot for the "bug"?
for the reason you've been talking about (invalid permission). It's just a guess ¯_(ツ)_/¯
in discord.js: i was wondering if anyone knew how to fix this
DiscordAPIError: Missing Permissions
the permissions its saying it doesn't have is 'manage nicknames' but i made sure and it has that permission. i feel like i get this a lot for no particular reason
because it's role is not higher than the end member's role
or it just doesn't have the permission to do that
discord doesn't lie
oh i wasn't aware it wouldn't work if the end members role is higher then the bots. Is there any work around without moving the levels of roles
Is there a way I can set "varName3" to another variable? I would like to give the embed message a randomly generated ID number
{
"storage": "1",
"varName": "embedToSend",
"channel": "0",
"varName2": "",
"storage3": "2",
"varName3": "${tempVars(\"embedIdNum\")}",
"iffalse": "0",
"iffalseVal": "",
"name": "Send Embed Message"
}
(I don't know why the spacing is weird)
Just assign it?
I want to make it a pre-generated random number. I don't know how to make "varName3" a custom variable.
Im working on a weather command. When I send the command, it sends the message. When I send it again, it sends it twice. When I send it again, it sends three times. Here is my code: ``` if (message.content.startsWith(prefix + "weather")) {
let zipCode = message.content.split("r ")[1];
if (zipCode === undefined || zipCode.length != 5 || parseInt(zipCode) === NaN) {
message.channel.send("Please provide a valid ZIP code! Note: this only works for the U.S.A.")
.catch(console.error)
return;
} else {
fetch(`http://api.openweathermap.org/data/2.5/weather?zip=${zipCode},us&APPID=no`)
.then(response => {
return response.json()
})
.then(parsedWeather => {
const weatherPics = {
"Clouds": `https://i.imgur.com/UbS3wXO.gif`,
"Rain": `https://i.imgur.com/RU8iwIE.gif`,
"Thunderstorm": `https://i.imgur.com/MH7QnT8.gif`,
"Sunny": `https://i.imgur.com/qTO6lBE.gif`,
"Clear": `https://i.imgur.com/ZNVcoap.gif`
}
if (parsedWeather.cod === '404') {
message.channel.send("This ZIP code either doesn't exist or there is no information avaliable for it!")
} else {
const currentWeather = parsedWeather.weather[0].main
message.channel.send({embed: {
color: 3447003,
fields: [{
name: `Location: ${parsedWeather.name}, ${parsedWeather.sys.country}`,
value: `
It is ${(Math.round(((parsedWeather.main.temp - 273.15) * 9/5 + 32 )))}° F with ${parsedWeather.weather[0].description}!
`
}
],
image: {
url: `${weatherPics[currentWeather]}`,
},
timestamp: new Date()
}
})
}
})
}
}
});```
for my api i smashed together this thingy
just as an image explorer
its basically just a modified simplified html thingy i found on github but it works
It's just advertising
Is there any way I can turn "varName3" into a pre-defined number?
{
"storage": "1",
"varName": "embedToSend",
"channel": "0",
"varName2": "",
"storage3": "2",
"varName3": "Can I get a pre-defined variable here?",
"iffalse": "0",
"iffalseVal": "",
"name": "Send Embed Message"
}
Client.once('message', async message => {
db.add(`globalMessage_${message.author.id}`, 1);
db.add(`guildMessages_${message.guild.id}_${message.author.id}`, 1);
})
else if (command === 'messages') {
exports.run = async (client, message, args, tools) => {
let member = message.mentions.member.first() || message.member;
let global = await db.fetch(`globalMessages_${member.id}`);
let guild = await db.fetch(`guildMessages_${member.guild.id}_${member.id}`);
message.channel.send(`**Global Messages: \`${global}\`\nguild Messages: \`${guild}\`**`)
}
}
it wont work for some reason
says first is not defined and client, message, args, tools even though 300 lines up i use them and they are defined
@quartz kindle I already corrected the problem, thanks for helping me
The ping of my bot is no longer high
help anyone?
@cerulean salmon Everything is explained in the error it self
cmd.mentions.members is null
So it cannot read the first property
Because cmd.mentions.members is null
So the statement is actually useless in your case
Since it's null
Is this discord.py @cerulean salmon
discord.js
why do you check for mentioned members in a command
Can't you put in discord.js arguments for the commands
i am trying to do something like this
when someone will mention the bot ,then bot will reply some particular sentence
its working fine
problem is when i bot try to get the response from user in DM
Then check if the guild is not none?
I never used disc.js, but I think this should be possible
wait
that's normal
Shouldn't you replace the && by an or or something similar
wait nvm
then bot will send every single message to the channel
Also, shouldn't you put
message.channel.type === dm
or
message.channel instanceof DMChannel
if i disable that mention and reply option
i can grab bots dm messages fine or vice-versa
but can't run them together
The thing is that the error you sent above is no where in the code you sent
So it's just impossible to help
On the error you sent above it's:
else if (cmd.mentions.members.first() != undefined) {
And on the screenshot
there is no where a code like that
am I right?
i cant find a solution for this (discord.py, python)
json.decoder.JSONDecodeError: Expecting value: line 1 column 2 (char 1)
Make the array then see
Is no one going to help me with my .first command
instead of '
For message counter
that doesnt change anything
It won’t change anything
It does
Do you just have import json because that’s all I see
JSON is "
It's not discord
no its changing the text in the codeblock
Ik
This is python I am JavaScript
Yea then
Don't help with js code
Won't help him at all
@manic basalt As stated many times on internet
this error happens when;
- non-JSON conforming quoting
- XML/HTML output (that is, a string starting with <), or
- incompatible character encoding
Guys
Traceback (most recent call last): File "lesterisawesome.py", line 9, in <module> for option in open('config', 'rt').read().split('\n'): FileNotFoundError: [Errno 2] No such file or directory: 'config'
There was no file "config" in the working directory
The error explains everything
if i made a generic program that can post statistics to various bot list apis like the one for this site, so you just run it from the commandline with a site name, bot id, api token and couters and it knows what to do, is that something people would use?
lol imagine it this way
when a method already exists and its been used for years
you would need traction in your project
basically this, without the need for an sql db: https://github.com/braindigitalis/botnix-discord-cpp/blob/master/update-bot-lists.php
https://cdn.discordapp.com/attachments/491800882220892170/641031371476828160/Screenshot_20191104-2112041.jpg
- people normally dont post their server count and adding an additional step is 2 lazy 4 some
they might, if this is easy to do.
why is a db involved lolw
the way ive created this was for my bot, so i only have to write the code once and its compatible with all these services out there that just take a json post to a https endpoint, the only variance is in field names
@valid frigate two reasons, it centralises reporting so that each shard isnt responsible for having to report the counters, and secondly a db is used by my bot anyway
so it made no difference for me to put an extra couple of tables in that db
in most libs shards arent responsible
you use upper level management to report that
if you're reporting per shard you're doing something wrong
i'd originally inteded each shard to be responsible to report to a db cluster, that way the failure of one shard didnt affect the others, with shards on separate machines
but ive thrown out that idea as the lib i use now uses the model you described
the db remains though, as the rest of the bot uses a db to store 1.4 million facts for chatbot use
mk might as well make it a bot stats reporter
you would have to support a lot more than just 1 language, aka supporting djs and eris
the most practical way to do this would be to have the program background itself... so you run it once on boot, and it just looks for the values of some env vars or something
the great majority of bots here are like that
that way you dont need to directly support a language
just say 'set these env vars with your stats from within your bot'
env vars might not be the best solution though
its not as smart on windows etc
so how would this be run on linux
additionally requiring a tool such as screen which most new bot devs are unfamiliar with
or run as a background process
https://github.com/braindigitalis/botnix-discord-cpp/blob/master/main.cpp#L123 theres how i do reporting myself, no djs in sight 🙂
i didnt ask for that
cross-platform shouldnt be too different
except for some libs that only work on linux
forking a background process isnt difficult, i can do that on any platform
doesnt need screen
more like spawning
i do use screen to run my bot core, but thats not related to this idea
thats just because i was too lazy to background it, and wanted to watch the debug log 😄
tbh, im not sure i'd leep the reporter bit in php, if i was going to make it available for others
perhaps a C++ project, with a prebuilt windows exe for the unable to compile
im asking for feedback on the idea, @valid frigate not help per se
k
well for experienced devs sure
otherwise, it's gonna be too confusing for newbies unless you actually give a solid tutorial on how to use it
how many characters are allowed in a embed field value
1024
Any ideas why when I try to get my bot informations with my bot I always get {'error': 'Unauthorized'}
(with the API)
HTTP Error 401: Unauthorized
wrong token
Do you even need the token for a GET request?
well
yea
you do need
lmao
thanks
in c, is it possible to return an array from a function ( like in this example https://www.tutorialspoint.com/cprogramming/c_return_arrays_from_function.htm)
but instead of "storing" it in a pointer, store it into another array in the main function
arr_1[n] = gen_arr_of_length(n);
something like this ^?
Do you even need the token for a GET request?
you need a token for every request
How do you remove a specific event listener from discord.js?
for example remove client.on("message", niceevent)
Just don't use it
great thanks for the amazing answer
@split hazel you can remove it from client._events
Its an array of arrays of functions iirc
Can you get Guilds by Their Name?
Yes
Nvm then xD
Then whats right?
what are you trying to do anyways?
Backdoor Command (Owner Only of cause)
thats a huuuge breach of privacy
backdoor?
really? @mossy vine
sounds like criminal stuff but ok
That is a MASSIVE breach of privacy yes
yes, we are talking about a literal backdoor to a server



