#development
1 messages · Page 1363 of 1

can I use promises in Array.map
what do you mean?
you can resolve the promise first and assuming it's an array/collection, you can map it afterwards
I mean I don't want to iterate over if the current function has not completed
map the array after the promise is resolved like flaze said
I dont want to iterate over my array twice, so I'll use for await (const datum of data)
you're not iterating it twice
@pale vessel Actually I wanted to do something like this.
emojies.map(async emoji => await msg.react(emoji));
will be it sync or async?
is OAuth easy?, I mean i'll start with a dashboard soon and I never read about it
yes
It's not exactly hard
Who knows how to do my bot to detect if a message has a image? 
check the message.attachments property
https://cdn.discordapp.com/attachments/658550982975946762/773104066208989184/unknown.png
I Get this error, and my bot just shuts down. any idea? Ive tried to use commands in the console but the commands just wont work
Ty
@rocky hearth You can basically map it then use Promise.all()
await Promise.all(emojis.map(emoji => msg.react(emoji)));```
message.author.presence.game.name
Why this code is error in name
Because that code is deprecated which belongs to v11
How i can change to v12
Which version of discord.js are you currently using
<User>.presence.activities returns an array of activities, Iterate through them and show all one by one
Np
https://cdn.discordapp.com/attachments/658550982975946762/773104066208989184/unknown.png
I Get this error, and my bot just shuts down. any idea? Ive tried to use commands in the console but the commands just wont work
Does that happen on startup or
Startup
What version of d.js are you willing to use?
Any
But i see discord.js@11.5.1 which is not maintained anymore
oh wth
Do npm i discord.js@latest
Commands dont work on the console for some reasin
How they not work exactly
Did the bot even start up?
Show me your console
Exit the process first
how
Ctrl + C
Then just click the button where it force stops the session or whatever the button is called
There must be a button for it
the "stop" button?
¯\_(ツ)_/¯
No output
(node:8064) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Message
at RequestHandler.execute (Z:\IR ELITE V.4.6\node_modules\discord.js\src\rest\RequestHandler.js:154:13)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async RequestHandler.push (Z:\IR ELITE V.4.6\node_modules\discord.js\src\rest\RequestHandler.js:39:14)
(Use node --trace-warnings ... to show where the warning was created)
what its error

The command line i said
@earnest phoenix i cant run any commands
is there a manual way to do it
How do I get total number of channels in a server ?
(I'm using discord.js)
Hello, does Mongodb have a function to add a line to all documents in the collection?
@near stratus <Guild>.channels.cache.size
channels.cache is a collection of cached channels of the guild
you can use Map.size to get the size/length of the collection
Any ideas? i dont have root access so i cant run any terminal commands, only file access
Alright , I coded a command which opens a ticket but I want only the one who reacted on ticket to access that channel. But there's an error that Is the one who reacted on the emoji to open a ticket can't see the channel.
Sending code
It's two paragraphs
async def ticketcreate(ctx):
embed = discord.Embed(title = "Hey! Create a Ticket by reacting below!" , colour = ctx.author.colour)
message = await ctx.send(embed=embed)
embed = await message.add_reaction("🎫")
@client.event
async def on_raw_reaction_add(payload):
author = ctx.author
guild_id = payload.guild_id
guild = client.get_guild(guild_id)
user = payload.user_id
emoji = payload.emoji.name
if emoji == "🎫":
overwrites = {
guild.default_role: discord.PermissionOverwrite(read_messages=False),guild.author: discord.PermissionOverwrite(read_messages=True, send_messages=True)
}
ticket = ctx.author.nMs
await guild.create_text_channel(f'ticket-{ticket}' , overwrites=overwrites)```
Webhook running at https://0.0.0.0:5000/dblwebhook
Error: listen EADDRINUSE: address already in use :::5000
why hostname is not getting used
its taking 0.0.0.0
😦
how to change it?
@waxen cloak you dont change it, you just ignore it and write your own ip address and it will work
@waxen cloak not there
you put your ip instead of 0.0.0.0 wherever you want to use this webhook
for example in the top.gg webhook settings of your bot
make sure nothing else is running on the same port
check if you still have another instance of the bot running
My bot dosent understand emotes in roles, is there any way to fix it?
can it be because of the shards?
@waxen cloak yeah that might be the case
you will need to run it on the master node
or one shard only
then redirect the vote using ipc to other shards if they need to use it
@harsh blade the problem is not emotes
the guild owner is not cached, you need to fetch it
let owner = await message.guild.members.fetch(message.guild.ownerID);
console.log(owner.roles)
i have to add that but where?
instead of guild.owner.roles
then what are you using
can i send you the code?
@fluid basin @quartz kindle i am creating webhook in my ready.js i think its on main node only no?
@waxen cloak you need to go to your top.gg bot edit page and configure the webhook there
@harsh blade is this line 13?
its line 10
ah so the problem is message.member being null
Good morning I am passing an old code that I have to silence to a new version of discord js, when writing the command it fails and this error occurs: TypeError [INVALID_TYPE]: Supplied overwrites is not an Array or Collection of Permission Overwrites.🥀
its line 10
@harsh blade in new version is let role = message.guild.roles.cache.find
so you need to do await message.guild.members.fetch(message.author.id)
before using message.member
so uh, i insert that in fron of line 10?
wherever as long as its before any line that uses message.member
also, see what spaguetti said
@harsh blade in new version is let role = message.guild.roles.cache.find
@earnest phoenix Aight
unless you're still using v11
@earnest phoenix Aight
@harsh blade that error happened to me today, I fixed it by putting the .cache
await message.guild.members.fetch(message.author.id)
Isnt there anything infront? like let =
What sheft and unsheft doing in js
no need, but you can if you prefer
for example
await message.guild.members.fetch(message.author.id);
console.log(message.member)
or
let member = await message.guild.members.fetch(message.author.id);
console.log(member)
mm
client.user.displayAvatarURL()
no

when
lol wot

discord.js v11?
how is your bot still working
lmao why are people still using v11
a boomer
Now this happens, i added the .cache line
@harsh blade if you're still using v11 dont add cache, thats for v12 only
WAIT WHAT
lmao why are people still using v11
XDDD
lol selfbots are not allowed fyi
@gray finch you know thats illegal right xddd
you got me at the first half willi

uh, no
I am passing an old code that I have to silence to a new version of discord js, when writing the command it fails and this error occurs: TypeError [INVALID_TYPE]: Supplied overwrites is not an Array or Collection of Permission Overwrites.🥀
theres a good reason why they removed it
they didnt remove it from v11 because they dont remve things from old versions
lol ok smh
@earnest phoenix overwritePermissions is to replace all overwrites, not a single overwrite for a role or user
to update a single overwrite, use updateOverwrite()
Oop
lol
no just .updateOverwrite()
ok
@harsh blade ah i forgot, in v11 its message.guild.fetchMember
damn why is there so many people using v11
Cuz im 11 years old
well d.js isnt 11 years old so
you know that discord itself is 13+ right?
@quartz kindle Jk im uhh old
The only thing I don't understand about this change is that I can't create a cache for my bot status to show users
x doubt
xd
@earnest phoenix you want to show online users or total number of members in all guilds?
yes thats only online users
total number of members
the changes that discord made now requires you to enable the "server members" and the "presences" intents in your discord developer portal
otherwise you will not receive information about online members
Ok so, now it fetches my server info and some other info before giving this error
however you can get a number of total members in all guilds by adding the guild.memberCount property of all guilds
the changes that discord made now requires you to enable the "server members" and the "presences" intents in your discord developer portal
@quartz kindle I had to open a ticket to discord to activate those two options
@harsh blade what do you have on line 15 now?
let hasPermission = role ? message.member.roles.sort((a, b) => b.calculatedPosition - a.calculatedPosition).first().calculatedPosition >= role.calculatedPosition
and you added the await guild.fetchMember before that?
and you added the await guild.fetchMember before that?
@quartz kindle Thats line 10
can you show it?
does the member show in the console?
its possible that the message.member variable is not updated after fetching the member, not sure since v11 is pretty old
so instead of using message.member use member
that way it will use the variable you fetched directly, which is a safer option and should always work
if it all works you can remove the console.log
The bot creates a role called new-role but neither changes the name nor removes the permissions, the error is here but I don't know where
TypeError: tomute.addRole is not a function
I know why it is
roles.add in v12
thanks bro
i need help with something
do you guys know how to do this
or is this on youtube?
ello?
Aaahhhh a chat system
help please
Uhhh I can't
its not hard to make something like that
how tho
but it can be a bit complex, so it requires some knowledge and logical thinking
i just copy things lol
you wont find that to copy
I have read the documents but nothing helps me, I do not know what is wrong or why, the bot create the role but neither change the name nor do anything with it
let muterole = message.guild.roles.cache.find(r => r.name === "muted")
if(!muterole){
try{
muterole = await message.guild.roles.create({
data: {
name: 'muted',
color: '#000000',
})
message.guild.channels.cache.forEach(async (channel, id) => {
await message.channel.updateOverwrite(muterole, {
SEND_MESSAGES: false,
ADD_REACTIONS: false
})
})
you're changing the overwrites for the channel where you used the command
multiple times
I need some help
So I write a command and the code look like this:
const flag = require('country-flags-svg')
...
let country = args[0]
if(!country) return message.channel.send('Please name a country')
let embed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setTitle(`Flag of ${country}`)
.setImage(flag.findFlagUrlByCountryName(country))
And I don't know how to catch an error when I write a wrong country name so my bot can response to that.
Fuck Js
no u
:c
you're changing the overwrites for the channel where you used the command
@quartz kindle So do I have to remove the overwrite?
@faint stump what does this return if you use an invalid country? flag.findFlagUrlByCountryName(country)
but it's svg
Yea
@earnest phoenix lets say you have 30 channels in your guild
with that code, you are editing the overwrites for the channel where you used the command in, 30 times. instead of editing the overwrites of each channel in your guild once
@faint stump yes but what does it return if you give it an invalid country
I dont know yet, it just give me error in log box
for example what happens if you do console.log(flag.findFlagUrlByCountryName("bla"))
what is the error?
(node:13000) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message
at RequestHandler.execute (F:\DiscordBot\node_modules\discord.js\src\rest\RequestHandler.js:170:25)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:13000) 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:13000) [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.
An error
@earnest phoenix lets say you have 30 channels in your guild
with that code, you are editing the overwrites for the channel where you used the command in, 30 times. instead of editing the overwrites of each channel in your guild once
@quartz kindle And how do I make him do it just once
and that error only happens if you give it an invalid country?
Yes
if the country is correct, it works?
Yes x2
Ok
@earnest phoenix its just logic, check your code again
okokok
Hold on a second
instead of using each channel of the guild, you're doing everything to message.channel
message.channel is always the same channel, the channel where you used the command in
When I write a correct country name, example Vietnam, it log this https://upload.wikimedia.org/wikipedia/commons/2/21/Flag_of_Vietnam.svg
and when you write a wrong country name it logs what?
Nothing
undefined?
Hello does anyone know any good and free place to host bot ?
But when I change from console.log to message.channel.send, it log error
so you can probably do something like this ```js
let url = flag.findFlagUrlByCountryName(country);
if(!url) return message.channel.send("invalid country")
@earnest phoenix good and free do not exist unfortunately, you have to chose one or the other
Oh
the best free option i know of is google compute engine, but it requires a credit card to create an account
Let me try
amazon also gives you a free vps but only for 12 months
and then there is stuff like repl.it and heroku, which work well but dont allow your bot to be online 24/7, it will be offline a few hours per month probably
an actual good hosting starts at about $3 per month
I think I'll try it on Amazon, because as I'm starting out, I have no funds to host the bot and host his page
amazon also requires a credit card to sign up afaik
an actual good hosting starts at about $3 per month
@quartz kindle I am Brazilian so things get more expensive
do you have a debit or prepaid card?
brazil has stuff like nubank and mercadopago/pagseguro debit cards
those should work for creating an account at google
3$ a month?
do you have a debit or prepaid card?
@quartz kindle I have a credit card
i pay like
7 dollars a month for my hosting 😂
@elder loom yeah i pay 3
Now this happend when I don't type any country:
(node:10868) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toUpperCase' of undefined
at isEqual (F:\DiscordBot\node_modules\country-flags-svg\dist\lib\api.js:6:38)
at F:\DiscordBot\node_modules\country-flags-svg\dist\lib\api.js:19:14
at Array.find (<anonymous>)
at findFlagUrlByPredicate (F:\DiscordBot\node_modules\country-flags-svg\dist\lib\api.js:10:27)
at Object.findFlagUrlByCountryName (F:\DiscordBot\node_modules\country-flags-svg\dist\lib\api.js:16:12)
at Client.<anonymous> (F:\DiscordBot\main.js:13:25)
at Client.emit (events.js:315:20)
at MessageCreateAction.handle (F:\DiscordBot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (F:\DiscordBot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (F:\DiscordBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
(node:10868) 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:10868) [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.
i'm using a dutch hosting service bcs i prefer paying
actually 2.77 or something, because i get 1 month free
with ideal
actually 2.77 or something, because i get 1 month free
@quartz kindle where?
galaxygate
it depends how much power you need tho
mine is 1gb ram
yours is probably better for that price
i need like 200-1gb
Ah ok I will try on google engine, thank you very much for your help
what the fux
dude, hetzner has like 4gb ram for 4 euro
can i pay with ideal there?
hmm not sure
One more thing, website hosting is free, I wanted to host on .xyz ?
google compute engine is a VPS, virtual private server, its like a full computer that you remote control, so you can do anything on it, including running websites
it doesn't support ideal
Ah got it, thanks for the help
Waiting too long and now I fixed myself 
nice
@elder loom still, 400mb for 7 euro is attrocious, im sure there ae better options
google compute engine is 600mb for free
Anyway, thanks for your help
@elder loom still, 400mb for 7 euro is attrocious, im sure there ae better options
@quartz kindle 4,75 euros tho
what
ah right, 7 dollars
they accept ideal here i think https://vpsget.com/index.php
Fastest VPS Server. ✅Tier III datacenter, full root access.✅ Semi-Managed VPS from only $5.95 USD per month! Allowing you to completely customize your hosting environment now!
6.5 for 1gb KVM, or 5.95 for 1gb non-KVM
dutch payment company thingy
hm
@faint stump u got ur answer? if not have an if statement saying if undefined, don't toUpperCase it
it was an internal error in the flags library for passing an invalid country
And now I realise that discord embed don't support .svg link/image
While I'm using a svg image pack
ye
What should I do, there is no npm pack about country image at png type
In the case to host my bot on google engine is it in the estancia tab? @quartz kindle
@faint stump you dont need a library, you can use something like this https://www.countryflags.io/
@earnest phoenix yes, instancias de vm
familia de maquina, proposito geral
série N1
tipo f1 micro
thats the one that is free
moon is back
Can you give me a step by step on how to host the bot and the website?
Tim do you speak portuguese?
welcome to earth moon
@faint stump you dont need a library, you can use something like this https://www.countryflags.io/
@quartz kindle This look very 'smol'
yes i do
yes i do
@quartz kindle What ?
speak portuguese
Ah sim
Então queria saber se pode me dar uma ajuda
sou novo na progrmação
mechia mais com php, html, css e redes
ai se puder me dar um passo a passo apara hospedar meu bot e meu site
vc ja usou SSH, linux e terminal?
a melhor opção de hospedagem é linux
@earnest phoenix its just logic, check your code again
@quartz kindle And tried but nothing
na hora de criar a instancia vc seleciona o sistema operacional, pode colocar ubuntu 20 por exemplo
depois vc vai conectar no vps usando SSH, procura um guia de SSH para google compute engine, eles tem um esquema de chaves q vc precisa configurar
vc faz no painel do google, onde vc criou a instancia
deixa me ver
Tim speaks all the romance languages
depois quando tiver a chave e o ssh configurado, vc pode baixar um aplicativo de SSH pra connectar nele fora do painel do google
o programa de SSH de dá um terminal remoto onde vc opera o linux da maquina pela linha de comando
deve ter varios guias explicando como configurar o compute engine, da uma pesquisada
tenho q sair agora
@faint prism uvuvwevwevwe onyetenyevwe ugwemubwem ossas
xde
i g2g now
wasnt expecting that to translate to english, but it did
I got memed
https://paste.ofcode.org/BXqrKj8gVg5CjgtsUjRkEp I do not understand where is the error gives error that it cannot read id as property of async
Plataforma de CPU e GPU
Serviço de VM confidencial
Ativar o serviço de computação confidencial nessa instância de VM.
Contêiner
Implante uma imagem de contêiner nesta instância de VM. Saiba mais
ativo algum desses dois ?
@quartz kindle
its for host a bot on google cloud?
@earnest phoenix can you show the stacktrace
yes
@earnest phoenix can you show the stacktrace
@sudden geyser ok
@sudden geyser
Can you show what line 1 - 10 of message.js looks like, because the stacktrace points to say it's coming from the library.
a dm maybe?
I also don't know why you're trying to call await like a function on line 51: await(tomute.roles.add(muterole.id));.
And tomute.removeRole(muterole.id); is not correct, as it should be tomute.roles.remove(...) now.
i cant write ugh
This error was only given when I changed some of the code that passed above
I also don't know why you're trying to call
awaitlike a function on line 51:await(tomute.roles.add(muterole.id));.And
tomute.removeRole(muterole.id);is not correct, as it should betomute.roles.remove(...)now.
@sudden geyser I have changed that and it gives the same error
I don't know why it gives the error in message.js
Because message.guild is nullable?
I'm going to put the code as it was before and tell you, wait
@sudden geyser https://paste.ofcode.org/57Ub2MCsMuzqM8WdZbCYXj
Keep giving the error, I don't know why
The stacktrace you showed us tells us it's coming from message.guild.id.
Have you fixed that first
yes
Now what error do you get instead.
is it a sentence or a question 
Now what error do you get instead.
@sudden geyser cannot read property id of null
on message.js but message.js is perfect has no error
It still doesn't look like it's coming from the file you keep showing us. The only two places it could possibly have come from based on the file are:
- The expression for when you defined
muterole - When you re-defined it in the try block.
However, it's not possible to come from either of those two sources as the first one would return undefined, while the second one would keep the old value since it could only throw.
So, it is coming from message.js. So, it's probably not perfect as you claim it is.
The root of your error last time was that message.guild is nullable. You solve that error by checking if it's null beforehand.
How do I check if it is null?
I'm sorry,I dont know about this topic a lot because it's the first time that happens to me****
the error jumps in logs when I try to mute someone
You check with equality operators: if (something === null) {...}
Server Settings -> Members -> Click on a User -> Transfer Ownership
this is not dbl related xD
Server Settings -> Members -> Click on a User -> Transfer Ownership
@crisp fable i will search the owner
do it
Does anyone know where to host website and bot for free
function test1 {
// Some Code
function test2 {
// Some Code
return setTimeout(/*Something*/);
}
// Some Code
}
In node.js, is there any method to block both test1 and test2 by replacing the return in the test2 function?
Does anyone know where to host website and bot for free
@earnest phoenix for simple websites, you can use github pages. However for the bot, I suggest you don't use Free hosts. See pins for more
oh do you mean return out of test1 if you return out of test2
@earnest phoenix for simple websites, you can use github pages. However for the bot, I suggest you don't use Free hosts. See pins for more
@abstract coyote I am somewhat new to website programming and I don't know how to do that
yes
return a boolean in test2
It's how I'm getting started now I have no funds to host the bot
then based on the boolean value return out of test1
or you can throw an error but that's not advised
@abstract coyote I am somewhat new to website programming and I don't know how to do that
@earnest phoenix Check some tutorials on Github Desktop and github pages, they are quite straight forward and kind of simple :)
just host it on your pc until you learn what you are doing then. take some time to research where to host it and how to build a website for it.
Or yeah, the best way would be to just invest in a VPS and host both the website and the bot on there.
Or yeah, the best way would be to just invest in a VPS and host both the website and the bot on there.
@abstract coyote Yes, but as I had to pay designers, I ran out of funds
Till then, host it on your pc as shaggst8r suggested. Maybe try making it as good as possible so when you can afford the host you can have it all prepared to go
Hmm
pay designers? you can learn everything for free online
Yes, but I preferred a designer
my advice is to start researching and learning how to do it yourself. having something you did on your own makes it mean more to you. it takes time, yes, but its worth it in the long run. it will be impossible to run the website/bot if you dont actually know whats going on
ah regarding the bot and the website it is already awfully ready I'm just having problems hosting it
host it from your pc until you have money to pay for a vps
understand
but my advice still stays the same. you need to understand what the bot and website code actually means before trying to grow it.
can I ask how much the designers charged?
^^ curious as well
i am rly curious xD
As I'm learning to program now everything went well, the only problem was the hosting
how much did it actually cost?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
can I ask how much the designers charged?
@abstract coyote They charged R $ 15.00 for the logo and R $ 30.00 for the emojis
emojis?
30 for emojis?
like discord server emojis?
After an update for 2nd bot in CSS description, idk why but bot prefix don't appear, so i will put it in on website, down, in description. It's possible to be decline for that?
wait aren't we talking abt the website?
Yes, I'm Brazilian so things are a little more expensive
After an update for 2nd bot in CSS description, idk why but bot prefix don't appear, so i will put it in on website, down, in description.
It's possible to be decline for that?
@slim atlas so sry that I can't help, but that looks so cool!
like discord server emojis?
@compact briar yes like that only for my bot, that only I have access
Hello, how can I do so that I can put text in paragraphs in the same field for my embed messages?
aren't we talking abt a website here?
thats what i saw
thats what it looks like..
So for the bot thing it was R $ 45.00 in total and for some logos on the site it was R $ 40.00
jesus
thats
a bit extreme..
but then again
if they did a good job for the money
anyways imma head out
I found a good job until
try checking out github pages for the website
and idk i heard digital ocean has like a free trial on some hosting? maybe check that out
see u
It's because here in Brazil things are more expensive
i have no clue if digitalocean does good hosting or anything and what their service is actually
but check it out
see ya!
See you
How to see the join position?
- get all members
- sort them by their join timestamp
- get the member's position
- ???
- profit
you need the guild members intent for this
it's mandatory for fetching all members
xD thats to much work, to much cache, and to much data, not worth it xD
How long is ur code?
not that long
but in order to optimise it, you have to use binary search
since for example, finding a position of an id inside an array of 100k elements can be extremely slow
a bot like @earnest phoenix does this, it's really fast, you can use @earnest phoenix jp [member] to test it

ufff
Don't you mean redis?
i can't solve thiiiis :(( where is prefix bot?
?

const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
Where do i Get the Webhook Port and the WebhookAuth
port is whatever you set it to, doesnt really matter as long as its not in use 5000 is okay most of the time
auth is the password you define in your code and on the top.gg website in your bots edit page under the webhook section
you probably have left it empty
port is whatever you set it to, doesnt really matter as long as its not in use 5000 is okay most of the time
@solemn latch soo i can use 5000 port
then what port shall i use
try 5000
if it doesnt work, it doesnt work

if it doesnt work, it doesnt work
@solemn latch how can i get to know port is not working
inb4 they ignore you too
99% of ports are available
it errors
@solemn latch in the log?
yes
what are discord's default image sizes?
like 36 etc...
if u don't know what i am talking about here : ```js
user.avatarUrl(36)
depends on the image, pfps are 128 i believe
power of two
you mean send a message with the content of the user's message?
just trim off the prefix and command, then send back the remaining contents of the msg
^
what library is this in even
How lol
if you know the basics of the programming language you're using, it should be simple
the concept is there, applicate it to whatever you're using
"applicate"
is that even a word
what would be the correct word
any link that points to your bot host with the correct port
Well if you have a domain you could use that, or you could use the ipv4 of the vps
Hiw to add a prefix? I don't really yse a prefix, only commands with the "prefix" in the text
let prefix = ""
then when you use a command just do ${prefix} command
thats the easy way of it
hmm
or you could just use startsWith: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
Oh tyty
@sudden geyser Ok, i solve the error
what is the difference between createReactionCollector and awaitReactions?
createReactionCollector uses events, awaitReactions just wraps it in a promise form
if you want to detect messages one by one, you need to use createReactionCollector
since you can use the collect event
if you want to detect messages one by one, you need to use createReactionCollector
"you mean to detect reactions...." right??
yeah
i thought you were talking about createMessageCollector and awaitMessages
they're both using the same concept anyway
ok, Is there any event that gets triggered when a reaction is removed from the collector?
yes, it's the remove event iirc
is it bad to host your bot on your own computer?
Not very reliable, but no harm
Why would it be??
people telling me its a security risk or smthn
i dont see why and its a lot easier for me
It might be inefficient. A bot doesn't need much processing power or memory as a PC would provide.
well i dont turn my laptop off when i go to sleep anyway
Not to mention shutting it down, power outages, or internet issues that can happen as a result of self-hosting
Other than that, no harm unless you have an open eval
In which case it's basically a RCE security risk to your personal machine
am I doing it correct?. the remove event is not getting triggered
well those dont happen very often and people dont use my bot much so im not worried ab it
ik someone who hosts a small bot on a 128gb R3700x iirc
what i wouldnt give for 128gb
well those dont happen very often and people dont use my bot much so im not worried ab it
@sturdy gazelle Like I said, just don't have an open eval, and it's fine
whats an open eval if u dont mind me asking?
am I doing it correct?. the remove event is not getting triggered
@rocky hearthdisposemust be true
did you click the link i sent
e.g. createReactionCollector(fn, { dispose: true })
Ooh ok thanks
whats an open eval if u dont mind me asking?
@sturdy gazelle A command that arbitrarily attempt to doeval()on text
aight we dont do that here
alright 🙂 all good then
my bot is mainly just connect four
Hehe I too created many games, like connect 4, puzzle16, tictactoe etc
Its very fun though
nice
i made my bot so that people could play against my connect-4 machine learning program i wrote a while back
also wow now that i see what eval does i can see why that would be a huge risk
haha yeah
im sorta new to javascript but not coding
I was trying to implement a cross-server games. So that people can seek games against others
i implemented tournaments for cross server games
its a lot simpler than going through the mess of people being able to dm others when they have no mutual servers
u already did it. Wow so cool
yessir
I'd like to see how you handle the matchmaking
allow me to give you a brief tour
please forgive my newness to js, i really tried
so in the game folder, c4-game.js contains the game object
do you guys know any game engines that run outside of browsers and support javascript? i don't want to learn a whole new language C# for unity
c4-make-game.js has the command to make games
@earnest phoenix GameMaker 2. It has language called GML. It is easier than js
yes but i only know js
it wont take u a single day, to get it
game-holder is the game registry of all the games in progress
please forgive my newness to js, i really tried
@sturdy gazelle I can tell. Quite the complex project!
the connect-4 ai is semi closed source
Also iirc, GML is based around js
Is there any shortcut on mac that gets me back to the previous channel I was in?
i do have a working connect four ai open source but it isnt a child/slave program. that one is closed source but if youre really smart and good at java you could enslave the open source version 🙃
Does the dispose event on <ReactionCollector> emitted when the reaction is removed entirely?
yeah
ok that's only for one reaction. What if all the reaction are removed from a message. Is there also an event for that
Hi 🙂 I want to make a bot that deletes every message from a channel that is not a command, could this be considered api abuse? I really want to understand this better, to see if it's possible to make or not
i dont think so
but what you can do is check for any other reaction whenever the dispose event is emitted
if there's no reaction on the message anymore then it means that all of the reactions are gone after that dispose event
@feral kiln You can ask in the official djs server
what i meant was js collector.on("dispose", () => { if (!message.reactions.cache.size) { // no more reactions } });
something like that
Yeah I got you tuvm
the remove event is emitted when a single user is removed from a reaction
the dispose event is emitted when all users are removed from a reaction and the reaction is deleted from the message
there is no event for removing all reactions from the message
yes. thanks
I made a prefix, how to use it in a bot response from a user?
wdym
I did this:
Now I want to use it in commands
ooh so u have just started
Yes
Is there anyway I can make tabs on my bots description so you can close and open it so it hides and shows the text when pressed
of course
I suggest u to follow djs guide. It will take u through the basics
Okay
embed your website or style your description directly
Ty
It would be a little hard to do without JS, but it's possible
Btw, where can I "place" the bot for don't getting offline?
i'd say use an iframe
embed your website or style your description directly
@pale vessel but with what I only know BDFD
Not Java etc. ;-;
i can't really help you with that, sorry
oh ok
@drowsy raven U need to host it somewhere, like heroku is a free service for that
I'm using digitalocean, it's not easy to use when it goes to bots but it's nice for python (networking etc.)
How can I Structure the client??
structure the client?
djs doesn't allow to Structure the <Client>
Yes yes
nope, but you can do class Client extends Discord.Client {}
you can also hack its prototype
Yes but that doesn't allow me to use my extended client like this, <Message>.client.myOwnProp
it does
why do you need to extend the client for that
as long as you replace the original
you dont even need to replace the original
message.client is the client instance, which means its the client you create with new Client
@pale vessel Not only for that. I've bunch of stuff to extend
ah
ok Lemme try to extend it then
const MyClient extends Discord.Client {
constructor(options) {
super(options);
this.myOwnProp = 'blah';
}
}
There. Problem solved.
Does extending the client also work if I'm already using a command handler - Commando
why not
class ABC extends Discord.Client {}
let client = new ABC();
client.on("message", message => {
message.client.constructor.name // ABC
})
So do i need to extend Client or CommandoClient?
no idea, never used commando
doesnt CommandoClient use Client anyway
I guess I should extend, CommandoClient, to access itself too.
yes, you should be extending the commando client.
Also I'm experiencing a weird bug in vscode. Everytime I autoimport smthing. It gets added to the very top of file instead of merging with already imported package
How can I access my enmap sqlite db file from a webserver on a completely different machine ?
you would have to literally build a web server with an aPI for that, on the machine where your sqlite is
because sqlite doesn't have a "server", it cannot be directly accessed from another machine.
you would have to literally build a web server with an aPI for that, on the machine where your sqlite is
@umbral zealot the way you worded it sounds like it's a super duper hard thing to do
i only use six lines of code for most of my express.js servers (including spacing)
It'll take a bit more than 6 lines of koa.js code to write an API for an sqlite database 😛
just evaluate the request param to_exec if the Authorization header matches the security pass and boom done
Boom 
guys i have question
Ask
i requested verification but a developer said that your bot need to made 3 month and it will get verified but my bot made 1 month so its true or not?
Verification doesn't require the bot to be old for a specific amount of time
thank you very much 🙂
@quartz kindle Just do it on a private server 
does that mean you're basically evaling your sql requests?
@quartz kindle cough coughIt eez wat it eezcough cough
It eez deez nuts
I think I might have figured it out
Server
const express = require("express");
const app = express();
app.get("/exec_sql", (req, res) => {
if (!req.params.to_exec) return res.sendStatus(400);
if (!req.get("Authorization") != process.env.SECURITY_PASS) return res.sendStatus(403);
try {
let output = <sql function for executing stuff which i dunno>(req.params.to_exec);
res.set("Content-Type","text/plain");
res.status(200).send(output);
} catch (error){
res.status(<whatever 300-400 status code seems right for this).send(error.message);
}
});
Client
const phin = require("phin");
phin({
url: "ip of server",
headers: {
authorization: process.env.SECURITY_PASS
}
}).then(<do smth>);
@old cliff
I have a collection in mongoDB like this
{
"_id": {
"$oid": "5fa0186b686604af2886e09e"
},
"worldWhitelist": [{
"type": "712906491635695647"
}, {
"type": "737611247989686333"
}, {
"type": "282859044593598464"
}, {
"type": "565962204327968769"
}, {
"type": "735874386200100974"
}],
"ownerCode": "735874386200100974",
"__v": {
"$numberInt": "0"
}
}
How i can create a query or a list for worldWhitelist in array
TypeError: args[0].toString(...).slice(...).join is not a function
const area = args[0].toString().slice(0, 1).toUpperCase() + args[0].toString().slice(1).join("");
the fuck
but .slice(1) return array ?
no, args[0] is already a string, you don't need to use .toString()
slice() works for strings too
uh ok
so you can simply use args[0].slice(1)
what is the discord bot verification process like? i havent found much of anything on google 👀
so basically i am stuck at creating my bot dashboard, ```js
router.get('/about', (req, res) => res.render('about'));
i need to let only the logged in users to access this
logged in with discord
so you use nodejs
hmm
try to look for "discord.js ban command" on youtube
most people have a link to their github repository with all the code in it in their description
eh I wouldn't suggest that.
hm ok
if you really need to copy paste everything
they don't want to write off code from a video as it's "too long"
¯\_(ツ)_/¯
most people have a link to their github repository with all the code in it in their description
@crisp fable hm ok
ok thx
Eh, I personally think those videos teach people to write code in only one fashion when they're new to the language
welp that's how i learned discord.js stuff
through youtube tutorials and mostly the docs
docs are actually easy to understand but most people don't even know how to structure code
@earnest phoenix are you running your bot on glitch
seems like they are
even tho glitch isn't really good for bot hosting
not really secure either
- they don't allow bot hosting/uptime services anymore
- DBL declines glitch bots now
Wait what
yes
Dbl declines glitch bots?
Yes because bots on glitch run 24/7 are breaking the ToS
glitches intention was static websites
yeah and then people like me went "here's how to host your bot on this free service"
And then glitch went "oh no!" and then "oh we can make money off it"
Glitch is still allowed as a paid platform correct?
I would assume so but who the fuck is dumb enough to pay $8/month for that shit when you can have a full VPS somewhere else?
yes you can pay for mild perks
A 2gb RAM, 400MB space VPS for $10/month? lol don't make me laugh.
ovh same
Galaxy gate OP
Oh? Where are they hosted
They're based in France
But their site is in English too
And you can send support tickets in English
hetzner is 2gb ram for 2.89 euro
but if you just want raw stats, and dont care much for quality, contabo is unbeatable
France is too far for me.
I would assume so but who the fuck is dumb enough to pay $8/month for that shit when you can have a full VPS somewhere else?
@umbral zealot with $8 you can buy TWO vpss
glitch is overpriced af
yep
contabo is in the usa as well iirc
contabo's prices are ridiculous, they have absolutely no competition
contabo has servers in both europe and america
the only issue I found using contabo was high ST between 17:00 and 19:00
but that was when I used the cheapest plan
hasn't happened since then
anyone has the 5 euro contabo plan?
@quartz kindle used to have
what made you move out? the issue above?
you moved to the 8.99 eur?
yep
curl -sS https://raw.githubusercontent.com/jgillich/nixbench/master/nixbench.sh | sh
is nixbench better than nench?
I feel like contabo could have a plan between £4 and £9
like
£9 is fucking overkill
havent tired nench
Hello
almost finished the benchmark ig
my galaxygate is paid for another 10 months or so, so im not switching now
but im looking for something with fast disk speeds
If I am logging into my client 3 times at the same time (shards) will that rate limit me?
it shouldn't?
yes
oh wait no
@quartz kindle I think you can apply for a partnership with gg and get faster speeds
AES 5GB/s lul
only 1 shard can connect every 5 seconds
partnership with gg? wut
gg = galaxgygate
ye but wat partnership
and how much faster speeds
1 MB/s faster
darn nixbench doesn't work with arm64

your server runs on arm?
my pi does
ah
it's "working" on the oracle server though
Mmm pie
@lyric mountain results pls
it's kinda slow though, dunno if that's normal or not
good enough, network is whatever
yeah same (cpu at least)
i think it's net and that's it
net speeds is the last thing
last one then ig
tests download from like 20 different places
downloading form china/japan usually results in shit like 1MB/s
100 MB/s IO speed is fast right?
i get 1000 or so on my pc
bruh
1000+ is NVMe
but i have ~50 on my oracle server
imagine having a NVMe vps
nvme would probably be higher honestly
50 is attrocious
Guys what can cause a Dissconect from Gateway thing?
but still better than google compute engine
A disconnection can
lol
hosts have a bunch of nvme's on raid
brah
but they limit their speeds based on your plan
geekbench is taking a while
oh no
Still trying to figure the MessageDelete Error lmao
Red is ded
I do not understand why every time I put a require with a file I get the error that it has not found the module
red is ded but you have redemption
OS : linux
Platform : ubuntu 20.04
CPU : AMD EPYC 7551 32-Core Processor```
wait imma make it Rainbow
epic
epyc is epic
still no net data
i can only use 2 cores out of the 64 logical cores 😔
@earnest phoenix show logs.js
gonna wait for net to finish then ill post it on random paste site and link here
@earnest phoenix show logs.js
@quartz kindle
@earnest phoenix you're trying to use SQLite before you require it
so where do i put it
require always goes first
damn, powershell fckd the benchmark output
lmfao
do you know how can I scroll up?
here's nixbench on my personal machine
https://hastebin.com/ayihotocij.yaml
or is there a file created?
did you install it
did you install it
did you install it
i have it installed
are you sure



