#development

1 messages · Page 918 of 1

tight plinth
#

not found

earnest phoenix
#

do the first he found

tight plinth
#

us is nit found in the countries code

earnest phoenix
#

yes

#

but in api write US is a country code

#

look

#

oh it work

#

200 was not enought

#

so i used data.Countries.length

nocturne grove
#

guess I'm a total noob right now, but I just want to send an avatar url with my bot. But displayAvatarURL() gives a .webp link or something

amber fractal
#

Look at the options

#

You can specify a format

nocturne grove
#

ohh thanks

#

weird change tho

heavy marsh
#

Does any one know how to use sportify to play music?

nocturne grove
#

still not showing the image itself

heavy marsh
nocturne grove
#

still not working

heavy marsh
#

.avatarURL({dynamic: true})

nocturne grove
#

changed size, filetype

heavy marsh
nocturne grove
#

pls I know how to use docs, but how I'm reading it the dynamic value is only useful when having gifs

heavy marsh
#

What are you trying to do?

nocturne grove
#

I just want the image to show in chat

#

like the very simple .displayAvatarURL of v11

heavy marsh
#

.displayAvatarURL()

#

Hold on

#
.defaultAvatarURL
limber flume
#

yo

#

anyone like?

heavy marsh
#

Hmm?

limber flume
#

sorry

#

im really sorry

mystic violet
nocturne grove
#

@heavy marsh it's all not working

#

Maybe I didn't try defaultAvatarURL

mystic violet
#

(when logging in)

earnest phoenix
#

How i get the second mention?

onyx hare
#

Is there a way to have the bot do an auto restart of it has an error?

#

Every now and then I get “Discord-API error”

hushed berry
#

how do i make a music bot

mossy vine
#

and.. what is the error?

#

@hushed berry how drunk are you

hushed berry
#

🥺

earnest phoenix
#

How i can get stats about a player in league of legends?

copper cradle
#

you use what's called an api

earnest phoenix
#

Ok ty xd

sterile minnow
#

does anyone know how to Get a message now like this in DJS 12?

try {
            var response = await msg.channel.awaitMessages(
              msg2 => Number(msg2.content) > 0 && Number(msg2.content) < 11,
              {
                maxMatches: 1,
                time: 10500,
                errors: ["time"]
              }
            );
          } catch (err) {
            console.error(err);
            var noresponse = new Discord.MessageEmbed()
              .setTitle(":exclamation: | No one is responding")
              .setColor("RED")
              .setAuthor(message.author.username, message.author.avatarURL);
            return void msg.channel.send(noresponse);
          }```
earnest phoenix
#

u mean with a message collector

sudden geyser
#

@sterile minnow maxMatches is now max I believe.

earnest phoenix
#

it is

#

wasnt it always

sterile minnow
#

okay i'll try

#
  (serverQueue.connection.dispatcher.end("Stop command has been used!"),
        await serverQueue.connection.dispatcher.end(
          "Prepare for trouble. And Make it double"
        ),
(node:1463) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'end' of null
#

da heck

main laurel
#

Guys can i add icon into description with markdown?

#

or the other method how can i do that

heavy marsh
#
bot.guilds.cache.memberCount
#

Is this wrong

#

Cause I get undefined

pale light
#
-       .flat(2)
-       ^
-TypeError: fields.flat is not a function
``` Help me
autumn quarry
#

Question, how can I have the bot see what type of status i have? ex: online, idle, dnd

#

(if you can answer, please ping me)

lapis ocean
#

I need something that allows me to give a role to a user that has successfully filled out a form on my website. What is the easiest way to achieve this? I have thought of having a field that requests the user for their Discord ID. I would then send the the field containing their ID as a webhook to Discord and then I would have to somehow create a bot that would read this ID and assign a role to the user. But Discord doesn't make it easy to share IDs, especially on Mobile, it's actually simple on Discord even if a bit hidden. So what other ways would you recommend to achieve this?

earnest phoenix
#

Question, how can I have the bot see what type of status i have? ex: online, idle, dnd
in which lib

#

I need something that allows me to give a role to a user that has successfully filled out a form on my website. What is the easiest way to achieve this? I have thought of having a field that requests the user for their Discord ID. I would then send the the field containing their ID as a webhook to Discord and then I would have to somehow create a bot that would read this ID and assign a role to the user. But Discord doesn't make it easy to share IDs, especially on Mobile, it's actually simple on Discord even if a bit hidden. So what other ways would you recommend to achieve this?
@lapis ocean
oauth, https://discord.com/developers/docs/topics/oauth2

Discord Developer Portal

Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.

#

require your users to sign it with discord before filling in the form

lapis ocean
#

AH!

#

Interesting solution, just not sure if my current tech stack allows for that.

heavy marsh
limber flume
#

yo

#

i need help

#

how

#

to make bot say guild name in dm

#

so liek

#

Welcome USER To GUILDNAME

earnest phoenix
#

library?

modest maple
#

python

earnest phoenix
#
bot.guilds.cache.memberCount

@heavy marsh check the docs? cache is a collection

#

thank you discord for messing that up

heavy marsh
#

bot.guilds.cache - Only goes up to here ...

#

in docs

heavy marsh
#

ahhh ...

limber flume
#

python

#

Welcome USER To GUILDNAME

#

how to do that

#

when someone joinsd

#

joins server

earnest phoenix
#

in which lib

limber flume
#

i have done this

heavy marsh
#

bot.guilds.users.cache.size

limber flume
#
@bot.event
async def on_member_join(sean):
    em = discord.Embed(title='Welcome')
    em.set_author(name=f'!WELCOME!')
    em.description = ('Thanks for joining this awesome server')
    em.set_footer(text='Bot made by: seañ#1718')
    em.colour = (0xFF0000)
    await sean.send(embed=em)
#

i have this

earnest phoenix
#

you know you can type what you're trying to say in one single message and not send 10 different messages to get the same point accross

limber flume
#

but i want it to

#

say

#

welcome to

earnest phoenix
#

stop spamming

limber flume
#

guild name

modest maple
#

you get passed the guild normally

earnest phoenix
#

bot.guilds.users.cache.size
@heavy marsh that returns the size of the collection

limber flume
#

?

modest maple
#

normally the member and guild

limber flume
#

bot.guilds.users.cache.size

#

this?

modest maple
#

no

#

thats not python

heavy marsh
#

Nope thats is for me

limber flume
#

oh 😦

earnest phoenix
#

they have no typing indicator

#

for me

#

🤔

limber flume
#

is it a global

#

or something

modest maple
#

you get passed the member object @limber flume

#

you can get the guild from the member object

#

e.g

#

member.guild

limber flume
#

i dont know what u men

#

wait

#

thats it?

modest maple
#

and you can get the name from that

limber flume
#

why am i so dumb

modest maple
#

i mean it would help if your var names wernt trash

#

calling somthing sean makes zero sense

limber flume
#

lol

#

;\

#

i know

#

right

#

+_+

#

how to make it say they name

#

member.user?

heavy marsh
#
[09/05/20 20:27:01] [ERROR] (node:22) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'cache' of undefined
#

hmmm

limber flume
#

member.user.username?

earnest phoenix
#

Yes

heavy marsh
#
bot.guilds.users.cache.size
[09/05/20 20:27:01] [ERROR] (node:22) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'cache' of undefined```
earnest phoenix
#

Try bot.users.cache.size @heavy marsh

#

literally read the docs???

limber flume
#

the

#

server

#

thing works

#

@modest maple

#

thanks for helping

#

can u do member.user?

earnest phoenix
#

the guilds property on the client is a GuildManager; https://discord.js.org/#/docs/main/stable/class/GuildManager

modest maple
#

@limber flume no

#

its a member object

#

not a user object

limber flume
#

ok

#

how to mention them

#

in the same dm as server

#

so welcome user to guild

modest maple
#

member.mention

earnest phoenix
#

can you stop spamming and collectively just type what you're saying in a single message holy

modest maple
#

yeahhhhhh

limber flume
#

we are not spamming?

earnest phoenix
#

are you a mod?

#

i am your dad

#

now sit

modest maple
#

you are just flooding chat

#

it gets annoying

limber flume
#

no turn noti off

earnest phoenix
#

fuck u

limber flume
#

^

modest maple
#

why are you here?

heavy marsh
#

hmm

limber flume
#

i cant get it to work.

#

ill try to ffic

#

fix

#

can i dm u @modest maple

earnest phoenix
#

its not funny

modest maple
#

no

ember atlas
#

@earnest phoenix Be nice.
@limber flume Quit line spamming, send your messages in one.

earnest phoenix
#

@ember atlas why ? why i need to be nice? Why?

limber flume
#

im sorry im dyslecix

#

😦

earnest phoenix
#

stop using your mental disorders as an excuse

ember atlas
#

@earnest phoenix Because I said. And continuing to be rude will cause further punishments so I suggest this all be dropped.
If no one here needs development support anymore, go to #memes-and-media

limber flume
#

its not a eczxuse i do have it

ember atlas
#

@earnest phoenix Don't start that either

limber flume
#

excuse

earnest phoenix
#

i know because i've been in a class with a dyslexic student lol but line spamming doesn't correlate to dyslexia

ember atlas
#

Doesn't mean you comment on something like that.

limber flume
#

it help me spell

#

u make me sad

earnest phoenix
#

@ember atlas so, Alright i will be silent.

grizzled raven
#

so uh

#

lets rewrite this conversation

#

whats the difference between x & ~y and x - y

limber flume
#

erm

earnest phoenix
#

thats a bitwise operator i dont get

grizzled raven
#

wait

#

no

#

nevermind

late plank
#

(node:82289) UnhandledPromiseRejectionWarning: SyntaxError: missing ) after argument list

this.client.shard.broadcastEval(`
(async () => {
    let channel = await this.channels.fetch("${this.client.compile_log}");
    if (!channel)
        return;
    
    const embed = new MessageEmbed()
    .setTitle('Compilation Requested:')
    .setColor(${(!!success)?0x00FF00:0xFF0000})
    .addField("Language", ${lang}, true)
    .addField("URL",  ${url}, true)
    .addField("User",  ${author.tag}, true)
    .addField("User ID",  ${author.id}, true)
    .addField("Guild",  ${guild.name}, true)
    .addField("Guild ID",  ${guild.id}, true)
    .addField('Code', '\`\`\`' + ${code} + '\n\`\`\`\n');
    if (!success)
        embed.addField('Compiler Output', '\`\`\`' + ${failoutput} + '\n\`\`\`\n');
    
    channel.send(embed);
})();
`);

#

am I dumb?

knotty steeple
grizzled raven
#

i said nevermind

knotty steeple
#

reeee

grizzled raven
#

yeah because i was doing stuff like 24 & ~8 which is 16 and 24 - 8 is 16

#

so yeah nvm

heavy marsh
#

So amm in discord.js v12
bot.uptime = bots uptime

But is there a way to get the uptime of the messaged shard?

#

Ok nvm got it

limber flume
#

hello i need coding help library python'

pale vessel
#

what do you need help with?

limber flume
#

how to make it so

#
@bot.event
async def on_member_join(sean):
    em = discord.Embed(title='WELCOME !!')
    em.description = (f'Thanks for joining {sean.mention} to {sean.guild}! We Hope You Have A Nice Time Here')
    em.set_footer(text='Bot made by: seañ#1718')
    em.colour = (0x574ea7)
    await sean.send(embed=em)
#

they can change the

#

message

earnest phoenix
#

Bruh i quit visual studio code by accident and now its gone from the taskbar (image) and it doesnt even seem to exist anymore wat

pale vessel
#

you need a database to store the message

limber flume
#

how to

pale vessel
#

so that users can customize it

limber flume
#

@earnest phoenix close it from task manager

pale vessel
#

i suggest not going there for now

limber flume
#

i dont know how to do that

earnest phoenix
#

@limber flume but its like, not there AT ALL

#

it doesnt even exist anymore

pale vessel
#

interesting

limber flume
#

it will after

#

u close

#

in taskmanager

pale vessel
#

@limber flume it's a pain thing to make

limber flume
#

damn

pale vessel
#

yes

earnest phoenix
#

theres no vscode in task manager

#

theres nothing

limber flume
#

hrm

earnest phoenix
#

only malwarebytes, discord etc

limber flume
#

erm

#

try

#

the

#

search bar at the bottom type vscode

earnest phoenix
#

"Application does not exist"

pale vessel
#

reinstall

earnest phoenix
#

but i didnt even uninstall it

pale vessel
#

then go to program files or wherever you installed it

#

create another shortcut

pale light
#
!Code:
message.channel.send({embed: {
 image: message.author.avatarURL
}})

- Error:
        image: message.author.avatarURL(),
                    ^
TypeError: message.author.avatarURL is not a function

!!Info:
Discord.js | v12
#

Help

earnest phoenix
#

but the program doesnt launch if i make a shortcut

#

somehow it looks like the .exe is corrupted

#

but theres nothing that corrupts it on my pc tf

lapis ocean
#

I need something that allows me to give a role to a user that has successfully filled out a form on my website. What is the easiest way to achieve this? I have thought of having a field that requests the user for their Discord ID. I would then send the the field containing their ID as a webhook to Discord and then I would have to somehow create a bot that would read this ID and assign a role to the user. But Discord doesn't make it easy to share IDs, especially on Mobile, it's actually simple on Discord even if a bit hidden. So what other ways would you recommend to achieve this?

#

What if my form system does not allow for oauth? @earnest phoenix

#

Any other smart ways to achieve this?

earnest phoenix
#

other than them inputting the id (which you can't really verify if it's actually their id), nope

amber fractal
#

Oauth would be the only way to truly verify it

turbid bough
#

or you can create a form like what discord bug testing uses, and have the bot accept that command

pale light
#

Can anyone help me

pale vessel
tight forum
#

hi there

#
const isEven = (n) => {
    return n % 2 == 0;
  }
  
  let printMsg = (evenFunc, num) => {
    const isNumEven = evenFunc(num);
    console.log(`The number ${num} is an even number: ${isNumEven}.`)
  }
  printMsg(isEven, 4)

what is that

#

i couldnt understand what it was

#

im trying to learn things I dont know and I couldn't understand what it was

turbid bough
#

it checks if number is even

earnest phoenix
#

% is modulus

late plank
#

Alright folks, I got it working, but I have serious concerns about safety. My goal is to send an embed with player information to a different shard. I have a snippet that works as intended, but unfortunately that means I'd be sending user input through broadcastEval. There has to be a better way of doing this. Any advice?

        let e = `
        this.supportServer.postCompilation("${code.replace('\"', '\\\"')}", 
                                                  "${lang}",
                                                  "${json.url}",
                                                  "${msg.message.author.tag}",
                                                  "${msg.message.author.id}",
                                                  "${msg.message.guild.name}",
                                                  "${msg.message.guild.id}",
                                                  ${json.status == 0},
                                                  "${json.compiler_message}");`

This call builds the embed that I need; and I need this to be called by all shards, but I can't think of a safe way to do it.

midnight blaze
#

@tight forum what you dont understand? it looks rly simple

lapis ocean
#

@earnest phoenix @amber fractal I didn't say I want to verify it.

late plank
#

I guess I could replace \" with \\\"?

lapis ocean
#

There's no reason I would need to verify.

tight forum
#

i know pangloss but I have been working for 15 hours

amber fractal
#

if you had an internal api running on all shards, you could send commands to it and tell it what shard to run it on I suppose

tight forum
#

cant feel my brain anymore

midnight blaze
#

n%2 == 0,
means only even numbers are going to be returned

amber fractal
#

I wouldnt do any eval with user input

earnest phoenix
#

someone can input another user's id, don't you think thats a bit of a safety concern? @lapis ocean

midnight blaze
#

@tight forum yeah, np, just let me know if u need an explanation

late plank
#

@amber fractal what exactly do you mean by internal api

lapis ocean
#

@earnest phoenix not at all, I want to give them a role, the form already is secure enough.

tight forum
#

tyvm mate

turbid bough
#

234703377999593472 hereby apply for moderator

amber fractal
#

an actual server running across all shards, like an api just for each individual shard

lapis ocean
#

My only problem is associating the 1. Person who Fills out the Form WITH 2. Person who has joined my server.

turbid bough
#

you cant

#

you would have to use some kind of custom form with oauth

amber fractal
#

you could also specify port ranges if you want to do that so you wouldnt even need to provide that shard you want to run it on and instaed send it to the specific port

lapis ocean
#

I wanted a better flow, because it's complicated to ask for people's Discord ID, especially when the vast majority are joining for the first time.

earnest phoenix
#

oauth is the only way to know it's actually them

amber fractal
#

But that's just what I think of first probably not even the best way mmLol

late plank
#

so basically an mini rest api for that call

earnest phoenix
#

otherwise i can go ahead and pretend i am thaun for example

late plank
#

Eh; I mean it's certainly better than evaling but fuck

#

I hate every option

lapis ocean
#

@earnest phoenix so what? If you pretend you are thaun, thaun gets the Role and you don't.

#

The Role is to give access to the server basically.

amber fractal
#

and you have someone that didnt apply for whatever having a role

#

what if it's malicious

lapis ocean
#

I can't imagine of a possible attack vector like that.

#

At least not that I would worry about.

turbid bough
#

i would report your bot as buggy if your bot gave me roles for no reason

lapis ocean
#

As long as the form is secure it's alright.

turbid bough
#

the form is not secure when they can manipulate the data

lapis ocean
#

@turbid bough but imagine this is a form that charges $1,000,000 ?

#

Imagine it's a paid community.

turbid bough
#

uh?

lapis ocean
#

Unless you hack the form there's nothing to worry at that stage.

turbid bough
#

wait you charge?

#

thats even worse

#

there is no "hack" the form

#

you insert id

lapis ocean
#

No, but people will have a code.

turbid bough
#

code?

lapis ocean
#

Yes, that can only be inserted once.

#

Yes, an Invite Code

turbid bough
#

an only otp code which only that one user can use to confirm their identity they own the discord account?

late plank
#

@amber fractal do you happen to know of a way to send messages directly to a guild, skipping discord.js caches?

#

I know it was possible in v11

lapis ocean
#

@turbid bough yes, except that the code is not tied to a user. It's single or limited use in some fashion

late plank
#

The've changed lots of their internals since then, so old methods don't work

turbid bough
#

??

#

ok

late plank
#

because if I could hit the endpoint directly I could just serialize the embed

amber fractal
#

You could make the api call yourself, which isnt as difficult as you might think. But I would think all guilds are cached anyways

lapis ocean
#

I like the Oauth idea, just can't apply it. I have webhooks though

turbid bough
#

im not sure how oauth and webhooks connect together

late plank
#

Yeah they're certainly all cached, but not on the shard I need it to be cached on 😄

amber fractal
#

oh

late plank
#

I think hitting the endpoint myself is the best solution here

lapis ocean
#

Me neither, not the point. The system I have can pass the data via webhooks to Discord, that's my point. But I don't think I can use Oauth.

modest maple
#

if you dont want to touch d.js just use a webhook

lapis ocean
#

I also thought of passing the Discord ID as a URL Query parameter, but how would I do that?

#

The form could catch the parameter.

#

But no idea how to pass the Discord ID as a URL parameter or if there's even a way to achieve that.

turbid bough
#

what language do you use?

#

and what api for the website

#

or whatever idk what i should call it

lapis ocean
#

I am not even a developer.

#

Else I would code an oauth solution

#

I am just looking at my options and then see what I have to learn.

turbid bough
#

im confused, you dont have a bot?

lapis ocean
#

This conversation assume I could build the bot, because I will learn.

#

But I don't want to learn and then discover I can't do anything .

#

I still want to learn of course, but wouldn't prioritize it.

#

I am thinking high level here, to see which technologies I have to learn and what I have to connect with what to make this work.

turbid bough
#

you can practically use anything.

lapis ocean
#

I know, I am trying to see what would fit what I have now. Because of course, one could always build anything from scratch.

turbid bough
#

its not important to learn everything, but once you got the basics of programming, you can pretty much use everything

lapis ocean
#

Yes, but it's not practical at all to try to do everything.

#

Learn everything + do everything.

turbid bough
#

well, if you want to know how to make a secure and a good program, that would require learning many things

lapis ocean
#

I wonder if this could help me create an oauth solution that can extract the Discord ID

turbid bough
#

i havent heard of it

#

but tbh, to use discord oauth is not difficult

lapis ocean
#

But I need some special servers or something no @turbid bough ?

#

Some SSL Wizardry or whatever, lol sorry for the ignorance

turbid bough
#

if you need to host your own website/bot, then yes, you would need your own server, or buy one.

lapis ocean
#

Not ssl, Oauth

main laurel
#

Sorry for that

turbid bough
#

well, you just need to do a https request with the specified information

#

basically

#

you have an url to discord oauth, it includes a redirect back your website

#

discord oauth url is where you would login with discord

#

then once you logged in, the site will visit that page with a query code, which you can do to get access to a key

lapis ocean
#

You make it sound very easy

turbid bough
#

it is

lapis ocean
#

I actually have a bot on my Discord that does some OAuth magic like that.

#

Not coded by me of course.

turbid bough
#

you just send some data to discord, and then you get data back

lapis ocean
#

And not hosted by me either.

#

How do I send that data? Server side code right?

vague kite
#
        const connection = await message.member.voice.channel.join();
        const dispatcher = connection.play('./../../assets/random.mp3');

        dispatcher.on('finish', () => {
          console.log('Finished playing!');
        });

So I'm just trying to play some random audio file from my assets folder right but when the bot connects it doesn't really play and just consoles finished playing.

I have installed:
Node-opus
ffmpeg-static
ffmpeg

@ me if you can help ❤️

lapis ocean
#

I need some code running on a server I guess.

turbid bough
#

yeah

lapis ocean
#

Could I do that with a webhost? That has PHP or something?

turbid bough
#

PHP or nodejs

lapis ocean
#

I guess I could grab some php script that does that maybe no?

pale vessel
#

yes you can

#

code it yourself

turbid bough
#

there is documentations on discord that tells you what data you can send to get access token, and with that token you can use that to get user info.

lapis ocean
#

So the way I see that it could work is, the script would pass an oauth request to Discord, the user would authenticate, and then it could extract their Discord ID, and then it would redirect the user to a URL with the DiscordID in the URL QueryStrings and then my form would catch that

pale vessel
#

uhh maybe not in the url

lapis ocean
#

And then the form would send the ID as a webhook to Discord, a bot would read it and assign the role to the user

turbid bough
#

the oauth is sent from discord. not to.

lapis ocean
#

Why not in the URL? This way it would work with my current system

turbid bough
#

in your website, you link your login button to this link for example https://discordapp.com/api/oauth2/authorize?response_type=code&client_id=157730590492196864&scope=identify%20guilds.join&state=15773059ghq9183habn&redirect_uri=https%3A%2F%2Fnicememe.website&prompt=consent

and with that, once logged in it will send a query data to the website you are using.

lapis ocean
#

So Discord sends data to that link right?

turbid bough
#

discord sends data to this link for example: https://nicememe.website/?code=NhhvTDYsFcdgNLnnLijcl7Ku7bEEeee&state=15773059ghq9183habn

#

and then you use your webserver to parse that code to get an access token

lapis ocean
#

Basically I need a server to catch that data right?

turbid bough
#

yes

lapis ocean
#

Looks like a webhook

turbid bough
#

well yes it kinda works like that

#

but you cant use that data for anything, so you would have to add login

lapis ocean
#

What do you mean "add login"?

turbid bough
#

logic*

lapis ocean
#

Ah, yes of course

#

I guess it would be quite simple

#

Catch the Discord ID and redirect to a URL with that ID as a query string

turbid bough
#

you dont need to redirect with a discord id with a query

#

you can just use a session for that if the form is on the same website as where you set your oauth

lapis ocean
#

I use a service to create forms. I'm not sure I can do that or why I would do it that way.

#

They have this feature at least.

turbid bough
#

Im not sure what service you use, but if that service allows users to login with oauth and validating the form's request, then it should be fine?

earnest phoenix
#

anyone used mysql.escape()? for some reason im getting errors using this

  connection.query("INSERT INTO reminders (user_tag, msg, date, epoch, user_id, channel_id) VALUES('"+reminder.user_tag+"', '"+connection.escape(reminder.msg)+"', '"+reminder.date+"', '"+reminder.epoch+"', '"+reminder.user_id+"', '"+reminder.channel_id+"')", function (err, result, fields) {
    if (err) throw err;
  });
#

specifically around connection.escape(reminder.msg)

Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'test @night raptor'',
lapis ocean
#

@turbid bough I think it doesn't. That's why I am trying to work it out this way. Should work just fine with a Query String no?

turbid bough
#

discord oauth does not work with query strings except from the authorization code

#

if you want to validate who want to send that form for example, you would need server code to compare to send that.

#

but im not sure

late plank
#

What goes into the auth header for the discord api?

lapis ocean
#

@turbid bough What I was thinking was that the script on the server would redirect the user to a url with Query Strings

late plank
#
 [Symbol(Response internals)]: {
    url: 'https://discordapp.com/api/v6/channels/568172962855911435/messages',
    status: 401,
    statusText: 'Unauthorized',
    headers: Headers { [Symbol(map)]: [Object: null prototype] },
    counter: 0
  }
turbid bough
#

that wouldnt work if you are using oauth

#

it basically makes oauth useless

#

other than obtaining data

#

the form itself on the server would need to use the oauth

twin marsh
pale vessel
#

new Date().getYear() ?

turbid bough
#

Date.Now().getYear() ?

pale vessel
#

oh same result

#

Date.Now is not a function

amber fractal
#

why did you new Date(Date.now())?

turbid bough
#

yeah i wonder that too

pale vessel
#

ikr it's the same

turbid bough
#

cause Date, isnt that a struct?

twin marsh
#

It's in v11

amber fractal
#

uh

#

That's js

turbid bough
#

v11 js?

amber fractal
#

The Date class is built into js

pale vessel
#

what

amber fractal
#

has nothing to do with d.js

lapis ocean
#

@turbid bough why useless? I don't understand why it wouldn't work.

#

Why would the form need to use the Oauth?

turbid bough
#

If you are hooking up a website form upto a discord bot that is going to do changes to a user, the form would need oauth for security etc.

#

its not that its required to

#

but its very reccomended

pale vessel
#

yeah

turbid bough
pale vessel
#

is utc even important

twin marsh
#

no

pale vessel
#

on year

twin marsh
#

We've tried the same

#

Without UTC in it

pale vessel
#

i mean if it's 31 dec

lapis ocean
#

@turbid bough I'm just worried if it would work or not. I'm not so worried about hacking. If someone hacks it will be very obvious and the consequences wouldn't be nefarious.

turbid bough
#

The value returned by getYear is the current year minus 1900. JavaScript 1.2 and earlier versions return either a 2-digit or 4-digit year. For example, if the year is 2026, the value returned is 2026. So before testing this function, you need to be sure of the javascript version you are using.

#

idk, it would probably work

#

just add 1900 and you got the year

pale vessel
#

you can also save the time by adding "Full"

smoky cedar
#

Is it possible to edit descriptions on dbl after you uploaded it?

turbid bough
#

yes

#

just press edit

smoky cedar
#

nice, so when i update the bot i can easly edit it

#

thanks :))

lapis ocean
#

Another solution would be to give them a code generated by the system, that is shown to them upon form submissions and/or email. And then they would input that code in the server.

restive night
#

how to react to message using emoji id across shard?

wintry sonnet
#

My bot @sick ibex randomly stopped working. It was working just fine until now. Now it doesn't do anything, except put this error in the console when I try to run a command

2020-05-09T22:31:04.215919+00:00 app[worker.1]:     at /app/node_modules/node-fetch/lib/index.js:272:32
2020-05-09T22:31:04.215921+00:00 app[worker.1]:     at processTicksAndRejections (internal/process/task_queues.js:97:5)
2020-05-09T22:31:04.215921+00:00 app[worker.1]:     at async Client.<anonymous> (/app/index.js:40:18)
2020-05-09T22:31:04.215968+00:00 app[worker.1]: (node:4) 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: 2)
2020-05-09T22:31:04.216031+00:00 app[worker.1]: (node:4) [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.```

Somebody help?
turbid bough
#

website prob broke

wintry sonnet
#

What website?

turbid bough
#

https://disease.sh/v2/all

white gyro
#

It's returning html, not json

turbid bough
#

its returning 502 html error

#

cloudflare

wintry sonnet
#

Same here

amber fractal
#

you should check for errors before parsing

earnest phoenix
vague kite
#

Since when is v13 out 🤔

earnest phoenix
#

Since i forked discord.js xd

smoky spire
#

actual v13 is gonna be ts rewrite tho and it's barely been started

earnest phoenix
#

I forked the commit hash before managers were imtroduced

#

Imported a few bugfixes from later commits and called it v13.0.0

#

Its mstly for my own bot anyways xd

smoky spire
#

Nice major version change for patches lol

earnest phoenix
#

V12.0.0-dev wasnt a major change

delicate zephyr
#

actual v13 is gonna be ts rewrite tho and it's barely been started
@smoky spire can I get a source please

earnest phoenix
#

Also i named it v13 to flex xd

#

Couldve called it v12.1.0-dev

smoky spire
#

@delicate zephyr

delicate zephyr
#

I guess they got sick of the shitcode

#

Dont get me wrong

earnest phoenix
#

Yes they did

delicate zephyr
#

I like d.js

#

but their caching

white anvil
#

djs is a trainwreck

delicate zephyr
#

is like trying to fit a elephant on a hamster

earnest phoenix
#

My fork is pre .cache managers with futur3 commits

white anvil
#

it should be way more modular than it is and the caching is garbage

#

no control

#

all or nothing

earnest phoenix
#

And the worst cache is the presence cache

delicate zephyr
#

The day we can disable caching

white anvil
#

presence cache is so niche

delicate zephyr
#

the better

white anvil
#

you shouldn’t need to use it

#

caching control should have been introduced in v1

earnest phoenix
#

3GB memory/3 day uptime
280MB memory/3day uptime PRESENCE_UPDATE disabled

white anvil
#

even eris doesn’t have good caching control

delicate zephyr
#

there no easy way to disable it

#

and I need presences

white anvil
#

there is no mainstream js lib with even mediocre caching

delicate zephyr
#

Mainstream no

white anvil
#

@earnest phoenix not surprising

delicate zephyr
#

but tbf, Tim made a decent for of discord.js

white anvil
#

presence update dwarfs other events

#

i am converting tim to the lib im using

earnest phoenix
#

Not just that, its per MEMBER
AND USER...

delicate zephyr
white anvil
#

because it’s everything that the other libs arent

#

aka good

earnest phoenix
#

One member in 8 guilds = 9 presences of the same person with different ids in guild

#

Its awful

#

Like fr why

white anvil
#

yeah I talked to tim about this yesterday

#

a lib already exists that does this

delicate zephyr
#

tbh

#

the only thing you should be caching

#

is the custom statuses / game statuses

white anvil
#

I cache nothing except messages

#

big up 50mb ram

turbid bough
#

can anyone save me from this hell dependency injection

delicate zephyr
#

otherwise just store the online/dnd/away/offline in a cache with only ids

white anvil
#

presence update alone was making me go over the bandwidth limit on my vps

earnest phoenix
#

I wanted to cache the statuses, not everything everywhere

#

So i got rid of all of them instead

white anvil
#

i would cache absolutely nothing but I need message cache for edit handling to work

earnest phoenix
#

@white anvil bruh vpses with limits are trash

#

How much you pay for it

white anvil
#

im paying fuckall for it

#

like £2

delicate zephyr
#

check out contabo

white anvil
#

/mo

delicate zephyr
#

their like a quid cheaper

#

lol

white anvil
#

contabo is good but they rejected my details and asked for my id

earnest phoenix
#

Nono contabo bad tho

white anvil
#

so I can’t use them 😂

delicate zephyr
#

its good for starter jens

white anvil
#

contabo is rlly good for the price wym

#

it’s so cheap

earnest phoenix
#

Try galaxygate, no bandwidth limits but theyre sorta half out of stock rn

delicate zephyr
white anvil
#

GALAXYGATE

#

LOL

#

nooo thanks

topaz fjord
#

you kinda cant do galaxygate rn

#

they're out of stock

white anvil
#

trainwreck of a provider

topaz fjord
#

but you can request

earnest phoenix
#

Its where rythm is hosted at though

topaz fjord
#

and they'll do it

earnest phoenix
white anvil
#

so??

topaz fjord
#

wym galaxygate is good lmao

delicate zephyr
#

lets not have a host war

white anvil
#

no galaxygate is literally trash

#

terrible uptime

earnest phoenix
#

Bruh..

topaz fjord
#

someone send me money for the ryzen vps

pale vessel
#

right after luke said that lmao

earnest phoenix
#

Its uptime is better than discord's LMAO

delicate zephyr
#

Stop. Final warning.

white anvil
#

ok epic

earnest phoenix
#

No ur supposed tosay ok luke

white anvil
#

either way I only have 200gb bandwidth limit on my vps

#

which is fine by me

#

im so conservative of what I send and receive with my bot that I only use like 1/10 of that a month

delicate zephyr
#

noice

#

I used 2TB of my bandwidth in the first month

white anvil
#

I only have messages intent

delicate zephyr
#

luckily I have unlimited but still lol

#

I use a dedi

#

but yea

white anvil
#

it’s not rlly unlim

delicate zephyr
#

it is lol

white anvil
#

they will eventually throttle u

delicate zephyr
#

They dont mmulu

white anvil
#

all hosts do

delicate zephyr
#

oneprovider hasnt since i started using them

#

we've had 1000/1000 the entire time

white anvil
#

if u push it too much they will

delicate zephyr
#

well yea

white anvil
#

they will eventually start losing money over it

#

bandwidth is expensive stuff

delicate zephyr
#

if you start using 1000/1000 for a month straight

white anvil
#

granted I don’t need a dedi

delicate zephyr
#

On provider dedis are fairly cheap for the low end ones

white anvil
#

I have a 2-core intel xeon and I use about 10% of that on average

delicate zephyr
#

and youre paying 2 quid?

white anvil
#

cheap dedis are usually a rip off

#

I did bcuz I got discount

delicate zephyr
#

how much ram

white anvil
#

it’s more like £6/mo

#

2gb

delicate zephyr
#

storage?

white anvil
#

again I use like 1/4 of that

#

uhh 70gb (?)

delicate zephyr
white anvil
#

yeah no

#

dedis below like $40/mo are usually rip offs

earnest phoenix
#

o

white anvil
#

you can’t have a dedicated machine at that price that is cost effective and also performant

delicate zephyr
white anvil
#

that’s probably okay

delicate zephyr
#

Its been doing great

white anvil
#

hetzner sell $30 dedis with 2gb ram btw

delicate zephyr
#

why

white anvil
#
  • hexa core ryzen
delicate zephyr
#

oh

#

thats why

white anvil
#

idk??

#

who would buy that

#

srs

#

that ryzen is such a waste with so little ram

delicate zephyr
#

ikr

white anvil
#

windows...server?

delicate zephyr
#

nope

#

main pc

white anvil
#

oh

delicate zephyr
#

that vswitch

turbid bough
#

why does JS use string for ID's but Discord.Net use ulong's??

delicate zephyr
#

is my headphones

#

lmfao

white anvil
#

i have an i7-7800k

#

which is good for me

delicate zephyr
#

yea

white anvil
#

all I do on my pc is write shit c and watch YouTube

delicate zephyr
#

this R9 3900X doesnt ever hit above 50% for me

#

so

white anvil
#

won’t even be able to take it to uni when I go this year

#

too bulky

#

need laptop

#

it’ll just sit in an attic losing value daily until I graduate in 4 years and it’s worth $20

#

:D

delicate zephyr
#

blame AMD

white anvil
#

it’s not just that

#

it has a 1080ti in there + 32gb ddr4

#

still worth $20 mmulu

delicate zephyr
#

lul

white anvil
#

Pretty much guarantee that if most of the traffic on your dedi comes from discord bot, 1.9TB of it is presences

delicate zephyr
#

nope

white anvil
#

do u not track presences

delicate zephyr
#

I do

wooden lance
#

does anyone know how to limit how much discord.js can cache? it tends to overload my vps if it doesnt get restarted for a few days

delicate zephyr
#

I just use the raw data

white anvil
#

wdym

delicate zephyr
#

@wooden lance you can disable events

#

discord.on('raw')

white anvil
#

you just take events from raw ws?

#

oh

delicate zephyr
#

setup my own caching

white anvil
#

why lmfao

wooden lance
#

o tru thanks

white anvil
#

ah

delicate zephyr
#

disabled the presence event

#

and then handled it myself

white anvil
#

there are socket wrappers that get rid of all the djs bullshit

#

for this purpose

earnest phoenix
#

Or just make your own lib

delicate zephyr
#

^

#

this

white anvil
#

why

delicate zephyr
#

I tried

#

but gave up

white anvil
#

pointless

#

waste of time

#

it’s such a challenge to make a good library from scratch that is really not worth it if what you want can be achieved with existing libraries

earnest phoenix
#

Well atleast there wont be shit to complain at, because it'd be your own shit then

white anvil
#

and in 99.99% of cases it can

delicate zephyr
#

I mean. yea, but like you learn a lot

white anvil
#

or if you want custom shit use a gateway and rest handler and build from them

delicate zephyr
#

which is why I tried origionally

white anvil
#

interesting stuff

next remnant
#

How do I automate testing of my bot?

white anvil
#

seeing how zlib is implemented

next remnant
#

Like with unit/e2e tests

#

(if anyone has experience with it in some other language/library, I'd love to hear it)

topaz fjord
#

you replicate discord's api

next remnant
#

effort

#

I don't want mock the entire API myself

white anvil
#

does anyone have experience with how best to implement ratelimit buckets using js

#

im not so proficient at promises that I know how to do it lol

twin smelt
#

SyntaxError: missing ) after argument list
at wrapSafe (internal/modules/cjs/loader.js:1047:16)
at Module._compile (internal/modules/cjs/loader.js:1097:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74
:12)
at internal/main/run_main_module.js:18:47

#

can some one dm me with help please

next remnant
#

@twin smelt haven't seen your code and haven't used js in a while but you probably forgot or accidently deleted a ) at the end of a function's argument list

twin smelt
#

@next remnant const Discord = require('discord.js');
const bot = new Discord.Client();

const token =

bot.on('ready', () =>{}
console.log('This bot is online');
})

bot.login(token);

#

i removed the token

next remnant
#

bot.on("ready", {}

#

That's your syntax error

#

Remove the } from there

twin smelt
#

so just leave it at {

#

?

midnight blaze
#

yep

#
bot.on('ready', () =>{
    console.log('This bot is online');
});

tight bough
#

I’m only starting in development and I’d like to know how with discord js create unique variables for each server

smoky spire
#

Use a database

twin smelt
#

whats wrong here?

smoky spire
#

Refresh ur token man

#

There's also nothing wrong

tight bough
#

@smoky spire thx

midnight blaze
#

I hope that is not your real token

#

@tight bough some people also use a json file.

twin smelt
#

no

delicate zephyr
#

@twin smelt please be careful. You posted your token

#

Please reset your token and be careful about posting any code here beforehand

zenith orchid
#

Can i use the emoji from another server with webhook?

smoky spire
#

Bots can use any emoji from any server they're in anywhere

zenith orchid
#

But this a webhook

smoky spire
#

Oh misread the question

#

You probably would only be able to use the emojis in that server but I'm not 100%

regal bison
#

This Gonna Show How Many serevs i Have and The Members Right ?

earnest phoenix
#

why is ur client this

#

thats odd

zenith orchid
#

@smoky spire, thanks for answer

regal bison
#

what ?

earnest phoenix
#

this.client

#

is that a class

regal bison
#

yes..?

earnest phoenix
#

ok makes sense

#

try it and see

regal bison
#

k

#

nop didnt work

earnest phoenix
#

check the docs christmasthink

#

also ur actual like status message is a normal string

#

so template literals dont work

#

use ``

regal bison
#

i Think gonna work Now

#

let status"

#

@earnest phoenix What u think

knotty steeple
#

u dont need all that

#

just the names in a normal array

regal bison
#

yeah !

distant plank
#

I want to insert an array in mysql but I don't know how.

pale vessel
#

just convert it to a string/join them

reef heath
#

Hello, I'm trying to make it so that when my bot replies to a message, it also attaches a gif. I have the link for the gif, but the only way that I know of making the bot show the gif is by sending the link. I don't want the link to be visible

#

So, basically, how do I make a bot post a gif without posting a link

#

I'm using Visual Studio Code with Discord.js

#

Here is the rest of the command if you need more context:

#

If you have any ideas, please @ me

stray wasp
#

@reef heath

#

Look at the examples shown. You can attach local files or even urls (Which is the better method to save bandwidth)

reef heath
#

urls is the better method?

stray wasp
#

https://discord.js.org/ is discordjs's documents I recommend you have a look through it if you ever are looking for a feature you require in your bot.

#

sending a file via a url yes

lofty grove
#

Hello.

stray wasp
#

because you arn't uploading the file everytime someone sends a command that the bot responds to.

reef heath
#

right.

stray wasp
#

since it's already uploaded.

reef heath
#

yes that makes sense

#

does that link also explain how to set the bot's status?

stray wasp
#
#

if you look for it yes.

lofty grove
#

there were commands, I forgot

#

it shows like that constantly

stray wasp
#

it's telling you it's starting the app, and is saying they turn off projects that are inactive to keep glitch running fast.

#

basically so that you can't run a bot or something off their servers

lofty grove
stray wasp
#

?

#

ok

lofty grove
#

Do you have this command that should be like this?

stray wasp
#

I'm confused.

#

what are you talking about specifically

lofty grove
#

This is a command to be thrown to bot.js, but I don't have this command, can you help?

stray wasp
#

I'm still confused on what your talking about.

lofty grove
#

I need to make the Starting site just like any other site, I need those commands

stray wasp
#

Oh the glitch app isn't starting?

#

that's a glitch problem probably. Run the code locally, makes it a lot easier for developing anyway

lofty grove
#

The boat is running now, but the logs are not in place, they keep turning.

stray wasp
#

honestly I wouldn't really bother with Glitch, I recommend moving to a local environment

lofty grove
#

let app = require("express")();
app.listen(8080)
app.get("/",(req,res)=>{res.send("OK")})

#

I was talking about these codes.

#

I got the problem fixed :D

reef heath
#

hey, my code has 1 error and it's bugging me. i'm not sure if it's doing any damage, though, but i don't know how to fix it, either.

#

in this line: switch(args[0]){

#

it underlines "switch" and says " ',' expected "

copper cradle
#

dude use fucking code blocks smh

#

it's not that hard

#

like

#

it's literally ```language here
code here
```

reef heath
#
   switch(args[0]){
//command "help" - Pulls up a list of the bot's commands
case 'help' :
message.channel.send('__Here is a list of my commands__:')

message.channel.send('"**a.help**" - Pulls up a list of my commands.')
break;
}```
#

wow

#

that's great! thank you!

#

anyways, it underlines "switch"

#

and says that it expects a comma

topaz fjord
#

show the code before it

reef heath
#
const Discord = require('discord.js');
const bot = new Discord.Client();
// token allows the code to send content to the bot. It's like an access password.
const token = '(not showing bc private)';
//set bot prefix
const PREFIX = 'a.';

//make bot online: open terminal (ctrl + ~) make bot online (node .)
//make bot offline: open terminal (ctrl + ~) make bot offline (ctrl + c)
bot.on('ready', () =>{
    console.log('bot is online')
})
//bot only responds to messages that start with "a."
bot.on('message', message=>{
    if(message.content.startsWith('a.') == false) return
    let args = message.content.substring(PREFIX.length).split(" ");
}
    switch(args[0]){
//command "help" - Pulls up a list of the bot's commands
case 'help' :
message.channel.send('__Here is a list of my commands__:')

message.channel.send('"**a.help**" - Pulls up a list of my commands.')
break;
}


//tells the bot to log in with the token
bot.login(token);```
stray wasp
#

the switch statement isn't inside of the message listener

reef heath
#

wdym? i'm really new to all of this

slender thistle
#
switch (stuff) { }```
reef heath
#

is this: { } message listener?

slender thistle
#

The switch isn't inside the event

trim saddle
#

so

slender thistle
#
message-event { switch (stuff) { } }``` is how your code would look if the switch was inside the message listener
reef heath
#

OH

#

thanks

#

sorry for being a dumbass

#

let's see if that fixes things

#

It created 9 new errors 😦

slender thistle
#

well...??

#

Post the errors?

reef heath
#

okay hang on hahah

#
  { switch(args[0]){
//command "help" - Pulls up a list of the bot's commands
case 'help' :
message.channel.send('__Here is a list of my commands__:')

message.channel.send('"**a.help**" - Pulls up a list of my commands.')
break;
} }```
#

i'll bold errors?

trim saddle
#

i'm trying to run a loop with this

with open('/path/to/data.json', 'r') as a:
    data = json.load(a)
bot = commands.Bot(command_prefix="REEE")
async def update_statuses():
    await bot.wait_until_ready()
    while not bot.is_closed():
        guild = bot.get_guild(433011085369409551)
        owo = guild.get_member(365255872181567489)
        yoshi = guild.get_member(488532005206884353)
        spood = guild.get_member(585225058683977750)
        data["avatars"]["owo"] = owo.avatar_url_as(format="png")
        data["avatars"]["yoshi"] = yoshi.avatar_url_as(format="png")
        data["avatars"]["spood"] = spood.avatar_url_as(format="png")
        data["statuses"]["owo"] = str(owo.status)
        data["statuses"]["yoshi"] = str(yoshi.status)
        data["statuses"]["spood"] = str(spood.status)
        json.dump(data, open('/path/to/data.json', 'w'), indent=2)
        print("Statuses updated")
        await asyncio.sleep(30)

bot.upstats = bot.loop.create_task(update_statuses())
#

and nothings happening

reef heath
#

woah

#

yeah, nvm my question.

pale vessel
#

show the error

slender thistle
#

Are you sure the task is actually being created

#

Add a print after bot.upstats =

trim saddle
#

wait..

#

do i even need to define it

slender thistle
#

Not necessarily

trim saddle
#

lemme try that

slender thistle
#

The task will still be created

#

Actually, does bot.loop exist at that point

trim saddle
#

not defining it worked

#

alright

#

i dunno whats happening but i can't write to my json

slender thistle
#

👀

meager ermine
#

Some one pls help me

#

My bot keeps resetting it's token 😦

#

I can't get it to come online 😦

reef heath
#

anyone wanna collab ?
@shut inlet on what?

#

If I'm honest, I hardly know anything, but I'm a very hard worker

copper cradle
#

how much is the paycheck worth?

#

I accept not less than $50

#

a week

grizzled raven
#

heres my youtube (not advertisement)

astral yoke
#

just dont

#

why would we need it

#

anyways i need some help

#

if i have this ```

module.exports = {
config: {
name: "say",
},
run: async (bot, message, args) => {
let text = args.join(" ");
if(message.content.includes('@everyone') || message.content.includes('@here') || message.content.includes('<@&') || message.content.includes('<@'))
return message.channel.send('No pings allowed!').then(msg => msg.delete(5000));
if(!text) {
message.reply("tell me something to say!")
};
message.delete();
message.channel.send(text);
}
}``` how would I make it so that if someone edits there message then the bot would edit the message with there updated message on the bot

copper cradle
#

their

grizzled raven
#

client.on("messageUpdate", require("./message.js").run) or whatever

astral yoke
#

couldnt i do if(messageUpdate) ?

grizzled raven
#

no

copper cradle
#

no

#

the callback for messageUpdate returns 2 parameters

grizzled raven
#

yeah ik im just lazy

copper cradle
#

your message is correct

#

lol

midnight blaze
#

why do u put async if u dont use await :/

grizzled raven
#

no because old message is the first param

copper cradle
#

¯\_(ツ)_/¯

#

@grizzled raven and

#

you passed a ''''''pointer'''''' to the function

grizzled raven
#

eh

midnight blaze
#

if i have this ```

module.exports = {
config: {
name: "say",
},
run: async (bot, message, args) => {
let text = args.join(" ");
if(message.content.includes('@everyone') || message.content.includes('@here') || message.content.includes('<@&') || message.content.includes('<@'))
return message.channel.send('No pings allowed!').then(msg => msg.delete(5000));
if(!text) {
message.reply("tell me something to say!")
};
message.delete();
message.channel.send(text);
}
}``` how would I make it so that if someone edits there message then the bot would edit the message with there updated message on the bot
@astral yoke
First of all: the function u included has nothing to do with editing messages. Secondly, a bot can not edit the messages of other users. Nobody can.

astral yoke
#

No no, not edit there message, when you do db!say hi then edit it to like db!say hello it would also edit his message to catch up with the edited one

#

do you know what i mean

grizzled raven
#

they mean that if you edit a message the message event will fire

midnight blaze
#

aha, ups

#

then I misunderstood what u said.

astral yoke
#

sorry bout that

copper cradle
#

you mean their message

#

there a place - the apple is right there
their possessive noun - that's their car
they're literally means they are

steel drum
#

im debating on wether i should use mariadb or postgresql (i think thts wht its called) for my bot

earnest phoenix
#

@steel drum depends on what ya doing

steel drum
#

on one hand im pretty sure postgresql provides better preformance but mariadb provides bult-in clusterization management stuff

#

i dont know if i want to look THAT FAR in advance to worry abt bot clusters

earnest phoenix
#

I use a mLab mongoDB for prefix storing

steel drum
#

but i also dont want to make very large refactors later on

#

hmm

earnest phoenix
#

storing stuff like this is easy

steel drum
#

im more interested in storing

#

alot of data

#

like each user can get "cards"

#

and have it all in some sort of table

#

for easy filtering & stuff

earnest phoenix
#

I'm trying to get all members of all servers, bc bot.users.size return an incorrect number, i have try to do something like this

bot.guilds.forEach(g => {
console.log(g.memberCount)
});

But it's returning a list of all servercount, someone know an another method?

wanton nova
#

how big is your bot?

slender thistle
#

Create a variable sum with value 0
on each iteration, add memberCount to it

pale vessel
#

you can also just use Collection#map

#

plus reduce

#

that's one line

queen needle
#
if (message.content.startsWith(prefix + "t")) {
    const GIFEncoder = require("gifencoder");
    const { createCanvas } = require("canvas");
    const fs = require("fs");

    const encoder = new GIFEncoder(320, 240);
    // stream the results as they are available into myanimated.gif
    let stream = encoder.createReadStream();
    message.channel.send({
      files: [{ attachment: stream, name: "myfile.gif" }]
    });

    encoder.start();

    // use node-canvas
    const canvas = createCanvas(320, 240);
    const ctx = canvas.getContext("2d");
    const background = await Canvas.loadImage(message.author.displayAvatarURL);
    ctx.drawImage(background, 0, 0, canvas.width, canvas.height);
    
    encoder.addFrame(ctx);

    

    encoder.finish();
    message.channel.send(stream);
  }```
#

im trying to figyre out how to add text but its not working

#
ctx.fillText("t", canvas.width / 2.5, canvas.height / 1.8);```
#

i tried to add that but then it would send the image at all

astral yoke
#

TypeError: require(...) is not a function at ["console", "command", "event"].forEach(x => require(`../handlers/${x}`)(bot));

#

why does this happen

pale vessel
#

what are you requiring it for

astral yoke
#

my handlers

pale vessel
#

also what's up with these 02 avatars

astral yoke
#

me?

pale vessel
#

never mind

#

where's the handler

#

in the file?

astral yoke
#

its a different folder

#

called handlers

#

which the handlers

#

command

#

console

#

and event

pale vessel
#

what's inside one of those

#

like console

astral yoke
#

ill dm you it

#

fixed

earnest phoenix
#

Express is not working

#

when i add dbl webhook

#

how to fix it?

pale vessel
#

not working
how to fix
how are we supposed to know how to fix if we don't even know what's not working

earnest phoenix
#

ok

marble juniper
#

how can I check if an image is a gif format and without using filenames

turbid bough
#

you can check the file's header text

marble juniper
#

k

exotic lotus
#

Can anyone help me with HTML coding?

honest perch
#

Don't ask to ask

exotic lotus
#

I have added login system on my website i want to make it fetch user's server bot is in
Just like Dyno and mee6, it shows user's server after login

#

How can i do it? Anyone help me with an example pls

warm marsh
#

Discord oAuth2

#

Google has many answers

frail ocean
#

Or even youtube, many many MANY good tutorials.

earnest phoenix
#

you cannot do it with raw html

#

you cannot do it with just frontend

#

you need a backend server to handle authentication

nocturne grove
#

can anybody please help me with sending a simple avatar image with a normal message (no embed) in d.js v12. I don't know what they did but I've never struggled so much with such a simple thing

summer torrent
#

MessageAttachment()

small prairie
#

embeds down?
image and thumbnail

nocturne grove
#

@summer torrent thanks, it's finally working

earnest phoenix
#

how big is your bot?
@wanton nova 163k members

#

But only shown 70k

#

Create a variable sum with value 0
on each iteration, add memberCount to it
@slender thistle

bot.guilds.forEach(g => {
var sum = 0
const total = sum + g.memberCount
console.log(total)
});

Something like that should be work?

slender thistle
#

well

#

sum = 0
first iteration: sum = 5 (membercount = 5)
second iteration: sum = 10 (membercount = 10)

#

You're resetting the sum variable every time an iteration happens

small prairie
#

lmao

#

@earnest phoenix var before the foreach

#

also it might spam your console depending on the number of guilds

earnest phoenix
#

yeah but i just want only one number

#
bot.guilds.forEach(g => {
const total = sum += g.memberCount
console.log(total)
});```
Okay so, that shit work
slender thistle
#

That shit do work

earnest phoenix
#

It returning me 150530

#

nice

slender thistle
#

Kinda

#

Could just use sum instead of creating another variable blobshrug

earnest phoenix
#

is this valid sql syntax, it says i have an error near "?"

    let sql = "UPDATE timezones SET user_tag = ?, user_tz = ? WHERE user_id = ?";
    let inserts = [tzData.tag, tzData.tz, tzData.id]
    connection.query(sql, function (err, result, fields) {
      if (err) throw err;
    });
Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?, user_tz = ? WHERE user_id = ?' at line 1
#

the purge command

heavy marsh
#
bot.shard.broadcastEval('this.uptime')

Will give this that shard uptime? - I mean the command works but does it give the proper shard uptime?
I am using v12 of discord.js

earnest phoenix
#

cache ig

heavy marsh
#

ig?

earnest phoenix
#

try with cache

#

i guess

heavy marsh
#

cache - where?

earnest phoenix
#

bot.shard.cache

#

Idk it works or not

heavy marsh
#

hmm ok

smoky spire
#

That's not a thing, you have it right

heavy marsh
#

?

smoky spire
#

The code you sent is good

heavy marsh
#

But I dont think I get the correct uptime

#

Cause like a few minutes ago my shard disconnected and resumed

#

But still shows the same uptime

smoky spire
#

Because the uptime is on the client and not the shard

heavy marsh
#

But how can I get the uptime of the shard?

#

then

smoky spire
#

Idk

heavy marsh
#

hmm

delicate zephyr
#

I mean

#

@heavy marsh using discord.js?

#

Internal sharing I presume

#

If so you can use process.uptime since each shard is its own process

heavy marsh
#

so bot.process.uptime

delicate zephyr
#

No

#

Just process.uptime

#

Should work

heavy marsh
#

Nope it shows NaN

earnest phoenix
#

how do i make the try; jump to catch if there is no match?

  try{
    console.log("update 1")
    let sql = "UPDATE timezones SET user_tag = ?, user_tz = ? WHERE user_id = ?";
    let inserts = [tzData.tag, tzData.tz, tzData.id]

    connection.query(sql, inserts, function (err, result, fields) {
      if (err) console.log(err);
      console.log(result)
    });
  }
  catch(err){
    console.log("insert 1")
    let sql = "INSERT INTO timezones (user_id, user_tag, user_tz) VALUES(?, ?, ?)";
    let inserts = [tzData.id, tzData.tag, tzData.tz]
    
    connection.query(sql, inserts, function (err, result, fields) {
      if (err) throw err;
    });
  }

it returns this in result, when no match is found

OkPacket {
  fieldCount: 0,
  affectedRows: 0,
  insertId: 0,
  serverStatus: 34,
  warningCount: 0,
  message: '(Rows matched: 0  Changed: 0  Warnings: 0',
  protocol41: true,
  changedRows: 0
}
nocturne grove
#

These functions are also available on the base Discord object. https://discord.js.org/#/docs/main/stable/class/Util

const Discord = require('discord.js');
const str = '`Hello world`';
console.log(Discord.cleanCodeBlockContent(str));

=> TypeError: Discord.cleanCodeBlockContent is not a function
How?

mossy vine
#

are you sure youre on the right version

nocturne grove
#

yes I'm on v12

mossy vine
#

@tawny ledge no, docs say its available on the Discord object

nocturne grove
#

definitely

tawny ledge
#

ok

cinder patio
#

Just do Discord.Util

#

you won't notice a difference

mossy vine
#

^