#development
1 messages · Page 1200 of 1
azerice bilen biri bana botum için yardım edebilirmi
i agree with that bud
-notr @earnest phoenix
@earnest phoenix
İngilizceden başka dillerde sohbet etmek için #memes-and-media kanalını, top.gg hakkında (Türkçe olarak da) destek almak için #support kanalını kullanın.
Bu kanalda Türkçe konuşmayın.
ok
There will be many trials to get to be a competent developer and unfortunately, being a developer is a vicious cycle of self deprivation due to questioning your own knowledge but don't dwell on it too long.
Try again tomorrow or the day after depending on when you get inspiration. Things will most likely cool down by then.
@eternal osprey
being a developer is jsut that, sitting infront of a problem and solving it
and then creating 5 other problems whilst solving 1 
hi
Please Don't Say Just Hello In Chat
2010-07-19 12:32:12 you: Hi
2010-07-19 12:32:15 co-worker: Hello.
## CO-WORKER WAITS WHILE YOU PHRASE YOUR QUESTION
2010-07-19 12:34:01 you: I'm working on [something] and I'm trying to do [etc...]
2010-07-19 12:35:21 co-worker: Oh, that's [answer...]```
code?
fr tho
why is thi not possbile
i get this back:
Weather for Union Square Park, CA
Weather Type: Cloudy
try{}catch(){}?
i have changed up my code a bit
onst Discord = require('discord.js');
const bot = new Discord.Client();
const weather = require('weather-js');
const prefix = '$PO ';
bot.on('message', message => {
let msg = message.content.toUpperCase();
let sender = message.author;
let cont = message.content.slice(prefix.length).split(" ");
if (msg.startsWith(prefix + 'WEATHER')) {
if ( message.channel.type === 'dm') {
return message.reply('I can\'t execute that command inside DMs!');
}
weather.find({search: 'California' + 'Union Square', degreeType: 'C'}, function(err, result) {
if (err) message.channel.send(err)
if (result === undefined || result.length === 0)
return message.channel.send("**Invalid** location");
var current = result[0].current;
var location = result[0].location;
const embed = new Discord.MessageEmbed()
.setDescription(`Weather Type: **${current.skytext}**`)
.setAuthor(`Weather for ${current.observationpoint}`)
.setThumbnail('https://media.giphy.com/media/CKsIi206Ntz4k/giphy.gif')
.setColor('#FF0000')
message.author.send({embed});```
is Union Square Park a place in CA or NY?
CA
Oh ok. What kind of data are you expecting?
i am expecting that the bot will give me the weather types of both selected places
but that seems to be now working
it just selects 1
Well, Cali is a big state so weather varies
i now changed it to germany and union square
once again
it only return info of germany
i mean
is the problem in my embed?
for multiple places, you'd have to make multiple API calls or if you read the API supports multiple place selection then it would be your implementation
how do i make multiple api calls?
is there any other way to get the weather types of different countries?
cuz weather-js sucks
or i am just stupid
Try and see if there's other weather api modules on npm
openweathermap?
What URL does it request data from? Does it have the features you want?
You could
but I feel like scraping HTML is more difficult than GETting data from an api
but the problem is that i can't find any good api to use
Then scraping is probably a good way to go about things then
btw, thanks for sticking around with me.
I have to scrape Spotify to do some things 
Not a problem
No. I was stating that my bot scrapes Spotify to do some things not I have to go do that rn
owhhh
how do bots make it so certain features are only able to be done after you vote for the bot?
They implement the webhook feature top provides then stores the data from that webhook for however frequently you're able to vote
is postgresql sql?
cuz
but the problem is that i can't find any good api to use
@eternal osprey why not use @lament meteor's api
yes. Reading the intro to PostgeSQL says that it uses and extends the SQL language
she's got an awesome api
yes. Reading the intro to PostgeSQL is that it uses and extends the SQL language
@lament rock SQL sucks tho
where
It depends what you're using it for and your data set sizes. I use SQL based solutions for certain things and Redis for other stuff
SQL is also what I learned initially so I'm biased to using it and trying to optimize queries
@earnest phoenix where is that api?
yeah there isn't a weather api
please do that if you could!
why unexpected end of input
const Discord = require('discord.js');
const bot = new Discord.Client();
const weather = require('weather-js');
const prefix = '$PO ';
bot.on('message', message => {
let msg = message.content.toUpperCase();
let sender = message.author;
let cont = message.content.slice(prefix.length).split(" ");
if (msg.startsWith(prefix + 'WEATHER')) {
if ( message.channel.type === 'dm') {
return message.reply('I can\'t execute that command inside DMs!');
}
weather.find({search: 'Germany', degreeType: 'C'}, function(err, result) {
if (err) message.channel.send(err)
weather.find({search: 'California', degreeType: 'C'}, function(err, result) {
if (err) message.channel.send(err);
if (result === undefined || result.length === 0)
return message.channel.send("**Invalid** location");
var current = result[0].current;
var location = result[0].location;
const embed = new Discord.MessageEmbed()
.setDescription(`Weather Type: **${current.skytext}**`)
.setAuthor(`Weather for ${current.observationpoint}`)
.setThumbnail('https://media.giphy.com/media/CKsIi206Ntz4k/giphy.gif')
.setColor('#FF0000')
message.author.send({embed});```
i am literally losing my mind
right now
did you make sure to balance your })
^
i only get that error on one liners
mmm. What helps is having a consistent tab style so you can easily identify mismatched brackets or parentheses
smh....
Stop.
@eternal osprey
bruh
if it is just a string why
and reset the tokeb after sendibg
it is not that exciting
if you don't trust us then
^
there you go
hmm i wonder if it is just vsc being stupid
vsc is never stupid when it comes to syntax errors. Only using implicit project typescript checking
@earnest phoenix what are you talking about?
the whole code is correct
it has to do with these i suppose
hover over the red line
@lament rock idk it once just fuck up everything i wrote
it's not vsc dying
Oh. That's probably the issue. What does that last ); balance with
it's typesceipt
@eternal osprey show the lines 19 and 10
or judt
throw all your code on hastebin
I guess you don't have closing curly brackets for those lines. It doesn't match with anything
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pls bal
ur missing brackets @eternal osprey
below
below?
here
those are the only closed brackets
owh i should add one bracked
close the if statment and the listener
i have many if statements
Please stop trying to help if you don't know what you're talking about
should be message.channel.send({embed: theVariable});
that is a valid MessageOptions Object
^
what
no
the property inherits the variable name so it's short hand for {embed: embed}
@eternal osprey why do u hv a weather find function in a weather find function?
instead, it can just be {embed} and that would be valid @earnest phoenix
i tried to search 2 different places/countries
within 1 command
i mean u only hv the second and first weather func
okay i get it!
and it works
however
it only calls the 2nd weather.find
instead of both
and i remembered
i had to assign it different variables?
did you assign the result of both to separate variables and then use both of those variables in the embed
i have assigned both to 1 variable
you cannot do that
okay
weather.find({search: 'Germany', degreeType: 'C'}, function(err, result1) {
if (err) message.channel.send(err)
weather.find({search: 'California', degreeType: 'C'}, function(err, result2) {
if (err) message.channel.send(err);
if (result === undefined || result.length === 0)
return message.channel.send("**Invalid** location")
var current = result1[0].current;
var location = result1[0].location;
var current = result2[0].current;
var location = result2[0].location;
```
this would be good right?
or should i change the var current
to current 1
and current2
too
you declare current and location twice so you should change those names, yes
ReferenceError: result is not defined
change your references to result to what you changed the names to
weather.find({search: 'Germany', degreeType: 'C'}, function(err, result1) {
if (err) message.channel.send(err)
weather.find({search: 'California', degreeType: 'C'}, function(err, result2) {
if (err) message.channel.send(err);
if (result1 === undefined || result1.length === 0)
return message.channel.send("**Invalid** location")
var current1 = result1[0].current;
var location = result1[0].location;
var current2 = result2[0].current;
var location = result2[0].location;
const embed = new Discord.MessageEmbed()
.setDescription(`Weather Type: **${current1.skytext}**`)
.setAuthor(`Weather for ${current1.observationpoint}`)
.setThumbnail('https://media.giphy.com/media/CKsIi206Ntz4k/giphy.gif')
.setColor('#FF0000')
message.author.send({embed});
```
i have already done that?
no i got it working
by changing the error
but now i gotta do the same with result2
Oh lol
can i type this as embed: .setDescription(Weather Type: **${current1.skytext} + ${current2.skytext}**)
i guess?
You don't need to do the + unless that's literally what you want to appear in the text
it works
it'd be more informative to do it like Weather type for 1: (insert skytext for 1)\n
Weather type for 2: (insert skytext for 2)
thanks

How you have it is good though. Don't fix it if it isn't broken
even tho i literally helped with nothing
code913, you are absolutely right'
XD
eh... microoptimizations sometimes add up

wait is that sarcasm
i was talking to @lament meteor and @lament rock
depends on what ur trying to achieve
your status...
people are horrible
don't code bots even if they are going to pay you
i am receiving this
how can i get it like : country :weather type
like California : Cloudy
@earnest phoenix who says i am offering money my man/
use the results and do it systematically
not that
ok
Coding discord bots, cheap!
thanks for the help once again
You'll have to make another embed field and do result1 weather on 1 field then result2 weather on another
@earnest phoenix i just stsrted with javascipt
embeds are cool

who says that i don't know python/
well then
quite the leap
okay thanks!
make a bot in that
bro what are you whining about?
i just want to learn javasscript
isn't that allowed?
if you don't help, do not wirte in the development channel.
who says that i don't know python/
@eternal osprey i meant that if someone actually asks you to make a bot for them then you'll probably go nuts cuz people are WEEEIRDDDD
ffss
alright. Let's not get too feisty
i just want to learn javasscript
@eternal osprey did i complain about anything
make a bot in that```
you should make a bot in python because you're experienced in it
@lament rock did u get that art commisioned?
but i want to learn a new language
time to steal
lovely, i am disarmed 🙂

quoting @misty sigil:
The discordjs.guide website is a great place
BECAUSE IT TELLS YOU TO LEAR ACTUAL JAVASCRIPT BEFORE TRYING TO MAKE A BOT
sorry for the ping
bruh
once again
sorry for the ping
@earnest phoenix nah no problem
i am doing javascript for a couple of weekss maybe a month
i know quite some things about it
i just had a problem with my weather bot
maybe easy solutionss
but things can happen
it's still a REALLY TERRIBLE idea to just start with js and try to make a bot in it
but it's your choice so do whatever you wanna do
yeah
i went nuts with https://grasshopper.app and learnt the basics
docs and courses
then moved to https://developer.mozilla.org
people go 4 years to college for this shit lol
lol
it took me like four moths to learn js
months
fuck
i know but i am just trying to make some discord bots and learning by that
hi, I need help with developing and coding a moderation bot
eh tbf projects aint a bad way to learn
hello world is the most important
hi, I need help with developing and coding a moderation bot
@earnest phoenix got any burning questions?
like which website do I use to develop the bot etc
you learn to code
to host it, you buy a vps
mk
you also have to learn to code
you check https://discordjs.guide
and ask for help with stuff here
thanks guys
welcome
my biggest pet peeve is when people underestimate programming
^
parents
they underestimate technology
so annoying, my parents thought that what i was doing was a waste of time and we were constantly quarrelling until i showed them that i earn money from it
me too
even tho all my projects are open source non profit fun stuff
"non profit"
is there a way to generate a 10 charecter long "code" with both case letters and numbers from 1-9 and 0? eg: aG1as9GjJ0
yes
how
Make a function for it
that will be kind of long 
....not really
loop over an array characters n times where n is the length of your desired string and grab a random char
^ or a string of chars
Create an array of characters you wanna use then create a string then do a while an loopCount is < 10, get a random element from the Array and add it to the string and return the string
could i do like how i did my rock paper scissors code? (if anyone remembers)
Just use a for loop
or you can use a package like crypto but no guarantees it'll only contain the characters you want
uuid 
hi i need help
const flags = {
DISCORD_NITRO: '
',
DISCORD_EMPLOYEE: '
',
DISCORD_PARTNER: '
',
BUGHUNTER_LEVEL_1: '
',
BUGHUNTER_LEVEL_2: 'Bug Hunter (Level 2)',
HYPESQUAD_EVENTS: 'HypeSquad Events',
HOUSE_BRAVERY: '
',
HOUSE_BRILLIANCE: '
',
HOUSE_BALANCE: '
',
EARLY_SUPPORTER: '
',
TEAM_USER: 'Team User',
SYSTEM: 'System',
VERIFIED_BOT: '
',
VERIFIED_DEVELOPER: '
',
SERVER_BOOST: '
'
};
what is the flag for server boosting and discord nitro ?
i couldn't find that
Those are not included in user public_flags
İ dont have nitro 😦
you have to get that data from an oauth flow or a user bot to fetch that data but that last one is against Discord TOS
serverboost ?
const flags = {
DISCORD_NITRO: ':nitro:',
DISCORD_EMPLOYEE: ':DiscordEmployee:',
DISCORD_PARTNER: ':partner_badge:',
BUGHUNTER_LEVEL_1: ':BugHunter:',
BUGHUNTER_LEVEL_2: 'Bug Hunter (Level 2)',
HYPESQUAD_EVENTS: 'HypeSquad Events',
HOUSE_BRAVERY: ':bravery:',
HOUSE_BRILLIANCE: ' :BrillianceLogo: ',
HOUSE_BALANCE: ':BalanceLogo:',
EARLY_SUPPORTER: ':early_supporter_badge:',
TEAM_USER: 'Team User',
SYSTEM: 'System',
VERIFIED_BOT: ':712723044140843111:',
VERIFIED_DEVELOPER: ':verified_developer:',
SERVER_BOOST: ':boost:'
};
😦
i want make userinfo
and i want it to show the badges
but it won't show server boosting and discord nitro badge
nitro and server boosting. GuildMembers usually have a boosting since property so you can reverse engineer that date to determine their boosting tier and with that, you can also determine that they have nitro. Or you can check if they have a gif avatar but that's not consistent
there should straight up be a tier property
just know that the nitro and boosting tier flags are not available to bots
oh
@waxen adder it's private info you can only get through oauth which the user has to authenticate
That's unnecessary data since you can determine the tier based on the date
I so I am kinda new to Developing and coding a Moderation bot can someone help me out?
welcome to djs
Discord sends you the bare minimum
oh ok
djs does a lot of shit for the end user
because most of the djs userbase is, well, stupid
Use micro-services :)
?
like it shows info about tokens or something
discord bots cannot access token of another users
yea i know but i mean like it shows token info or something
What kind of bot is that? @waxen adder
idk i found it
oh
displaying user email is a breach of privacy and most likely a violation of the TOS but grant tokens provided by oauth can't do that much
if that is a grant token
Oh. You feed that bot the data. Uh. Idk what that would fall under
isn't this bot and the dev that made it breaking tos by doing this things
I'm not sure since the user has to provide the token
idk
oh ok
How you can make the member.createdTimestamp clean?
huh?
why would you use the timestamp
What I can use either?
how do i get the permissions of a member?
@fringe axle createdAt
Thanks!
how do i get the roles of a member
and remove all of them
i tried a lot of ways, but none work 😦
in which library
rewrite
by rewrite do you mean latest or current stable
If you want to remove every role you can use member.edit() and pass roles as an empty list
member.user.presence will return what the user is playing or doing, right?
check up with the docs
from what i can see it returns a presence object
presence contains the status and activities
how do i get all the permissions of a member?
Wait @sudden geyser So I would do member.edit()
await member.edit()
this object is returned @fringe axle https://discord.js.org/#/docs/main/stable/class/Presence
I used member.user.presence.game before but it won't worked
bob the function takes kwargs
ok so do i just leave it blank
You need to pass one for roles. If you pass an empty list all their roles will be removed. you can also check out the links cry gave you
for example:
roles= []
await member.edit(roles)
this object is returned @fringe axle https://discord.js.org/#/docs/main/stable/class/Presence
@earnest phoenix I just want to see what are you doing. Like playing Visual Studio Code
@sudden geyser
*role=None?
@earnest phoenix
like I said
If you pass an empty list all their roles will be removed.
try it out and see
how do i get all the permissions of a member?
can you just tell me if this code will work?
pls
role=[]
await member.edit(role=role)
or is it roles= role
Hello. How do I check if a target has a certain role? I am creating a "game" and when I check if a user has a certain role, it always thinks that it does. However I believe it's checking if the user who SENT the message has the role (in which case when I tested my code, it did, since people who didn't have the role had the command work), but I want to check if the target has the role. Basically, I have my target sent as this:
let target = message.mentions.users.first() || message.author;
But then I'm getting whether the user has the role using this:
var role = message.guild.roles.cache.find(role => role.name === "Shielded");
if (message.member.roles.cache.has(role.id)) {
message.reply("User has a Shield! Please try again later.");
}
How do I transfer message.guild.roles.cache.find into my target? If that makes any sense...
@earnest phoenix, any idea how to make this better, nicer?
can you just tell me if this code will work?
pls
role=[]
await member.edit(role=role)
or is it roles= role
i don't know where to ask this, but, is there some kind of built-in way to store variables to servers? currently, in the script i've written for my bot, any variable that changes in one server (e.g. prefix) changes in every other server the bot is running in as well. i'm hosting the bot myself. is there a built-in way to make the bot store variables to each server or do i have to code in my own way?
can you just tell me if this code will work?
plsrole=[] await member.edit(role=role)or is it roles= role
@earnest phoenix @sudden geyser
i don't know where to ask this, but, is there some kind of built-in way to store variables to servers? currently, in the script i've written for my bot, any variable that changes in one server (e.g. prefix) changes in every other server the bot is running in as well. i'm hosting the bot myself. is there a built-in way to make the bot store variables to each server or do i have to code in my own way?
@earnest phoenix if u can afford then paid databases, if u cant then free databases or hosting the files on ur own pc
@fringe axle try .join(", ")
@fringe axle try spacing it out? so instead of activity1,activity2,activity3 have it with spaces ^
bob like I said, try it out and see. I'm just going off the documentation and it looks like it would remove all roles from the member. Please stop constantly pinging me. 
Nice! Any idea for a presence card?
How do I transfer message.guild.roles.cache.find into my target? If that makes any sense...
message.author.roles.cache.find()works for me @simple stump
gonna make an actual card with canvas and stuff or just an embed? @fringe axle
Is this a package? (Something like this @golden condor)
No it was made by that guy
You need to use canvas to make that
I don't have much experience with canvas so I can't really help
is canvas hard to learn
Well I've never needed to use it, so I haven't
and for the fourth time, how do i get all the permissions of a member?
member.permissions
lmao
you need to serialize them
@quartz kindle for example?
the most basic way of serializing an object is using JSON
JSON.stringify(object)
but in this case, the permissions object has a few built in methods
got it, thanks tim
Do you guys know of a registrar that offers .sh domains
im confused with that... confusion, extending the text channel class but its never gonna be user, maybe text channel base?
how do i server deafen my bot
hey, how would you check your bot has permissions in an on_message? discord.py, or get your bots ID in the specific guild.
Do you guys know of a registrar that offers .sh domains
@opaque eagle
I have multiple issues. I am trying to remove a role from an user after x amount of seconds. So in this case, I want to remove a role after 24 hours. I put the time stamp into a table (which works), then I want to check if that time is <= to the current time, but then add a time after that. So basically:
if (row && row.time + 120000 <= ts) {
// Remove role
}
However, when I do that, the bot thinks that row.time + 120000 is the time stamp (lets say, 1234567) but then appends 120000 to the end. So then the time becomes 1234567120000. So this is a stupid question:
How do I add 120000 to row.time (the time stamp in the database)?
Second question (I already posted this, however message.author.roles.cache.find() doesn't seem to work):
How do I check if a target has a certain role? I am creating a "game" and when I check if a user has a certain role, it always thinks that it does. However I believe it's checking if the user who SENT the message has the role (in which case when I tested my code, it did, since people who didn't have the role had the command work), but I want to check if the target has the role. Basically, I have my target sent as this:
let target = message.mentions.users.first() || message.author;
But then I'm getting whether the user has the role using this:
var role = message.guild.roles.cache.find(role => role.name === "Shielded");
if (message.member.roles.cache.has(role.id)) {
message.reply("User has a Shield! Please try again later.");
}
How do I transfer message.guild.roles.cache.find into my target? If that makes any sense...
How do I add 120000 to row.time (the time stamp in the database)?
@simple stump isrow.timea string?
Yes
Then that's probably the issue. If you want to add X int to another int they need to be the same type, else JS will treat it like string concentration
I have tried putting 120000 in quotes. Would that help?
Sorry these are stupid questions. I don't do JS dev lol
You need to convert row.time to a number
You can use parseInt(theString, 10) for that for example
How do I check if a target has a certain role?
I think the issue is yourifstatement (message.member.roles.cache.has(role.id)). You're checking the member who sent the message (message.member). You can replace it withtargetinstead so it uses either the mentioned user, or yourself if no one was mentioned.
The reason your first attempt didn't work (message.author.roles.cache.find(...)) is because message.author is a User instance. You can only check a user's roles on a GuildMember instance. message.member is a GuildMember instance.
So, in conclusion, replace message.mentions.users with message.mentions.members and message.author with message.member if you want to search for the guild member rather than the user in general.
Ohh I see. Thanks so much 🙂
What is the discord nitro counterpart at user.flags.
ex: const flags = {
DISCORD_EMPLOYEE: 'Discord Employee',
DISCORD_PARTNER: 'Discord Partner',
BUGHUNTER_LEVEL_1: 'Bug Hunter (Level 1)',
BUGHUNTER_LEVEL_2: 'Bug Hunter (Level 2)',
HYPESQUAD_EVENTS: 'HypeSquad Events',
HOUSE_BRAVERY: '
',
HOUSE_BRILLIANCE: '
',
HOUSE_BALANCE: '
',
EARLY_SUPPORTER: 'Early Supporter',
TEAM_USER: 'Team User',
SYSTEM: 'System',
VERIFIED_BOT: '
',
VERIFIED_DEVELOPER: '
'
};
how can i add nitro to discord. badges
I don't think there is one for nitro.
no unless you selfbot
selfbot
ah yes
use selfbot to query and send it to main bot node process, 300iq no one will ever know
🧠
||if it wasnt obvious, im joking, dont selfbot||
though sometimes i do get the idea of doing shit like that
You could use some hacky ways of checking if a member has nitro, such as if their avatar is a gif or if they're boosting the server but imo I'd rather leave it out than have some left out.
accessing non bot endpoints like message indexes, accounts linked to x user, flags, that kind of shit
i wouldnt have to do any of my oauth crap if i could simply check the accounts linked to a user

userbotting would've been allowed if people hadn't used them to raid servers
Error: Could not find player config
at exports.getBasicInfo (/app/node_modules/ytdl-core-discord/node_modules/ytdl-core/lib/info.js:59:13)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Object.exports.<computed> [as getBasicInfo] (/app/node_modules/ytdl-core-discord/node_modules/ytdl-core/lib/info.js:296:18)
at async exports.getFullInfo (/app/node_modules/ytdl-core-discord/node_modules/ytdl-core/lib/info.js:187:14)
at async Object.exports.<computed> [as getFullInfo] (/app/node_modules/ytdl-core-discord/node_modules/ytdl-core/lib/info.js:296:18)```what does that mean?
I need help with coding and developing a moderation bot I am stuck on it
How can I get the clients volume?
@earnest phoenix libary, error.
@fringe axle libary?
Discord.js
@earnest phoenix
Error?
@fringe axle libary?
@earnest phoenix discord.js v12
@fringe axle brb gotta do some research
Okay
@fringe axle by volume, i assume volume in vc?
Yes
And by vc, i assume its dispatcher?
Yea
need help
dosent work the part of
def imagefromURL(url, stream=False):
return Image.open(BytesIO(get(url, stream=stream).content))
@radiant kraken
@floral creek whats the website supposed to do?
click it
mk
what's the error @floral creek
oh ok
thats my code
i'm pretty proud of myself for making this work https://youtu.be/mw9uUIoeBkY
@faint prism this might interest you, it's .net core and node.js working together ^
I'll check it out
thats pretty cool
Is that your own client?
the minecraft one? that's just forge, the bedwarsstats overlay is its own app
it has always on top enabled
this dudes played 2000 games of bed wars
i used to tryhard that shit lool
The black overlay window is what you're referring to?
correct
my main motive for the app is that there's a dude charging for this, a monthly subscription for an app like this with less customization
hey, i mean, if theres demand for it might as well charge
i wanted to make a better and a free alternative
Free but not FOSS?
yeah
There is a website that's dedicated to help you picking a license that fits
It makes it really easy it's just check boxes
Like MIT for example
MIT ftw
Jinx

whats the site?
yeah i saw, github does it too however i'm mainly considered about people stealing some parts and then charging for something that should be free again
even with credit
Non-judgmental guidance on choosing a license for your open source project
even with credit
@earnest phoenix The GNU GPLv3 also lets people do almost anything they want with your project, except distributing closed source versions.
Also, I'm interested in seeing the source :)
having it open source means that other people can contribute via pull requests as well, and you might end up with some useful community features you otherwise wouldn't have implemented
i wish there were more resources on makign scalable discord bots
i wish there were more resources on makign scalable discord bots
@earnest phoenix I designed mine pretty scalable using SOLID design principles
like?
If that's what you mean
wdym solid design principles
right but how does that translate to code
It's just design patterns that allow your project to be more maintainable
and infrastructure
like are you distributing with kubernetes, if so what do the configs look like etc. do you have a rest -> integration structure
Well with dependency inversion, I can swap out entire bits of logic without refactoring where that bit was referenced in the code
stuff like that
Using interfaces, and factory design pattern. Alternatively you could use inversion of control containers
Ah
I have a CICD pipeline that deploys to a raspberry pi :P but that's about it as far as infrastructure goes
Gated merges with the main branch, build verification pipelines, unit tests, etc
ok, do you have one big monolithic app or microservice styled api etc
yea for cicd i use travis and docker etc
paired with github
good easy way to do things
I wouldn't call it "monolithic" but it doesn't use an API for logic. It uses a class library for that
is it one process
hello, could someone explain to me what module.exports and module.exports.run does?
lets say you have two files: a.js and b.js
in a.js you have this code ```js
let something = require("./b.js")
whatever you put in module.exports in your b.js file, is what a.js will get when it requires the file
if you do module.exports = 10 in b.js, then something in a.js will become 10
by default module.exports is an object, so instead of module.exports = 10 you can do module.exports.abc = 10
in this case, then something becomes {abc:10} when you require the file
oh ok
I'm confused why this bit of code:
con.query(`SELECT * FROM shielded WHERE id = '${message.author.id}'`, (err, rows) => {
if (err) throw err;
const [ row ] = rows;
if (row.time == null) {
return;
}
var parsed = parseInt(row.time);
if (row && parsed + 1000 <= ts) {
con.query(`DELETE FROM shielded WHERE id ='${message.author.id}'`, (err, rows) => {
if (err) throw err;
const role = message.guild.roles.cache.find(role => role.name === "Shielded");
message.member.roles.remove(role);
})
}
});
Keeps saying that it can't read property time of undefined. I do have the column time, however nothing is in it at the moment.
log the value of row to see what it is (right after you declare it)
Alright
one more thing, what would module.exports.help do? does it create a type?
Also if (row.time == null) is the line (307). prob shoudl show the error to: https://hatebin.com/gpqnkgdkle
It says "undefined"
(the log)
are any rows being returned?
no
I don't have any however
But I want to make sure that that doesn't affect the bot
Cause there is a high chance that someone won't be "Shielded"
Basically user's can shield themselves, giving them the "Shielded" role. It is for a set time, however if the time runs out (which if row && parsed + 1000 <= ts) manages), then remove the shield and delete the row from the shielded table.
Then you should probably check if any rows are returned before you go forward, as it looks like you rely on it being present.
rows will be an array of elements
so if there's nothing in it
row will be undefined
if you try to access anything on undefined you get that typeerror
so you should check if (row) {...}
dpy?
Who can help me with giveaway bot?
Who can help me with giveaway bot?
@leaden shard Are you making a giveaway bot?
yea
what exactly do you need help with
yes @ancient falcon
MusicPlayer
@commands.command.has_any_role('DJ, dj, dJ, Dj')
AttributeError: 'function' object has no attribute 'has_any_role'
thats an error
im getting
im using cogs btw
thats ok right:
still not working
says syntax error
ah my bad 1 sec
Does anyone know if you can require lodash without the underscore, '_' apparently is what you define lodash as, But I want to define it as ```js
const lodash = require('lodash')
Is there any detailed reason as to why you can't just do what you sent?
You can name it whatever you want as it's just a variable
const x = require(y)
are you talking about x or y ?
Thanks
In practice they like to use _
does anyone here know how to develop a moderation bot? I can't figure out how to make one
what language and library u using?
discord.js
If you can make a bot you can make a moderation bot. Are you looking for how to do some type of feature
Then what feature are you looking to do? "How to develop a moderation bot" is very broad.
I am trying to figure out like how to do the Moderation logging @digital ibex
like if someone were to be banned or someone was making roles removing/making channels etc
person gets banned: https://discord.js.org/#/docs/main/master/class/Client?scrollTo=guildBanAdd
channel gets created: https://discord.js.org/#/docs/main/master/class/Client?scrollTo=channelCreate
channel gets deleted: https://discord.js.org/#/docs/main/master/class/Client?scrollTo=channelDelete
ty
Look at the Events column on the documentation: https://discord.js.org/#/docs/main/stable/class/Client
Thanks guys
const sp = require('spotify-web-api-js');
const spotify = new sp();
function x () {
spotify.getArtistAlbums('43ZHCT0cAZBISjO8DG9PnE', function (err, data) {
if (err) console.error(err);
else console.log('Artist albums', data);
});
};
ReferenceError: XMLHttpRequest is not defined
You're probably using a library that's intended to be used on client side JS
wdym
aka XMLHttpRequest can't be accessed because you're not in the right environment.
"spotify-web-api-js**
There is this note on the npm page for the dependency
im stupid thnks
For some reason this snippet of code:
https://hatebin.com/godhorudew
Isn't adding the "Shielded" role to the user. It exists, and it worked once, but I don't know why it isn't working now.
does the "inserting data ..." still get sent?
Also this:
https://hatebin.com/qfkqsircfg
Isn't adding the Cooldown role AND seems to subtract experience from everyone; not just the author of the message.
HYes
*Yes
console.log(role) before adding it
👍
if your event listener is async, use await when adding the role
if you dont want to make it async, add a .catch() to roles.add()
I get undefined 😮
(when printing role)
I'll double check that it's actually there
how do people make bots that you can link accounts to using APIs?
@gritty bolt
Can bot read custom status of a user?
yis
funnily enough i never found the api docs on user presence format
pls link me if you find it

only found it under SKD which seems to be different than REST
I'm getting constant 'invalid token was provided' after multiple token regenerates, The token in the application and the token in the token.json are the same
@opal plank you mean this? https://discord.com/developers/docs/topics/gateway#activity-object
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
I'm getting constant 'invalid token was provided' after multiple token regenerates, The token in the application and the token in the token.json are the same
@still merlin the hell
show the token.json (hide the token obviously)
{
"token": "token"
}```
index.js
```js
const token = require('./token.json');
client.login(token)
Is it that easy to deserialize in JS? Damn
Here I was trying to use JSON.parse on a file steam result
yis
@pale vessel hints
Sometimes my bot says it is online, and even has a status feed, but does not reply to commands until I reboot it
So basically, silent failure
And I've tried to fix error handling a million times
But Reactor has the world's hardest-to-use error handling
@slate oyster discord doesn't immediately update when a bot goes offline
it takes a few seconds
I know, but it's not been responding for a few minutes now
then
check your error logs
discord api errors don't terminate the process
unless it is a promise rejection
I get tons of 404 errors
But they are not what crashes the bot
As I've gotten plenty of 404 errors in the past, which do not crash the bot
So I dunno what crashed the bot this time
I mean, I do have plenty of 404 errors in my log
But I can literally reproduce those errors without the bot crashing
lol
@sterile thicket user.presence
But I can literally reproduce those errors without the bot crashing
@slate oyster errors don't crash unless they're <smth> level of stuff like promise rejections
Did you just steal my bot style
I'll remember that
you dont need to json parse a required json file
only if you read it with fs
@quartz kindle lmao did you even read that guys code
Can someone please explain the invalid token error?-
@still merlin token.token
@earnest phoenix So this is my error handling code
@slate oyster the hell is that spaghetti programming language
Is that generics in JS :o
Java
Thankyou @quartz kindle
it's token.token @still merlin
@earnest phoenix i was replying to amazriSF's issue
use {token} or change the variable name to avoid confusion
I'm using fs for a command handler
you have to parse the data
@earnest phoenix if you're requiring a json file you dont
she is using fs
no
yes
I'm using fs for a command handler, Not the json files
the fuck
I wonder if I actually remembered to push my latest error handling fix...
Because, tbh, I feel that it really should work for error handling this time
why did you send fs code then
le brain damage has arrived
alright my bad i need to go see a doctor my eyes are not functioning properly
confuuusion of the highest orda
const { token, prefix } = require("./config.json")
would work, if it doesn't have {} iirc you have to do token.token as token is the json not the token key in the json
@earnest phoenix Anyways, the code isn't that bad to read
You just have to learn Reactor
Can help me anyone arrange my command
arrange?
Really
Just arrange these
oh
yeah embeds and mobile is a no-no
he doesn't know how to edit it?
@thick gull I know
i think he means the fucked up mobile display
Wait
Just arrange these
@formal agate you mean arrange them on different places on the embed?
what language do you prefer
@earnest phoenix brilliant intelligent
^doesn't work for mobile
R.I.P
probably winning on the fact that mobile display is fucked with embeds
dump on description instead
@opal plank stop using that f word
fuck word is not safe for work
LoL
You think I am -13
I mean who else cares about fuck word
me
this is no longer #development though:)
I'm from Asia
One of my bot's users found a super weird glitch in my bot
And the criteria to trigger the glitch are oddly specific
But the fact that the glitch exists in the first place suprises me
What was it
Now i know how is hard to make the bot prefix to mention
u can't use message.mentions.members.first() any more
@misty sigil
Basically, my bot is responding to the message -mmm
It deletes the message (if it has delete perms) and responds with a generic 404 response
My bot's prefix is not -, and mmm is not a valid command
Yet my bot is treating it exactly as if it were a command. Changing the command name causes it not to trigger, but adding arguments after a space works fine.
And maybe you could pass this off, but the exact criteria for this to happen, which I will explain in my next message, make this extremely weird though
what how do you even find that
??????? what does it respond with
However, it's not just responding to the other person's bot
Because we tried it out in a channel that the other person's bot is muted in
And it still did it
However, it does only work in servers the other person's bot is in
But their bot is not sending messages (because it is muted on the channel), and I even checked with them to be sure it was muted
Also, the glitch only occurs in channels that my bot has configured as chatlink (within it's DB)
(I forgot to filter out my bot's name and logo in my screenshot, oof)
Anyways
I got confirmation that the other person's bot was muted
So it's not just responding to other bots
check if you're only checking prefix length and not actual prefix
check if you dont have any extra instance of your bot or some test program with your bot's token running somewhere
reset the token just incase
if you use switch cases, check if you forgot a break somewhere causing it to fallthrough
similarly, check if you forgot to return somewhere
add some logging to that, and check what it logs when you run -mmm
Ok,
I'm not able to develop rn, doing homework
But will try when I can
Thanks
If not, I'll reset token like you said
My bots being unresponsive to commands, Could someone help me please? https://pastebin.com/yH3gwk5e (I have a few unused packages, To be used later on)
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
prefix.prefix.length
Thankyou so much
so how do i remove the reaction f rom a collection?
im awaiting a reaction
then doing collected.last().remove(message.author.id)
but it just removes the entire reaction
(ive checked docs, and searched it up.)
docs dont seem to say how to remove a specific one
and google says to put user id there
You need to fetch the reactions for the message (if not already done), and then use reactions.users.remove(userID)
You want to just make the bot unreact with the reaction it added?
Example from my code:
msg.reactions.cache.forEach(r => r.users.remove(userID));
^this will remove a user from every reaction, you may want to slap some if checks into that if you dont want that to happen
Then my snippet should work if you adapt it to your context
Hello,anyone know how to get the uptime of a discord bot?
client.uptime
oh lol
Can someone give me link for VPS?
i can't find anyrhing in docs why is it?
@earnest phoenix ill dm you one if thats ok
Ok
Yup it is
ok
what are some good modules/whatever to make graphs
@misty sigil
Joined Servers: 97
Online Users: 23148
UpTime: 53582
aeeeaeae

how do i convert that?
divide by 1000
Converts to second
devide by 100 to minutE?
that’s a fundamental misunderstanding of division my man
ik im dumb 
divide by 60000 if my math is correct
For some reason this snippet of code:
https://hatebin.com/godhorudew
Isn't adding the "Shielded" role to the user. It exists, and it worked once, but I don't know why it isn't working now. Also this:
https://hatebin.com/qfkqsircfg
Isn't adding the Cooldown role AND seems to subtract experience from everyone; not just the author of the message.
did you console.log(role)?
Yes
I got undefined
However the role is there...
So I'm confused whether I'm getting the role correctly or not...?
My bot Leaf Bot now has custom commands (a lot) And is now online 24/7. Its improved!
@hushed crane i think you're missing a bracket
Hope i get approved! i just have to wait about 4 weeks to find out! (i probably wont get approved because i saw lots of declined messages so im pretty sure the chances are low)
? @sinful belfry
Ok
#logs shows approvals too
just follow the bot rules in #rules-and-info and you'll be fine, but this is the wrong channel
?
He's pointing out you're missing a bracket there.
the art of lines, circles and question marks
Does pycharm have a rich presence?
What is process.exit(1) doing
Does pycharm have a rich presence?
@static trench not directly, but there is a plugin for it. Search for "Discord Integration" in the Plugins menu in settings.
What is process.exit(1) doing
@hushed crane https://nodejs.org/api/process.html#process_process_exit_code
Thx
@static trench not directly, but there is a plugin for it. Search for "Discord Integration" in the Plugins menu in settings.
@sudden geyser 🙂 thanks!
@earnest phoenix are you using the npm node-sqlite3 package
Also how many rows are in the table
what would a decent easy way to turn this: into something like this:
"1️⃣ | idk",
"2️⃣ | what",
"3️⃣ | other"
yea
I want to add the emoji based on what position its in
map provides the index as an optional param
@static trench Just using sqlite
Not node-sqlite3 or sqlite3
And has only 2 rows
@static trench Just using
sqlite
@earnest phoenix ????? what>
im discord.py . that doesnt apply to me
Ah, my bad
ll good!
How would I get an avatar (and put it in an embed) given an ID? I'm trying to hard code a command (on request), however I can't seem to add the avatar if I set the ID as a string. I know many people instead use message.member.users.first(), but I want to use it given an ID. Here is my code:
if (message.content.startsWith(`${prefix}aki`)) {
let aki = "@<727193643315757076>";
const akiEmbed = new Discord.MessageEmbed()
.setColor('#0099ff')
.setTitle('Aki')
.setDescription('All About Aki')
.setThumbnail(aki.avatarURL)
.addFields(
{ name: 'Famous Quote:', value: 'hewwwwo! gib snacc pls ,,uwu,, bewwy wubs too!!', inline: true },
{ name: 'Favorite Food:', value: 'snaccs', inline: true },
{ name: 'Favorite Thing:', value: 'bewwy wubs', inline: true},
{ name: 'Favorite Song:', value: 'Aki please tell me', inline: true},
{ name: 'Noteflight Equivalent:', value: 'Akimoto Hyena', inline: true},
)
.setTimestamp()
.setFooter('Akimoto Hyena #4511');
message.channel.send(akiEmbed);
}
oh yay i got the bot dev role 😄
Lol
oh yay i got the bot dev role 😄
@simple stump when did you submit?
Lol
I have one bot here in the Disc I think, but no others lol
And I haven't worked on that bot for months. Nearly 2 years?
Ah
<Client>.users.cache.get('ID') iirc should work fine
alright ty 🙂
i can't remember if avatarURL is for guild or user though
so you might have to edit that for your needs
avatarURL is for users
you should use user.displayAvatarURL() since it supports default avatars too
alright ty
yeah just tried the cmd again
shouldnt what bo rb o s s (nice username btw lol) said be:
let si = message.guild.members.cache.get('545353297096343552');
yes
and as he said the issue is that its guild.members, whereas avatarURL is user?
but then you will need to use si.user.displayAvatarURL()


