#development
1 messages ยท Page 675 of 1
like this: client.on("message", etc
well that explains much
the command won't work without a command handler
But this one does
if(msg.startsWith(prefix + "invite")){ message.channel.send(INVITE LINK HERE: https://discordapp.com/oauth2/authorize?client_id= 586587344082305029&permissions=537159744&scope=bot`);`
and msg and message don't work together
i have both, and they both work
If i change that one command im having issue with to this: https://paste.fedoraproject.org/paste/vVdDiuHkT5HjdoowXWMFHA
Itll work
But when i add in the custom emoji
it doesnt work
client.emojis.get("EMOJI ID");
@earnest blade whats not working about it? any errors?
The bot just doesnt respond
show your full code? remember to hide your token
@earnest phoenix he doesn't have a command handler at all
basicially, i have a custom emoji. when i send that custom emoji, i want the bot to send a message thats just that custom emoji
your bot needs to be in the same server as the emoji
it is
to be able to send it
the emoji id is not the guild id, did you obtain it by escaping the emoji or
that's not how it works
every emoji has it's own id
msg and message don't work together
it has to be used with a command handler
obtain the format by escaping the emoji
const { Client } = require("discord.js");
const client = new Client();
client.on("ready", () => console.log("The bot has logged in successfully!"));
client.on("message", message => {
const msg = message.content.toLowerCase();
if (msg.startsWith("oof")) message.channel.send(client.emojis.get("602154064649912349")));
});
client.login("TOKEN");
@earnest blade you're welcome


same idea different emojis
@earnest phoenix Yea, i have the ID
oh that would explain why it works
msg is defined
The second does
yes @grim aspen
In that link, the first command wont work
but the second does
How do i make it detect the custom emoji
@earnest phoenix ?
can you put that in begginer coder's language xD
you have specific emojis, you don't need regex for it at all
I just need it to find a custom emoji in the message content
startsWith returns whether the string starts with the string you specify
you're probably looking for includes
can you try this:
const emoji = client.emojis.get("602154064649912349");
if(msg.startsWith(emoji)) {
message.channel.send(emoji);
}
i havent tested this so might not work
please stop
spoonfeeding again
you're looking for includes which checks if the message content includes a specified string @earnest blade
No spoon feeding
@earnest phoenix would it be msg.Includes?
you'd do it on the content property
msg itself is a Message object
wait no
i have no idea what your code looks like so i'm not sure what is msg exactly
but it would still work before with startsWith if i made it detect something else besides a custom emoji
let msg = message.content.toLowerCase()
ah yeah, you can then just use msg.includes(...)
startsWith checks if the string begins with something, includes checks if the string includes something
based on that, make a decision
But i wanted it to check if the emoji nwas at the beggining
so thats not the issue
the issue is that the bot wont detect the custom emoji
i see your issue, you're converting everything to lowercase
but you're checking for an emoji with an uppercase name
ooohhhhhh
hmm
so do any of you know how to stop this https://i.imgur.com/v2wkWi6.gifv (the scrolling)
what would be a good line to draw between a casual for(let a in b) loop, versus array.map?
thanks @earnest phoenix , that fixed it!
๐
๐ค
๐ค
inline in css
Make them different divs perhaps.
Idk
How many repos do you guys all have? https://moosecorp.xyz/i/human-badge-8238.png
I made a game in C++ and Python lol
Whats with the 2 blurred private ones 
One is a bot that I am hosting for someone
The other is bot a guy and I are working on, not sure if they want me to show it
I have 24 repos
Dang
Nearly all private
lol
Well I wish I could keep a repo public and then privatize certain branches
Like dev should be private, but master can be public
Or I can make it private, but users can still access to put issues in type of thing
Yeah but what about when I want a repo to be public so people could submit issues, but I have my code public then so
Yeah, thats what I mean, the dev branch could just be on your local device
Master could be on git
Right, but what about repos where I don't want any code
I just want them to see the timeline and submit issues
Dont commit code 
Well that sucks
or just create two repositories
https://github.com/DiscordBotList/issues dbl uses it for issues 
if you use github just for issue tracking just use
trello or jira
i've also seen a few irl friends use nTask
GitLab lets you hide certain parts of a repo with permissions, which is neat
You can let anyone see the issues and stuff of a repo but lock down the code to just contributors
Lots of permissions config
so in my script
<script>
window.onload = () => {
const fragment = new URLSearchParams(window.location.hash.slice(1));
if (fragment.has("access_token")) {
const accessToken = fragment.get("access_token");
const tokenType = fragment.get("token_type");
fetch('https://discordapp.com/api/users/@me', {
headers: {
authorization: `${tokenType} ${accessToken}`
}
}).then(res => res.json())
.then(response => {
const { username, discriminator, id } = response;
alert(`Hello, ${username}#${discriminator} (${id})!`);
}).catch(console.error);
} else {
window.location.href = "https://discordapp.com/api/oauth2/authorize?client_id=585149040035889187&redirect_uri=https%3A%2F%2Fpibot.pw%2Fdashboard&response_type=token&scope=identify";
}
}
</script>
How would I go about accessing my Discord.Client()?
you don't
stop exposing sensitive information to the frontend
Your supposed to have a back end that handles the oauth
never do it all in the front end
Unless you want to get into trouble with users/discord
@earnest phoenix ^^^^^^
i mean, i do have a backend, but idk how i would go about like for example, saving stuff to a database, or using client for things.
the only thing I can think of is using a function on the front end which runs a backend file and returns the result, but idk how I'd get the client in that backend file since it wasnt passed from the front end, if you get what i mean
what are you trying to do
make an api
^
you have no need for a database for oauth
what you have right now is literally asking for web vulnerability
follow these practices https://dzone.com/articles/security-best-practices-for-managing-api-access-to
Doing some nice features for my bot for 20k guilds how does this look also i need to add volume and shuffle icons probably at the bottom center
thx i have been getting into some nice image gen stuff that is just the template but it's easy enough for me to dynamically edit the text and pics
@prime cliff is this for ur website
noice
Nope it will be the nowplay command
oh
I was gonna do something like that for my website
whats the point of showing controls if you can't use them
Also, it works for checking status as well
You can have them highlighted for shuffle and repeat etc
Yup
I was gonna send all the data from my bot via a websocket
Which would be like 356 requests per song but meh
On average
Jay, are you sure you're in the right channel?
@topaz fjord i used to have a little experimental system like that
used to
yes
Oh woops
i abandoned the project
oh
i had a separate audio server that acted like a websocket server aswell, it was basically glorified and faster lavalink
I don't really have repeat for my bot because that would just waste resources sitting in a vc with noone, yes i can check for no users in vc but that's would be bad for users that just update Discord or crash
wait then this means the react component will have to update an average of 356 times a song


you don't need to send ws data on the song being elapsed every second, you just need to provide the current playing state, current time of the song and the length of the song
you can then have a calculated progress bar
var arr = [โappleโ, โorangeโ, โswordโ, โbagโ];
``` Can someone tell me how do I remove orange from the array?
splice should do the trick
example?
If you dont include the 3rd argument, it simply deletes it.
ok thanks
You can also use indexOf to get the index of a specific item in an array
lol who uses indexOf
whats your preference friend
@valid frigate is there another way you can get the index of an item in an array if you dont already know it's index?
probably not
Essentially that would simplify to
arr.splice(arr.indexOf(someInput), 1)
Yo trying to auto react with my bot..
How do I make it react to images only
client.on('message', message => {
if (Attachment) {
message.react('heart');
}
});
This has to be asynchronous
let image = message.attachments.size > 0 ? await message.attachments.array()[0].url : ' ';
if (image) message.react('the emoji')
and also 
@quiet flame here you go
What's happening here
attachments doesnt return a promise afaik
Oof
no need for await

@quiet flame do you know what is a ternary operator?
No sir
so snails showed you a ternary operator way of checking if the message contains an attachment, and if it does, to check for the attachment's url if it exists
thats basically whats happening
I didnt get why we need the url
the attachment might not be an image
might be a file uploaded from the computer for example
oh yes
although a better way would be to check for its width, not its url
also .array()[0] can be replaced with .first()
I was thinking on similar lines..width or height
yes

is it just an accepted fact that every bot has the same help command ? and you will be spammed by a wall every time you want help with a specific bot ?
I mean I make my bot have a pingable prefix so no other bot responds
oh true i guess
as of now i just use the "!" prefix and hope my command names are unique enough
that's the thing though, it's only the admins that read your command description when they invite the bot
how the users supposed to know ?
Well they don't unless they want to test your bot
that's why i thought using the most popular prefix would help them "guess the correct commands"
normally we get spammers who do "!help" 500 times
lol
so why not just have a list of commands, and when you run it without arguments it will give more information about the command
like without the prefix ?
..no
is your problem the prefix or that bots respond with a wall of text, describing what every command does including the smallest things
i dont understand lol
is it just an accepted fact that every bot has the same help command ?
then it developed into using different prefixes
what do you mean by "same help command"
"!help"
Why not just have customizable prefixes per server
i guess that would work
A lot of bots do it
hmm wonder how intuitive it is to get command info by pinging the bot
just add "ping me for help" in the status
yea
that's a good idea
think i'll go with that
btw, on the website, do you have to enable anything to show how many servers your bot is in ?
i know mine is in a couple just from reading the logs, but the website still says N/A
do you have to reach a threshold?
where?
Learn it
where im edit on css?
do u understand what eco is saying
i dont
Getting a design on the website
@abstract crow it has nothing to do with the api
simply write your css between style tags in your long description
Ah gotcha. I didn't know lul
Can I add JavaScript code into my website?
Like document.write(10)?
or Math.floor(Math.random() * 10)
yes
I figured it out
<script>js here</script>```
I know
ok
If there's too much Js there, you can import from a file
<script src="path/to/file.js"></script>```
Also just as an FYI, no javascript in your bot's long description (on DBL) unless your bot is certified
lol
Rip
discord really fucked that one up
Ok
<a href="http://example.com">Lorem Ipsum</a>```

Can someone verify my bot?
Takes up to a week, #502193464054644737
Ok
If it hasn't been a week, don't ask unless you like getting muted
I might not be able to make it
make what
lol
as long as its online and commands are working, it should be verified
^
I'd put it on your VPS
VPS?
A paid server where you host code
Thanks
I cant seem to have up 115px in my margin
Rip
@opaque eagle I have a problem
My detailed description is gone
How Do I make attachments
With a persons avater
like @fair grail
With HTML
what?
What the heck is happening xD
im asking you
Let me get some cheetos
@earnest phoenix attachment as in, the bot sends the authors avatar?
Yea
Just like @fair grail
what library are you using
JavaScript
wrong cyber, and bots dont work here
bruh
Discord.js
For example: message.author.avatarURL
so why not just send the avatar url back
I want it to be in a custom scenario
Or back ground
Go to #commands
I will show you
then you need to use a library that can do image editing
@grim aspen with what? you probably know more about image manipulation than i do
by itself it cannot
How about HTML?
A guide made by the community of discord.js for its users.
Nono
use canvas
oK
HTML is for another thing xD
Html is just a markup lang, doesn't have anything to do with image manipulation
Git hub is really confusing
github pages
git pages*
thats about as simple as it can get really
git by itself doesnt offer web hosting lol. github does
Oh then I have bad memory :(
Websites for you and your projects, hosted directly from your GitHub repository. Just edit, push, and your changes are live.
really, that is as simple as website hosting can get
I just want a really simple one
make a repo, upload your files, enable github pages, done
oK
@mossy vine Uh sry for ping but what lang do u use
mainly javascript, why?
Me too
Oh okay I was wondering how to enlarge emojis given the user provides one
In discord?
what lib
d.js
example

Oh my
oh LMAO
Anyone knows how to program in Roblox Studio
Mainly lua.
Oh my
That is really long
@mossy vine It works for custom emojis, but how would I do it for default discord ones
i gotta out it in pastebin
lemme see smthing
@broken shale i dont think you can. its unicode displayed as twemoji
yeah RIP unless I make a dictionary of all deafult ones enlarged
Aint nobody gonna spend that much time on a dic
@stray garnet lines 10-13
Doesn't djs provide separate classes for unicode and custom emojis
Sadly
@mossy vine Yea whats with that
do i have to explain? you are creating an embed telling you to mention the user and then sending it, not caring about the rest of the command
oh

Omg
refer to this if you want also https://www.codecademy.com/learn/learn-css
omg
!serverinfo
@dense cairn reeee
How I can have a vote webhook?
You mean count votes through webhooks or send votes to a discord webhook?
Webhook, save the user ID on vote, on command fetch the database
Hello, my doggies
I need some help with porting my bot to discordbots
Where am I supposed to put my token?
discordbots is a website to list your bot to get more servers, they dont host your bot for you
use a VPS
to host or just run it on your computer
i feel stupid now
when someone votes this comes up:
at /home/ubuntu/node_modules/discord.js/src/client/rest/RequestHandlers/Sequ ential.js:85:15
at /home/ubuntu/node_modules/snekfetch/src/index.js:215:21
at processTicksAndRejections (internal/process/task_queues.js:85:5)
(node:28837) 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(). (rejectio n id: 25)
(node:28837) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissi ons
how do i give the correct permission in the webhook?
What is the CPU usage for a bot like Dank Member, Pokecord, etc?
Like how much do they need to run that shit
probably around 80-90%
What do the need in terms of specs?
ask devs?
Well that is kinda why I asked in development
the bots devs
@abstract crow https://medium.com/@brendanrius/scaling-kubernetes-for-25m-users-a7937e3536a0
This is an interesting write up from the mee6 people about their migration to k8s
It has some resource usages in there
They use approx 150gb of ram and a maybe around 100vcpus total (guesstimate from article and dashboard)
Given this was back in July of 18
discord destroying people's vps's since 2014
Oliy is the CEO of every bot
when u list on dbl u sign away ur bot's rights to oliy
How to take all roles from a Person, and give it them back with one command?
I smell API abuse
Even if it's for the most noble of reasons, API abuse is API abuse
xD
wouldn't it be easier to just have a muted role that supersedes the rest and add/remove that
ik
yea also how we do it on another server i'm in, and have a channel only they can see
so they get quarantined basically
but when they have other roles with SENR_MESSAGES perms they still can write
@prisma bobcat hmm thats a good idea
idk a lot about how roles work they're kinda confusing tbh, but wouldn't a mute role at the top of the list with no send permissions overrule any role under it with send permissions?
otherwise for the og idea, just get all the role id from member.roles, then iterate them to remove them an store them somewhere, and on unmute add them back
hmmm
you can remove multiple roles with a single api request
don't iterate through them
that's called api abuse
o neat, didn't know that
my bot doesn't mess w/ any roles really so haven't had to mess with em
how do you promote/advertise/whatever your bot to get people to use it? besides just sticking it on bot list
message.member.removeRoles() // stable d.js``````js
message.member.roles.remove() // master d.js``````js
client.editGuildMember() // Eris```
get ur friends to add them i guess
im friends with the owners of some medium-to-large servers... i ask them to add, they add, others in the server see, they add too
word of mouth is gr8
i'm mod on a decent-sized server (3k something members) ima add it to, but that's about it
yeah that should be enough tbh
message.member.removeRoles() Take all Roles?
check docs
and i gotta test it out a bit more on smaller servers first cause this bot came from hacked-together version made for that server, so gotta make sure feature/stability parity so i don't screw em lol
wait how to give them back?
message.member.addRoles()
read docs plox
legit right on there --> https://discord.js.org/#/docs/main/stable/class/GuildMember?scrollTo=addRoles
petition to change discord.js.org to readthefuckingdocs.com
they got some good docs
doesn't seem that bad
who here knows how to use wavelink
and knows how to wait until the current player is finished playing a song
why do you want to wait
hey guys whats the best database for a discord bot
I saw rethinkdb is pretty clean and fast, is that good?
There is no "best database"
It depends on multiple things
How big the app is, how fast it will need to read and write data, how many requests will it need to handle/second and more
Well just an easy-to-use one, doesnt really need to be that fast and I guess it shouldnt corrupt easily (json) and can store many items without breaking :p
Well if its small, and you want simplicity you could do something like mongo. Although I would reccomend MySQL or Postgres since they are relational and allow you to define Key constraints. Which IMO is super useful
I use MySQL over postgres but have heard many good things about postgres
@scarlet phoenix I heard mysql has some dodgy syntax though
Its just your standard SQL
Some people dont care for SQL but personally I dont have any issues with it
It comes to preferences
my advice; sqlite for small scale bots, postgresql for large scale bots
i need some help.
i created a ban command in my bot.. and when someone use the command to ban a member who has a highter role than the bot i wanna the bot reply with a message that say the error.. and the question is how to use role.position here
it always says position of undefined
ok so, in Java
I have a base class and a bunch of other classes which all extend said class.
I have some objects of those classes stored in a Map where I map the name to the base class (Map<String, MyBaseClass>)
(As all the objects are at least of that form)
Now the thing is I have a method in said base class that I override in most of the extended classes, when I grab one of the objects from the map and call that method I'll simply get the method specified in the base class, this isn't what I want and I'm wondering on how to fix that? Does me putting them in a Map as the base class make Java "forget" what "bigger" class they were? Can I simply change them back in to the extended class? Is my approach wrong here?
Would me using an interface that requires the method and then mapping them using the interface work with the overrides?
java makes me wanna rm -rf tbh
then it's not overriding properly
jshell> class Base { void method() { println("Inside Base"); } }
| created class Base
jshell> class Sub1 extends Base { void method() { println("Inside Sub1"); } }
| created class Sub1
jshell> class Sub2 extends Base { void mehtod /*notice the typo*/() { println("Inside Sub2"); } }
| created class Sub2
jshell> var map = Map.<String, Base>of("a", new Sub1(), "b", new Base(), "c", new Sub2());
map ==> {c=Sub2@6433a2, a=Sub1@5910e440, b=Base@6267c3bb}
jshell> map.get("a").method()
Inside Sub1
jshell> map.get("b").method()
Inside Base
jshell> map.get("c").method()
Inside Base```
What does this error mean?
pam_unix(sudo:auth): authentication failure; logname=vinniehat uid=1001 euid=0 tty=/dev/pts/0 ruser=vinniehat rhost= user=vinniehat
Aug 14 04:32:26 vinniehat.tk sudo[6802]: pam_unix(sudo:auth): conversation failed
Aug 14 04:32:26 vinniehat.tk sudo[6802]: pam_unix(sudo:auth): auth could not identify password for [vinniehat]
Aug 14 04:38:28 vinniehat.tk sudo[6843]: pam_unix(sudo:auth): authentication failure; logname=vinniehat uid=1001 euid=0 tty=/dev/pts/0 ruser=vinniehat rhost= user=vinniehat
I tried everything online, and this happens when starting nginx
Smh YouTube stopped my play cmd cause of too many requests
Smh comes to dbl to advertise an account for a shit game
So lemme ask you guys this. What hosting service do you guys all use? Also, is Digital Ocean considered expensive? If so, what are some other hosts besides OVH. I use Vultr rn, wanted to switch to GG, but too many issues, again.
DO is fairly cheap
i used scaleway for my old discord bot
currently using google cloud
The only thing with DO is I have no clue what any of this means https://moosecorp.xyz/i/dusty-brake-4324.png
Droplets are just your servers
But like Kubernetes? And why host a DB for more money, when u could just host it with the VPS?
Having the db on the same machine can cause the app to run slower
Yeah but don't companies just have a dedi for the DB or somethin
So your just paying for another server that runs a prebuilt DB for you to customize
I mean I am fine with setting up the server myself. Its just right now, is it safe to run both on one VPS? And what do bigger companies use, inhouse hosting or companies like DO
if you're not worried about resource management, it is
also, it depends
some companies prefer to host everything on their servers while companies like discord are hosted on google cloud
The main thing is that a dedicated database vps usually have really nice built in features not usually needed on a normal vps
Ok. Cuz right now like I am 14 and don't have things that require gazillions of gbs. So having a big server isn't necessary for me, but I want something that I can roll into the future with
Typically around security and snapshot backups
Hm
At work (Med sized fintech company) We work with ~70 different db instances
Also with Vultr I had issues with Ubuntu 19.x, DO offers that too, I see more use 18.04, should I go 19 or 18?
Yeah, I always the most current LTS build
managed databases also offer things like metrics, which is actually really useful
At the same time u said that this came up https://moosecorp.xyz/i/hallowed-engine-9962.png
They are different metrics
The db instances will be specific to that, disk IO latency, DB pool sizes, IO and stuff
Plus about 6 months ago when I had GG, before I switched to Vultr, I had issues too. Just GG and their OS I have issues with
Maybe they don't install something, but all these x isn't installed, can't run y, can't do z function
If you dont use docker stuff Skysilk is pretty good and cheap
But their VPS's run on LXC so no container stuff unfortunatly
They are working on KVM stuff tho
I don't even know what docker is. Shocker there, pun intended
you should really get into learning docker
Docker is super useful
it's amazing
So droplets are VPS's, Kubernetes are what?
Docker + Docker-compose + K8s is super nice
I will have to look that up, what does Docker do?
I do at work, but for my discord bot I just have traffic routed to the k8s pod with that shard
sentry + docker is a must combo for me right now, those two in a combo make my life so much easier
Ok so for someone like me, basic developer, hosting bots and websites, with like 0 traffic, Droplet with LTS Ubuntu, and then run my PSQL DB on there?
Sentry I โค
We used to use sentry at work, we switched off it for a homebrew solution
Was nice for the couple monthes I used it
I have a server for my bot with different channels for logging and error reporting and it works out well to alert me
Hey I know some of those lol
Oo Plesk ๐
those are just preinstalled software etc
just go with a simple empty ubuntu image
then install what you need on it
Yeah Plesk is
Cpanel is for a gui for hosting a site https://cpanel.net/
With its world-class support and rich feature set, cPanel & WHM have been the industry leading web hosting platform for over 20 years. Trusted world-wide by our technology partners Wordpress, CloudLinux, Lighstpeed, and more.
^^
Yeah I really don't
its worth it to get the experience
I have NGINX setup somehow
I don't know how
Reverse proxy shit
vime ๐
WTF
Well just had to make 2 payments for it to register.
@earnest phoenix Would you happen to know how I can forward my VPS IP to my URL?
I have DNS options
`client.on('message', message => {
if (message.attachments.height != 0){
message.react(':heart:');
}
});`
Trying to make the bot auto react to an image
Use code blocks ๐
but this make it react to plain text too
Also, console.log a lot.
console.log(message.attachments.height)
Try reacting with the ID
attachments is a collection
\โค
@abstract crow you can do that with nginx
So forward my VPS IP, to My Domain, which forwards back to my VPS?
I have it setup with CloudFlare
well, it should return to your domain
which should then contact your internal app
Ah gotcha
i found this on serverfault https://serverfault.com/a/629153
I'll check it out
Is that DO I see ๐
I mean I just rock the normal Putty
Yeee
Btw
New windows update coming out for terminal........possibly supporting remote access to other servers 
Me2
I used to use Putty, but now use Moba
xd
lmao
When I create a new .js file called commands then code commands in that file it doesnโt work
Yikes.
Make a message handler
then call functions within that file or make external files for each and store them inside a map/collection.
Thank you
@quartz kindle Bro size worked 
`client.on('message', message => {
if (message.attachments.size > 0){
message.react('โค');
}
});`
Ok so I need some sql peoples
I am trying to grant all privs on a user on ALL databases
I can only find on 1 db, not all
I am trying to grant all privileges to a user in SQL
But not just in a single database
You canโt do it in multiple databases I donโt think you would have to run them a couple of times to get what your doing..
Unless your thinking of tables,
Hmm I donโt use SQL in websites still donโt think you can access multiple tables and databases at a time
I forgot how to make scroll bars in HTML5
Anyone know how?
though if you read the page it's non standard
only works on chrome, meaning if you want to hide the scollbar youll need to make fallbacks for safari, edge, etc
this is my error pmessage in visual code
PS C:\Users\User\Desktop\cmder\mybot> node index.js
(node:5912) UnhandledPromiseRejectionWarning: Error: Incorrect login details were provided.
at WebSocketConnection.<anonymous> (C:\Users\User\Desktop\cmder\mybot\node_modules\discord.js\src\client\ClientManager.js:48:41)
at Object.onceWrapper (events.js:291:20)
at WebSocketConnection.emit (events.js:203:13)
at WebSocketConnection.onClose (C:\Users\User\Desktop\cmder\mybot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:390:10)
at WebSocket.onClose (C:\Users\User\Desktop\cmder\mybot\node_modules\ws\lib\event-target.js:124:16)
at WebSocket.emit (events.js:203:13)
at WebSocket.emitClose (C:\Users\User\Desktop\cmder\mybot\node_modules\ws\lib\websocket.js:191:10)
at TLSSocket.socketOnClose (C:\Users\User\Desktop\cmder\mybot\node_modules\ws\lib\websocket.js:850:15)
at TLSSocket.emit (events.js:208:15)
at net.js:588:12
(node:5912) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:5912) [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.
PS C:\Users\User\Desktop\cmder\mybot>
@sterile quarry code? And have you recently installed/updated d.js
Oof
Hmmm can you try to use bot <token> in your login method?
Replace that with bot.login("bot Token")
bot.login
so change client.login(token) to bot.login(token)?
want me to send u the java script
Sure
How I can do a line break in my bot detailed description?
No...
is this for dbl
Yes
<br/>
Ok thx
<br/>
No
@cursive dagger
He doesnt have token
Defined
The const token is undefined
So the login is invalied
Snuwy it's a recent api change.
Discord recently forced their api to have not infront of their token, but discord.js didnt have it at the time
I have try to put all the link and only the ID
Just the id
Hm can you copy paste the server format you are using with the Id only
Hm and your bot is in this server with dsl in it
Yes it's the support server ๐
Yep
You should DM oliy about this
Ok
I think my html doesn't work the <br></br> do nothing
why i always get 0 when i do
message.channel.send(`${message.guild.members.filter(o => !o.presence.status === 'offline').size}`)```
:(
Because you are doing it wrong
!variable attempts to convert it to boolean and invert it
So then youre checking if false === offline
Which will always fail
You want the not equal operator, which is variable !== offline
Hey guys, you having method to work on bot discord and use prod branch and dev branch without create two app ?
Technically you could log in twice concurrently. If the code that's running is the same, everything would be duplicated. Eg running your help command, you'd get two replies. You could do something with process.env.MODE or .DEV or .PREFIX, up to you, to decide which bot reacts to what prefix or in what channels, but I think it'd just be a better idea to have two tokens. Each in a different .env file. @pine edge
@wet void thanks actually run my bot on my vps with pm2 and if i run it on localy is no same ?
Each message would get processed twice, one on each of the two running apps. Same token used to log in twice at the same time, so just your one bot online.
Ok thanks for this information @wet void
Hi, I need help. This command should do me leave a voice channel, but it doesnt work:
let messageArray = message.content.split(" ");
let cmd = messageArray[0];
if(cmd==='!humo')
{
let iduserafk = message.author.id;
let Canalvoz = message.guild.member(iduserafk).voiceChannel;
if(!Canalvoz)
{
message.channel.send('You are not in a channel.');
}
else
{
message.guild.member(iduserafk).setVoiceChannel(null);
}
}
@midnight lantern What the error ?
I dont leave the channel
No error in terminal or whatever ?
no
And bot have permission to move ?
try this
else
{
member(iduserafk).setVoiceChannel(null);
}

@midnight lantern does the bot have permission to kick you
Why is it undefined?ts // ~/Routes/some_file.ts import { ScrabbleValues as results } from "../"; console.log(results); // undefined``````ts // ~/index.ts export * from "./Modules/Assets/";``````ts // ~/Modules/Assets/index.ts export { default as ScrabbleValues } from "./scrabble.json";
(TypeScript)
db.prepare("CREATE TABLE IF NOT EXISTS guilds (id TEXT, prefix TEXT, log_toggle FALSE, log_channel TEXT, guild_premium FALSE, case_counter 0")
I also want to add in individual toggles for each event there is like, guildMemberAdd, guildMemberRemove, messageUpdate, roleUpdate, etc
But that seems to be a bit messy so I wanted to know if there was a better way to do it
Would that log ~ or ~/foo/?js // ~/foo/index.js export class Foo { constructor() { console.log(__dirname) } }``````js // ~/index.js import { Foo } from './foo/' new Foo()
(I'm writing a node module and I need to write files and make dirs from where my module's class is initialized)
How do you make the colored text?
```lang
code
```
Ok thanks
console.log('Test');
export class Foo {
constructor() {
console.log(__dirname)
}
}
?
Ohhh
export class Foo {
constructor() {
console.log(__dirname)
}
}
There thanks
replace lang with the language the code is in, so smth like this:
```js
// js for javascript
console.log("foo")
```
@wheat carbon
Yes thanks
bot.on('message', message => {
let args = message.content.substring(PREFIX.length).split(" ");
switch (args[0]) {
case 'ping':
message.channel.sendMessage('Pong!')
break;
Does someone know why discord.js seems to occasionally send two identical presence updates?
I should be getting two (as I share two servers with the bot) but I'm ocassionally getting three
alguรฉm aqui fala portuguรชs
No
;-;
ninguรฉm
XD
does anyone know how long it takes the website to update how many servers your bot is in ?
Did you post?
yes
Are u sure it was successful
i updated the bot token it post the servers of
i know it works because, i started posting the server count of a test bot
and the website showed 3
now i changed the bot it should post server count of
but it still shows 3, not sure if it's delay or just unsuccessful
how did u get a "test bot" approved through dbl
it's not a bot on the site
just my personal
generating a new apikey for dbl might work
@opaque eagle you just need the token to post
oh
but i guess it's not optimal to able to post the server count of a different bot on the site
update, i got it working
the issue was i had several bots with the same bot token running
DiscordAPIError: Unknown Message
/rbd/pnpm-volume/c9c66428-0d5d-43ea-8c41-f58f44451698/node_modules/.registry.npmjs.org/opusscript/0.0.7/node_modules/opusscript/build/opusscript_native_wasm.js:8
var Module=typeof Module!=="undefined"?Module:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}Module["arguments"]=[];Module["thisProgram"]="./this.program";Module["quit"]=function(status,toThrow){throw toThrow};Module["preRun"]=[];Module["postRun"]=[];var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_HAS_NODE=false;var ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_HAS_NODE=typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string";ENVIRONMENT_IS_NODE=ENVIRONMENT_HAS_NODE&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMEN
abort(DiscordAPIError: Unknown Message). Build with -s ASSERTIONS=1 for more info.
db.prepare("CREATE TABLE IF NOT EXISTS guilds (id TEXT, prefix TEXT, log_toggle FALSE, log_channel TEXT, guild_premium FALSE, case_counter 0")
I also want to add in individual toggles for each event there is like, guildMemberAdd, guildMemberRemove, messageUpdate, roleUpdate, etc, but that seems to be a bit messy so I wanted to know if there was a better way to do it
And better-sqlite3 doesnโt support array data types so I canโt do the events like that
@tall mist you tried to fetch a message that either no longer exists or never has existed
Meaning you fetched a message that no longer exists or never has
I donโt see how that doesnโt make sense
Or, my mistake, you deleted your message in code and tried to use it again
Like message.delete()
Then you tried to do something with it
@amber fractal thx you
i did
but
i have other err
TypeError: Cannot read property 'send' of undefined
/rbd/pnpm-volume/c9c66428-0d5d-43ea-8c41-f58f44451698/node_modules/.registry.npmjs.org/opusscript/0.0.7/node_modules/opusscript/build/opusscript_native_wasm.js:8
var Module=typeof Module!=="undefined"?Module:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}Module["arguments"]=[];Module["thisProgram"]="./this.program";Module["quit"]=function(status,toThrow){throw toThrow};Module["preRun"]=[];Module["postRun"]=[];var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_HAS_NODE=false;var ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_HAS_NODE=typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string";ENVIRONMENT_IS_NODE=ENVIRONMENT_HAS_NODE&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMEN
abort(TypeError: Cannot read property 'send' of undefined). Build with -s ASSERTIONS=1 for more info.
@tall mist send is undefined.
?
That Error.
what can i do
Code?
you can learn js and how to debug
instead of asking how to fix every error without even providing code
hi, anyone know what this json error means and how to fix pls
error: json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 2 column 2 (char 3)
code:
{
{"type": 2, "name": "PewDiePie"},
{"type": 1,"name": "jeff xd"}
}
you can't put objects in objects
?
what is what?
your trying to list objects in an object
thats not how json works
you need to give them a name
ooh
{
"name": { "values": "here" }
}
or
[
{ value: "here" }
]
db.prepare("CREATE TABLE IF NOT EXISTS guilds (id TEXT, prefix TEXT, log_toggle FALSE, log_channel TEXT, guild_premium FALSE, case_counter 0")
I also want to add in individual toggles for each event there is like, guildMemberAdd, guildMemberRemove, messageUpdate, roleUpdate, etc, but that seems to be a bit messy so I wanted to know if there was a better way to do it
And better-sqlite3 doesnโt support array data types so canโt do the events like that
idk use a nosql database then?
That means there is a wrongly closed bracket
Oh thatโs not good
Double check all your brackets
A } bracket or )?
Any of them
Is Node.isOnline inside an exported function?
You properly closed Node.isOnline, but you didnt close exports.run after it
Yes, from what i can see, exports.help is inside exports.run, and exports.run is never closed
Still have same error
You need to close exports.run before you begin exports.help
Check how you opened it, and close it the same way
Removing the comma will do nothing
Itโs a trailing comma
It can be there or not, it doesnโt matter
surprised it doesnt cause an error
Js ignores trailing commas in objects because its smart, but json is not as forgiving
A trailing comma in json will cause an error
Would it be good to just transfer stats and bot information via a database and then pull it using PHP instead of using a WS server, that I can't use online
How would I make a command that adds a new channel with a certain name? I am trying to make an essentials bot that has moderation, utilities, and normal uses. This command will be like a ticket creator. I've looked in the documentation but couldn't find a function that creates a channel.
Main library.
Which main lib?
"View docs for | Main Library | stable"
what
Thats what it says.
discord.js?
Discord.js
Stable.
Look at the documentation for guild
took less than 5 seconds to find lol
Check the createChannel options
First time coding in PHP! Yeet
Maybe its a good thing to actually learn the language instead of just making queries...
You're trying to get status of something that doesnt exist
Oof
So, how do you make bots.
You program them
Lol
anyone that can halp me again
Give them a few seconds, I asked them to put the error in here.
one sec lemme copy it
ReferenceError: like is not defined
at Object.<anonymous> (C:\Users\User\Desktop\Lifelessbot\index.js:1:1)
[90m at Module._compile (internal/modules/cjs/loader.js:868:30)[39m
[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:879:10)[39m
[90m at Module.load (internal/modules/cjs/loader.js:731:32)[39m
[90m at Function.Module._load (internal/modules/cjs/loader.js:644:12)[39m
[90m at Function.Module.runMain (internal/modules/cjs/loader.js:931:10)[39m
[90m at internal/main/run_main_module.js:17:11[39m#
i think its a error or something
Use code blocks and we also need code
The error come from index i think
yes it is
Something defined as 'like' is undefined in index.js
lemme check
->

