#development

1 messages · Page 955 of 1

earnest phoenix
#

take data from ffmpeg

#

send it to liv

#

lib*

#

discord.js likes to do a lot of the steps for their users because they know most of their userbase is dumb

#

but by doing that you lose the customisation

golden condor
#

most

#

I'll look inside the package

#

To see how it works

pure lion
#

hey stack, how can i check if a user has blocked my bot because i made a rickroll command that dms the user a rickroll link?

slender thistle
#

You can't

earnest phoenix
#

penis

problem solved

pure lion
#

ah yes

earnest phoenix
#

it was sarcasm shivaco

pure lion
#

i tried a catch block but it didnt work ://///

mossy vine
#

did this man just refer to this channel as stackoverflow

slender thistle
#

Solid

pure lion
#

yes

mossy vine
#

you can catch the promise

pure lion
#

nvm im very clever

#

i forgot how to catch

#

:^)

mossy vine
#

<Promise>.catch(r => doShit()))

#

alternatively, <Promise>.then(r => doShitIfSuccess(), r => doShitIfFail())

pure lion
#

i fixed it lmao

pale vessel
#

alternatively ```js
try {
await something();
}

catch(err) {
error
}```

#

but that's wack tho

mossy vine
#

im pretty sure that doesnt work on promises

pure lion
#

yes i left out error8)))))

pale vessel
#

it does

mossy vine
#

it does?

#

wtf

pure lion
#

ye it does

pale vessel
#

await is the key

mossy vine
#

oh you are awaiting it

earnest phoenix
#

imagine using await/async i make a CATCH PYRAMID like a real PROGRAMMER

pure lion
#

(node:19472) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send messages to this user
(node:19472) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send messages to this user

pale vessel
#

well

pure lion
#

o h

pale vessel
#

try reading the error

pure lion
#

i didnt add await hahahahahaahahahhahaahaahahahahhfwuskgakeugiueaygkeaugkeaugr

pale vessel
#

that might help

earnest phoenix
#

@pure lion show code

pure lion
#

i fixed it for real this time

earnest phoenix
#

what bots you guysmad

#

e

mossy vine
#

if only there was a website

pure lion
#

gusymad

mossy vine
#

where you could see that

pure lion
#

ikr

#

thatd be amazing

pale vessel
#

see what

pure lion
#

i think id call it...

#

top.jeejee

earnest phoenix
#

i made CODELyon

pure lion
#

ok

earnest phoenix
#

ok

#

ahm yall guys weird

#

+1

earnest phoenix
#

? wut

#

Ahm how i can get Bot is Status

storm bluff
#

how can i make when user vote get a role

let support = bot.guilds.cache.get("563708914265358336");
  if (support === undefined) return;
  let role = support.roles.cache.find(r => r.id == "716983765993259078");
  let member = support.members.cache.get(vote.user);
  member.send("Thanks for voting for luffybot")
  if (member) {
    member.roles.add(role).catch(error => {
      console.log(`this user not in support server`);
    });
  }
});```
earnest phoenix
#

but the user must be in same server with the bot

#

oh nvm

opaque seal
#

Where can I find all the rate limits of discord?

honest perch
#

docs

opaque seal
#

Couldn't find them

#

are you sure?

earnest phoenix
#

@opaque seal the rate limit is 100 maybe

#

@storm bluff not working?

storm bluff
#

@earnest phoenix nope

earnest phoenix
#

any error?

storm bluff
#

nope

#

@earnest phoenix

#
  let support = bot.guilds.cache.get(configf.bot.supportserverid);
  if (support === undefined) return;
  let role = support.roles.cache.find(r => r.id == "716983765993259078");
  let member = support.members.cache.get(vote.user);
  member.send("Thanks for voting for luffybot")
  if (!member) return
  if (vote.type == "test") {
      console.log("Test successful!")
    } else {
      if (vote.type == "upvote") {
        bot.channels.cache.get(configf.logs.voters).send(`Thanks for ${vote.user} just upvoted for ${configf.bot.botname} `).then(() =>{
           member.roles.add(role).catch(error => {
      console.log(`this user not in support server`);
    });
        })
      }
    }
});```
earnest phoenix
#

hmm,so?

digital ibex
#

hi

#

does anyone know an alternative i can use instead of passport

golden condor
#

Passport?

digital ibex
#

yes

golden condor
#

Wdym by that

digital ibex
golden condor
cinder patio
#

I mean, you could do the authentication yourself

golden condor
#

^

digital ibex
#

how would i do that?

cinder patio
#

You can create your own middleware, which is basically just a function which is ran after each request

golden condor
#

Check it manually

balmy knoll
#

let KitPass = guild.roles.cache.find(role => role.name === 'KitPass') Why this doesn't work?

golden condor
#

Role doesn't exist?

cinder patio
#

or not cached

golden condor
#

^

balmy knoll
#

No, the role exists, but it is not found as it is not set correctly on the channel. channel.updateOverwrite(KitPass, { CONNECT: true, SPEAK: true, MOVE_MEMBERS: true });

golden condor
cinder patio
#

KitPass should work as well, if it's not null or undefined

golden condor
#

Oh

#

Try console.log(KitPass)

balmy knoll
#

Now i fix it, I just had to put a then

golden condor
#

Ok

balmy knoll
#

If after creating a role, I want to set all permissions to OFF, how can I do that?

golden condor
#

If you create a role it should give the automatic perms

cinder patio
#

you could try to set it's permissions to 0

#

not sure if that would work

balmy knoll
#

@cinder patio All works

earnest phoenix
#

anyone a php programmer?

feral heath
#

just ask your question

small prairie
#

API dead?

earnest phoenix
#

What's better to cache, redis or memcached

#

Looking to cache hundreds of thousands of rows

quartz kindle
#

redis is generally more powerful and has more features

#

memcached is probably easier to use

modest maple
#

Just build youre own lul

small prairie
#
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:64:26)
(node:6705) 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)
(node:6705) [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.

Help

digital ibex
#

u got disconnected from ur internet

#

@small prairie ^

small prairie
#

Vps error nvm

ocean socket
#

Hey can anyone tell me how to run a bot on glitch?

quartz kindle
#

create an account, create a project

small prairie
#

Lmao

ocean socket
#

yea I already did that

quartz kindle
#

if using javascript, install the required npm libraries and move your files there

#

if using python idk, i know it supports python but idk whats the procedure for it

ocean socket
#

Oh

#

I use Python xD

quartz kindle
#

try googling "using python on glitch"

#

you should be able to find answers

ocean socket
#

yea good idea

astral remnant
#

Dank Memer is switching to mongodb :0

quartz kindle
#

from what?

flat pelican
#

ah yes

#

@flat vine what about no

summer torrent
#

from what?
@quartz kindle rethinkdb iirc

flat pelican
#

and I already know that people were reporting you for annoying behavior

quartz kindle
#

ah, never used rethink, it was hyped up for a while but i never bought the hype lul

#

makes sense i guess

summer torrent
zenith terrace
#

if using python idk, i know it supports python but idk whats the procedure for it
@quartz kindle o so there is a python on glitch 👀

quartz kindle
#

idk i often heard that yes

modest maple
#

yeah sadly

quartz kindle
#

sadly? lmao

modest maple
#

There is a loop hole Mal's ratelimit system

quartz kindle
#

Lol

modest maple
#

16 Threads

#

all at once

#

16x the amount per ratelimit

#

noice

quartz kindle
#

sounds illegal

zenith terrace
#

I guessthats how u install it

modest maple
#

@quartz kindle Hush my child

#

You know how many discord bots break ToS

#

too many

quartz kindle
#

lmao

modest maple
#

I am doing this for perfectly legitimate reasons

#

🚣‍♂️

#

you know whats fucking dumb as shit tho

#

why df does their ratelimit do it off per session

#

and not per Ip

#

get ratelimit? Just restart the program. Oh look its not ratelimited anymore

#

-_- Php is trash af

quartz kindle
#

lmao

#

my rate limits are done by nginx

#

hopefully they're good enough

unique nimbus
#

Just give me a bypass for the rate limits

#

profit™️

summer torrent
void bane
#

Ah sorry

earnest phoenix
#

yaya

#

my bot was aprooved

summer torrent
#

👏

limber flume
#

hey how to make a command, where yout type vote and u vote then check and it checks if u voted and gives user prize

spice smelt
cinder patio
#

Callum, aren't custom emojis mapped by their id?

spice smelt
#

yes they are

earnest phoenix
#

@snow urchin so message.reactions.cache.get(emoji) is undefined

#

yes

cinder patio
#

If the emote has an id, your emoji variable becomes emojiName:emojiId

#

not just the emoji id

snow urchin
#

👍

cinder patio
#

if packet.d.emoji.id exists return the id, otherwise return the name (which would be the unicode character for the emoji)

snow urchin
cinder patio
#

uh that's quite unnecessary

#

literally you can do packet.d.emoji.id:packet.d.emoji.name but O.K

spice smelt
#

hey. On quick.db, I used to do this : js guilds.set(guild.id, {gName: guild.name, other: values})
But since I'm trying to switch to mongoDB, I can't find how to do that.
More concretely, I'm trying to name a value in function of a variable. Is that possible?

golden condor
#

are you using mongoose?

spice smelt
#

No. Actually, I tried, but a lot of things went wrong.

#

Why? Does mongoose support this?

amber fractal
#

Mongoose just connects to mongodb and I believe they also allow you to make schemas

#

If you're inserting, you should use insertOne (or replaceOne with the upsert option if the data may already exist)

digital ibex
#

hi, me again js const discordStrategy = require('./strategies/discordstrategy') why am i getting an error? TypeError: OAuth2Strategy requires a verify callback ? the error is coming from ^

spice smelt
#

That isn't what i meant. Let me explain: I can use this to set the value "1" to 123 : js col.updateOne({id: "456"}, { $set: {123: "1"} }, {upsert: true}); But what I want is to assign the value 1 to the content of a variable. By exemple, if var1 = 123, I want to do smth like js col.updateOne({id: "456"}, { $set: {"${var1}": "1"} }, {upsert: true}); note: of course "${var1}" wont work since we need this: ``, but it would break the code block

#

then, to get 1, would use col.findOne({123: "1"})

digital ibex
#

from string to number?

earnest phoenix
#

parseInt() ?

copper cradle
#

@digital ibex it literally says, you're missing a callback

digital ibex
#

in the documentation, it doesn't say anything about a 3rd callback

#
passport.use(new DiscordStrategy({
   clientID: process.env.CLIENT_ID,
   clientSecret: process.env.CLIENT_SECRET,
   callbackURL: process.env.CLIENT_REDIRECT,
   scopes: ['identify', 'guilds']
}, (accessToken, refrshToken, profile, done) => {
   console.log('e');
}));```
copper cradle
#

well that's kinda weird

#

add an extra one and see

#

it's a verify callback

#

so maybe you do some verification or something

#

Idk I've never used that

tight plinth
#

so I made a bot with kurasuta sharding manager but suddenly the bot failed to start with this being the only error i can found in the logs https://cdn.lumap.me/3ahb7bwl.png

#

oh wait i guess i know why it dont work

#

maybe that running two bots with this sharding manager at the same time results in one of them failing to start

#

hmm

#

yea

ripe epoch
#

would a bot respond to itself if it said a command?

#

which it uses

digital ibex
#

yes

#

unless u make it not

ripe epoch
#

ok

#

thanks. i always used to think it was .msg.author.self: return

#

idk why

digital ibex
#

thats js

#

not py

ripe epoch
#

makes sense

#

lol

pale vessel
#

msg.author.bot would probably still work in py

slender thistle
#

yep

tight plinth
#

my brain is too smol to make an algorythm like that so im asking you guys. With js, I have an object like {dotpost: "plz dont dotpost"} and I need to do a list of everything in the object (example: here it will return "dotpost"). how cna i make that

earnest phoenix
#

how to react to an embed with custom emojis? i tried ```js
message.channel.send(p).then(embedMessage => {
embedMessage.react(bot.emojis.get("717372158329880650"))


but this doesn't work :/
pale vessel
#

use Object.keys(object) @tight plinth

tight plinth
#

oh

ripe epoch
#

cheers @earnest phoenix

tight plinth
#

thx

ripe epoch
#

for help

pale vessel
#

np

amber fractal
#

It's just a variable

pale vessel
#

it doesn't matter

amber fractal
#

doesnt matter what it's called

digital ibex
#
const discordStrategy = require('./strategies/discordstrategy')
``` why am i getting an error? `TypeError: OAuth2Strategy requires a verify callback` ? the error is coming from ^
#

the file discordstrategy is:

pale vessel
#

show the error stack

digital ibex
#
const DiscordStrategy = require('passport-discord').Strategy();
const passport = require('passport');
console.log('test1')
passport.use(new DiscordStrategy({
   clientID: process.env.CLIENT_ID,
   clientSecret: process.env.CLIENT_SECRET,
   callbackURL: process.env.CLIENT_REDIRECT,
   scopes: ['identify', 'guilds']
}, (accessToken, refrshToken, profile, done) => {
   console.log('e');
}));
module.exports = passport``` nothing logs btw
#

kk

amber fractal
#

did you try done(null, profile) like the docs said?

digital ibex
#

using passport and passport-discord

#

yes

amber fractal
#

then why did you remove it

digital ibex
#

uhh, idek tbh

#

i get the same error

amber fractal
#

did you save your code?

digital ibex
#

yeah

#

when u save it automatically restarts

#
(accessToken, refrshToken, profile, done) => {
   done(null, profile)
}``` this is the different thing i done
earnest phoenix
#

@earnest phoenix ( sorry ping )

I got (node:22293) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Emoji

even if my bot is in the server from where i got the emoji

cinder patio
#

How do you get the emoji ID

earnest phoenix
#

right click an then copy id on emoji

pale vessel
#

how did*

amber fractal
#

no

#

that copies the message

#

You need to escape it

earnest phoenix
#

i don't have nitro so i couldn't \:emoji:

amber fractal
#

I dont have it either

earnest phoenix
#

Invalid Form Body :/

lyric mountain
#

@nova basin delete messages requires permission grant

#

it'll obviously not work without that

nova basin
#

Okay so in order to add my bot its needs to work with a 0 perms link and "Delete Messages" is in that, right?

lyric mountain
#

no

#

it must say "I don't have enough permission for that (requires Delete Messages perm)" whenever it tries to use a command that requires it

sullen cradle
#

n

lyric mountain
#

you gotta give the user a reason why the command isn't working

nova basin
#

uuh so a /help command would say, In order to use me grant me {perms}

#

ah okay makes sense

lyric mountain
#

why does a help command require delete messages perm?

nova basin
#

well cuz it deltes the /help after it weas executed

#

to keep it clean

#

dunno

lyric mountain
#

that's....quite unnecessary

#

and might refrain people from inviting your bot

#

because delete messages is a powerful permission

nova basin
#

well so if I remove all that my bot will fit, right?

#

Yes I know

lyric mountain
#

make it optional if you must

slender thistle
#

User: -prune
Bot: I DON'T HAVE DELETE_MESSAGES PERMISSION PLEASE GIVE ME PERMISSION DELETE_MESSAGES

lyric mountain
#

he already understood that shiv lol

nova basin
#

nah I guess imma just remove it

#

Thanks for your help tho

lyric mountain
#

you're welcome

slender thistle
#

Cool I just wasn't following the conversation at all

nova basin
#

Was confused af

#

hehe :D.

lyric mountain
#

Cool I just wasn't following the conversation at all
statikk shiv

nova basin
#

one last question

#

But if the bot says, I need perms for that.. It will be okay?

lyric mountain
#

yes, but remember that it's not good to require such perm unless it's strictly required for a certain command

nova basin
#

yea okay, I guess it would be better to just remove it lol

#

to avoid confusion

#

ye

still merlin
#

the code

.setDescription(
          ["Invite SpiderBot"](
            "https://discordapp.com/oauth2/authorize?client_id=703704761114951710&scope=bot&permissions=11278"
          )
        )

comes out with a error

C:\Users\Jon\Desktop\SpiderBot Project\index.js:417
          ["Invite SpiderBot"](
                              ^

TypeError: ["Invite SpiderBot"] is not a function
    at Client.<anonymous> (C:\Users\Jon\Desktop\SpiderBot Project\index.js:417:31)
    at Client.emit (events.js:224:7)
pale vessel
#

add quotes

still merlin
#

but Im not trying to use a function i just want text

pale vessel
#

just wrap ` around the content

still merlin
#

ok

#

Its still "not a function"

pale vessel
#

what did you do

golden condor
#
.setDescription('[Invite SpiderBot](https://discordapp.com/oauth2/authorize?client_id=703704761114951710&scope=bot&permissions=11278)')
still merlin
#

does it all need to be on the same line because whenever I save it it goes into 4 lines

golden condor
#

Yes unless you use `` instead of ''

#

With a string it shouldn't do that

pure lion
#

H e l p

#

Discord.js

golden condor
#

with what

pale vessel
#

be patient

pure lion
golden condor
#

not cached

pure lion
#

It works literally everywhere else

#

Oh

#

W h a t d o t h o

pale vessel
#

you have to fetch the owner first by using guild.members.fetch()

earnest phoenix
#

w

#

where my roles bot

golden condor
#

that fetches all members

pale vessel
#

just put the id smh

#

i'm not giving the full code

pure lion
#

Bruj it works in other servers

golden condor
#

here, the owner isn't cached

pale vessel
#

as you can see there are over 100k members in this server and the owner never goes online

pure lion
#

Makes sense

#

Time to put a catch block in an embed :Dd

amber fractal
#

you can separate code on new lines. but you need to escape the newline with a \

golden condor
#

or do this

#

guild.owner ? Some shit if it exists : some shit if it doesn't

pure lion
#

So like

pale vessel
#

guild.owner ? guild.owner : await guild.members.fetch(guild.ownerID)

pure lion
#

A h

earnest phoenix
#

make it prettier with null coalescing

#

guild.owner ?? await whatever

pure lion
#

aa!stats

#

Fuc

#

Wait

#

I hate code formatting :Dd

#

aa!stats

#

Missing permi-

#

HHHHHHHHHHHH

lyric mountain
#

errr

#

dude

#

you're in development channel

still merlin
#

in my help command i get 2 lines of undefined,
the code is

 .addField("<8ball `YOURQUESTION`", "*Answers questions..*")
        .addField("<roll", "*Rolls a dice for a random number*")
        .addField(
          "<avatar",
          "*the bot will tag you with a link to your avatar*"
        )
        .addField("<joke", "*Sends a random joke*")
        .addField("<prefix", "*tells you what the server prefix is*")
        .addField("<help", "*Display's this message*")
        .addField("<dare", "*get a dare in truth or dare*")
        .addField("<truth", "*get a truth in truth or dare*")
        .addField("<ping", "*Pong!*")
        .addField("<servername", "*displays the current server's name*")
        .addField("<serverinfo", "*get the current servers information*")
        .addField("<uptime", "*dislays the bots uptime*")
        .addField("<mctip", "*get a minecraft tip!*")
        .addField("<setNSFW", "*sets the current channel to NSFW*")
        .addField("<botinfo", "get SpiderBots information")
        .addField("<remNSFW", "*remove's NSFW from the current channel*")
        .addField("<hphouse", "*What's your Hogwarts house?? find out..*")
        .addField("<slap `@USER`", "Slaps the mentioned user!")
        .addFields("<rps", "play  rps with SpiderBot")
        .addField("<invite", "*invite link for the bot*")
        .addField("<support", "*support server URL*");
      message.react("🙋‍♂️");
lyric mountain
#

where are the other fields?

#

only 5 are showing

still merlin
#

ohh thanks heh-

earnest phoenix
golden condor
#

you were rate limited

onyx summit
#

are you making manual requests to discord?

earnest phoenix
#

yes

#

are you making manual requests to discord?
no

pale vessel
#

it's the api

earnest phoenix
#

wut

#

yes

#

the corona.js file

#

but the problem is the Bot stop, when i hit rate limit

onyx summit
#

then check the status, if its 429, you got ratelimited

earnest phoenix
#

Bruh

#

it says RATE LIMIT

onyx summit
#

check the status code

earnest phoenix
#

-__-

onyx summit
#

you are trying to parse that which fails...

earnest phoenix
#

wut

#

parse what

onyx summit
#

you or the library you are using is trying to parse the message saying that you have been ratelimited

amber fractal
#

try/catch the parse

earnest phoenix
#

ok . . .

onyx summit
#

or check the status code

slim tundra
#

hi guys

#

i need a bot for DiscordSRV

#

(minecraft)

#

but im not good with java soo if someone can make me one/help me with making one pm me pls

earnest phoenix
#

ahm

#

we don't make bot for someone

#

so just learn it and make a bot

winter basalt
#

thats a hard request, go to fiverr or freelancer OR learn it and make your own

earnest phoenix
#

yes

#

the life is not easy

#

everythings are not free

earnest phoenix
#

Im looking for a dev to code a bot for me 100 $ spending limit please dm I was not born yesterday so dont mess with me !

#

my price is $102 sorry

#

suck but h o l e

#

that's a skill i do not know yet

#

I can teach you

#
  File "C:\Users\І г о р\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aiohttp\connector.py", line 936, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore  # noqa
  File "C:\Users\І г о р\AppData\Local\Programs\Python\Python38-32\lib\asyncio\base_events.py", line 1050, in create_connection
    transport, protocol = await self._create_connection_transport(
  File "C:\Users\І г о р\AppData\Local\Programs\Python\Python38-32\lib\asyncio\base_events.py", line 1080, in _create_connection_transport
    await waiter
  File "C:\Users\І г о р\AppData\Local\Programs\Python\Python38-32\lib\asyncio\sslproto.py", line 529, in data_received
    ssldata, appdata = self._sslpipe.feed_ssldata(data)
  File "C:\Users\І г о р\AppData\Local\Programs\Python\Python38-32\lib\asyncio\sslproto.py", line 189, in feed_ssldata
    self._sslobj.do_handshake()
  File "C:\Users\І г о р\AppData\Local\Programs\Python\Python38-32\lib\ssl.py", line 944, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1108)
```W.T.F ?!
#

Help pls

slender thistle
pure lion
#

i cant get youtube-search package to work :<<<<<<

earnest phoenix
#

THX!!!

#

Bruh why everyone want to buy a custom bot

#

xD

lyric mountain
#

because less than 1.5% of the world can code

earnest phoenix
#

:0

#

😮

lyric mountain
#

ah, wait, wrong percentage

#

it's >0.5%

earnest phoenix
#

:0

loud nebula
#

Does someone now how to create a var with how many servers has your bot

earnest phoenix
#

.help

sudden geyser
#

Twix what library.

loud nebula
#

Discord.js

#

and node.js

sudden geyser
#

On the client instance, get the size of the .guilds collection. If you're sharding you'll need to get each shard's total guild count and add them all up

restive furnace
#

it's >0.5%
if those coders who ask 24/7 help like how to print output (aka basic things) for example are counted, i think then its somewhat 1,0-1,5% of world can code.

sudden geyser
#

tbh it's less than 0.1%

digital ibex
#

hi js const discordStrategy = require('./strategies/discordstrategy') why am i getting an error? TypeError: OAuth2Strategy requires a verify callback ?

#

discordstrategy.js is```js
const DiscordStrategy = require('passport-discord').Strategy();
const passport = require('passport');

passport.use(new DiscordStrategy({
clientID: process.env.CLIENT_ID,
clientSecret: process.env.CLIENT_SECRET,
callbackURL: process.env.CLIENT_REDIRECT,
scopes: ['identify', 'guilds']
}, (accessToken, refrshToken, profile, done) => {
console.log('e');
}));

module.exports = passport;

sudden geyser
quartz kindle
#

also, that package hasnt been updated in 3 years, its possible that it doesnt work on newer passport versions

digital ibex
#

kinolite, wdym?

#

oh, what else would i be able to use?

sudden geyser
#

Try removing the parentheses

digital ibex
#

i am so stupid

#

thank u

loud nebula
lyric mountain
earnest phoenix
#

The vote track isnt working i did everything correctly.

lyric mountain
#

from what I've understood, you're using both client and bot for event handling

#

which is booting-up your bot twice

loud nebula
#

const client partials is for reacrion roles and const bot is for command handler, just to make it easy

#

@lyric mountain

lyric mountain
#

yeah, but still

loud nebula
#

And what do you mean where is the token

lyric mountain
#

there's absolutely no reason to start two clients

quartz kindle
#

that doesnt make it easier, that makes you run your bot twice at the same time, which means twice the cpu, ram and bandwidth usage

loud nebula
#

where can i find token

lyric mountain
#

in your bot's edit page

#

go all the way to the bottom of the page

#

next to the widgets

loud nebula
#

found it

#

now i have

lyric mountain
#

@loud nebula please delete the token from the file

#

I'd refresh the token if I were u

#

you can't share the token publicly

loud nebula
#

oh

#

ok

lyric mountain
#

does it throw any error?

#

is it the same error?

loud nebula
#

yes

#

yes

lyric mountain
#

what's your dj.s version?

jade citrus
#

I've got an issue with my bot : I use Lavalink to play music, but I recently got 429'd by Youtube. I asked in the library's support server, they told me that it's because Youtube doesn't like people downloading it's songs. They told me to setup an ipv6 rotation to bypass the limitation. I tried setting up an ipv6 tunnel, but for that my router needs to be pingable.

I know the issue isn't really related to the bot, so can you tell me where I can get help about not being able to ping my router ?

loud nebula
#

12.2.0

lyric mountain
#

ah

#

I see the issue

#

it's not new discord.Client()

#

but new Discord.Client()

loud nebula
#

oh

#

where?

quartz kindle
#

he defined defined discord in lowercase

#

so its not wrong

loud nebula
#

3?

lyric mountain
#

both in client and bot

quartz kindle
#

it doesnt matter

lyric mountain
#

ah

quartz kindle
#

if you defined it in lowercase, then use it in lowercase

lyric mountain
#

nvm then

#

I'm out of ideas

quartz kindle
#

what is the error again?

lyric mountain
quartz kindle
#

anyway you dont need to use postStats at all

digital ibex
quartz kindle
#

dblapi.js does it automatically for you

loud nebula
#

Still says the same

digital ibex
#

why am i getting this? i have scope: ['identify']

#

using passport and passport-discord

summer torrent
#

developer portal

#

you can get it from developer portal

digital ibex
#

oh

#

ok

summer torrent
digital ibex
#

yeah. i got it to work, but it takes quite a while to load, do u know what could be causing that?

loud nebula
#

@lyric mountain Still not working

#

i dont uderstand it

quartz kindle
#

did you remove the setInterval and postStats?

loud nebula
#

hdym

#

@quartz kindle

quartz kindle
#

dblapi.js does it automatically

#

you dont need to use postStats

loud nebula
#

oh ij

#

ok

quartz kindle
#

as long as you give it the correct client

#

you're giving it client

lyric mountain
quartz kindle
#

but you never do client.login

#

you do bot.login

#

you should remove client and use only bot for everything

modest maple
#

AM i going fucking mad?

#

or should this not fucking return:

loud nebula
#

but i need to have things right under const client = new and i cant have 2 right under something

quartz kindle
#

you should not have two

modest maple
#
<discord.embeds.Embed object at 0x000001FC3276BA68>
[[...]]          <------ This

quartz kindle
#

you should use one for everything

loud nebula
#

But then, how can i put 2 things right under something

quartz kindle
#

wdym 2 things right under

loud nebula
#

now i have error 429 @quartz kindle

#

too many requests

quartz kindle
#

did you remove the setInterval?

loud nebula
#

yes

#

@quartz kindle

#

uhh hello?

quartz kindle
#

show full error

loud nebula
#

Oops! Error: 429 Too Many Requests

#

its from this

#

dbl.on('error', e => {
console.log(Oops! ${e});
})

quartz kindle
#

that error is caused by the setInterval that you had before

loud nebula
#

but i removed that

quartz kindle
#

are you sure you removed it? did you save the file after removing it?

loud nebula
#

yes

quartz kindle
#

show your current code

cosmic girder
#

So uh my api ping isn't working someone help

lyric mountain
#

api ping?

loud nebula
cosmic girder
#

@lyric mountain yes

lyric mountain
#

what api ping?

cosmic girder
#

Free robux no way @loud nebula

loud nebula
#

Where do you see free robux (And yes i have a free robux server)

lyric mountain
loud nebula
#

lol

lyric mountain
#

this could get your bot banned yknow

loud nebula
#

huh

#

oh oops

#

Oh im sorry

#

Oh wait

#

It is my test bot

#

OHHHH WAIT

#

That is the error

knotty steeple
#

any free thing is a scam

lyric mountain
#

and any scam = banned bot

#

banned bot = banned account

loud nebula
#

1 is it no scam 2 sorry 3. it is my test bot

lyric mountain
#

it goes on

cosmic girder
#

Lil

loud nebula
#

you can say

#

hello

#

nothing happened

cosmic girder
#

Dang I exposed srry @loud nebula

knotty steeple
#

scam

loud nebula
#

but sorry

quartz kindle
#

so its working now?

loud nebula
#

idk im going to check it now

quartz kindle
#

the problem wasnt really that code, the problem is that you had setInterval set to 1ms, which means sending thousands of requests to top.gg so its possible that top.gg banned you temporarily

loud nebula
#

oh

#

When is that over @quartz kindle

earnest phoenix
#

make a request via curl/postman and check the headers

proven lantern
#

client.on('message', (msg)=>{msg.content}); will msg.content include the Commands Prefix?

knotty steeple
#

yes??

#

u dont even have msg defined in ur callback

proven lantern
#

i did magic

earnest phoenix
#

ok

proven lantern
#

i feel like the command prefix wont be in the message content

#

but i cant test it

knotty steeple
#

everything in the message is the message content

#

its ur job to see if a prefix is there

proven lantern
#

i can't test until i have an approved bot

pure lion
#

uh

#

rpg ping

#

oops wrong channel

knotty steeple
#

u can?

proven lantern
#

how can i setup a command prefix for testing?

pure lion
#

dude you can add the bot before its approved

proven lantern
#

i have my bot in my discord channel

knotty steeple
#

in ur code

pure lion
#

lmao

proven lantern
#

you can dev test the bot before it's approved

pure lion
#

no

#

you can have a fully functioning bot in many servers

#

before then

proven lantern
knotty steeple
#

adding a prefix to a bot on the site doesnt automatically give it a working prefix

pure lion
#

^

proven lantern
#

gotcha

pure lion
#

@proven lantern are you making a bot and, if so, what library?

proven lantern
#

yep, discord.js

#

i just made this change

#

can't the prefix be overridden though? how does that work?

magic jackal
#

Yes, you would set it per guild if you needed that, store it in a seperate map or object for just prefixes for the guild

heavy marsh
#
bot.on("channelCreate", async(channel) => {

if(channel.guild.id !== `611881570202025986`) return
``` - Is this wrong in v12 of discord.js
pure lion
#

why did you put () over channel

#

or is that a thing you can do :///

#

anyway

heavy marsh
#

You can do that

pure lion
#

do !if

heavy marsh
#

hmm?

magic jackal
#

That won't work in JS

heavy marsh
#

!if

magic jackal
#

@heavy marsh What is the issue?

pure lion
#

^

heavy marsh
#
[03/06/20 18:27:57.855] [ERROR] (node:13) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined
at Client.<anonymous> (/home/container/bot.js:211:18)
#
if(channel.guild.id !== `611881570202025986`) return
``` = Line 211
pure lion
#

wait

#

i am confusion

#

when you make a channel its assigned a new ID

heavy marsh
magic jackal
#

Director, you're checking an ID that is generated at the time of the event, you can't check it. Try

console.log(channel)```
#

and see what it returns

proven lantern
#

looks like either DMChannel or GuildChannel can be passed into the listener's function. GuildChannel is the only one with the guild property

heavy marsh
#

I am dum

#

The error is from DM channel

magic jackal
#

There you go

heavy marsh
#
[03/06/20 18:36:32.733] [LOG] DMChannel {
type: 'dm',
deleted: false,
magic jackal
#

nice there you go

heavy marsh
#

So just ignor dms?

#

ignore*

magic jackal
#

then add if(channel.type === 'dm') return //or handle here

pure lion
#

ooooooooooooooooor

#

you could just

proven lantern
#

if(channel.guild && channel.guild.id !== `611881570202025986`) return

rigid maple
#

I need HTML knowledge

magic jackal
pure lion
#

i cant html good

rigid maple
#

I code botlist but when I say send the application does not come to the authorized panel

earnest phoenix
#

you made... a bot list?

rigid maple
#

ı don't speak english

#

😦

#

I coded the bot list

#

@earnest phoenix

magic jackal
#

I think he is trying to add a bot to top.gg

rigid maple
#

no

magic jackal
#

idk, what is the issue?

earnest phoenix
#

if you're trying to make your own bot list

#

you have a huge way to go

#

that requires full stack knowledge

rigid maple
#

woW ok thanks

wide ruin
#

i have a list of urls

#

how can i get the image from each one and save it?

rigid maple
#

where ? @wide ruin

earnest phoenix
#

loop through the list, GET request to the url, read the body and save the read data into a file

wide ruin
#

ok thanks

surreal notch
#

by which bot we run our codes on discord only

earnest phoenix
surreal notch
#

like some guys do

  if (msg.content === "botinfo")
  if (command === "botinfo") {
     let embed = new discord.RichEmbed()
     .setitle("BOT INFOMATION")//set title of embed
  .setColor("#ff2052")//color of embed
     .setDescription("Hello friends this Bot is Made By Priz Made for Multi Purposes For Helping Gamers")//Description of embed
     .addField("test","java")
     .setThumbnail(${msg.author.avatarURL})
     .setFooter(${msg.author.username},${msg.author.avatarURL})
  msg.channel.send(embed)

   }```
mossy vine
#

thats just an eval command

surreal notch
#

@mossy vine what is eval?

honest perch
#

evaluate

surreal notch
#

How to do that

honest perch
#

what library

cerulean hornet
#

Someone help me, my bot doesn't detect that I'm on a voice channel

surreal notch
#

discord.js

cerulean hornet
#

my code was v11, I'm not able to update to v12

surreal notch
#

@honest perch

lyric mountain
#

my code was v11, I'm not able to update to v12
@cerulean hornet why not?

honest perch
#

@surreal notch google it

surreal notch
#

what to google

#

could you tell

proven lantern
#

i cant update to v12 because my environment is limited to node version 10

honest perch
#

you wont be able to use v11 at some point

proven lantern
#

hopefully google supports node version 12 soon. they only have beta support for version 10 now

turbid bough
#

lol wut

honest perch
#

cant you install node manually

turbid bough
#

idk apt install nodejs

honest perch
#

curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash

#

i think that **should **work

cerulean hornet
#

@cerulean hornet why not?
@lyric mountain I don't understand much about v12

#

Put that aside, how do I do a setlanguage command? to change bot languages?

lyric mountain
#

you need to create locale files

#

which would contain all the text from your bot

cerulean hornet
#

know any channel that has a tutorial video?

lyric mountain
#

like, locale_en-US.properties would contain all the text in english, while locale_fr-FR.properties would contain all the text in french

#

and you'd need a database to store language preferences of each server

#

just search node.js localization on google

proven lantern
lyric mountain
#

google translate would do a very shitty and lazy work

proven lantern
#

lol

lyric mountain
#

but yeah, you could use it

cerulean hornet
#

Using the database until easy just do not know how to do the command: c

lyric mountain
#

create locale files

#

also, I'd focus on updating to v12 asap

modest maple
#

The translate API is also heavily ratelimited

cerulean hornet
#

I already use v12

modest maple
#

< 2 million characters per day

lyric mountain
#

if going for a translating api, I'd recommend yandex

proven lantern
#

Google is deprecating nodejs 8 support in 2 days. i guess that means version 10 will be stable and version 12 will be beta soon

lyric mountain
#

we meant d.js version, not node

cerulean hornet
#

but is there any npm that facilitates the setlanguage commands?

lyric mountain
#

no

proven lantern
#

d.js12 requires version 12 and soon d.js11 will require version 12

lyric mountain
#

not everything can be spoonfed to you

#

localization is a hard work, even harder if you leave it for later

#

d.js12 requires version 12 and soon d.js11 will require version 12
@proven lantern soon there will be no d.js 11 to require anything

#

it'll not be updated

#

4 months is the maximum deadline to update to d.js v12

proven lantern
#

hopefully google supports 12 before d.js 11 stops

lyric mountain
#

read above

#

google doesn't need to support v12, you're confusing node.js 12 with d.js 12

proven lantern
#

d.js 12 doesn't work with node 10

lyric mountain
#

that's obvious

#

current version is 11, 10 is already old

proven lantern
#

so if google doesn't support node version 12 and discord only supports version 12 then it wont work with google

lyric mountain
#

it will

#

d.js 12 works with node.js 11

#

it already does actually

cerulean hornet
#

it will
@lyric mountain , do you know any place I can look for more about the language command?

lyric mountain
proven lantern
#

google only supports node 10 at this time. but in 2 days they are going from beta support of node 10 to it being the stable version

lyric mountain
#

it'll not tell you how to make the command itself, it will tell you how to make multi-lang support for your code

#

google only supports node 10 at this time. but in 2 days they are going from beta support of node 10 to it being the stable version
@proven lantern dude, node is v11 currently

#

v10 is already obsolete

proven lantern
#

odd numbers are not lts releases

lyric mountain
#

actually, it's version 12 already

#

with 14 being beta

#

odd numbers are not lts releases
@proven lantern proof?

proven lantern
#

i'm talking about google's hosting

lyric mountain
#

...

proven lantern
#

The Node.js 6 runtime has been deprecated. The Node.js 8 runtime will be deprecated on 2020-06-05. To ensure that your functions are on a supported version of Node.js, migrate them to Node.js 10. After 2020-08-05, function deployments that use Node.js 6 will be blocked. Cloud Functions that continue to use Node.js 6 after this time may be disabled.

lyric mountain
#

you could have said that you were talking about google HOST

#

you said google NODE

proven lantern
#

they should have beta support for version 12 soon

lyric mountain
#

why do you even bother with google hosting?

#

it's expensive, and free plan is very limited

proven lantern
#

i have never paid anything for their hosting

lyric mountain
proven lantern
#

they give you 28 hours of free cpu time every day

#

i never need more than 1 cpu

valid frigate
#

28 hours
1 day = 24 hours

#

so +4 hours every day?

lyric mountain
#

two processes share the same cpu time

valid frigate
#

yo thats crazy

lyric mountain
#

it's like heroku dynos

proven lantern
#

it can scale out

lyric mountain
#

but still, free plan is so limited that it'd be a miracle to have more than 30 servers without the bot becoming extremely slow

tight plinth
#

Every time my bot needs to send a message this error appears, even after a restart or after regen the token. How can I solve it

lyric mountain
#

Every time my bot needs to send a message this error appears, even after a restart or after regen the token. How can I solve it
@tight plinth the body is too long

proven lantern
#

"".substring(0,2000)

pale vessel
#

slice

cobalt umbra
#

Anyone made dashboard + bot with Python? What did you use?
I'm thinking the cleanest way is to make 3 separate things: dpy bot, django website and API (flask/maybe django becaues great ORM) that previous 2 can connect that will just be dealing with database.

That seems like a bit overkill tho.

lyric mountain
#

the word flask gives me shivers

#

I've made a dashboard in react native and the bot in java

#

I don't think with python would be too overkill

modest maple
#

@cobalt umbra What ive done is Bot as one system

#

what i used to have was the api and site with django

#

because its very easy just to have another app for the API side of stuff with django using the rest_framework

#

it works pretty well

#

tho personally i've switched to Flask and Quart because i prefer building my own stuff for what i need todo

cobalt umbra
wicked pivot
#
const str = 'BlaBla https://discord.gg/xxxxx blabla';

if(str.includes("https://discord.gg/")){
  console.log(str.slice(19));
};
console.log(str);```

I am currently testing to be able to retrieve information from a possible link from another server to post on the server with: https://discord.com/api/v6/invites/

Problem I can't find a way to recover a specific part of a message with slice
lyric mountain
#

use regex

cobalt umbra
#

I think I'll go with it then. Oof I got lot to code stap

modest maple
#

It's less than u think tbh

#

Crunchy's old system was like 500 lines with django

#

Spotify's system is like 200 lol

proven lantern
#

str.split("/").includes("discord.gg")

lyric mountain
#

regex would be better

#

because people can bypass those splitters

quartz kindle
#

@lyric mountain my bot was on their free plan until 500+ servers lol

lyric mountain
#

lol how

quartz kindle
#

google's free instance of compute engine

earnest phoenix
#

which are all the functions a bot have (like ready/message/messageUpdate/ etc ) ?

quartz kindle
#

its not bad at all, its better than glitch and heroku

#

the only issue is very limited bandwidth, which is the reason i moved out

golden condor
#

What are you talking about here?

lyric mountain
#

free hosting

golden condor
#

Does he mean Google cloud?

lyric mountain
#

yep

golden condor
#

Oh nice

proven lantern
quartz kindle
#

f1-micro instance has 0.2 cpus (1 cpu at 20% capacity lol) and 600mb ram

#

still better than glitch heroku

dapper basin
#

hello

proven lantern
#

hello

digital ibex
#

hi, why is req.user undefined with expressjs?

wicked pivot
#

how to detect that a message .includes () a space

digital ibex
#

i have js app.get('/', (req, res) => { req.user; });

#

@wicked pivot if(String.includes(' '))

topaz moth
cobalt umbra
#

I'm actually still busting my head, it's open source and I want it to be perfect stap

topaz moth
digital ibex
#

i don't think theres a way to make a dashboard in python, i don;t think so cuz my friend who only knows python is learning js to make one

topaz moth
#

i just do this then have endpoints which serve html templates

#

ofc there is a way to make dashboards

#

welcomer has a dashboard and thats made in python

digital ibex
#

no i mean, a web dashboard

topaz moth
#

yeh...

digital ibex
#

but idk py lol

quartz kindle
#

of course you can make one with python, why wouldnt you

#

python supports web servers

wicked pivot
#

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'includes' of undefined

digital ibex
#

oh

cobalt umbra
#

That's a good idea, I have tons of ideas I'll have to review them tommorrow

#

peterthink ah it's a great idea

topaz moth
#

just make sure that u dont make it blocking

cobalt umbra
#

ye dw

wicked pivot
cobalt umbra
#

It's probably not gonna be similar I'll just take the idea and make it from scratch

#

oh god what is th at

wicked pivot
#

it's not very clean I admit it but I didn't find any other way

#

then it doesn't work anymore sad

proven lantern
#

are you trying to get the invite code from a string that contains a link?

wicked pivot
#

I am trying to retrieve the code of a post link on my server

proven lantern
#
const indexOfHostname = pieces.indexOf("discord.gg")
console.log(pieces[indexOfHostname+1]);```
#

replace the empty string with your blalala string

sudden geyser
#

or some regex

wicked pivot
#

i feel very stupid but thanks

lyric mountain
#

That endpoint requires oauth2

#

I'd say you're entering complex waters

cobalt umbra
#

Should I even bother with async Python ORM, literally all packages I found were in very early development/alpha.

#

I answered my question nvm

wicked pivot
#
 (node:17498) UnhandledPromiseRejectionWarning: Error: 404 Not Found
    at /rbd/pnpm-volume/ee988e40-a781-4cf0-9372-ec9a7a538c68/node_modules/.registry.npmjs.org/snekfetch/4.0.4/node_modules/snekfetch/src/index.js:193:21
    at processTicksAndRejections (internal/process/task_queues.js:88:5)
(node:17498) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:17498) [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.```
google translation I would like this message not to be displayed how to do?

code : 

```js
const LinkDiscordP = ["discord.gg/", "https://discord.gg/"];
  if(LinkDiscordP.some(link => message.content.toLowerCase().includes(link))){
    const GetMessage = message.content.split("/")
    const indexOfHostname = GetMessage.indexOf("discord.gg")
    snekfetch.get("https://discord.com/api/v6/invites/" + GetMessage[indexOfHostname+1]).then(async(get) => {
      get = get.body
      if(!get){
        return
      }
      console.log(get)
    })
  }```
earnest phoenix
#

its not an valid invite code.

#

so, its giving 404 error

wicked pivot
#

yes I know but precisely that is the goal x), I purposely do this so as not to have a "stupid" error

#
if(!get){
        return
      }```must replace its with what so that when there is an error it executes the code in {}
proven lantern
#

if(!get.ok)return

wicked pivot
#
snekfetch.get("https://discord.com/api/v6/invites/" + GetMessage[indexOfHostname+1]).then(async(get) => {
      if(!get.ok)return console.log("Not Okay")

      get = get.body
      console.log(get)
    })```still not :/
proven lantern
#

maybe it throws an error that needs to be caught in .catch()

lyric mountain
#

Yeah, just put .catch(err => null)

#

That'll "handle" the exception

proven lantern
#

its funny that library has an ok property when it throws an error when it's not ok

#

so it's always ok === true

wicked pivot
#
snekfetch.get("https://discord.com/api/v6/invites/" + GetMessage[indexOfHostname+1]).then(async(get) => {
      get = get.body
    }).catch(err => console.log("Not Okay"))```hm
quartz kindle
#

isnt that library deprecated

honest perch
#

it is

#

it says to use node-fetch

earnest phoenix
#

hey

shy turret
#

@earnest phoenix discord.js v11 or v12

earnest phoenix
#

11

#

11.5.1

shy turret
#

I highly recommend updating to v12 but

#

Im pretty sure it is

#

client.guilds.size

#

Change client to your client variable

#

Unless it is already client

earnest phoenix
#

yea

#

thats it?

shy turret
#

Yah

#

v12 is client.guilds.cache.size

earnest phoenix
#

and it will show how many servers its in??

shy turret
#

Yes

earnest phoenix
#

okay let me try

shy turret
#

But

#

U need to put it in something

#

Like console.log()

#

Or an embed

#

Message whatever

earnest phoenix
#

so

#

console.log(client.guilds.size)

#

that??

warm drift
#

yes

earnest phoenix
#

ok ill try

astral yoke
#

if you dont know that you should learn jsfirst

#

just sayin

proven lantern
#

do we need to get permission to be able to invite our bot into the testing channels here?

shy turret
#

@astral yoke i learned js well within 3 years by learning discord.js first

astral yoke
#

im talking to shadow

modest maple
#

Should I even bother with async Python ORM, literally all packages I found were in very early development/alpha.
You could look at the databases Module which is a async implementation of sqlalchemy core

#

but most of the time no

#

its easy enough todo querys

cobalt umbra
#

ye

honest perch
#

@proven lantern it needs to be approved

#

and submitted

cobalt umbra
#

ye believe me I looked at all of them, and all of them are very risky imo (breaking changes/missing features/possible bugs etc)

modest maple
#

i found the databases module worked really well tbh

#

i say even tho i only used it for the auto commit

#

lol

proven lantern
#

@honest perch thanks, i submitted it yesterday, but i'm guessing it'll take awhile to approve it with all the covid-19 stuff going on

honest perch
#

2 weeks approximately

cobalt umbra
#

I'll just use glorious asyncpg yukarismug

proven lantern
#

@honest perch you're talking about submitting to https://top.gg/ right? not some other process to get approved for testing in this guild?

modest maple
#

I'll actually take asyncPg over psycopg2 most of the time and go async just cuz psycopg2's implementation is weird and janky

honest perch
#

@proven lantern thats what im talking about, yes

modest maple
#

Like execte_many being slower than doing multiple executes or the fact it uses standard string formatting just to replace it with $1

misty sigil
#

qq of 11pm
how do i make bot run code when kicekd from guild

modest maple
#

theres an event for it

#

it'll be somthing like on_guild_remove

proven lantern
#

that event only fires when you leave leave the guild, not disconnect

modest maple
#

i mean thats literally what he asked for lol

proven lantern
#

he edited

#

there should be an event on disconnect

modest maple
#

hes asking when its kicked

#

that event fires on but not exlusivley: banned, leaving normally, kicked

misty sigil
#

oh coool

proven lantern
#

but leaving normally means right click guild and click leave server and not disconnecting. that tricked me before

modest maple
#

Hes not asking for disconnecting tho lmao

#

hes asking for if its Kicked or banned or leaves lol

proven lantern
#

im just complaining

#

i want to make a bot that says hello every time i connect to the lobby so i feel good

warm drift
#

Can bots get rate limited for reactions?

misty sigil
#

i think

smoky spire
#

Yeah

#

You can get ratelimited for anything that uses the api

slender wagon
#

Oof

warm drift
#

Because my bot sort of depends on multiple reactions every 5 seconds or so

#

more like 30 seconds

slender wagon
#

Dayum

warm drift
#

Is there a number like the 5 msgs every 5 seconds

#

because i dont want this thing getting sacked

smoky spire
#

I get ratelimited after adding a single reaction

warm drift
#

pog

tired nimbus
#

Is there a way to convert a Date value to time remaining?

warm drift
#

you can have the date in ms

#

then do some math

tired nimbus
#

I already have it in ms I have it as a Date object

misty sigil
#

time remaining to what

tired nimbus
#

(millseconds in the future) - (milliseconds since 1 January 1970 UTC / Date.now())

#

then would there be a way to convert the milliseconds easily to a format like: 5 Days 1 Hour

#

or would I have to divide for each value

#

hold on let me see if ms can do that

royal portal
#

hey so I have a thing to log deleted messages

#

and if i say a message before the bot turns on

#

then when the bot turns on and i delete the message, it wont work

#

only the messages after the bot is on

#

anyone know a solution

#
client.on("messageDelete", async(message) => {
  let delEmbed = new Discord.MessageEmbed()
  .setTitle("Message Deleted")
  .setColor("RANDOM")
  .addField("Message", message.content)
  .addField("User", message.author.tag)
  .setTimestamp();
  
  let loggingChannel = message.guild.channels.cache.find(ch => ch.name === "general")
  if(!loggingChannel) return;
  loggingChannel.send(delEmbed)
});
warm drift
#

The message just isn

#

t in cache

#

I dont know if you can do anything about that with the messageDelete event

tired nimbus
#

v12 only

royal portal
#

i am in v12

quartz kindle
#

partials wont fix it

#

the message delete event from the discord api doesnt provide anything other than the message id, channel id and guild id if applicable

#

if the content of the message isnt cached beforehand, there is no way you can obtain it anymore

warm drift
#

best bet is to keep the bot up

royal portal
#

so is there nothing i can do about it?

quartz kindle
#

the most you could do is try to fetch it, but i highly doubt that will work

royal portal
#

i guess i'll just have to keep the bot up

quartz kindle
#

bots dont cache messages indefinitely anyway

#

by default discord.js caches a maximum of 200 messages per channel

#

so even if it it keeps running, it wont be able to get a deleted message thats older than that

#

unless you change the option to cache more

warm drift
#

ram destruction

quartz kindle
#

you could also fetch a certain number of messages at login, so you dont start from 0

#

and yes, all of that will eat your ram

royal portal
#

ah ok

#

time to make a different bot i guess

quartz kindle
#

if you want to make a bot specialized in monitoring message deletions, you'd need to provide a custom storage system

rotund yarrow
#

Hey I need some real simple help with reactions in discord.js, can someone help?

royal portal
#

yeah

quartz kindle
#

for example save the message content in a database

#

but that could have privacy implications

river terrace
#
                            ^

TypeError: Cannot read property 'channel' of undefined```
sudden geyser
#

what is message

river terrace
#

sorry i forgot the ticks

#

its an error

#

for advice.js

rotund yarrow
#

?

#

@quartz kindle I don’t get it

river terrace
#

i have the superagent package which is the only package i need for it to pull from the API

#

and its not working

#

i can help u electro

#

i know about reactions

#

whatsup

quartz kindle
#

@rotund yarrow dont ask if someone can help, just ask the question and wait for someone to help

river terrace
#

oh

#

that makes sense but ill help ya if u want

#

yo Tim

#

could u help me figure out why its not pulling from the API for live advice lol

#

i posted the error up there

quartz kindle
#

that error means message is undefined

river terrace
#

oh

#

reall? bc its in there

#

wait

#

const message =

#

like that?

quartz kindle
#

no

river terrace
#

uh like this....

#

let message =

#

and then put something after the =

quartz kindle
#

no

river terrace
#

ok then how

#

i dont know any other way to define a variable

quartz kindle
#

a Message object is a complex discord.js structure

#

you receive one when you receive a message

#

you dont create one nor define it yourself

river terrace
#

then how is it supposed to work

#

and how am i supposed to fix it

#

i dont really understand that

#

:/

quartz kindle
#

is that a command?

river terrace
#

i can paste the command

#

if u want

quartz kindle
#

if its a command it should have a message coming from somewhere

river terrace
#

module.exports = {
    name: 'advice',
    description: 'gives a random life advice',
    category: 'none',
    run: async (client, kayn, REGIONS, config, message, args, con, guilds) => {
        request
            .get('http://api.adviceslip.com/advice')
            .end((err, res) => {
                if (!err && res.status === 200) {
                    try {
                        JSON.parse(res.text)
                    } catch (e) {
                        return message.reply('An API Error Occurred :(');
                    }
                    const advice = JSON.parse(res.text)
                    message.channel.send(advice.slip.advice)
                } else {
                console.error(`REST call failed: ${err}, status code: ${res.status}`)
                }
            });
    },
};```
#

advice.js

#

am i dumb?

#

i feel like i messed up on something so obvious and i just dont understand it

proven lantern
#

maybe that export should be in a function

river terrace
#

is it not in a function?