#development
1 messages · Page 1117 of 1
be a bot dev = https://sololearn.com
Ok thanks
which one?
Brainfuck
i still need help the thing on stack didnt do shit
@sterile minnow sorry if I missed it, but what exactly do you need help with
nodeJSisjsbutokay
I love '.'
If you have little knowledge in most the langs you specified or just want to start off fresh, I'd recommend Python.
Has anyone eve-
Ew py as a starter language? Do you want to ruin your sense of syntax for the future
Ok bye
I finally got it
What did you finally got
Python is super beginner friendly like JavaScript is
plus you don't need semicolons in either languages
whichever ur more comfortable with, use:
c lang: libdiscord (beta)
java: jda
node.js: eris or discord.js
@fringe jackal ^
discord.js-light*
as a first language i learnt visual basic lmao
Probably should learn djs before using djs light for now
i got sad when there were no goto's in python
eh
if there are any new bot devs which actually knows node.js, i'd point them into the direction of eris
not discord.js
Me when the :=
go
which is one of the reasons why i dont like discord.js
not this server
but the reputation discord.js has
Why does the walrus operator look weird
i like it
it's sad that you're using it as an assignment
only a man?
sorry im a woman
thats sexist dude
shoot, erwin beat me to it
ah 2020
Sorry I'm a woman too
either way, not the place for asking that i guess
that's going to get you on a list
new bingo things
oh you right, might be able to add that to bingo
Hire me daddy
😩
Let me do some work for you so you can pay me 😩 😩 😩 😩 😩 😩 😩 😩 😩 😩 😩
Please I need money for hosting
this is #development fyi
oop mb
sometimes i forget when people ask off topic questions it doesnt automatically make it off topic
if (guild.levels === "enabled") {guild.levels = "disabled"
await guild.save()
message.channel.send("Leveling System is Disabled")
} else {
guild.levels = "enabled"
await guild.save()
message.channel.send("Leveling System is Enabled.")
}```
This only disables it
when the database isnt it
anyone help?
when the database isnt it?
basically the database saves it under "levels"
and it is either enabled or disabled based off of that command
but when the database's "levels: "enabled"" it just skips the whole entire command.
I've even tried else if statements
I cant seem to figure out why it just does not notice if it says disabled or not
Show where you're checking if it's enabled or disabled
Also why don't you just save as a boolean 
Not sure exactly (because I didnt actually look at the code), but why dont you just use a boolean?
levels: true or levels: false for enabled or disabled
does anyone know how to make a div take up the entire browser's screen? i've been trying to make it work on my bot's site for the past 30 mins now
height of 100vh
this gives me an error
me?
just did that
<script src="js/vendor/modernizr-3.11.2.min.js"></script>
<script src="js/plugins.js"></script>
<script src="js/main.js"></script>
<script src="https://cdn.jsdelivr.net/gh/tengbao/vanta@master/vendor/three.r95.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/tengbao/vanta@master/dist/vanta.fog.min.js"></script>
<div id="vantaFog"></div>
<script>
VANTA.FOG({
el: "#vantaFog",
mouseControls: true,
touchControls: true,
minHeight: 200.00,
minWidth: 200.00,
highlightColor: 0x70707,
midtoneColor: 0x0,
lowlightColor: 0x2f2f2f,
baseColor: 0x222222,
blurFactor: 0.40
})
</script>```
#vantaFog {
position: absolute;
display: block;
min-width: 100vw;
min-height: 100vh;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: -1;
}
produces (vanta is https://www.vantajs.com/)
guilds.levels: true is not proper js, nor what I meant
if (guild.levels === Boolean(true)) {guild.levels = Boolean(false)
await guild.save()
message.channel.send("Leveling System is Disabled")
} else {
guild.levels = Boolean(true)
await guild.save()
message.channel.send("Leveling System is Enabled.")
}
like this?
what's the point of doing Boolean() on a boolean
if (guild.levels === true) {guild.levels = false
await guild.save()
message.channel.send("Leveling System is Disabled")
} else {
guild.levels = true
await guild.save()
message.channel.send("Leveling System is Enabled.")
}
this better?
I keep getting this error when I'm trying to put guild data into a mysql table
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
errno: 1366,
sqlMessage: "Incorrect string value: '\\xF0\\x9F\\x8F\\x96Et...' for column 'name' at row 1",
sqlState: 'HY000',
index: 0,
sql: `INSERT INTO guilds (id, name, prefix) VALUES ('702754622015799336', '🏖Ethereum Paradise🏖', "$")`
}
could just do if(guilds.levels) because if checks for a boolean condition so doing if(x === true) is redundant
you're not sanitizing your input
Can be as simple as
guild.levels = guild.levels ? false : true
await guild.save();
return message.channel.send(`Leveling System is now ${guild.levels ? 'enabled' : 'disabled'}.`)
trying to save an emoji into a mysql db?
or you're using mysql in which case, why and you need to set the table format to utf8mb4
https://discordapp.com/channels/264445053596991498/272764566411149314/740338923770740856 can someone help with this?
Why are you saving guild names
i put the name so its easier for me to look through in the case i need to change something
but id is actually easier tho
@strange trout it still does not work. I took your code exactly, but it only changes if the levels = true and it changes it to false
but never if it is false to true
it accesses it via the id
the name doesnt do anything for the bot
it makes my eyes hurt less when looking through it on phpmyadmin
sometimes there are reasons to store names, such as dashboards
https://discordapp.com/channels/264445053596991498/272764566411149314/740338923770740856 can someone help with this?
@gritty bolt
i have the collation set to utf8mb4_general_ci
@sweet ruin there's probably something wrong with the code I sent. I'm on mobile lol
No no
it works now
somethin in index which I put there
to block the code from working in the first place
if it was disabled
was stopping it
I need to rework that into the booleans xD
Yeah. Makes it a lot simpler though
Alexis
would an If else statement work for the booleans in index
because Im looking at the code you wrote here
and idk how I could make that into an if else statement with such large code
his code is an if else statement really, just written in a different way
^
if(guild.levels) {
// TRUE do this
} else {
// FALSE otherwise do this
};
sometimes there are reasons to store names, such as dashboards
@solemn latch
there are never reasons to do that, you can fetch the guild object and if you're using oauth2 you can get partial guild objects with a bearer token
if you store any dynamic data then you have to also listen to their changes and update it accordingly which is just retarded
so, you should request thousands of guilds names?
What
so, you should store and track thousands of guild names?
if you need to access all of them
you don't get the point
🤷♂️
can someone please help with this https://discordapp.com/channels/264445053596991498/272764566411149314/740338923770740856
if you need to track guild changes, then you're already logged in to the gateway - if you're logged into the gateway you have guilds in cache which means that you don't have to request anything, the name is pulled from memory lol
more than one thing can access a database
that's not the point
It's redundant
so I am using JDA and created a shard Manager with default gateway intents. Now almost no user data are available anymore?
accessing from db is slower than accessing memory
???
plus imagine the resource waste that's spent on tracking guild changes just to update strings in a database
It just gives an extra thing to worry about saving and updating since names are dynamic
that and you also need to account for bot downtimes and unreceived events
i've literally spent an hour trying to get a background for my bot's website to work i dont get it
tldr storing any dynamic data is asking for a headache and it's on you
so my dashboard, which has no access to my bot, should request every single guilds data from discord?
integrate your bot into the dashboard backend
Why wouldn't dashboard have access to the bot lol
seperate servers
doesn't matter...?
so, send request data to the separate server?
discord bots can be logged in to the gateway regardless on how many machines they're on
just integrate your bot into the backend of the dashboard
have it logged into the gateway so you get all guilds in cache
you don't have to keep any other data in cache but guilds
to reduce memory load
i'm aware
along with more network usage
the transfer is so small the network usage doesn't matter lol
🤷♂️
storing dynamic data doesn't scale and it's just asking for problems
hmm
okay, what about user data.
for example, mee6 leaderboard data.
wheres the user usernames coming from? discord directly?
you cant fetch other users with oauth no?
i'm having problems with ms
most likely mee6 backend
client -> mee6 backend -> cache lookup -> if not found, REST request -> return the user to the client
it works normally but not when i feed time in
thats gotta destory ram then?
because they would be caching the top atleast 100 of each guild atleast
also you're probably used to d.js caching which is extremely heavy
i easily handled this guild + DAPI + discord bots + 2.5k other guilds at around 150MB steady
with all members cached
hi
what's up
at mee6's scale it would cost more resources to store the user avatar and other relevant data in the database and keep up with the changes
which they do not
keep in mind that you cannot track member/user changes if you don't have shared guilds
if you have a well designed database, you will need very little caching
sorry my english is horrible
database lookups should be fast enough for something like a top 100 users per guild
most likely
ay
i doubt it
tim agrees with me
keep in mind that you cannot track member/user changes if you don't have shared guilds
the users on mee6's leaderboard page appear updated regardless
i doubt mee6 would store usernames it would probs be user IDs
Jeremy can you show your code
@sudden geyser just ms(time)
^
and time is defined as my arguments
well if it needs to fetch 100 users every time it loads a top 100, that would be troublesome
it most likely keeps them in cache
they would need to fetch them at startup
in this case, what would a cache do? if you need to fetch them anyway for them to be updated
i tried this with my leaderboard system, i swapped to storing them because discord would get mad at fetching 20+ users, let alone 100
sure you wont update it every time, you will keep a cache for like 24 hours
even at relatively small scale
you can cache them from GUILD_CREATE and GUILD_MEMBER_CHUNK and you'll receive according gw events for it
however
these bots work at a HUGE scale
and they probably have specific protocols they use with discord
if they are present in all the guilds they provide top 100 lists for, then they most likely keep their database updated with usernames included
and keeps updating them from member_update events
then they probably have a short term cache layer for displaying them through the website
and time is defined as my arguments
@misty sigil can you logtime
so 1s (bare args) undefined (ms(time)) 60000 (ms("1m")) 1s (time args)
yes i logged that
at mee6's scale it would cost more resources to store the user avatar and other relevant data in the database and keep up with the changes
@earnest phoenix yeah why would they do this when they can just link the image in the website XD using member.avatar_url
mee6 does just send the discord avatar link
they do have a username cache tho
are you using mongodb ?
i know that
because if you delete your account they will still display the username as what it was
not deleted account
mee6 does just send the discord avatar link
@solemn latch you need the avatar hash for that, which is the point of the message, the avatar isn't just the user id
i need to found best database for discord bots
so 1s (bare args) undefined (ms(time)) 60000 (ms("1m")) 1s (time args)
@sudden geyser
there is no best
@earnest phoenix mongo or sql dbs
in discord.py you can just do user.avatar_url
ok ok thanks
whichever u want
i don't know, how do you fix that when you press invite it sends you to a browser and sends you back?
discord protocol when
why dont they use it tho
at least they used to, back when the game store was a thing
telegram/whatsapp/viber/skype/etc all use their own protocols
i'm pretty sure that the discord in-app protocol is experimental for android right now
they're experimenting with oauth
well, opening discord urls with the discord app is long overdue
discord:// yeet yeet
its how invites are "beamed" too
i dont even use the app so i cant test lmao
it doesn't even render properly for me on android :omegalul:
works on desktop though
cool
they need to do it for bot invites
and oauth2 in general
the app should open discord oauth2 inside the app
i remember there were plans to allow executing RPC commands with the protocol but that's dead news i assume
nothing has been mentioned for over a year
oauth2 opens in discord for android at least
even when inviting a bot?
uhhh, i dont know
isn't fully working yet
at least it partly works then
xD
just like everything else on discord 
my bot won't change his profile picture
its getting there™️
tbh tho discord has its stuff together better than me
better than all of us
and i have what. 6 scripts to deal with and a website XD
A
what
i dont think so
Someone who made a bot what else would it mean
because some people dont consider apps like botghost or bot designer as being a "bot creator"
Never again
i don't
assembly bot creator anyone?
haha good joke
lmao
performing get requests with assembly
before you're even able to start coding a discord interface, you'll need to code your own network drivers and shit
i'm a bot creator 
c bot when
the moment i see these words i give up:
glitch, heroku, ghostbot
😳
ive never coded anything below c++ and people who made the first computers scare me
their brains must be like skyscrapers
i've never coded anything below js :^)
yes
yes
its a steam game
add to your wishlist now
on STEAM?
you didnt know?
app
there's tons of those
tons of bots here are made with "makers" like that
lmao
heroku is good for its actual purpose
granted all of the bots made with those makers are shit but it's the effort that counts ⭐
so is glitch
whats the mobile app that you have to watch ads to keep your bot up
bot designer?
TIL that shit is a steam game
thats the one that really gets me
Doing it rn, no balls
lmao
the ui is so clunky and bad
who uses steam for talking anyways
what lang/stack?
no idea
someone steam called me once, was so confused
i'd assume also electron
forgot it was a feature
only good electron app is VSC
press ctrl + shift + i and watch the errors on discord bombard
i press f12 :^)
it's even prettier when you enable gateway logging
i press alt f4
how do you enable that?
i press ctrl+shift+w
~~if i say it i'll get beaned
~~
only works on chrome version tho
lmao
client muds
i didn't reverse engineer half of the user gateway workflow with just gateway logging
so, who wants to finish my project? cuz my motivation already way too low for today lmao
im about to pull the bingo again with the my code errors and doesnt show error/code
does ms() return undefined if it cant figure out what (time) is?
like 3s sometimes works?
no its just that it works if i manually input it
try checking your actually getting 3s then
im getting 3s
it does seem to return undefined if it doesnt understand
https://github.com/vercel/ms/blob/master/index.js#L101
it does clearly have a case for s
on my arg and my time declaration
https://jeremy-clarkson.is-inside.me/7dDHMYtF.png heres the log
1s is the arg
undefined is ms(${arg})
60000 is ms("1m")
1s and 1s are other ways im trying to make it work
just to make sure, this log is
arg ms(arg) ms("1m")
this may seem like a dumb question
but if i return nothing
if (!match) {
return;
}
the returned thing would be undefined yeah?
it could not be matching the regex, or not matching the switch cases, its not really clear
but if i were to put in ms("1s") it works
can i see the code you used for this log
https://jeremy-clarkson.is-inside.me/7dDHMYtF.png
console.log(args[2], ms(${time}), ms("1m"), time, time.toString())
why are you not using args[2] inside ms?
is time just = args[2]?
man, i have no idea. it seems silly
looking at the code for the lib, i just dont see how that returns undefined
how do you get the image url of the guild picture
<guild>.icon iirc
oh
this may seem like a dumb question
but if i return nothingif (!match) { return; }the returned thing would be undefined yeah?
@solemn latch it'd imagine it'd return null
That's the issue with js not specifying function signatures
was just me being fucking dummy
o left a space?
yes
youd think the lib would be able to handle a whitespace
yea lol
🤔 such a tiny fix
@solemn latch i do message.guild.icon onto an embed and it says invalid or malformed url
djs right?
its iconURL() for the url, mb.
https://discord.js.org/#/docs/main/stable/class/Guild?scrollTo=iconURL
.icon just gets the hash for the icon
https://discord.js.org/#/docs/main/stable/class/Guild?scrollTo=icon
oh
Can we increase quality of Avatar cmd?
yes
You can increase the size of the image.
this does the trick (enlarges the image) .displayAvatarURL({size:4096, dynamic:true})
Yo
hi
hello
Comment allez vous ?
Someone can help me please the command to list what server bot is in discord.js, which shows the guild id, the owner id/name, etc...
Just like this: https://discord.com/developers/docs/resources/guild#get-guild
Discord.js version: 11.6.4
EDIT: nevermind, i do not need it more
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
what
do u want a server info command?
and u want to get the guild?
<Message>.guild should work
also read the d.js docs not discord docs
Hey Guys, Discord has disabled my bot and asked me to contact them for more information. I have but obviously they'll take a while to respond. I was wondering if anyone has had a similar experience and could shed some light on the issue?
Possibly breach of TOS, API abuse, over 100 servers w/o sharding, etc
That's in Discord docs for large bots
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
oh I was way off
100 servers
Let me get my facts straight hol up
You need to be verified to be over 100 servers*
That's probably what I was thinking of..
Who needs a free translator api?
Someone was looking for one the other day
wdym
like
whenever i leave it running 24/7
he just joins
i don't know what his purpose is
but i want to get him out of my repl
sorry for asking but what is "repl"?
A service that you shouldn't use to host bots
A service that you shouldn't use to host bots
@strange trout why?
oooh I see, that's interesting
o lol
If its not private, then he is allowed to be there right?
@slow fable How did you hide it?
.env
Oh
@slow fable Btw, you have to stay on the page for the hosting to continue, right?
You can use a pinger to keep it up 24/7
It's fine I don't need it, I was just wondering
I didn't know this website existed
is it new?
no
h
How long does it take for your bot to be approved?
const Discord = require("discord.js");
const bot = new Discord.Client();
const token = "token";
const PREFIX = "-";
const color = "#434072";
bot.on("message", message => {
if (message.channel instanceof Discord.DMChannel) return;
let args = message.content.substring(PREFIX.length).split(" ");
switch (args[0].toLowerCase()) {
case "test test":
message.channel.send("test")
break;
}
});
bot.login(token);```
How do I make the command to have multiple words? I tried to do it as shown but it doesn't respond.
Hi
hey
const Discord = require("discord.js");
const bot = new Discord.Client();
const token = "token";
const PREFIX = "-";
const color = "#434072";
bot.on("message", message => {
if (message.channel instanceof Discord.DMChannel) return;
let args = message.content.substring(PREFIX.length).split(" ");
switch (args[0].toLowerCase()) {
case "test test":
message.channel.send("test")
break;
}
});
bot.login(token);```
How do I make the command to have multiple words? I tried to do it as shown but it doesn't respond.
@errant perch no
ok
Yo I was looking in FAQ and rules and I don’t see any reasons why they would decline your bot?
like if(args[1] === "test"){
msg.channel.send("test")
}
or just violation of tos
im using a command handler but how i can make to make commands in separated folders
yes
ok
everything is on there, and i want some folder but id to use properly use fs
const Discord = require("discord.js");
const bot = new Discord.Client();
const token = "token";
const PREFIX = "-";
const color = "#434072";
bot.on("message", message => {
if (message.channel instanceof Discord.DMChannel) return;
let args = message.content.substring(PREFIX.length).split(" ");
switch (args[0].toLowerCase()) {
case "test":
if(args[1] === "test"){
message.channel.send("test")
}else{
message.channel.send("Kindly provide Second args")
} break;
}
});
bot.login(token);
@errant perch ^
i got it working
elseif
just see if args 1 is present
@dire obsidian you'd need to read the ./commands/ directory with the fs module (readdir)
by
you said you were using a command handler, correct
if(!args[1]) return msg.channel.send("AH e ")
yes
ah yes
kk
actually i have this to identify the commands
;-;
where are you using Categories though
^
nowhere
I assume you're following Discord.js' official guide already
im addin it cuz i think ill need it
but then what do you mean by you have to identify them
then it will be what u want
yes i do
but then what do you mean by you have to identify them
@sudden geyser to search the commands
:pepehmm:
@errant perch args[index]
bot.memes = new Discord.Collection();
bot.fun = new Discord.Collection();
const commandFiles = fs
.readdirSync("./memes/")
.filter(file => file.endsWith(".js"));
for (const file of commandFiles) {
const memes = require(`./memes/${file}`);
bot.memes.set(memes.name, memes);
}
const commandFiles2 = fs
.readdirSync("./fun/")
.filter(file => file.endsWith(".js"));
for (const file of commandFiles2) {
const fun = require(`./fun/${file}`);
bot.fun.set(fun.name, fun);
}```
this is tough way
but i use this from starting
why though
-command arg1 arg2 arg3 ...
args[0], args[1], args[2], args[4]
@woogie
because at that time i was big of a noob
ah
@faint prism ok i'll check that out
-command arg1 arg2 arg3 ...
args[0], args[1], args[2], args[4]
@faint prism
Was i right ? since in his case case is the cmd
Make sure you understand how arrays work
you were right but i didnt prefer that way
ok
both work though
You weren't wrong using args with the index of one. However, I recommend looping through all available args based on the count in the array
ok
Just curious, what’s more common, discord.py or the js api?
i think js is because its easier and there are more tutorials on it lol
if you judge things off tutorials you won’t get far
I’ll take a look at js
docs are the thing you need
it may be easier for starters
Which one is better for starters?
plus js is similar to c# so if you want to learn other languages that’s cool
Kewl
plus js is similar to c# so if you want to learn other languages that’s cool
@upbeat sedge no way. C# and JS are very different
yeah
And you can implement those in js?
I said similiar
I'm not too familiar with JS, but from the samples I've seen they seem worlds different
not the exact same
Where C# is explicit, strongly typed, and unforgiving.
Js is more relaxed about data types, function signatures, etc
Which one is better for starters?
@rare moss Python or JavaScript. But I would lean towards Python imo
somebody know how to make a events handler?
i allready have a command one but idk how configure it, the discord.js dont shows anything and i search but nothing works
You do it similarly to the command handler one you do: read a directory and require the file
However, since it's going to be events, you'd do <EventEmitter>.<on or once>(eventName, ...args)
like client.on(event.name, (...args) => events.run(...args))
Yeah it's simple
thanks bro
ill say the truth, all my time i using programs to make bots, but look coding is more funny
I use switch () for my commands but if i used if message.content == "egg" would i notice any performance issues?
what is a redirect URI (posted in #support originally, just moved channels)
@earnest phoenix "but the redirect URI is used mainly on sites that use the discord OAuth2 to add/use discord user info on their websites"
if you're adding a bot to a server, you don't need the code grant nor the redirect URI
Bruh no one uses python here 😦

I use switch () for my commands but if i used
if message.content == "egg"would i notice any performance issues?
@errant perch no
ok
just use switch if you have like tons of if else
for simple bots if / else stuff is fine. but if you get more commands its probably smarter to use a switch case
if else is slower, an example of it is yandere simulator, if you know how bad the fps specially when there is a lot of student, then thats the answer
^ thats not the reason its slow lol
the issue there is that the checks time variables every frame with a if statement as example
the reason its slow is cause the entire game redoes all the scripts every frame
instead of doing it, yknow, once ever 30 frames
its because its checking every block one by one, and its doing it every frame
thing is when unity compiles it it becomes switch cases so that doesn't matter
if else is already slower, make it per frame thats why, it could be a bit faster if coded with switch but the point is if else is slower
i didnt buy the game 
interestening the url is invalid
i didnt buy the game :GWahreeVampySmug:
@sinful lotus its free
yikes thought it was paid
i mean he gets like 300k a year from patreon. but the game is free
lol if he would take money for it. Would be funny AF to pay for a game so badly optimized that i would rather play Gmod with 2 Million Addons installed (yes i did it and it was horrible)
he's made 4million dollars to this day
i mean, the guys not the best at coding, but he's great at getting money
lol you can make money if you just make a half decent Weeb / NSFW game
there is a guy who makes 50k/Month bcs of a NSFW Sims 4 Mod
hey guys 🙂
iam new here i just wanted to ask briefly
yes?
iam making a discord server on my own and i wanted to make a Verification channel
i successfully made a bot where it checks you using Captia (bot checking bots...ironic)
i just wanted to know how can i force send players from one channel to the other
maybe with roles
@lusty quest bother join in and try helping?
nope
sure
do you know any way/bot i can force to make the player switch from a channel to another?
almost XD
okay
use mee6
i want the player to force switched to the #welcome channel of my server after they hit the check mark
oh
that's easy
yes
and gives u a role that mutes you (i know iam smort XD)
so how can i do that
that's easy
@earnest phoenix
I made that with mee6
you say a command and it verifys you
so you want me to help?
He means react to a reaction and you get a role.
no I made it so you say !verify and it verifys you
ok
using the same carl bot thing
but after i did that
i instantly got switched to #welcome
instead of me having to go there manually
My bot does that
who?
i know what you mean
thanks
Can I please DM you my bot's link?
sure
Thank you
no problem
I'ma go now
wait one last thing
Ok
pineapple
is there a bot that can reward players (with XP or anything) for inviting other players?
i saw that before
woah
its possible in embed to setimage more than 1 ?
Imagine
is it possible to only let a bot speak in one channel but it finds the channel from the name of it
@still lily it's better to do it by ID
Voice channel.leave()?
Yes
Np

Nope it's not
I start a peer server and it doesn't work :d
On the port my peer connection looks for
Any reason why the following code is not working? I'm checking if the user has admin permission, or if it's the botowner, but It seems to break the if statement when checking the permissions, my code:
PS: If I log the message.author.id it's the same that I have for ownerId and if I remove the check permission it works.
if (!message.member.hasPermission("ADMINISTRATOR") || message.author.id !== ownerId)
return message.reply(
"Sorry, You don't have the correct permissions for this command."
);
Thanks
why
If the owner doesn't have admin, it won't activate
You need to check if they don't have admin and they are the owner
So you should check both
@raven axle try this
if (!message.member.hasPermission("ADMINISTRATOR") && message.author.id !== ownerId)```
I'm checking if the user has admin permission, or if it's the botowner
Isn't && "and"?
How does && apply here
lemme show u an eg
oh
ok nvm
i thought u meant
nothing
leave it
|| should work
I'm so confused bout it lol, it doesn't seem to work
100 iq responce
it returns, shiv
can i upload more then one bot
ya
nice
time to add my ai
anyone know the webpage / channel that i can find info on bot upvoting checking for discord.js
@still lily https://top.gg/api/docs#jslib and #topgg-api
Hello Guys, so I have a premium system where the bot checks in the specific server of having the specific premium role where if they have it, it will run the premium command or else it will state telling that he doesn't have premium and he will need to purchase it. This my current code:
const botconfig = require("../botconfig.json")
const colors = require("../colors.json");
module.exports.run = async (bot, message, args) => {
if(bot.guilds.cache.get('721372685275234436').members.cache.get(message.author.id)){
if(bot.guilds.cache.get('721372685275234436').members.cache.get(message.author.id).roles.cache.some(r=>r.id==="736643325863395331")){
//Commands run of him having premium
}else{
// Stating you don't have premium
}
}else{
// Stating you don't have premium
}
}
module.exports.config = {
name: "premium",
aliases: [],
usage: "a!premium",
description: "Premium Test!",
noalias: "No Aliases",
accessableby: "Members"
}``` As you can see, there are two elses, the first else stating for not having the role, and the second else stating that he is not in the server, but I usually put in the two elses telling he doesnt have the role and finish.
The question is that some commands, for example: I have an economy system, and for normal users, it will give (for example) $150, and for premium users, $250. I put the premium script in the `//Commands run of him having premium`, but for the normal users, should I repeat it twice in the two elses? or what should I do?
jesus thats alot of text
Please read and give me help, if so! 😦
you just could make a object with premium users and do if (premiumUsers.includes(msg.author.id) { //premium code
} else
{ //normal code }
why 2 checks?
or something like that
you just could make a object with premium users and do if (premiumUsers.includes(msg.author.id) { //premium code
} else
{ //normal code }
@restive furnace no, it will error.
that wont work like that.
it does
I dont think it does.
lemme pull you example
how to fix this error? (node:4320) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body embed.image.url: Not a well formed URL. at RequestHandler.execute (F:\BOTS\JSBOT\node_modules\discord.js\src\rest\RequestHandler.js:170:25) at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:4320) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:4320) [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
@outer marsh
your embed image is a bad url
how can my bot see this channel
what is your url?
let premiums = ["528256079101034506", "another premium user"];
if (premiums.includes(messageAuthor#id)
{
// you premium code
}
else
{
// normal code
}```
Hey, I have searched through my code multiple times for an error and haven't found one. This code is supposed to create a captcha and if the user completes it correctly it will give them a role, which it does, and if they don't get it right it would kick them. It correctly does the part for getting it right but it doesn't do anything for getting it wrong 🙁
let captcha = new Captcha()
const krole = member.guild.roles.cache.find((x) => x.name === "Kick")
const channel = member.guild.channels.cache.find((x) => x.name === "verify")
if(!channel) {
return console.log(member.guild.name + " Please Create channel with name verify")
};
const vrole = member.guild.roles.cache.find((x) => x.name === "non-verified")
if(!vrole) {
return console.log(member.guild.name + " Please Create role with name 'non-verified'")
}
member.roles.add(vrole)
const verifycode = await channel.send("Please type the given code to be verified",
new Discord.MessageAttachment(captcha.PNGStream, "captcha.png"));
let collector = channel.createMessageCollector(m => m.author.id === member.id);
collector.on("collect", m => {
if(m.content.toUpperCase() === captcha.value) {
m.delete()
verifycode.delete()
member.roles.remove(vrole)
return member.send("Thank you for verifying! You now have access to the rest of the server!")
member.guild.roles.add("")
}else if(m.content.toUpperCase() === captcha.value) {
member.send("You gave wrong code, so you have been kicked.")
member.roles.add(krole)
m.delete()
verifycode.delete()
if(member.guild.roles === krole);
then (member.kick)
} else{
verifycode.delete();
}
})
})
oh it becam image
or then just do to prevent repeating like if (premiuns.includes(messageAuthor#id) // give 2x coins else // give 1x coins
inside one code blcok
LINK https://media.discordapp.net/attachments/677543640456888354/740437339431501903/PMUL_SEMIS_GROUP_2.jpg?width=789&height=444
@feral aspen check my messages
how is this this deformed?
@feral aspen check my messages
@restive furnace oh, when someone buys, premium. I should keep adding to my premium listt??????????
premium array?
yes, or then get a proper database, but i just showed how you would do it. it isnt automatic on any bots, atleast i mean, they have to do the keys theirselves
No.. that ownt happen
using api as well
if anybody solves my query just tag me thnks
im not going to give you best possible
@restive furnace well my code was better, I believe.
Its just that I should repeat two times for normal users?
or what.
Hey can someone help me with making a welcome screen? For node js
the way mee6 does it like that ?
Yeah
like with a image?
And saying welcome to ..... @user
oh well thats easy
@restive furnace well my code was better, I believe.
nope, too many if/elseif/else's
one second
I'll dm u as I need help lol
just do this https://webtax.is-inside.me/JqNJYOep.png
^
How can you get the right array?
I mean that you can get the one that is the newest.
js?
Yes.
my_array[my_array.length - 1]
I found that but I need help with it.
explain
Um.
I am basically popping a random auditlog.
RIght now how do I make it so it picks one.
let data = auditlogs.data.pop()
@crystal socket
What is that spacing
?!?
oof
I tried @crystal socket
let datatrue = auditlogs[auditlogs.data.length - 1]
But I know I did it wrong cause I was confused.
Can anyone else help me.
have you tried putting a ; at the end 
I actually did.
It still says.
undefined
When I do.
var my_array = auditlogs.data;
var last_element = my_array[my_array.length - 1];
console.log(last_element)
It shows one.
Just not the right one.
why cache.filter
@blazing ravine because it is 11.6.2...
okay
UnhandledPromiseRejectionWarning: TypeError: (intermediate value).setColor(...).addRect is not a function
@silver dust addRect isnt a function meaning you probably havent created your canvas properly
oh
So uhm how would I go about making a birthday command? Since I'm rather new to js and json as well I'm kinda lost.
I wanted to do something like: "PREFIXbday 01/01/2000" and write that + author into a json file and check every day if it's someones birthday
I feel like it shouldn't be hard but somehow my brain is failing lol
split the arguments by / or ., then check if the mm/dd/yy(yy) is valid, then store to database, and finally, make an interval where it checks if the day & month matches what it is in the database.
so I should rather use a db for that?
I mean json should work fine as well since your birthday really doesn't change
right?
database = what ever you use as the database.
ahh
json is kinda database, so yeah, atleast I do count it
yeah I was thinking about changing my other json stuff to mongo or so
well it's a file in the end
yeah
and files are persistent storage
it's just that it's not as good compared to other databases
yeah I get that so I probably really should switch to mongo or so
mongo is nice 
yea mongo is nice. there are a few people here wo say its trash but i dont get the reason
Task exception was never retrieved
future: <Task finished name='Task-169' coro=<VoiceClient._create_socket() done, defined at C:\develop\python\lib\site-packages\discord\voice_client.py:172> exception=gaierror(11001, 'getaddrinfo failed')>
Traceback (most recent call last):
File "C:\develop\python\lib\site-packages\discord\voice_client.py", line 191, in _create_socket
self.endpoint_ip = socket.gethostbyname(self.endpoint)
socket.gaierror: [Errno 11001] getaddrinfo failed
Help
so how hard is it to change from json to mongo in general?
you probably have to write everything into the mongdb again
either by hand or write a migration script
not exactly hard apart from rewriting your write-file stuff to insertOne/updateOne
just a bit time consuming
well it aint much rn anyways, just some channel names & id's
so might as well do it now instead of waiting even longer
yea the earlyer you start the better. i guess it can be annoying if you are already at 100+ guilds and the performance of your json db starts to degenerate
okay 🙂 thanks for the help
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'utils' of undefined
code?
my discord.js bot stops playing a track three seconds before the end. The most interesting thing is that it works on my windows10 computer, and such a bug occurs on the Linux Ubuntu server.
There are no logs, or events..
@hybrid roost well, i did try YTDL-CORE-DISCORD andplay(ytdl(url), {type:'opus'});, track still terminating.
the error comes from this line:
.addField(`Roles [${roles.length - 1}]`, roles.length < 10 ? roles.join(', ') : roles.length > 10 ? this.client.utils.trimArray(roles) : 'None')
the discord client has no utils property iirc
@lusty quest wdym?
ts or js?
js
@earnest phoenix, the simplest solution you can make bool variable and work when it equal true. When command used, make bool false and use Timeout (setTimeout(void, time) in JavaScript)
there is no property
for utils
for utils
@lusty quest hm
I actually have never had this issue 🤔 sounds weird, neither on ubuntu nor linux
can somebody say me how can I send webhooks with custom authorname and avatar
In a text channel
language?
python
is that even possible?
yeah
It's a kwarg
my friend had done it in .js
mh?
@lusty quest how to run my bot script on docker container
I kinda don't know what docker file would be like
node or py?
How can I see I how much servers is my bot?
lib?
how to overwrite permissions for a channel using python
How can I see I how much servers is my bot?
@celest junco lib?
so i have this commands that loops through all the guilds and grabs the owner of each one. but i run into this problem where i get a error when it hits this discord which appearantly had no owner or something and idk how to get around this. how do i handle discord with no owners?
how to overwrite permissions for a channel using python @everyone





