#development

1 messages Β· Page 988 of 1

tulip ledge
#

I mean if you don't know what a function is you should go learn the basics of javascript first

earnest phoenix
#

when it's the right option :=)?

#

@tulip ledge calm down πŸ˜„

tulip ledge
#

I'm not salty just saying what I'm thinking πŸ€·β€β™‚οΈ

earnest phoenix
#

which makes u salty af.

tulip ledge
#

So if I'm honest I'm salty?

earnest phoenix
#

ur not honest in there.

tulip ledge
#

Alright then πŸ€·β€β™‚οΈ

pale vessel
#

LMAO

tulip ledge
#

What

#

No lol

pale vessel
#

@tulip ledge i agree with you on this one

tulip ledge
#

Please just go learn basic js first

misty sigil
#

thats kinda important

earnest phoenix
#

i have problem i have Const guild = new Discord.Guild(client, data); but it says ReferenceError: data is not defined

#

@earnest phoenix Learn javascript ty.

tulip ledge
#

@earnest phoenix Read your error

#

What does it say

earnest phoenix
#

i will send it now

pale vessel
#

oh god

tulip ledge
#

Read

misty sigil
#

oh jeezus

tulip ledge
#

The

earnest phoenix
#

learn javascript.

tulip ledge
#

Error

misty sigil
#

DATA IS NOT DEFINED

pale vessel
#

oh lord all mighty

misty sigil
#

you must define data

earnest phoenix
#

IK but how to define it

#

i cnat finde

pale vessel
#

they probably copy pasted the docs

earnest phoenix
#
    at Object.execute (C:\Users\PC\Desktop\DsBot\commands\wlcc.js:7:45)
    at Client.<anonymous> (C:\Users\PC\Desktop\DsBot\index.js:50:33)
    at Client.emit (events.js:315:20)
    at MessageCreateAction.handle (C:\Users\PC\Desktop\DsBot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\PC\Desktop\DsBot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\PC\Desktop\DsBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
    at WebSocketShard.onPacket (C:\Users\PC\Desktop\DsBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:436:22)
    at WebSocketShard.onMessage (C:\Users\PC\Desktop\DsBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:293:10)
    at WebSocket.onMessage (C:\Users\PC\Desktop\DsBot\node_modules\ws\lib\event-target.js:125:16)
    at WebSocket.emit (events.js:315:20)
    at Receiver.receiverOnMessage (C:\Users\PC\Desktop\DsBot\node_modules\ws\lib\websocket.js:800:20)
    at Receiver.emit (events.js:315:20)
    at Receiver.dataMessage (C:\Users\PC\Desktop\DsBot\node_modules\ws\lib\receiver.js:436:14)
    at Receiver.getData (C:\Users\PC\Desktop\DsBot\node_modules\ws\lib\receiver.js:366:17)
    at Receiver.startLoop (C:\Users\PC\Desktop\DsBot\node_modules\ws\lib\receiver.js:142:22)
    at Receiver._write (C:\Users\PC\Desktop\DsBot\node_modules\ws\lib\receiver.js:77:10)```
solemn latch
#

const data = "your data"

tulip ledge
#

Probably yes

#

Woo

earnest phoenix
#

ok

pale vessel
#

@solemn latch big brain

tulip ledge
#

That would just return data is not defined

#

Lol

misty sigil
#

it's not hard

tulip ledge
#

Ah he edited it

solemn latch
#

im on mobile

misty sigil
#

please, learn basic JS before coming here.

clever garnet
#

im trying to make a swear filter for my server so how do i make it search the message for spefific words or strings

im using discord.js

solemn latch
#

its slow

tulip ledge
#

Ah yeah no worries

solemn latch
pale vessel
#

@clever garnet use .includes or regex

clever garnet
#

ok

tulip ledge
#

I wonder I've never really used python before but does regex work in python? πŸ€”

pale vessel
#

yes

tulip ledge
#

Oh cool

pale vessel
#

regex works in many languages

pure lion
#

please, learn basic JS before coming here.
...

Nah

still merlin
#

How do you return a message and add a reaction in if(!)

earnest phoenix
#

@earnest phoenix just do

const guild = require('discord.js')

run: async( client, data) {
}

pale vessel
#

this chat rn

still merlin
#

Ive tried message.channel.send('') + message.react('')

misty sigil
#

im trying to make a swear filter for my server so how do i make it search the message for spefific words or strings

im using discord.js
@clever garnet js const badWords =[ "word", "anotherword" ] if(message.includes(badWords)){ message.delete }
you get it

still merlin
#

but i get a error

clever garnet
#

ok

misty sigil
#

atleast i think thats it

pale vessel
#

actually no Jeremy lol

misty sigil
#

idk

pure lion
#

Ive tried message.channel.send('') + message.react('')
@still merlin .then(() => message.react)

misty sigil
#

i'm just thinking

pale vessel
#

you can use .some

#

words.some(word => content.includes(word))

#

cases aren't taken in account

pure lion
#

Wait

#

Why didn't I know this

#

:o

tulip ledge
#

Oh and doesnt message.delete have to be a function? πŸ€”

earnest phoenix
#

does it ?

#

πŸ˜„

pure lion
#

You'd do message.delete()

still merlin
#

wait so,
if(!my thing) return message.channel.send(my second thing) .then(() => message.react('my reaction')

earnest phoenix
#

or msg.delete()

pure lion
#

@still merlin yeah

still merlin
#

ok tysm

pure lion
#

or msg.delete()
Ah, a man of culture

earnest phoenix
#

XDD

#

true

tulip ledge
#

or msg.delete()
@earnest phoenix Only if the message you're deleting is defined as msg

pure lion
#

@still merlin add a closing parentheses

earnest phoenix
#

@tulip ledge That's why i said or msg.delete()

#

:=9

#

:=)*

tulip ledge
#

Yeah seams fair

#

Alright everyone good night

pure lion
#

bOt.oFf('mOoSaGe', aSyNc mSg => {})

placid hamlet
#

I'm looking for bot verifier developer, for businesses. Write to private.

digital ibex
#

if bot.on takes no parameters, why would bot.off take parameters lol

harsh dock
#

@placid hamlet please explain

pure lion
#

if bot.on takes no parameters, why would bot.off take parameters lol
@digital ibex is joke

indigo folio
#

he is looking for bot verifier developer for business. if you are a bot verifier developer, write to private

pure lion
#

I'm bored, someone need help

solemn latch
#

can you do the dishes for me plox @pure lion

pure lion
#

No

solemn latch
pure lion
#

Make a bot to do it

#

:pog:

solemn latch
#

i wis

#

wish

pure lion
#

wihs

earnest phoenix
#

Please help i get this error ``` const data = data
^

ReferenceError: Cannot access 'data' before initialization
at Object.execute (C:\Users\PC\Desktop\DsBot\commands\wlcc.js:7:18)
at Client.<anonymous> (C:\Users\PC\Desktop\DsBot\index.js:50:33)
at Client.emit (events.js:315:20)
at MessageCreateAction.handle (C:\Users\PC\Desktop\DsBot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\PC\Desktop\DsBot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\PC\Desktop\DsBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
at WebSocketShard.onPacket (C:\Users\PC\Desktop\DsBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:436:22)
at WebSocketShard.onMessage (C:\Users\PC\Desktop\DsBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:293:10)
at WebSocket.onMessage (C:\Users\PC\Desktop\DsBot\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage (C:\Users\PC\Desktop\DsBot\node_modules\ws\lib\websocket.js:800:20)
at Receiver.emit (events.js:315:20)
at Receiver.dataMessage (C:\Users\PC\Desktop\DsBot\node_modules\ws\lib\receiver.js:436:14)
at Receiver.getData (C:\Users\PC\Desktop\DsBot\node_modules\ws\lib\receiver.js:366:17)
at Receiver.startLoop (C:\Users\PC\Desktop\DsBot\node_modules\ws\lib\receiver.js:142:22)
at Receiver._write (C:\Users\PC\Desktop\DsBot\node_modules\ws\lib\receiver.js:77:10)```

pure lion
#

Send the line

earnest phoenix
#

they said to put this const data = data

pure lion
#

Change the name of the const

earnest phoenix
#

ok

pure lion
#

Right now, you're getting the value of data, the const you've just written

earnest phoenix
#

bc i need it here const guild = new Discord.Guild(client, data);

digital ibex
#

ok

pale vessel
#

poor guy

pure lion
#

@earnest phoenix
const discordData or something idk

earnest phoenix
#

k

pale vessel
#

you're not supposed to do that

pure lion
#

it's your const Β―\_(ツ)_/Β―

#

That too

digital ibex
#

lol

earnest phoenix
#

:/

pure lion
#

Uh

#

Are you aware of

#

client.on

#

?

#

:)

digital ibex
#

wjay

earnest phoenix
#

@pure lion it's useless

pure lion
#

W j a y

earnest phoenix
#

just let him learn

#

javascript

#

first.

pure lion
#

Ok fine

#

It's not like I knew JavaScript first UwU

earnest phoenix
#

i literally

#

told him

#

and he still

#

didn't read

#

the text

digital ibex
#

oh boy

pure lion
#

Const bot = bot

#

iTsNoTwOrKiNg!

earnest phoenix
#

xd now i get data is not defined

pure lion
#

OMG LEARN JAVASCRIPT

earnest phoenix
#

xd

#

Im trying ok?

#

Learn

#

first

#

then try

#

ty

pure lion
#

Use a yt tutorial

digital ibex
#

he just doesn't know js, no need to be retarded about it

golden condor
#

There is no need to get heated over it, everyone was a beginner once

earnest phoenix
#

:/

pure lion
#

Okay true

golden condor
#

@earnest phoenix don't listen to them, just keep trying and you will succeed

#

Google is your friend

#

You can lookup your issues

pure lion
#

^^^^

golden condor
#

And find forums with the same issues as you like stack overflow

pure lion
#

Yes, definitely stack

earnest phoenix
#

he just doesn't know js, no need to be retarded about it
@digital ibex if so

#

why doesn't he learn first?

#

he doesn't know anything and asks for help

#

makes alot of sense.

tepid canyon
#

it makes sense to ask for help doesnt it?

earnest phoenix
#

literally the error tells him what's wrong and he still ask what is wrong.

pure lion
#

This isn't a conversation

earnest phoenix
#

it makes sense to ask for help doesnt it?
@tepid canyon with 0 javascript knowledge?

blazing portal
pure lion
#

Go to DM please this is for development of code, not character

golden condor
#

Listen if you are gonna be a dick about it then go somewhere else or we'll get mods involved

digital ibex
#

how is he going to know to he needs to know js first? you're probably the first person to tell him

earnest phoenix
#

He doesn't even know

#

first steps of it.

indigo folio
#

my mans everyone starts somewhere

earnest phoenix
#

@golden condor Ty u are nice guy

digital ibex
#

at one point you too didn't know the first steps of it

earnest phoenix
#

i literally told him 20 minutes ago

#

how he can fix it

#

and he still continued it

#

i tryed

#

it didnt work ok

pure lion
#

Just change the name of the const

earnest phoenix
#

didnt work still

pure lion
#

Wait I have a better idea

earnest phoenix
#

im listening

#

xd

indigo folio
#

it seems like he doesn't have a variable called data either

pure lion
indigo folio
#

now i get data is not defined

pure lion
#

Just please

#

L e a r n

earnest phoenix
#

i learned basics

digital ibex
#

you guys need to chill seriously

earnest phoenix
#

im chill xd

digital ibex
#

not u

#

lol

earnest phoenix
#

@earnest phoenix can u send whole code and then let's see?

misty sigil
#

how do i change the css of the bot website to make all span text be white

pale vessel
#

use color

#

color

misty sigil
#

doesn't work on the bot name

pale vessel
#

show code

misty sigil
#
span{
  color: white;
}```
pale vessel
#

you need to use the class name

#

isn't it .bot-name

misty sigil
#

ahh

pale vessel
#

wait lmao

#

you meant all span

misty sigil
#

nah

#

dw i did mean that

pale vessel
#

but still, try using a specific class or id

#

all right

earnest phoenix
#

anyone has an example for a boost message?

#

I tried something like:
const channel = member.guild.channels.cache.find(channel => channel.name === "Ρ❀з・staff-commands");
if (message.member.roles.find(role => role.name === 'test role')) {
channel.send(thanks for boosting! this is a test message!);
}

But not working lol

still merlin
#

how about
client.on("ServerBoost", (ServerBoost)?

#

im not sure if it works but it might

#

maybe check the docs

earnest phoenix
#

no boost event :(

still merlin
#

ah

sinful belfry
#

can you not listen out for the boost message in a certain channel?

earnest phoenix
#

Wdym?

#

it just won't send anything

still merlin
#

I'm making a suggestion command in discord.js and I'm not sure how to make it react to the suggestion embed, anyone know how?

earnest phoenix
#

I'll look smth up

sinful belfry
#

i mean, you know the system message that is sent?

#

where is says something like 'user boosted this server'

earnest phoenix
#

ohhhhh

#

it is sent in the announcement channel

#

Does it make a difference?

sinful belfry
#

you can listen out for that, and when that is sent, you check if the number of boosts in the server has increased

#

nope, it shouldnt

#

as long as the bot can read messages there...

#

and you can get the current number of boosts with guild.premiumSubscriptionCount

earnest phoenix
#

I don't think you understood me, all I'm trying to do is make my bot send a thank you message, for whoever gets that test role (booster basically) πŸ˜„

sinful belfry
#

so you want your bot to send a 'thank you' message to the person who boosted?

earnest phoenix
#

yeah!!

sinful belfry
#

yeah so you're gonna have to check for the system message being sent

#

then you can see which user is mentioned in it

still merlin
sinful belfry
#

and that user should be the one who has boosted

solemn latch
#

i think your missing a ","

sinful belfry
#

^

still merlin
#

i tried that and more errors

sinful belfry
#

oof

earnest phoenix
#

ah damn

solemn latch
earnest phoenix
#

Oooo

sinful belfry
#

it is possible im pretty sure

#

as long as you have the system messages being sent to a channel the bot can see

#

im 99% sure @gilded plank does it automatically too

solemn latch
#

yeah heres all the message types

sinful belfry
#

^

earnest phoenix
#

I tried guildMemberUpdate it didn't seem to work for some reason

sinful belfry
#

check the link that Woo sent

earnest phoenix
#

okkie

sinful belfry
#

you basically gotta listen out for the system message

solemn latch
#

message.type gives ya the type

sinful belfry
#

and the user who boosted is mentioned in the message

pure lion
#

Aaaaaaaaaaaaaaaaa

sinful belfry
#

um

earnest phoenix
#

USER_PREMIUM_GUILD_SUBSCRIPTION

ANIcuteThink

pure lion
#

:o

earnest phoenix
#

hmm okok I can try

solemn latch
#

yeah, pretty sure those are boosts

sinful belfry
#

yeah

#

it is

solemn latch
#

my cat has demanded a cuddle, ill be back catHeart

still merlin
pure lion
#

Delete the break

sinful belfry
#

send the code

pure lion
#

And then send the code

sinful belfry
#

lets see what ur trying to do

earnest phoenix
#

no need for a break

still merlin
#
client.on("message", (message) => {
  let args = message.content.substring(prefix.length).split(" ");

  switch (args[0]) {
    case "spidersuggest":
      if (message.author.bot) return;
      let suggestion = args.slice(1).join(" ");

      if (!suggestion)
        return message.channel
          .send("**error** You need a reason for the suggestion!")
          .then(() => message.react("❌"));

      const webhookEmbed = new Discord.MessageEmbed()
        .setTitle(`Spider Suggestion -`)
        .setColor("#c75dc9")
        .addField("Suggestion:", suggestion)
        .setFooter(`Suggested By ${message.author} (${message.author.id})`);

      webhookClient.send("New SpiderSuggestion", {
        username: `spidersuggest`,
        avatarURL:
          "https://cdn.discordapp.com/icons/702134225528291368/66d4c03d4c8d064fc884ba70d32134f6.webp",
        embeds: [webhookEmbed],
      });
      message.channel.send(
        `Successfully submitted, thank you for submitting a suggestion! ${message.author} (Join the support server to see the results of the suggestion)`.then(
          (webhookEmbed) => {
            webhookEmbed.react("πŸ‘");

            message.react("βœ…");

            break;
          }
        )
      );
  }
});```
earnest phoenix
#

I think break should come after });

pure lion
#

That's a lot of brackets

sinful belfry
#

put the break before the 2nd last }

#

it is currently within the .then for the message sent

still merlin
#

ok thanks

sinful belfry
#

@earnest phoenix oh just read that you can actually do it with the guildMemberUpdate

#

lol sorry

earnest phoenix
#

yeah I tried doing that but it didn't work

#

I need an example ahhhh

sinful belfry
#

oh lol

earnest phoenix
#

const BaseEvent = require('../../../utils/structures/BaseEvent');
module.exports = class GUILD_MEMBER_UPDATE extends BaseEvent {
constructor () {
super('GUILD_MEMBER_UPDATE');
}

async run(bot, oldMember, newMember);
const channel = bot.channels.cache.get('589748677929861160');

if (oldMember.roles.cache.size !== newMember.roles.cache.size) {
if (!oldMember.roles.cache.has('725022503004799017') && newMember.roles.cache.has('725022503004799017')) {
     channel.send(thanks for boosting! ${newMember} this is a test message!);
   }
  }

[Got this off a YT vid, so confusing]

sinful belfry
#

wdym

earnest phoenix
#

that'd be complicated....

#

he means like yggdrasil

#

bot

sinful belfry
#

a discord server?

#

im confused

pure lion
#

Oh god

#

Short answer:

#

Fuck no

#

Long answer:

solemn latch
#

To a channel in another discord server?

pure lion
#

aaaaaaaaaaaaaaaaa

sinful belfry
#

yeah that isn't too hard tbh

earnest phoenix
#

isn't too hard

sinful belfry
#

you need to fetch the channel

pure lion
#

Its not but

#

You need a channel to fetch

sinful belfry
#

^

pure lion
#

sad wanting to help noises

#

Maybe you could log all the channel IDS in the guild into a JSON

solemn latch
#

Like a suggestion command for your bot?

pure lion
#

Wait

quartz kindle
#

instead of doing message.guild.channels

pure lion
#

So it sends to your server?

quartz kindle
#

do someotherguild.channels

#

you can use client.guilds.cache.find() or client.guilds.cache.get() to find the server you want

pure lion
#

@earnest phoenix is it your server the suggestion will send to?

#

Like

#

No, the new command

quartz kindle
#

he wants to know if the target server is also owned by you

pure lion
#

Simple

#

That's simple

quartz kindle
#

do as i said, use client.guilds.cache.get(your server id here)

pure lion
#

Get the ID of the guild, then the channel

quartz kindle
#

then you can access that guild's channels

pure lion
#

Yeah

#

Basically what tim said but dumber

quartz kindle
#

yes

pure lion
#

Not message.guild

quartz kindle
#

as you can see

#

message refers to "this message"

#

message.guild refers to "the guild this message belongs to"

#

so instead of "the guild this message belongs to" you need to write something that means "this specific guild that i specify with an id"

#

which is what client.guilds.cache.get() does

#

it allows you to get a specific guild with an id you specify

#

yes

#

and then continue getting its channels and finding the channel

#

like you were doing before

pure lion
#

let gld = client.guilds.cache.get(ID here)
let chn = gld.channels.get(the channel ID)
chn.send(msg)

quartz kindle
#

you can also break it down like that if you prefer

#

but you can make it a one liner like you had

pure lion
#

Either works, but you can use the smart version or the dice version

quartz kindle
#

Lol

#

....

pure lion
#

Oml

#

Uh

#

Ok

#

Clean up time

quartz kindle
#

you just copied and pasted two different things

#

im trying to explain it to you so you can understand it and write it yourself

#

thats why im trying to explain it

pure lion
#

Sorry for wasting your time.
When? You need help, we're here to give it :)

quartz kindle
#

everything that has a dot, is a chain, like get this from this from this

#

for example message.guild.channels means get channels from guild from message

#

but you want channels from a different guild

austere rose
#

I know.
Never 'I know' a teacher

pure lion
#

Which is the star channel emote

quartz kindle
#

client.guilds.cache.get() means get a guild from the guild cache from the guild manager from client

austere rose
#

Putting a dot at the end of your sentence is not gonna do anything different you know

quartz kindle
#

both of them give you exactly the same result, which is a guild
which means, you can use the same continuation of the code on it

#

for example both message.guild AND client.guilds.cache.get(some id here)
both of them can be followed by .channels.get() or .channels.find() like you had before

#

meaning, all you need to do, is replace the part that gives you the guild

#

the rest of the line stays the same

#

yes you can do that

pure lion
#

Looks good

quartz kindle
#

now you have to replace channel with chn everywhere else in that code

#

because the variable channel no longer exists

pure lion
#

You can just do chn.send

#

Instead of message.channel, because it would send in the wrong location

quartz kindle
#

also, it needs to be guild.channels.cache.get()

pure lion
#

Dumb question, wants the difference between fetch and get?

quartz kindle
#

get = gets it from the cache, or undefined if not found in the cache

#

fetch = gets it from the cache, if not found it the cache tries to get it directly from discord, if not found in discord, returns an error

pure lion
#

Oh okay

quartz kindle
#

and since it makes an http request to discord, fetch returns a promise

#

so it needs await or .then()

pure lion
#

I probably should learn more js

#

But thanks :)

#

?

#

????????ΒΏ?ΒΏ

solemn latch
#

It was a good question @pure lion

pure lion
#

What is the up

quartz kindle
#

lmao

pure lion
#

You're welcome

#

It was a good question @pure lion
@solemn latch :o

#

Sorry for being dumb.
There is no dumb in coding, unless you're me

quartz kindle
#

np, hope it helps with future similar things

pure lion
#

*sitting around for someone who needs help because I have no life outside this hobby*

#

Ok DM if you need help I'm gonna go watch paint dry

neat ingot
#

are there known issues with discord.js's setPresence function? For some reason it occasionally doesnt update my status and just sets it to be empty. atm i update the status to show how many guilds the bot is in and it updates each time that value changes. but as i said, sometimes the status just vanishes completely lol

#

no errors or anything get thrown either

pure lion
#

Send code

#

yes, I was here while you were typing

neat ingot
#
const count = client.guilds.cache.size;
client.user.setPresence({
    status:'online', 
    activity: { 
        type: 'WATCHING', 
        name: `!!help || ${count} guilds`,
    }
});
quartz kindle
#

afaik the rate limit for that is not large enough to allow of changing on every single guild change

neat ingot
#

sigh, i had a feeling it was gonna be some kinda rate limited crap

#

but couldnt find any info in the docs about the limit for it

pure lion
#

Is there a fUnction to lower the temp in my room rn it's 31Β°C and I'm dying

quartz kindle
#
if(temp.C >= 31) {
  temp.dont()
}
neat ingot
#
const fan = new Fan({rpm: 1000});
while(hotaf){ fan.blow() };```
earnest phoenix
#

overvolt the fan mowpiffygootem

solemn latch
#

That could also be used for fans of famous people

quartz kindle
#

Lol

solemn latch
#

Maybe a lower rpm tbo

#

Tho

pure lion
#

bot.on('oh god I can't feel my face', async pain => {

let room = pain.house.rooms.cache.find(r => r.current)

if (room.temp > 30) {
console.log(room.temp)
room.temp.set(fuck anything below 30 fuckkkk aaaaaa).then(() => console.log('thank fuck'))

})

earnest phoenix
#

when you think about it

#

our body is asynchronous BigBrain

pure lion
#

I was actually thinking about this earlier

#

<:BigBrain:yo can you gimme the emoji ID?>

earnest phoenix
#

615775892177944627

pure lion
#

Tanks

#

Ye?

#

@earnest phoenix

#

U got it?

solemn latch
pure lion
#

Hot

solemn latch
#

I almost posted a nsfw emoji

#

Because I can't see on mobile

pure lion
#

πŸ‘€

#

dM

#

Jk

pure lion
#

You ever just want it dumbed down to ground floor?

quartz hill
#

Are all user id 11 digits?

pure lion
#

Uhhhh

sudden geyser
#

no

pure lion
#

Just do id.length (assuming js)

sudden geyser
#

For example, mine is 18.

quartz hill
#

Max How many digits are there? When I select the bot according to it in the database.I will allocate space accordingly in the database.

amber fractal
#

Technically none

#

they add a digit every time they need to...

#

it'll keep increasing

quartz hill
#

hmm thx

pure lion
#

wHy uSe DaTaBasE wHeN yOu CaN uSe JsOn? πŸ₯΄

sudden geyser
#

cringe and yes there is no max

quartz hill
#

I use Heroku and the data must be permanent.

still geyser
#

any advice on how to get the python discord to work in sublime text 3?

sudden geyser
#

qqq I don't use Heroku, but what do you mean by that. Are you not able to set a table and type by string

digital ibex
#

@still geyser wym?

#

u do it the same u would with any text editor, if thats what ur saying

still geyser
#

yes was just checking it worked the same thank you

wheat valve
#

How do you get the bot to only respond to its own mention, and not everyone and here pings? My bot has the respond to mentions code, and it doesn't respond to pings like @wheat valve but instead it responds to both pings of itself, and everyone and here pings. I use discord.js

magic jackal
#

@wheat valve check if the message author is your bot user id

#

in DiscordJS its this

if(message.author.id === "your_botID" && message.content.includes("@everyone")){
  //do something here
}
#

something like that should do fine

neat ingot
#

@quartz hill

function seemsFlakey(potential_flake) {
    return /^[0-9]{14,19}$/.test(potential_flake);
}```
there is a javascript function to tell you if a string looks like a snowflake id
#

its not flawless ofc, as any string matching those conditions would return true. But it should cover all valid snowflake id's also

celest basin
#

hi

#

anyone know what this error is

24.06 00:58:49 [Bot] (node:30) UnhandledPromiseRejectionWarning: Error: 502 Bad Gateway
24.06 00:58:49 [Bot] at IncomingMessage.<anonymous> (/node_modules/dblapi.js/src/index.js:118:25)
24.06 00:58:49 [Bot] at IncomingMessage.emit (events.js:322:22)
24.06 00:58:49 [Bot] at endReadableNT (_stream_readable.js:1187:12)
24.06 00:58:49 [Bot] at processTicksAndRejections (internal/process/task_queues.js:84:21)
24.06 00:58:49 [Bot] (node:30) 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)
24.06 00:58:49 [Bot] (node:30) [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.
quartz kindle
#

all you can do is wait

solemn latch
#

o

#

captcha bot is a good idea

amber fractal
solemn latch
#

ive never run into one in the wild

quartz kindle
#

why is mine not there

solemn latch
#

thats why i brought it up

#

pretty pog too

#

does it work well?

quartz kindle
#

yes

solemn latch
#

i might have to play with it

quartz kindle
#

im working on a big rewrite tho

#

probably gonna release it later on as v3

solemn latch
#

oo

#

that explains why you are so good at helping out

quartz kindle
#

lmao

green kestrel
#

someone created a team name on my bot which was the n word. as the list of top 50 team names (by size and also score) is public, ive decided i need to add a swear filter to this and have used an external api. Would you say this is too extreme or a good call, as people can play trivia games in non-nsfw channels? has anyone else here implemented a swear filter in any part of their bot and how did you do it?

quartz kindle
#

hmm i havent thought about that

green kestrel
#

its always been technically against the TOS i wrote for it

quartz kindle
#

my bot has 20k+ user generated entries with no naming restrictions, let me check if there are that kind of names there lmao

green kestrel
#

on 3 terms, bringing the bot into disripute, attempting to harm or upset users

#

and another, i forget

#

but i looked them up in case this user came to me complaining i'd censored his team name πŸ˜‰

#

there will be, i keep finding that kind of stuff in sporks too but generally im more lenient and hands off with sporks, ive always asserted hes self policed like wikipedia as anyone can correct facts on there, but with the trivia bot im the only one who can rename an offensive team name

quartz kindle
#

i'll just settle for complaints

#

if anyone complains, ill contact the owner and request a change, or change it myself

#

one thing you could do is require top teams to abide to naming conventions/rules

#

kinda like sports teams do

green kestrel
#

yeah, except i dont vet the names before theyre created

quartz kindle
#

they can be named whatever shit they want in the minor/amateur leagues, but once a team goes pro and is listed in rankings, they need to rename into a proper name

earnest phoenix
#

I'm making a kind of card that shows an inventory of things.

But the image is not sent, in theory there are no errors in the "drawing"

let imagen = new Discord.Attachment(canvas.toBuffer(),"inventario.png")
channel.send({files: imagen})```
green kestrel
#

theyre created on the fly with "!trivia create arbitrary name here"

#

then others join it by that name

#

the api ive used can return a censored string, so in the case above it would rename their team to ######

quartz kindle
#

wouldnt that difficult people from joining it?

green kestrel
#

well, it would show thats the new name

quartz kindle
#

i guess thats one way

green kestrel
#

it'll say "you successfully created and joined the new team ######, {}"

#

that way if they had say 'ass' in it (the filter is quite strict) their team might be "big ### player group"

#

for example

#

πŸ˜‰

#

come to mention it, got no way to rename a team atm, i should add that!

quartz kindle
#

@earnest phoenix afaik the files option has to be an array

#

so {files:[imagen]}

earnest phoenix
#

in the channel.send?

#

channel.send({files:[attachment]})

quartz kindle
#

yes

earnest phoenix
#

oh, thanks!

#

With the version change from v11 to v12, are there any changes to the npm canvas?

copper cradle
#

dude

#

canvas has nothing to do with d.js

#

c'mon

solemn latch
#

hmmm
if you dont define intents in client at all, does that just mean all intents(non Privileged)

quartz kindle
#

yes

#

at least while discord allows it

solemn latch
#

yeah

quartz kindle
#

supposedly they will become mandatory in october

misty sigil
#

so i have something working

#

but i want my discord bot link to redirect to my website

solemn latch
#

ima just yolo chuck intents in my bot and upload it to the main bot

misty sigil
#

that did not awnser my question

solemn latch
#

that was for a conversation before

quartz kindle
#

@misty sigil you mean the user gets redirected to your website after adding the bot?

misty sigil
#

yes

quartz kindle
#

you'd need oauth2

misty sigil
#

but how exactly

quartz kindle
#

not sure tbh. you can add a redirect_uri parameter to the invite link, but afaik it only works if the user went through the oauth2 flow

#

so something like user logs in > gets redirected to bot invite > gets redirected to website

#

but i havent done that before so idk

slender thistle
#

wasn't it uri

quartz kindle
#

was it? mb lul

slender thistle
#

Yeah I remember it being uri

#

That's easily bypassed though

cunning gorge
#
const newPrefix = prefix || bot.user.mention
  let args = message.content
    .slice(newPrefix.length)
    .trim()
    .split(/ +/g);
  let msg = message.content.toLowerCase();
  let cmd = args.shift().toLowerCase();

How do you make the bot respond to its mention when someone pings it, I tried doing that, but it didn't work. Please ping me if you have a solution.

earnest phoenix
#

if(message.content.match(new RegExp(`^<@!?${client.user.id}>( |)$`))) you can edit that to fit ur needs @cunning gorge

cunning gorge
#

thank you

#

@earnest phoenix whats the new RegExp, is it previously defined?

earnest phoenix
#

i belive so let me check my code

cunning gorge
#

ok thx

earnest phoenix
#

It is not

cunning gorge
#

ah so hm why would it be a new instance

earnest phoenix
#

idk

#

im newto coding too

cunning gorge
#

Ah ok

earnest phoenix
#

heres the complete code with it if it helps ```if(message.content.match(new RegExp(^<@!?${client.user.id}>( |)$)))
return message.channel.send(My Prefix Is : eb!);

});

cunning gorge
#

Thanks!

earnest phoenix
#

np

celest basin
#

hellp

#

*hello

#

how can i get Discord API ping

amber fractal
#

what lib

celest basin
#

this is code ?
client.ws.ping
or this the ping of the client's server

amber fractal
#

ah, that's the ping of the websocket

celest basin
#

websocket is Discord API ?

amber fractal
#

well, it's your connection to discord's servers basicall

#

There's no perfect way really, the most common approach is to send a message, wait for it to be sent then edit in the time it took to send

#

but it isnt perfect

celest basin
#

yp

#

u r right

valid frigate
#

imho the only number you really need to rely on is the discord api latency

vale garden
#

hi

#

like member.role.add is for adding a role

#

what do i do to remove a role

pure lion
#

You'll never guess

#

member.role.destroy

#

Jk

#

It's remove

#

Not destroy

solemn latch
vale garden
#

kk

#

thx

#

the remove isnt working

#
TypeError: Cannot read property 'remove' of undefined
#
mutee.role.remove(muterole.id).then(() => {
    message.delete()
    mutee.send(`Hello, you have been unmuted in ${message.guild.name} for: ${reason}`).catch(err => console.log(err))
    message.channel.send(`${mutee.user.username} was unmuted!`)
})
#

see

#

oh nwait i got it

#

lol

pure lion
#

Uh

#

roles, role

visual sandal
#

How would I set a canvas image as the discord embed image? js

zinc condor
#

rate this

pure lion
#

3000/10

zinc condor
#

thank

#

am making discord bot in Go

pure lion
#

:o

dusk sphinx
#

How can i adjust my bot online time

pure lion
#

Elaborate?

dusk sphinx
#

Where can i find it

pure lion
#

Like

#

Get the uptime of your bot

#

?

dusk sphinx
#

Maybe yes

pure lion
#

Uhhhh

#

I know there's a timestamp somewhere but I'm too tired

dusk sphinx
#

Is anyone else

earnest phoenix
#

let afk = new db.table("AFKs"),
      authorStatus = await afk.fetch(message.author.id),
      mentioned = message.mentions.members.first();

  if (mentioned) {
    let status = await afk.fetch(mentioned.id);

    if (status) {
      const embed = new Discord.MessageEmbed()
      .setColor(0xffffff)
      .setDescription(This user (${mentioned.user.tag}) is AFK: **${status}**)
      message.channel.send(embed).then(i => i.delete({timeout: 5000}));
    }
  }

  if (authorStatus) {
    const embed = new Discord.MessageEmbed()
    .setColor(0xffffff)
    .setDescription(**${message.author.tag}** is no longer AFK.)
    message.channel.send(embed).then(i => i.delete({timeout: 5000}));
    afk.delete(message.author.id)
  }

// NOTE:
// The following code is a command:

const Discord = require('discord.js'), db = require('quick.db');
const status = new db.table("AFKs");
let afk = await status.fetch(message.author.id);
const embed = new Discord.MessageEmbed().setColor(0xffffff)

  if (!afk) {
    embed.setDescription(**${message.author.tag}** now AFK.)
    embed.setFooter(Reason: ${args.join(" ") ? args.join(" ") : "AFK"})
    status.set(message.author.id, args.join(" ") || AFK);
  } else {
    embed.setDescription("You are no longer AFK.");
    status.delete(message.author.id);
  }

  message.channel.send(embed)```
#

is this the right code ?

pure lion
#

Uh

timid flume
#

Manual Afk?:v

tepid canyon
#

Where can i find it
@dusk sphinx if you are using djs it is client.uptime

#

returns a time in ms iirc

fresh hatch
#

can someone help me why do i get my bot's ping with - at the start?

wanton nova
#

because sometimes the message comes later than the Date.now()

#

so it would result in a negative number

amber fractal
#

that's why you send a message yourself and use .then or you could await it I guess

wanton nova
#

what i would reccomend you doing is something like this

message.channel.send("Pinging... sec").then(msg => {
let ping = msg.createdTimestamp - message.createdTimestamp
});
amber fractal
#

but it's not perfect for ping

wanton nova
#

true but its still viable and semi-accurate

dusk sphinx
#

Do i need download the discord.js?

pure lion
#

I-

#

Did you do npm i discord.js

#

--save

#

@fresh hatch get the absolute value of the ping

fresh hatch
#

lemme try

#

@wanton nova i get 0ms πŸ˜‚ and api gets 200ms

#
client.on('message', message => {
    let ping = message.createdTimestamp - message.createdTimestamp
    let pingembed = new Discord.MessageEmbed()
        .setColor("#0000FF")
        .setTitle("Ping :ping_pong:")
        .addField("Latency: " + ping + "ms")
        .addField("API Latency: ", `${client.ws.ping}ms`)
    if (message.content.startsWith(`${prefix}ping`)) {
        message.channel.send(pingembed);
    }
})
wanton nova
#

because you are subtracting the same number

#

of course its gonna be 0 lol

#

what i would reccomend you doing is something like this

message.channel.send("Pinging... sec").then(msg => {
let ping = msg.createdTimestamp - message.createdTimestamp
});
fresh hatch
#

msg is not defined

wanton nova
#

put message.channel.send("Pinging... sec").then(msg => { at the top

#

below client.on

#
client.on('message', message => {
message.channel.send("Pinging... sec").then(msg => {
    let ping = msg.createdTimestamp - message.createdTimestamp
    let pingembed = new Discord.MessageEmbed()
        .setColor("#0000FF")
        .setTitle("Ping :ping_pong:")
        .addField("Latency: " + ping + "ms")
        .addField("API Latency: ", `${client.ws.ping}ms`)
    if (message.content.startsWith(`${prefix}ping`)) {
        message.channel.send(pingembed);
    }
});
})
#

like that

pure lion
#

Okay real talk

#

Can someone explain arrow functions to me

wanton nova
#

like in what sense?

fresh hatch
wanton nova
#

how they work?

pure lion
#

Yeah

wanton nova
#

@fresh hatch you arent ignoring the bot, put if (message.author.bot) return at the top, below client.on

#

@pure lion sorry still not understanding, like how they work on the inside or how to use them?

#

cause i dont wanna explain stuff you probably already know

pure lion
#

Oh

#

Uh

fresh hatch
pure lion
#

I literally know nothing about arrow functions

wanton nova
#

@fresh hatch

client.on('message', message => {
if (message.content === "k!ping") {
// ping code
}
});
pure lion
#

@wanton nova wouldn't it be better to await a message and then get the ping from that?

wanton nova
pure lion
#

Okay thanks :)

wanton nova
#

true but i dont wanna explain async await

fresh hatch
wanton nova
#

np

pure lion
#

Async await is kinda simple

#

I think-

restive furnace
#

it is

wanton nova
#

it is, but i dont wanna explain it pogey

pure lion
#

From what I know, it's just waiting for a return

#

From heaven

#

:Dd

wanton nova
#

over heaven 😳

#

says the world

restive furnace
#
let msg = await message.channel.send("hi");
msg.edit("hello");```
wanton nova
#

yeah i know you can do that

#

but .then is more simpler for begginers imo

restive furnace
#

actually no i my option

wanton nova
#

i had no fricking clue what async await did when i was a begginer

#

😎

pure lion
#

Could do .then(() => then msg.edit)

#

Β―\_(ツ)_/Β―

wanton nova
#

wha

restive furnace
#

.then((m) => m.edit("aa"))

#

thats what he meant

wanton nova
#

lmao

pure lion
#

Wait shit-

#

*dies*

wanton nova
#

epic

pure lion
#

Epic 2020 dead compilation

#

_*heehee_*

#

:D

wanton nova
#

i need to finish my connect4 game pogey

pure lion
#

:o

#

What's finish????

wanton nova
#

finnish

#

the language

pure lion
#

:o

wanton nova
#

its not a language

#

it is

#

im drunk

pure lion
#

Staart is a language

#

?

#

Question mark

wanton nova
#

no?

#

i dont think so

pure lion
#

:oh:

wet osprey
#

hey guys i develop bot in python. i'm trying to make bot dashboard in flask but for guild date when i run bot in separate thread in flask i'm running into so many backend issues.
i'm new to flask. i will be happy to hear any help or suggestions or any other way to make dashboard in python

warped jay
#

How can I make the bot ignore NSFW words with !urban command when done not in NSFW channel?

#

@wet osprey use Quart

#

Well, I want to ignore NSFW words, completely

pale vessel
#

that's not possible, urban dictionary should absolutely locked to NSFW channels

#

it's mandatory

warped jay
#

I'll lock to urban to NSFW

pure lion
#

if (!message.channel.nsfw) {if (msg.content.includes(word list array) {return}
}

#

Oh oka-

warped jay
#

python

pale vessel
#

yeah, don't, i got a warning for that

pure lion
#

Didn't specify

pale vessel
#

almost got my bot deleted

pure lion
#

Shit dude-

warped jay
#

Ok, I'll lock

#

Locked the whole urban comamnd to NSFW channel

#

Is that ok?

pale vessel
#

yes

pure lion
#

Btw if I wanted to make a dashboard, (if I should even think about it at all) how would i prepare my bot to interact as easily as possible (discord.js but you probably know that by now by the amount of time i spend here)

warped jay
#

Or just do I use a filter?

pure lion
#

No

#

Lock it

pale vessel
#

you can't use a filter, even if it works

warped jay
#

So I need to lock it

#

right?

pure lion
#

Yeah

pale vessel
#

yeah, unfortunately

warped jay
#

Locked

pure lion
#

:sad:

warped jay
#

Can I lock the urban only for this server?

pale vessel
#

nope

#

if they caught you doing that, you're dead

pure lion
#

In all dimensions

warped jay
#

my friends are against

pure lion
#

Don't do it

pale vessel
#

yeah, i know the pain

honest perch
#

A mod will personally go to your house and delete the bot

pure lion
#

A Mod will hire a hitman*

pale vessel
#

i even sent a whole essay to a mod regarding this; no means no

warped jay
#

Just to let you know

honest perch
#

Flazepe: sends a mod an essay
Mod: no

pale vessel
#

true dat

pure lion
#

πŸ…±οΈeon

honest perch
#

Bean

pure lion
#

:bean:

#

Why is there no bean

#

Also

#

If I wanted to make a dashboard, (if I should even think about it at all) how would i prepare my bot to interact as easily as possible (discord.js but you probably know that by now by the amount of time i spend here)

#

(please dumb it down to as low a level as possible)

#

(:))

pale vessel
#

set up an express server, use template generator to make your site consistent (let's say ejs), set up an oauth application to get user information and connect the dashboard to the same database as your bot so that users can modify settings and then your bot can detect the changes seamlessly

pure lion
#

What if you use json files for db, is there an easy way for me to switch to quick.db or anything?

pale vessel
#

it's the same procedure, no matter what "database" you're using

#

when a person modifies something, use the same method as how you would change something on the database on your bot

#

except that it's on the browser tm

pure lion
#

So json would work fine?

#

Ok it's probably fine, ill do my best

pale vessel
#

i mean yes but it's really slow

pure lion
#

Foc

pale vessel
#

and you know, it's json

#

it can get corrupted easily

#

when it rewrites, it gets the whole file first

#

it's just slow and unreliable

#

get a proper database first like mongo or postgres

pure lion
#

Okay, what is a good alternative that requires like no setup?

#

Oh, I will have a look

pale vessel
#

probably

pure lion
#

Thx :3

lusty spade
pure lion
#

Uh

#

Make the channel a new let and then send to the new let

lusty spade
#

if i do that it says channel.send is not a function

restive furnace
#

then channel is null or undefined

lusty spade
#

i reset the channel and now i get TypeError: Cannot read property 'get' of undefined

restive furnace
#

as i said its undefined then

#

do let chan = <msg>.guild.channels.cache.get(channel.id) did he input the channel

#

and use chan in the rest of the command

lusty spade
#

ok i'll try

#

so i got this TypeError: Cannot read property 'send' of undefined

pale vessel
#

what even is channel

lusty spade
#

ok nvm i fixed it

#

i just need to add .id behind channel in the file where i set the channel

dusk sphinx
#

I haven't do the npm yet

plucky heart
#

I can't install canvacord :v

narrow torrent
jovial nexus
#

why estadouser[user.presence.status] responds with undefined ??

let estadouser = {
           "online":"Online", 
           "idle":"Ausente",
           "dnd":"No Molestar",
           "invisible":"Invisible/Desconectado",
         }
#

(user = message.author)

pure lion
#

how can i add my bot to top.gg
@narrow torrent
Log in to https://top.gg > add bot > follow the instructions

narrow torrent
#

ok

#

ty

rustic sundial
pure lion
#

Image invert?

rustic sundial
#

Yeah

#

I can't find it on net

#

:/

pure lion
#

Try this

rustic sundial
#

Thanks

pure lion
#

Np

nocturne grove
#

why estadouser[user.presence.status] responds with undefined ??

let estadouser = {
           "online":"Online", 
           "idle":"Ausente",
           "dnd":"No Molestar",
           "invisible":"Invisible/Desconectado",
         }

@jovial nexus log user.presence.status and see what it gives you

jovial nexus
#

Ok, its fixen now thanks

nocturne grove
#

okay nice np

pure lion
#

Can someone create a bot that needs help with coding so I'm not bored all the time

dusk sphinx
#

What do i need to do with npm

queen needle
#

how could i check in discord.js if a bot is verfied

#

verified*

pure lion
#

Uhh

#

@queen needle

#

Probably this

dusk sphinx
#

Do i need sign in ?

pure lion
#

No

#

What are you using to make your bot?

dusk sphinx
#

Idk..

pure lion
#

Okay, what code language are you gonna use?

#

Or are you completely new?

dusk sphinx
#

Eng

pure lion
#

Do you know any code language

dusk sphinx
#

Yes but don't remember

crude crag
#

how can I get Mimu in my Dc server?

dusk sphinx
#

Mimu is no respond tho

crude crag
#

Ik, tho I need it for my server, for welcoming peeps

dusk sphinx
pure lion
#

@crude crag just go to top.gg?????

#

Why not use my bot uwu

queen needle
#

lol

crude crag
#

okeh

#

Why not use my bot uwu
@pure lion which is?--

tight plinth
#

is there any way to fetch a deleted message on discord.js? i want my bot to send a notification if a message got deleted, even if the message isnt cached/is partial

sick cloud
#

could anyone suggest me some sort of module that can replace basically any non-alphabetic character in a string
basically if it isn't Aa-Zz delete it

hasty sparrow
#

Regex?

sick cloud
#

too much work as i'd have to literally define every single character

hasty sparrow
#

Uh no

sick cloud
#

er

#

then how

hasty sparrow
#

Should be negative lookahead Character class negation

tight plinth
#

i dont know any module that can do that but you basically can do that manually by splitting your string at every character and look at every character i guess

earnest phoenix
#

Does anybody know how to setup webhook for top.gg on google cloud

hasty sparrow
#

@sick cloud [^A-Za-z]

sick cloud
#

can i use that in some sort of .replace

hasty sparrow
#

Sure

sick cloud
#

so str.replace(/[^A-Za-z]/, '')

and h a.ha h -- a would become hahaha

hasty sparrow
#

Try it out

sick cloud
#

nice

earnest phoenix
#
const { MessageEmbed } = require("discord.js");

exports.info = {
    aliases: ["snipe"]
}

exports.run = (client, message, args) => {
    const msg = client.fetchAuditLogs(message.channel.id);
    if (!msg) return message.reply("Nothing to snipe");

    const snipe = new MessageEmbed()
        .setAuthor (`Sniped ${msg.author.tag}`, msg.author.displayAvatarURL())
        .setDescription(msg.content);


        message.channel.send(snipe);
}
#

cries in spanish

quartz kindle
#

fetchAuditLogs is for a guild, not client

earnest phoenix
#

lmao i figured that out from reading it a million times

#

but what can i do to make it for a

#

snipe

#

command

quartz kindle
#

you need to save messages using the messageDelete event

#

otherwise you cant get them after they are deleted

earnest phoenix
#

mhm

#

and how do i do that- sorry second week coding

quartz kindle
#

use the messageDelete event

#

client.on("messageDelete", message => { do something with the deleted message })

earnest phoenix
#

so do i put that in index.js for my cmd handler

#

right

meager cobalt
#

yes

earnest phoenix
#

and then it should work

#

oml- what do i put in the place that says do something with the deleted message

long yew
#
client.on('message', message => {
    if (message.content === `${prefix}start`) {
      message.channel.send(new Discord.MessageEmbed()
      .setColor(`RANDOM`)
      .setTitle('Choose your starter!')
      .addField('Chose from Sobble, Grookey or Scorbunny')
      .setDescription(`Write ".start [pokemon name]" to chose your starter, for e.g .start sobble`)
      .setImage('https://imgur.com/a/jWSf4yW'({ dynamic: true, size: 2048, format: 'png' }))
      )}
    })
#

what needs changing?

earnest phoenix
#

you used a link as a function it says

#

try

#

""

#

those

golden condor
#

I have made a messageDelete.js file

#

With my event handler

#

and for some reason

#

The event won't trigger

slender thistle
#

Why are you spamming

golden condor
#
exports.run = async (client, message) => {
    if (message.author.bot) return;
    if (message.channel.type == "dm") return;
    console.log("A message was deleted.")
    if (client.snipes.has(message.channel.id)) client.snipes.delete(message.channel.id)
    client.snipes.set(message.channel.id, message)
}```I tried this and it wouldn't work
#

And I have no idea why

white anvil
#

anyone here with experience with eslint

#

HOW do i stop this happening

#

without disabling the rule

quartz kindle
#

wtf

tight plinth
#

client.on("messageDelete", message => { do something with the deleted message })
@quartz kindle i mean, i activated partial messages in my client options so the event also triggers if the message is not cached

quartz kindle
#

he wants it for a snipe command

tight plinth
#

oh

pale vessel
#

that's ::after

#

just look what they did and replace it

#

it's probably border or something

hasty sparrow
#

Yep, border-left-color

golden condor
#

@quartz kindle i found out why, it's because I wans't caching messages

#

Thanks πŸ‘

long yew
#
client.on('message', message => {
    if (message.content === `${prefix}start`) {
      message.channel.send(new Discord.MessageEmbed()
      .setColor(`RANDOM`)
      .setTitle('Choose your starter!')
      .addField('Chose from Sobble, Grookey or Scorbunny')
      .setDescription(`Write ".start [pokemon name]" to chose your starter, for e.g .start sobble`)
      .setImage('https://imgur.com/OG56YKE.gif')
      )}
    })
#

how do i remove the undefined text on the embed?

quartz kindle
#

its a field

#

fields have a title and a content, you didnt give it a content

#

for example .addField("title goes here", "content goes here")

long yew
#

oh ok thanks

tulip ledge
#

So I have this MySQL database connection and my bot is perfectly fine but after like 1-2 hours my bot crashes and I get this error:

Error: read ECONNRESET
at TCP.onStreamRead (internal/stream_base_commons.js:205:27)
lusty quest
#

connection timeout

tulip ledge
#

Thats what I thought

lusty quest
#

are the Server and the Database close proximity?

tulip ledge
#

But is there a way I can find out why?

#

They're on the same VPS

lusty quest
#

so you got the mysql server on the VPS?

tulip ledge
#

yes

lusty quest
#

can the VPS handle both?

#

its possible that it got to much load and lacks behind

tulip ledge
#

Shouldn't be

lusty quest
#

did you got a overview of the load in the time where it crashed?

tulip ledge
#

No

#

But last night it crashed with no one doing anything

lusty quest
#

does the Hoster restart the vps after a certain time?

tulip ledge
#

Idk

#

Could be

pure lion
#

@pure lion which is?--
@crude crag aleBot u////u

lusty quest
#

i know that Heroku restarts the vps in the night

pale vessel
#

heroku offers a vps?

tulip ledge
#

No but these are online 24/7 and don't get restart without user input

misty sigil
#

thAts not really how they work though

lusty quest
#

i currently have a Digital Ocean VPS and additional a Managed Mysql database. But i replace the mysql database now with a MongoDB cluster

tulip ledge
#

One of my friends I'm talking to said it could also be discord api

lusty quest
#

i dont have this strange behavior

#

why should the Discord API reset the database Connection?

tulip ledge
#

I'm on my friend's VPS she bought it on Contabo

#

No

#

My friend said it could be discord API timing out

#

I just assumed it was MySQL since i had some problems with ECONNREFUSED a couple days ago

lusty quest
#

ye

#

if i think about it its possible its the discordAPI

restive furnace
#

just make some interval when it reconnects to the mysql db

#

like half hour or so

tulip ledge
#

Is there any way to fix it?

lusty quest
#

what is the ping of the bot to the API?

tulip ledge
#

How do I see?

lusty quest
#

client.ws.ping

tulip ledge
#

I used to be able to with v11 but I think it changed since it gives NaN

#

1 sec

lusty quest
tulip ledge
#

108

lusty quest
#

108 is normal

#

idk why you get then these timeouts

restive furnace
#

how is your bot's ping so high, super?

tulip ledge
#

Maybe it's due to location?

#

I think my friend bought the VPS's in the US

#

Maybe thats why?

lusty quest
#

funny story. got a Command that accesses a API and someone overflowed the Bot with making some fancy Command parameters

pale vessel
#

@tulip ledge us is fine

lusty quest
#

he found something that made the API return 1k datasets per parameter

#

so the bot got DDosed by the API

misty sigil
#

is that 40 seconds+ ping

tulip ledge
#

400 seconds

misty sigil
#

holy god

lusty quest
#

bcs 1.2 Million Datasets where in the query

tulip ledge
#

499000 = 499 seconds

#

Thats like almost 10 minutes lol

lusty quest
#

but now ive got the command robust enought to not fail for it anymore

misty sigil
#

imagine having 10 minute ping

#

on a game

lusty quest
#

1 minute is already annoying AF

#

for both sides. you either murder the entire enemy team without them seeing you or you die instant on spawning

tulip ledge
#

Yup lol

lusty quest
#

@tulip ledge the Discord API should be geolocal. the client should select the best possible API server depending on the Ping

#

but your timeouts are strange. is there some other stuff on the VPS that uses a lot of bandwith?

tulip ledge
#

So discord api is prob not why?

#

Not that I know of my friend and her friend host on there too

lusty quest
#

i have this issue when i run a bot with many files on my PC bcs of bad Internet.

tulip ledge
#

Maybe it's caused by one of their things

lusty quest
#

so i guess something eats the bandwith. that causes the API to time out

tulip ledge
#

mmmh yeah maybe

#

I heard the other one hosting on the vps has a minecraft server on there maybe that's causing it?

lusty quest
#

possible

tulip ledge
#

But I mean

lusty quest
#

when suddently many users connects

tulip ledge
#

We have unlimited trafic and 1000 Mbit/s per port

lusty quest
#

since its a VPS you get only 1 gbit

tulip ledge
#

Yeah 1gbit per port

lusty quest
#

then how many are using the VPS? when there are 4 users and each connects to the internet its possible that each of them get 1/4 of the Speeds

tulip ledge
#

Me, my friend and her friend

#

BUt I'm pretty sure her friend is hosting like 3 things

lusty quest
#

when now the Minecraftserver got ~50 Clients and some backround stuff pulls 500Mbits.

#

then 500Mbits for the other 2 is left

tulip ledge
#

Mmmh alright

#

So that might be the issue

lusty quest
#

but its strange you dont need so hight speeds for a bot i guess 10Mbits is enought

#

(atleast for a small bot)

tulip ledge
#

Yeah well

#

My bot isn't exactly small

#

It's not my bot on DBL

lusty quest
#

more than 1 shard?

tulip ledge
#

I'm working on a new one

#

It's not sharded yet

#

But it uses like 300MB ram

#

And thats a lot for a discord bot

lusty quest
#

what database did you use?

#

nvm

tulip ledge
#

When it's on it's peek

lusty quest
#

mysql

tulip ledge
#

MySQL

lusty quest
#

had about 1GB Ram with enmap

#

and 5 Guilds

tulip ledge
#

Enmap isn't exactly light

lusty quest
#

ye

tulip ledge
#

I have 1 guild

#

Since it's not finished yet

lusty quest
#

mysql is better but i think MongoDB is better for Scaling in the longtherm

#

also you can better loadbalance it

tulip ledge
#

My bot does ALOT of calculations and stuff all at once