#development
1 messages · Page 751 of 1
Thanks
Is this a good idea? rs results.into_iter().nth(0).unwrap_or_else(|| { create_guild(guild_id); get_guild(guild_id) }) basically if (for some reason) the guild is not in the database it creates the guild and calls it self (get_guild)
could this cause major issues?
and is so it there a better way to do this
unwrap_or_else basically says: if the type of .nth(0) is None run this code and if it's not None go ahead and return the value/guild
the only issue is it that it calls it self which could be recursive is something goes wrong (i.e there's an error inserting the guild into the database, which there shouldn't I think I've handled all the possible errors that could occur there)
Everywhere where an error can occur an error will occur eventually
From my experience especially at places where it is "impossible" 😦
but yeah, if you handle all DB errors then it should be ok i guess?
as long as it's in(serted) into the db it should be fine
but y'know that's where something goes wrong 🙃
I think I set up my bot to restart if something with the DB goes wrong.
Throw up your hands, run away and try it again after a restart 😄
and after 3 tries it will just shut down till I take a look at it
the only db errors I could think of is:
- the guild is already in the database which get_guild would not have any issues with
- postgres for some reason isn't running, except I have it as a service so it should be fine
In the year that my private bot runs it only had 1 DB error, but that was because I was messing around with the sqlite DB while the bot was running
hmm
make sure the guild ID has to be unique in the DB
in the worst case it will throw an error of a duplicate guild id and it doesn't add the guild a 2nd time
Well I shouldn't be getting those errors either way
because if the guild is already in the database it shouldn't be going through create_guild again
also it worked so [2019-12-20T23:26:29Z INFO rin::db] guild 657724679691173908 inserted into the database successful
Ok so I don't know how to make it so only a "Certain role or the account id of the person" can use the bot can someone help?
what language and library
if only 1 person is allowed to use the bot then check the id of the person that uses the account and only execute the command if it is the correct user id
if you want to bot to only react to people with a role then check what roles the person has that uses a command and see if it has the wanted role
check if the user ID is the same as the ID you want that certain person you want to use, like if (theUserID === "264811613708746752") {...} (264811613708746752 being the actual user to restrict it to). As for roles, you'll need to get the role object and see what members have it (filter).
ok
i love it when they ok their way away in confusion
"I see" 
Next question will be why theUserID is undefined
or the syntaxerror for three dots
how can i make the bot create channels in a catgory and doesnt make all channels like this
what
i want to make the channels like this when i type the command make the channels in log category
when i do it make the channels in random places
https://discord.js.org/#/docs/main/stable/typedef/ChannelData ChannelData#parent
thx
Everytime i try to do this:
var rr = args.join(" ")
var roleinfo = rr.split(" | ")
var permission = roleinfo[2].toUpperCase().split(", ")
message.guild.createRole({
name: roleinfo[0],
color: roleinfo[1].toUpperCase(),
permissions: permission
})
it returns:
(node:3949) UnhandledPromiseRejectionWarning: RangeError: Invalid permission string or number.
Try using discord.js's permission constructor
You can't pass a string like that
@earnest phoenix I hope this helps
how to make dis work? js if(command === undefined) { message.delete() const errore = new Discord.RichEmbed() .setAuthor('Error', 'https://cdn0.iconfinder.com/data/icons/shift-free/32/Error-512.png') .setDescription(`I don't know wich command that is! \nPlease try again.`) .setColor('#36393F') message.channel.send(errore) }
or does it work?
cuz i tried and it didnt
if (!command) just
show me urs normal command
and it needs to be else if, if u have like 10 cmds or more on the same place
if (cmd1)
else if (cmd2)
else if (cmd3)
else
i tried !command onl;y
i dont have a msg handler
does not work at my cmds
and i use // to find my commands
if u dont have its not suprise that it wont work
client.on("message", (message) => {
//so you dont have this?
});```
y
the command will always be defined
so its not possible?
i- thats not what i said at all
k
your logic just went off the rails so I'm telling you that the command will always be defined
yeah ok
unless you have a command handler
which you get the command from a collection, and if its not set, it returns null
unless his handler keeps commands in an object or array, then it will return undefined lul
speaking of object, what are peoples thoughts on having one master object, e.g one object that is created that has the client object, command, message, user object, message obect in one
rather than passing seperate parameters to a function you just pass the one object and get from it what you need from there
That's completely personal preference. afaik there isn't any change in performance etc...
the whole interpreter is basically one master object
global in node and window in browsers
// in browser
const abc = "something"
console.log(window.abc) // something```
although not all browsers expose this
yh
in node you can do global.abc = something
then use global.abc everywhere, without needing to pass objects through functions
What do you people do with requests (mainly message sends) timing out and/or 500 server errors (when discord goes poopy mode)
Do you just ignore them, do you retry the request (if so, what if the retry fails too)? Do you handle a timeout differently than a 500 error?
fire and forget
if you get a 500 just forget about it
there isn't anything much you can do about it
What is best place to find color palettes for bots?
wdym
https://colorhunt.co/ like that
what
colours for bots r just hex codes
i know
just get the hex code of the colours you want
welp we finally got selenium opening new tabs properly now how to close them 
hi
hi
RuntimeError: no running event loop
C:\Users\ChillFish8\AppData\Local\Programs\Python\Python37\lib\asyncio\base_events.py:1772: RuntimeWarning: coroutine 'AsyncManager' was never awaited
handle = None # Needed to break cycles when an exception occurs.
RuntimeWarning: Enable tracemalloc to get the object allocation traceback```
argggggggggggggggggggggggggggggggggg
i hate async somtimes
how would you make a compile command with discord.js?
what does that even mean
I've seen some bots with !!compile and ofc !!eval.
how do you make a compile command?
more like idk how a compile command works, but i heard it is better than eval
sometimes
it's like eval but better
you have to understand i can't read your mind
mostly cuz its completely pointless making a compiling command just to do the same task as eval
why would you need a command to compile code? which eliminates the entire point of eval
there is no point unless your pushing changes and updates to run
@shy turret some bots are made in c++/c# and thats what they call their eval as compile and some bots are just files and eval is their eval.
oh thanks
is it possible to make a public function (command handler)
im just not gonna command handlers then..
on d.js i just fetch all cmds, check if its command and if yes then fetch the file and cmd.run(client, message, args);
oof my bot is on 5 guilds and ram usage is 500 (maybe cuz my while loop)
jesus what while loop r u doing
trick to get ur process ram like 5gb on nodejs js let stopped = true; stopped = false; while(!stopped) { message.channel.send("true") }
that did make my bot ram usage so high
thats just api abuse if ur spamming true
ik, i just used my eval cmd and see what happens
just dont do it 
k
but how then i could do that it awaits for reaction before sending msg in logs, ex if he presses thumb down, then it wont send it, and if yes, then it sends cuz rn it sends it before reacting anything
wait_for()
js async still has a wait_for()
but in terms of looping
any loop creates hang and is 'blocking' code
you could create a new task and have it in a loop waiting for it to stop it blocking the rest of the code
and with 528mb ram u might be screwed
yeah gotta get better vps
you have a vps with 528mb ram!?
jesus christ
"trick to get your process ram like x on nodejs":
while (true) setInterval(() => {}, 0);```
wait you actually ran that 
yes cuz i wanted to see how much it takes my ram
its like 4$ for 4GB ram vps
yea
i just dont know but idle it uses 10mb ram
2 Main bots 3 Private bots and a multi code webhandler
ah ok
80% of that ram usage is the webhandler xD
my bot uses ~5mb at idle
xD
im actually surprised at that but kinda not
is the embed type on d.js-master rich, or message or what?
its an object
yeah but in the object
MessageEmbed.type is undefined, but what is it when its sent
MessageEmbed?
its on d.js master
im aware
oh i see what you're asking now
🤔
@restive furnace Fetch the message and see what the property embeds gives
MessageEmbed#type shouldn't be undefined
This code doesn't contain any error(RIP my bad english)
what code
kk
yey got working my reason cmd
can i do this?
you need to do !msg.member.hasPermission and msg.member.hasPermission
hasPermission is deprecated
you still can use it
,-,
what specifically "can I do this"
thought I can use this
have you tried it
<Permission>#has
Hello so I was wondering what url I should use for my bot since I don't have a website for it.
dont put anything in that field
Yes so I can add it to my server
Okay
What would you recommend use to create and host it
creating - literally any programming language with literally any code editor
hosting - a vps
Okay
have you ever coded before?
i guess no
I only did basic java along time ago
Okay thank you @modest maple
https://www.w3schools.com/js/DEFAULT.asp
https://discordjs-fork.readthedocs.io/en/latest/
https://nodejs.org/en/docs/
Hey chill how do you add it to your server
have you programmed it and have it running?
What do I have to do that my bot comes in the Discord bot list
Add the bot to top.gg and have a lot of patience ^^
Then after 2 weeks you re-add your bot because the detailed description was not detailed enough
Ok, do I have to do the description in English or do other languages go?
what ever just as long as it isnt:
a) Just HTML/CSS
b) Look like this:
p[ ikhudfgpokjdtrgha poji erta
gihudhfgsapoij]sghfdoij[hsgfd
]=adrg;iuhdhfaspo]k#sfgh
][
im doing this to get over the 300 min requirement```
any language can go
ok
Can someone make a bot where someone types "100" in a channel, the bot deletes the message and puts a reaction on the last post with the emoji name also being "100"? If they type "asdgfafs" it shouldn't work but if the emoji exists it should work
-hardrequest @daring gorge
@daring gorge
You seem to have asked for a very specific bot/feature. You likely won't find it on the site if you haven't searched already. You can try and put a request on Fiverr or Freelancer.
O_o seems like it would only take 5 minutes lol
yep
which is why its better to just go there
as people willing to do a 5 minute job for 10 bucks are a dime a dozen
whats wrong, it wont send msg into modlogs, even tho its defined https://paste.ee/p/HYRCT#gnL6moxr0Nw1oKTbfeFFed9imvkO0Q91
@daring gorge isnt that already builtin with +:emoji:
@restive furnace
Are you Saving the Channel by ID or Name?
let modLog = message.guild.channels.find(c => c.id === tag.get("mod_logs"))
Tho, are you copy and pasting Commands?
no?
- message.guild.channels.get(id) should work fine.
it worked until i made if (!modlog) {}
+😎
k got working, i just needed to add .catch after the thing and remive if (!modlog)
so now it ignores if no modlogs channel setupped
its k if not much guilds
await sondageMessage.add_reaction(":thumbsdown:")```
Can't figure it out why this is not putting the reactions on the message
have u assed sondageMessage to somthing
and Ignoring that
u need to Unicode instead of the \👎 version
Wait what language is that isn't it suppose to end with ; for each function
what
I'm very confused don't want to do with that because I've never heard of Unicode
its legit what all the defualt emoji's r
So the emojis that come with Discord
thats not very accurate
That is what I have used
not accurate at all
I still don't get it what do I need to do to fix it
a unicode character is a character like any other character, you can copy paste it, use it in text, in code, etc
there are many emojis who have a unicode version of it
So I put a slash in front of it
That did not fix it
code
async def poll(ctx, *, args):
await ctx.message.delete()
if not len(args) > 0 :
None
else :
questionSondage = "".join(args)
dictEmbed = {
"title": ":bar_chart: Poll",
"description": \
f"""
{questionSondage}
"""
}
sondageMessage = await ctx.send(embed = discord.Embed.from_dict(dictEmbed))
await sondageMessage.add_reaction("/:thumbsup: ")
await sondageMessage.add_reaction("/:thumbsdown: ")```
- well atleast we now know ur defo on python
thats not what they ment
you do \ to turn
into !4165_Hyped_ZeroTwo
or #265156361791209475 into [#265156361791209475](/guild/264445053596991498/channel/265156361791209475/)
D.py basically wants the emoji like: \u23EE
This is confusing I don't know how to turn 👍 into something like /u233EE
you in d.py discord
or python discord
if you go there
and into playground or bot commands
you can do ?charinfo <emoji> and it will give you the unicode
Ok thx
await sondageMessage.add_reaction("\:U0001f44d: ")
So it needs to be something like this
Ok
but you'll need all of the parts if it send them to you so you just put them all togethert
That's all it sent
yh so u should be fine
It is only adding one
code
await sondageMessage.add_reaction("/:thumbsdown: ")```
that part^^
re send it
async def poll(ctx, *, args):
await ctx.message.delete()
if not len(args) > 0 :
None
else :
questionSondage = "".join(args)
dictEmbed = {
"title": ":bar_chart: Poll",
"description": \
f"""
{questionSondage}
"""
}
sondageMessage = await ctx.send(embed = discord.Embed.from_dict(dictEmbed))
await sondageMessage.add_reaction("\U0001f44d")
await sondageMessage.add_reaction("\U0001f44e")```
that should work
that description...
It does not work
any error or is it just not adding it?
that
1.2.3
How do I update Discord PY
which caused any d.py bots which is on a earlier release than 1.2.5 crashes on animated emojis
r u on pycharm or somthing else?
IDLE
pip install discord.py --upgrade i think?
i cant remember cuz i use pycharm so i can just click a button xD
So pip install discord.py --upgrade
think so yh
Yep got it Thank you
it should stop having that error now
Yeah it's good now
👍
@outer niche by the way reset your token
did even notice
bad token leak
@loud salmon if i could borrow u just a sec just incase they havent reset it yet could you delete:
https://discordapp.com/channels/264445053596991498/272764566411149314/658055518409064463
ugh
@outer niche for big stuff like that use triple backticks ----> ``` big text shit here ```
kk
did you reset your tokeN?
yes
cool cool
legitimate question does discord reset tokens after a few months/years? a lot of my apps got their tokens regenerated
nope
lmao weird
ik if you upload to github code with your token it automatically become invalid
i haven't done that since like 2 years ago lul
the only way it can get forcefully reset is what chillfish said and api abuse
hmm
my bots process wasrunning for 11 days and it could read messages but not send any
token regen fixed that
definitely not api abuse
if your token is invlid it will kick you off the API completly
Instant crash and program ends
odd
if you catch the error when the token is invalid it wont
weirdest thing is jda was logging shard reconnection events and no errors involving an invalid token
but i dont exactly know why you would do that, cuz well you kinda wanna know when the token is invalid or not
discord is strange
reactions have a delete property (it might be remove) and you can pass the user as a arg for it to delete
so it only removes the user's reaction
yh
well your getting the reaction and user from the bot.on()
so you have the two object you need
what people usually do is count the reactions and if bigger than 1, remove it
tbf i dont remove them cuz people often dont give the bot manage reactions perms and it just dicks u
also stops people spamming somthing like a paginator
yeah, better just use djs master and listen to the reaction dispose event (if doing stuff like interactive menus)
Does anyone know how to make a discord login or a website
Probably talking about discord oauth2 flow
Something like that
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Check /app/package.json: command not found. Is a start script missing? https://glitch.com/help/failstart/
What should I do
Read the error
Kk
Whats weird happening w embeds... they are sending as [Object object] on d.js
(on dms)
const emb = new Discord.MessageEmbed()
.setColor(0xea411d)
.addField( "You have been warned in **" + message.guild.name + "**", `Reason: ${reason}` )
.setFooter("Moderator: " + message.author.tag)
let User = message.guild.member(message.mentions.users.first()) || message.guild.members.get(args[0]);
User.send(emb+ "basic mark()").catch(e => {
message.channel.send( `**${user.tag}** has DMs disabled, so he wont get warn message.` );
})```
why are you trying to concat an object and a string
ik
yes
then that should be easy for you
cool
wdym cool
you sent a json, cool
it doesnt matter
you should know this stuff, the answer is no, it can be empty
{
"users":[
"564309687189635087"
]
}``` i had this the whole time
{
"users":[
"564309687189635087",
"id2"
]
}```
^^^^ not that
but it still didnt work
that guy is banned
for testing
but it does react
idc
is it heroku xddd
i have to wait for it
and yes, it can
Omg
Lmao
Lmao
its not a vps
Dafuq
it is
Even glitch is better
You dont have root access
idc about root
@surreal sage Its not a vps if you dont have access to root
Its not vps
idc
You have full access to vps
im here for something else
"bot hosting"
You use some cancer shit
You are here for copy pasta
if(message.author.id === blacklist.users) return;```
```json
{
"users":[
"564309687189635087"
]
}```
there is no such host that is free
You only copy other peoples stuff
tutorial alert
@west raptor Can you please stop them naming them me as "copy pasta"
copy pasta
im not a dick
yes you are
no hes not xd
no u
how is this being a dick fam
u use a fucking json database
yeah we're helping you smh
haha
LOl
no
@compact oriole LMFAAOOOOO
@west raptor please
@surreal sage what you are doing, is Unnessasy staff pinging
Then code that yourself
I DID
Even people that coded for 7 days its easy
probaly not
@west raptor im crying now CUZ I WANT HELP
and i dont get it
HoW cAn I fIlTer ThRoUgH aN aRrAy

you know google exists
😭
STOOOOOOOOOPPPPPP
Acting is the key 🗝
@west raptor PLEASE
hes kinda agressive
Learn a few tips and tricks to help you easily find information on Google.
Tip 1: Start with the basics
No matter what you're looking for, start with a simple search like where's the closest airport
^^^
Pasta, how bout this
@twilit rapids Please 😭
stop crybaby-ing over json
Oh hey @opal halo, ur bot got accepted! 😄
like fking json
Yup
Good job!
Thanks!
@twilit rapids
The User CDeveloper#0001 is agresieve and constantly pinging Dream#9849.
i just want fucking help and now your letting me cry
I'm making another bot rn

cuz i dont want to be named like that
@opal halo whats its name?
AGAIN
KK Pasta
N00b
@surreal sage well cause you're obviously trying to get spoonfed so whyy should we help you
^
the rules said that we cannot spoonfeed
NO
I just want to know my problem so i can try to fix
Bruh
Ok we saw that all
your problem is you're not filtering the array correctly, so now fix it
we no give codes
sorry
Then don't call us bitches
@spare goblet we just got called bitch by @surreal sage
i do if you dont stop beng a dick
@surreal sage DUDE STOP YOU BEING A DICK
Damn dude
also stop with the attitude
my man
Bruh I never even said anything
u know you can just calm down and be cooperative and probably we'll help you
@earnest phoenix probaly thats his Attitude
^^^
bro
Ok
Ok
JUST STOP
Jeezus
You are asking to get Spoonfeeded.
Saying people trying to copypasta are being dicks? Wtfffff
NO
Shut mouth
lmaoaoooaoaoaaooa
Hi
^^^
Didnt I already say

STOPPPP
DUDE THATS THE BEST THING EVER @compact oriole
Guys i Need random anime picture
jesus christ guys what the fuck
ikr
Ikr
I want to make one link that gives you a random photo
@surreal sage your blacklist is an array, so you need to check if the array contains a user id. you do that by using array.includes(id)
this guy is telling us that we're being dicks for saying that he is using copypastas
@quartz kindle that dude @surreal sage is kinda agressive
FUCK UP
ok chill now he gave you the solution
Just stop naming me like that
@surreal sage Toxic Copy Pasta
guys shut up please
Yes
RAAAAAAAAAAAAAAAAAAAAAAAAAA
RAAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAA
v
b
RAAAAAAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAdfsdnfgbkm
Omg
sstoootoppspototposootppws
😂
@west raptor
Ya know there is such thing as a block button
NO YOU
Omfg
what did i do lol
I just want to be calm
And you insult me
i swear when my bot gets Accpepted i do an module for him that when he caps locks something that it sends an dm to him:
copy pasta
i didn't
AGAIN
lmao
stop it script
Affax don't do anything tbh
Bruh ur crying because of copy pasta...
HOLY FUCK
You stop being a dick
and i you @earnest phoenix
what
please stop adding fuel to the fire, move on, go to other channels, block people, go do something else please, im out
Hi
Please stop fighting and take this to DMs, this is #development. If you want to block each other then please do so
This is not the time nor the place. Any one who continues to fight will be muted for 1 month.
@spare goblet axyx was calling us a bitch
^
Move on please
@opal halo what is your bots prefix?
Mine has to be mentioned. prefixes got annoying.
How did prefixes get annoying xD
© might be a good prefix
I use to have it customizable.
I annoyed myself is the tldr
™ = good prefix
is best
@quartz kindle With that array.include
my array = blacklist
but that didnt work
i tried blacklist[users].include
didnt work either
What to use there?
As a random guy just showing up, is blacklist[users] an array?
Or is blacklist an array?
So you're accessing a users key of a JSON value of which is an array
Am I correct
Then yes, that should be correct
Try with apostrophes then
whats that?
'
uh js
Wrong symbol, the apostrophe is '
Yes
first?
'
ok
Can't you use Google for that instead of asking
i'm dutch and i dont know the names of symbols 🤣
` is backtick, ' is apostrophe
It would of bean easier to say quote marks
That would be " which wasn't precisely correct
(node:11) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'includes' of undefined
if(blacklist['user'].includes(message.author.id)) return;```
oh lol
Proofread what you write ty :^)
y sry
If it's not a dynamic key and doesn't contain special characters why not just use .users ?
Aye nice, you got it fixed
Guys hi this is my first time asking for help but something I can not understand what am I doing wrong...
And the problem is that I do not send Canvas, and writes an error saying an empty buffer. I will specify that I work with this module for the first time and I do not really know anything about it.
Help 🙂
Code: https://pastebin.com/L85u4UQg
how does my bot get verified
By time
@static surge your function does not return anything
move the function outside of the scope, so you dont redeclare it every time you run the command, and you dont need async here
create the canvas, then return it
@quartz kindle And how to make it return?)
This is my first time working with Canvas
That's basic programming
And @earnest phoenix #commands please and common prefixes are muted
module.exports.run = async () => {
...
let buffer = profile(...);
}
function profile(...) {
return new Canvas(...).toBuffer();
}
@quartz kindle And the very sending far?
const attachment = new Discord.Attachment(buffer, 'welcome-image.png');
await message.channel.send(attachment);
.send({ files: [attachment]});
or
.send("message",attachment);
the way you did it should also work, test it
Hm...
Working local attachment:
const attachment = new Discord.Attachment('./card_images/sample.png', 'sample.png');
const embed = new RichEmbed()
.setTitle('Wicked Sweet Title')
.attachFile(attachment)
.setImage('attachment://sample.png');
message.channel.send({embed}).catch(console.error)
if you want it in an embed, yes
How do I check if a message contains an attachment?
message.attachment[0]?
does not work
rtfd
Help pls
can u do eval message and send me the logs
@quartz kindle Listen ... I see you understand a lot of things ... I’ve done something like it’s necessary, but my avatar is not shown
.addCircularImage(member.displayAvatarURL, 85, 90, 64)

@restive furnace
k then its message.attachments[0], i think
@vagrant stream for the attachment you can use the links
message.attachments.first() maybe
👏 Read 👏 the 👏 docs 👏
attachments is a Collection, which is an extension of Map. Maps do not have numbered indexes like arrays
they have keys, like objects
@static surge canvas does not download images, you need to download them before you can use them
Does Glitch.com Supports Canvas?
ask glitch
Ok
@quartz kindle
Um ... And this is my profile picture in what plan to download?
I tried so, it gives an error
const result = await fetch(member.user.displayAvatarURL.replace(imageUrlRegex, "?size=128"));
if (!result.ok) throw new Error("Failed to get the avatar.");
const avatar = await result.buffer();
what err
Failed to get the avatar
show full code
@quartz kindle https://pastebin.com/KdWc6bcK
you didnt await it
also, if you're doing that inside a function, you need to make it async
what did you do ?
I did not understand you ...
You need to await it
Async 101
@earnest phoenix glitch can use canvas yes
@quartz kindle And I also wanted to know either how it calls it, or just how to do it ...
This is how to make a strip
Only I need it around the avatar, and not as an example.
@earnest phoenix fp glitch is node.js developement thing... so it supports every npm package
ok lets try it
if (command === "enable") {
const args = message.content.split(' ').splice(1).join(' ');
if(args === "clear") {
if(clear === 0) {
clear = 1;
message.reply("I've enabled **clear**!")
}
} else {
if(args === "lockdown") {
if(lockdown === 0) {
lockdown = 1;
message.reply("I've enabled **lockdown**")
}
} else {
if(args === "kick") {
if(kick === 0) {
kick = 1;
message.reply("I've enabled **kick**")
}
} else {
if(args === "ban") {
if(ban === 0) {
ban = 1;
message.reply("I've enabled **ban**")
}
}
}
}
}
}```
im doing this but its hard
i know i can do: ```js
if(args === 0) {}
im not sure*
but can i do args = 1;
cuz if args is like a variable stored somewhere
would it pick the job from that variable and store something in it?
you're checking if a string is a number. why do you want to re-assign args specifically?
wdym
wdym by what
what will happen if i do that*
do what specifically
what?
if(args === 0) {}
This will always be false because args is a string and will never be 0
where is args 0?
i know i can do:
if(args === 0) {}
??
thats what i want
there is nothing defined as args
well there is
but no 0
these others are vars
btw you can do else if()
idc
no need for js else { if() }
else if is literally that tho
what is the problem anyway? i dont understand what you need
i have to do every thing of this http://prntscr.com/qea1hn in enable/disable i want like 10 lines of code and not hundreds, i want that if the args have the name of a variable it changes the variable value
so i can have it short
http://prntscr.com/qea23d im now here
a command handler sounds much easier to manage, or an object/collection
the best way to do that would be to put all of those inside an object
but how to change then?
how to change them then
values[args[0]]
if you are working with true/false, you can do values[args[0]] = !values[args[0]]
i want that i can change them
if you strictly need to work with 1/0 and not true false, then you need to do js values[args[0]] = values[args[0]] ? 0 : 1
the basics of it is like this
you have an object, ie values = {test:1}
so im gonna continue this
so you can access it by values["test"] and it will give you 1
ik
and you can change it by doing values["test"] = 0
and if you are working with true and false, there is a shortcut
for example
values["test"] = !values["test"]
nvm
if values["test"] is true, it becomes false, if its false, it becomes true
values["test"] EQUALS NOT values["test"]
this is the easiest way to switch something between true and false
il take your first example
and what you wanted is to use args directly, right? so you can use the value of args directly in there
values[args]
@quartz kindle isn't there a way to .toBoolean or something
help
i dont understand what you want desert
@quartz kindle Do you see the strip below?
Depending on the user's XP, it changes...
I want to do something like this
you make 2 bars, the one in the background always has the full length and the bar in the foreground is a limited length depending on the XP
^ and convert the experience percentage into the pixels needed to fill the bar
@quartz kindle @blissful scaffold
I’m saying that I’m a beginner can show how to do it
I know the theory, but I'm not a JS dev so I can't really help you with any details
I would say read the documentation related to canvas, making rectangles is usually pretty easy and i think rounded edges are also not too hard
Can I drop a link to it? Because I really didn’t find anything.
The few times that I had to work with JS I usually used the Mozilla docs
@static surge you see how you did addRect to create a rectangle?
Has anyone used typeorm with mongodb?
I don't wanna use mongoose for its lack of TS-ness
and callbacks... yuck
@quartz kindle Saw.
havent used any mongo, nor any orm, nor ts lmao
lol
@static surge so basically its the same thing
you create a background rectangle for the bar
and another rectangle on top for the xp fill
the rest is all math
rectangles are created from 4 values: X position, Y position, Width and Height
so in those numbers you need to define where the rectangle should start (X and Y)
both of your rectangles should start at the same position
then you need to define the rectangle width in pixels
one rectangle should be the full width, the second should be a partial width
you need to use math to calculate the correct width
then the height, both rectangles should be the same height
for the width math, you can use the following formula
xp bar width = currentXP * full bar width / totalXP
Whats the easiest way to create an image in node.js
canvas probs
I use canvas, it's neat
@delicate zephyr jimp for the easier-to-use-but-much-slower one or canvas if you used html canvas before
I need it for node
since I'm gonna use a web server to give images after generated
since I also want it to embed in discord 
@fluid basin
Canvas can still be used can’t it
yeah
yeah node-canvas
well honestly idk but afaik the nodeJS libraries for image manip are quite slow
it's an image
how long does it take for a bot to be verified?
a week or more
ok
It really depends
atm it around 2 weeks
Depends on how backed up their queue is and how many mods are available to test
@opaque eagle how would you send it through express when using express?


