#development

1 messages · Page 1585 of 1

grizzled raven
#

what are you changing? text colour or bg colour

#

just making sure

zenith terrace
#

text colour bot description

#

important didnt work either

#

hence the __description part

grizzled raven
#

yeah

#

.entity-content__description > .content { color: #0c3ccc !important } should work though

cerulean ingot
earnest phoenix
#

I haven't used screen, but can't you do screen -ls and see the PID?

Or you can probably try this
for i in `pidof python3`; do pstree -sp $i ;done | grep -v '^ '

drifting wedge
#

how can i make this bar @ the bottom like move automatically?

#

like without hovering, or clicking anything

#

how can i make it like move

lyric mountain
#

move where?

drifting wedge
#

i got it dw

errant perch
#

(node:2432) UnhandledPromiseRejectionWarning: Error [SHARDING_READY_DIED]: Shard 1's process exited before its Client became ready.

#

help lol

#

const manager = new ShardingManager('./bot.js', {
    // https://discord.js.org/#/docs/main/v12/class/ShardingManager
    totalShards: 'auto',
    token: 'token'
});

manager.on('shardCreate', (shard) => console.log(`Shard ${shard.id} launched`));

manager.spawn();```
#

sharding managers im using

#

bot wont start without sharding so any help would be nice 👍

rose warren
#

Google Cloud issues are preventing Discord from rolling out a fix right now. Just gotta be patient. My bot's been offline for an hour.

errant perch
#

i think i figured it out

quaint wasp
#

how do i make a bot create a channel with a name?

rose warren
#

Ah looks like the sharding issue has just been resolved.

quaint wasp
#

dang

#

nice

#

do u know how to create channels using discord.js?

pale vessel
#

RTFD

quaint wasp
#

?

lyric mountain
#

RTFD = Read The Fuckin Docs

#

Basically "docs have only one job, don't take it from them"

odd stratus
delicate shore
#

Hey guys

#

I needed some help with html

#

I have to scroll to see the time

lament rock
#

change the padding of the elements

delicate shore
#

Any way I can just put it in such a manner that I don't have to scroll below

delicate shore
#

This is my code

lament rock
#

is the See Above an image

delicate shore
#

nah

pearl trail
shrewd sparrow
lament rock
pearl trail
shrewd sparrow
#

oh ok thx

#

it would be nice to test my code out but ok

mild ivy
#

yo i'm tryna make a review command that would take the message input and put it into an embed. This is my code but it seems to not function can someone help me?

    await message.delete();
    const bruh = message.content.slice(4).split(" ");
    const saymessage = args.join(" ");
    const embed = {
        "title": `Review by ${message.author}`,
        "description": saymessage,
        "color": 4718336,
      };
      MessageChannel.send(embed);
    return;```
lament rock
pearl trail
#

oh thanks, i didn't found about that code on any website

delicate shore
#

What do I do

#

I can't

#

figure out

#

I tried everything

lament rock
lament rock
#

different divs implicitly have padding you cannot remove and make them vertically align

delicate shore
#

oh

#

But I need diff divs

lament rock
#

You can have nested divs

#

or you can modify div scaling

delicate shore
#

how?

#

not good with css

#

(me)

#

wait

#

nvm

#

I fixed it

#

Thanks

quaint wasp
#

How do I like..

#

filter to find a person by id?

#

I got that..

#

but fetch isnt working..

#

help.

glossy spoke
#

client.users.fetch("id");

quaint wasp
#

thanks. 🙂

lament rock
tribal siren
#

what's wrong in here

lament rock
#

Literally nothing. Just that djs v11 still works but lol

pale vessel
#

Nice discord.js

lament rock
#

"discord.js"

pale vessel
#

Yes

lament rock
#

cough

tribal siren
#

try using new Discord.RichEmbed()

pale vessel
#

did papi even have that

lament rock
#

Wait. Fuck. I should have named it RichEmbed

pale vessel
#

amandathink what did you name it

lament rock
pale vessel
#

do you even need a builder

#

ah you have one

#

aren't they slow?

lament rock
#

What

pale vessel
#

is it the same as discord.js or just rewritten to mimic it?

lament rock
#

Ripped from and just modified to TS and also to follow my eslint rules

pale vessel
#

hrm

#

I actually don't know, I never used the builder

#

I doubt it makes much difference

lament rock
#

Any abstraction layer has overhead to process

#

The time lost is pretty negligible as well

pale vessel
#

Right

slim heart
#

@Not Erwin

#

pain

#

so many people named erwin

pale vessel
lament rock
#

Haven't seen that nick in a while

slim heart
#

@opal plank 1.3GB for 40k pog

vernal minnow
#

Problem: The Data Does Not Save properly. By This The Command Does Not Work.
Error: I Do Not Know

const log = require('../../database/schemas/logSchema');
const name = 'logchannel';

module.exports = {
    name: name,
    category: 'admin',
    run: async (client, message) => {
        try {
            message.delete();

            if (message.member.hasPermission('ADMINISTRATOR')) { } else return message.reply('**You Do Not Have Permission To Set Log Channel**').then(message => message.delete({ timeout: 4000 }));

            const channel = message.mentions.channels.first()
            if (!channel) return message.reply('**I cannot Find This Channel**').then(m => m.delete({ timeout: 3000 }));

             log.findOne({ guildID: message.guild.id }), async (err, data) => {
                if (err) console.log(err);
                if (!data) {
                    let newLog = new log({
                        guildID: message.guild.id,
                        logChannel: channel.id
                    });
                     newLog.save();
                    message.channel.send(`**The Mod Log Has Now Been Set To ${channel}**`);

                } else {
                    data.updateOne({
                        logChannel: channel.id
                      })
                    data.save()
                    return message.channel.send(`**The Mod Log Has Now Been Set To** ${channel}**`);
                }
            }
        } catch (error) {
            require('../../structures/on_error')(client, error, name);
        }
    }
}
pale vessel
#

Error: I do Not Know
No way...

#
data.updateOne({
    logChannel: channel.id
})```what are you updating?
vernal minnow
pale vessel
#

isn't that just the filter?

vernal minnow
#

I'

#

I'm Updating the Channel Id

pale vessel
#

ah

#

try adding await await data.updateOne()

#

and I don't think you need data.save()

#

updateOne() does that for you already

vernal minnow
#

ok

#

Nope Still dose not work

sacred aurora
#

just change

data.updateOne({
  logChannel: channel.id
})

to

data.logChannel = channel.id
#

then save it

cinder patio
#

is this sequelize or mongoose?

sacred aurora
#

i think its mongoose

pale vessel
#

that doesn't look like sequelize

cinder patio
#

it does

pale vessel
#

there's updateOne()?

#

oh

crystal wigeon
#

hey umm

#

how would i get a users' guild that he's an admin or owner of

#

using oauth

#

it returns all the guilds the user is in

pale vessel
#

use your bot

crystal wigeon
#

can i pass something like ?owner=true

pale vessel
#

nope

crystal wigeon
#

i need it from oauth

crimson vapor
#

updateOne is not as cool as findOneAndUpdate

old cliff
#

how can I get output of console.log in eval() ?

#

should I just not console.log and just do it the old eval way ?

cinder patio
#

what's your end goal?

earnest phoenix
#

redirecting stdout?

old cliff
#

to get the console.log value from an eval

cinder patio
#

and why are you using eval in the first place?

#

You probably shouldn't use console.log in eval, but a custom function, which instead of printing to console, it puts the value in an array or something

old cliff
#

don't question my methods... I know what I am doing

pale vessel
#

Right

old cliff
#

yes

toxic jolt
#

hi

#
(node:7960) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit``` im getting this error for years. i how to fix this
glossy spoke
#

There are too many client listeners

#

client.on

pale vessel
#

message

glossy spoke
#

Ya

toxic jolt
glossy spoke
#

Just make a command handler or try making all commands inside 1 listener for event message

toxic jolt
#
client.on("message", async msg => {```like this?
glossy spoke
#

If you want to solve it

toxic jolt
glossy spoke
#

And inside that put as commands as you can

toxic jolt
#

why shards error

#

:c

silver lintel
#

when i have two good embeds and i try edit, it edits e1 to have both instead of replaceing e1 with e2

let e = blahblah
let edit = another embed
let msg = await message.channel.send(e);
msg.edit(edit);
pale vessel
#

both?

#

you mean content and embed?

#

because bot messages can't have 2 embeds

silver lintel
summer torrent
#

that is different message

#

look at (edited)

silver lintel
#

oh well how do i make it not do that

tight plinth
#

if i do <Guild>.members.fetch(an id) but the member is not in the guild, does it error or does it just return undefined?

summer torrent
#

can i send tryitands.ee

tight plinth
#

pensive

#

i hate error handling

#

😩

summer torrent
#

check error code mmLol

tight plinth
summer torrent
#

kekw

marble juniper
#

ever heard about our lord and saviour

#

the ? keyword

#

you need to show the code

#

otherwise we can't help

#

well

#

you are not passing the middleware

#

and you shouldn't create the webhook each time a post request is being made

#

also its better if you require modules at the top of your code

daring prawn
#

hey so this is my code

## Links
<a href="https://dsc.gg/">Invite Link With Perms</a>

<a href="https://dsc.gg/">SmartWikiSupport</a>


<a href="https://.gg/"><img src="https://invidget.switchblade.xyz/jp8et9xU56"></a>

<style>
@keyframes float { 0% { box-shadow: 0 5px 15px 0px rgba(0,0,0,0.6); transform: translatey(0px); } 50% { box-shadow: 0 25px 15px 0px rgba(0,0,0,0.2); transform: translatey(-30px); } 100% { box-shadow: 0 5px 15px 0px rgba(0,0,0,0.6); transform: translatey(0px); } } .entity-header__image { box-shadow: 0 5px 15px 0px rgba(0, 0, 0, 0.6); transform: translatey(0px); animation: float 4s ease-in-out infinite; } 

.entity-content__divider{
    display: none;
    border: none
}

.entity-content__description {
  background: none;
  border: none;
  }

body {
  background: linear-gradient(135deg, #8a2387, #e94057, #f27121);
}

</style>
#

the thing is my color and stuff is visible in the preview page but after i save it it doesnt

#

Like in preview page: it shows color
In bot page: it only shows black and not my colors

daring prawn
marble juniper
#

can't rn sorry

daring prawn
#

okay ill wait

dusky sundial
#
        def check(reaction, user):
            return user.id == ctx.message.author.id and (str(reaction.emoji) == '![yes](https://cdn.discordapp.com/emojis/735540961278689440.webp?size=128 "yes")' or '![no](https://cdn.discordapp.com/emojis/735540931587211264.webp?size=128 "no")')

        reaction, user = await self.client.wait_for('reaction_add', timeout=600.0, check=check)

It doesn't seem like the check method is even running when I react to the message

#

tried printing something in it, but nothing happens

daring prawn
slender thistle
unkempt ocean
pale vessel
#

x == y or x == z??

slender thistle
#

You can either do any([x == y, x == z]) or x == y or x == z

dusky sundial
slender thistle
#

That's interesting

dusky sundial
#
        def check(reaction, user):
            print("Here")
            return reaction.message.id == message.id and user == ctx.message.author and (str(reaction.emoji) == '![yes](https://cdn.discordapp.com/emojis/735540961278689440.webp?size=128 "yes")' or str(reaction.emoji) == '![no](https://cdn.discordapp.com/emojis/735540931587211264.webp?size=128 "no")')
#

This doesn't print anything

slender thistle
#

Are you sure the code block with the wait_for itself actually runs?

opal plank
#

qt above

slender thistle
#

Cute person named Not Erwin

dusky sundial
#
            print("Here")
            reaction, user = await self.client.wait_for('reaction_add', timeout=600.0, check=check)

This does print something, yea

#

It's just in a try block so it should run no matter what

earnest phoenix
#

x in (y, z) WeSmart

slender thistle
#

oh geez I forgot you can do that too

earnest phoenix
#

Do you have reaction intent enabled doe

opal plank
#

DM_REACTION and GUILD_REACTION iir

#

DIRECT_MESSAGE_REACTIONS && GUILD_MESSAGE_REACTIONS

earnest phoenix
#

Oh, anyway. reaction_add only gets dispatched if the messages are cached

old cliff
#

wait... theres a reaction intent ?

earnest phoenix
#

consider using raw_reaction_add instead

dusky sundial
#

Oh yea, that was it. Jesus christ I'm sad

opal plank
#

there is

dusky sundial
#

Been sitting here for an hour

opal plank
#

1024 and 8192 bitfields

dusky sundial
earnest phoenix
#

it'll get dispatched despite the message caching

opal plank
#

i assume there are no partials like d.js or something

old cliff
#

on djs you could just fetch the partials and move on

earnest phoenix
#

in fact, the emoji that raw_reaction_add returns is partial.

opal plank
#

yall fighting on py, here i am fighting on ts

#

or, well, js

#

its not much ts related

#

trying to map something

#

by shards, in one line

dusky sundial
#

I had my bot in py, rewrote it to Java and then back to py

opal plank
#

i just rewrote to use a different and better lib, dont think i'll port something this big to another lang

dusky sundial
#

Yea it's not fun, but it's something to do while you're procrastinating school work shrug

opal plank
#

fair

dusky sundial
#

I think Julia looks kinda fun, but there's so little documentation

earnest phoenix
#

even rewriting something on another lib is pain, let alone rewriting it in different lang

lethal trout
#

const client = new Discord.Client() - When I do this it does not fetch the users correctly

const client = new Discord.Client({ fetchAllMembers: true }) - When I do this my events don't work!

const myIntents = new Intents();
myIntents.add('GUILD_MEMBERS');

const client = new Client({ ws: { intents: myIntents } });``` When I do this non of the commands work! 

I have Server Members Intent!
So can someone help me what I should do?
earnest phoenix
#

the last code block is the correct one

#

however

#

you only added the GUILD_MEMBERS intent

#

so you'll only get member related events

#

nothing else

#

let me pull up the docs

lethal trout
#

@earnest phoenix u there?

pale vessel
lethal trout
earnest phoenix
#

i literally said let me pull up the docs chile

pale vessel
#

and use the bitfield instead, way easier and less pain

lethal trout
earnest phoenix
#

include the GUILDS intent

#

and also GUILD_MESSAGES

pale vessel
#

select your intents/events and provide the generate number to the intents property

lethal trout
#

will this work?

pale vessel
#

you tell me

lethal trout
pale vessel
#

yeah

#

the best way to check is by testing it

#

is what i'm trying to say

lethal trout
earnest phoenix
#

Guys, I know I sound like a nub asking... but, I forgot if it’s client.login(" ") or client.login(' ')

pale vessel
#

both and client.login(` `)

#

or client.login(variable)

#

crazy

earnest phoenix
#

Alr thanks lol, sorry I forgot I’m just testing something

eternal osprey
#

hey

#
 const obj = require("./trainers.json")
                        idIndex = obj[firstmember].mons.indexOf(given1)
                        obj[firstmember].mons[idIndex] = given
                        idIndex = obj[targetMember.id].mons.indexOf(given)
                        obj[targetMember.id].mons[idIndex] = given1

so i have this code.
it should replace the given(1) with given as you see```js

{"345138133429649408":{"name":"Awsome","mons":[3298763,3949091,2493972,5281975],"currentBalls":3,"spawnIds":[7357173,7691225,6019191,6966024],"catching":false},"367251020914491392":{"name":"xGAMERSx","mons":[5234883,9689076],"currentBalls":3,"spawnIds":[1444051,2479025],"catching":false},"808344263598669874":{"name":"pea hancock","mons":[5370724],"currentBalls":3,"spawnIds":[7011973],"catching":false}}```
this is how the json looks like.
however, it doesn't error and doesn't change anything at all

unkempt ocean
#

For those whose CSS broke after the last update

  • Try to use .entity-wrapper instead of body
  • Set background property to transparent !important for the class named "bTmyJW". Example:
.bTmyJW { background: transparent !important; }
#

this should stay here just in case peepoblush

quartz kindle
#

but not the file itself

#

to change the file itself, you need to write obj to the file with fs

eternal osprey
#

will give it a go

lethal trout
#

i did this but the events are not working

#

like status not showing

#

i only added the fetchallmembers :true

#

everyone time i add it events dont work

quartz kindle
#

log the debug event

lethal trout
quartz kindle
#

client.on("debug", console.log)

leaden crystal
#

the animation css attribute is not working for me??

pale vessel
#

Aren't they deprecating the fetchAllMembers option since it just causes problems?

unkempt ocean
leaden crystal
quartz kindle
pale vessel
#

that's good

leaden crystal
#

sorry wrong reply

#

@unkempt ocean

pale vessel
#

you should only request for members when you need it

quartz kindle
#

their implementation of fetchAllMembers was all borked

#

i had to fix it myself in djsl

lethal trout
#

sry for ping

lethal trout
quartz kindle
#

what are the many things?

unkempt ocean
quartz kindle
#

do you have the GUILD_MEMBERS intent?

pale vessel
#

that infamous error

lethal trout
lethal trout
quartz kindle
#

how big are your shards?

#

how many guilds?

lethal trout
lethal trout
quartz kindle
#

discord only allows requesting members for 120 guilds per minute

#

so 144 guilds takes a minimum of 2 minutes

#

you need to change your client options to allow waiting for 2 minutes

lethal trout
#

eyes_zoom so why is my status not working

leaden crystal
lethal trout
#

@quartz kindle guilddelete is working but guildcreate not working

#

and status not working

#

i am trying to fix since yesterday

silk wadi
#

]]vps

quartz kindle
opal plank
#

this doesnt seem right at all

#

2 seconds for 5 shards?

lethal trout
crystal wigeon
#

hey umm ik i keep asking stupid questions but how do i get guild avatars from that hashtxt

#

like for users there's a avatars route

#

is there something similar for guilds?

eternal osprey
#

so @quartz kindle it would be like this? ```js
const obj = require("./trainers.json")
idIndex = obj[firstmember].mons.indexOf(given1)
obj[firstmember].mons[idIndex] = given
idIndex = obj[targetMember.id].mons.indexOf(given)
obj[targetMember.id].mons[idIndex] = given1

                    fs.writeFileSync("./trainers.json", obj);```
#

as the obj now gets saved into the file

lethal trout
eternal osprey
#

also nodejs version

lethal trout
#

and see above so u understand

lethal trout
eternal osprey
#

i am trying to replace 1 id of the firstmember

#

with a saved variable

opal plank
#

first

#

json database

#

second, semicolons

eternal osprey
#

i know

opal plank
#

third, indentation

#

fourth, wtf

#

5th, wtf? you using object for mapping?

eternal osprey
#
{"345138133429649408":{"name":"Awsome","mons":[3298763,3949091,2493972,5281975],"currentBalls":3,"spawnIds":[7357173,7691225,6019191,6966024],"catching":false},"367251020914491392":{"name":"xGAMERSx","mons":[5234883,9689076],"currentBalls":3,"spawnIds":[1444051,2479025],"catching":false},"808344263598669874":{"name":"pea hancock","mons":[5370724],"currentBalls":3,"spawnIds":[7011973],"catching":false}}```
opal plank
#

jesus christ

eternal osprey
#

an array in an array with inside objects.

#

i mean... i tried my best 🙂

#

anyways, tim told me that the obj indeed changes. i just need to fs.writefile

#

the obj to this json file

cinder patio
#

learn to use a proper database, it's so much easier, faster and safer. You're paobably tired of hearing this lmao

opal plank
#

tim should've told you to use a database

eternal osprey
#

i am definitely tired of hearing this ;). I understand the point... but i just want to stick on with json.

#

My code already depends too much on json. It will take days to change it all.

#

i'll use real databases in the future, for other projects.

opal plank
#

and thats why back dating 2 months ago, i warned you to use a database

eternal osprey
#

And yeah, i understand.

#

I am also using real databases for my other projects.

#

I just can't get back to it with this code.

cinder patio
#

I think it's worth switching to a proper database

eternal osprey
#

yeah i understand. Will have a look this week.

opal plank
#

i literally told you to start using a database dating back 3 months

#

you started as 2 coordinates, and now you see how it spiraled out of control

eternal osprey
#

yeah i do see that.

#

But once again, i can't get back now. I would have to change literally everything. 4 months of work gone,.

opal plank
#

you can

eternal osprey
#

also, this is only a bot for me.

opal plank
#

a week at most to port your code

eternal osprey
#

Not for public use.

opal plank
#

my bot also has been worked for around 3 months now

#

just rewrote it

#

took 4 days

eternal osprey
#

how old are you?

opal plank
#

yours you wont even need that much change, you'll simply use a database to store

#

23, why?

eternal osprey
#

owh just wondering

#

What study have you followed?

opal plank
#

you mean if i gratuated in something?

#

i did not do uni, if thats what you wanna know

eternal osprey
#

Yeah, and if not, what study are you following?

#

owh

opal plank
#

currently nothing, im getting experience rather than a diploma

#

focusing as scaling

eternal osprey
#

yeah, sorry i was asking it as i need to choose a study to follow.

cinder patio
#

it's our choice

#

your*

earnest phoenix
#

Is there a way I can add color to strings?

eternal osprey
#

yeah i wanted to follow computer science/software engineer. I wanted to know whether that was his study so i could ask him how hard it is, if it's fun etc.

marble juniper
#

like javascript code blocks for example

#

lol

eternal osprey
#

so yeah i changed my code a bit but it still doesn't want to work

dusky sundial
eternal osprey
dusky sundial
earnest phoenix
#

how do you create a discord bot please in Italian?

dusky sundial
#

JavaScript or Python is a recommendation if you're new

earnest phoenix
#

how do you create a discord bot please in Italian?

dusky sundial
earnest phoenix
#

@marble juniper @near stratus , but what if I want an embed color string?

jovial elk
#

Hmmm is there any workaround for embed fields to be inline for mobile users too? It just looks so much better on desktop version

quick ridge
sacred aurora
split hazel
#

pretty simple

#

you can pretty much Google everything step by step and then add all the solutions together, if you don't want the challenge

quick ridge
sacred aurora
#

wut

#

lol

#

where can i get that kind of challenge tho

#

i want to try it

glossy spoke
#

SoloLearn (on PlayStore)

#

lmao

sacred aurora
#

bruh

#

that mean code on the phone?

earnest phoenix
#

Is there a way I can add color to an embed string?

sacred aurora
#

well

#

color: "the color"

split hazel
#

the docs for raw embeds are on the discord dev portal i think

#

but yeah above should work

earnest phoenix
#

@split hazel, @sacred aurora , thanks! <3.

split hazel
earnest phoenix
#

@split hazel thanks this can help me a lot

split hazel
#

or just use the embed builder if that's easier for you

earnest phoenix
#

@split hazel huh, it didn’t work

split hazel
#

the colour didn't work?

earnest phoenix
#

Mhm

split hazel
#

show code

earnest phoenix
#

Isn’t it like that?

lament rock
#

You need to put the color property identifier in the embed object. Lol

split hazel
#

yeah

#

behind description

#

make sure to add a comma at the end

earnest phoenix
#

Ohh, lol

pearl trail
#

Hello, is using autoplay Youtube feature on bot prohibited? Like i want to play Japanese song, i added one and when the song ended, it'll search and play other Japanese song like autoplay do. I want to search this information in google but it's hard to find. Just to make sure i didn't break any ToS, because i can't find it on https://developers.google.com/web/updates/2017/09/autoplay-policy-changes

lament rock
#

Streaming YouTube audio from sources other than YouTube is already against the terms of service

pearl trail
#

yeah, but i stream audio from youtube

earnest phoenix
#

or scraping youtube in the first place

split hazel
#

but due to discord not doing anything about it we don't really care

lament rock
#

Tools like YTDL got DMCA'd for a reason. Thanks, GitHub

pearl trail
eternal osprey
#

hey guys

lament rock
#

Just know that whatever you do music wise is already against YT's terms of service

split hazel
#

you mean playing a song then playing another one automatically?

eternal osprey
#
 var m = trainers[firstmember].spawnIds;
                        m.concat(founds.spawnId);
                        var d = trainers[firstmember].mons;
                        d.concat(founds);
                        var p = trainers[targetMember.id].spawnIds;
                        p.concat(found.spawnId);
                        var n = trainers[targetMember.id].mons;
                        n.concat(found);```why doesn't this change in the json file?
eternal osprey
#

Is that because i need to write it first?

split hazel
#

speaking professionally you'd probably want to ask discord but I've seen tons of bots (huge ones) having the same so discord probably won't do anything about it

sacred aurora
#

r u using ytdl?

split hazel
#

you're kind of on your own

#

against google tos

#

streaming things

pearl trail
lament rock
sacred aurora
#

i mean u can use the recomendation object to do the autoplay thing

#

my bot has that feature too

pearl trail
pearl trail
sacred aurora
#

wait a minute

#

lemme see my code

split hazel
#

by streaming music from their platform you're effectively ripping content from them with no ad revenue so it is against tos

#

but that's about the main idea of music bots

pearl trail
#

oh, ah yes no ads

earnest phoenix
lament rock
#

You shouldn't worry about if it's against TOS or not. It always will be. So, just do it, I suppose

solemn leaf
#

Yeah you just change cookies here and there

pearl trail
split hazel
bright glade
#

🥺

serene cliff
#

which port does bots use to send request to discord api gateway?
trying to find a way to use librenms to monitor how many request my bots send

someone replied: 80, 443

but im unsure since music bot, dont it send music data through UDP aswell?

earnest phoenix
solemn leaf
#

@serene cliff none

split hazel
#

yes as long as its in the reply/send method

solemn leaf
#

You connect to the websocket

split hazel
#

which it is

solemn leaf
#

No port

earnest phoenix
#

Thank you, sor/ma’am lol

lament rock
quartz kindle
#

voice is udp, gateway is tcp, rest is https

split hazel
#

tcp is far too slow for good voice connections

#

since it validates if all packets were sent

serene cliff
#

so which port is it for udp, tcp then ?

quartz kindle
#

wanna hear a tcp joke?

solemn leaf
#

No

split hazel
#

No

#

joking go on tim

solemn leaf
#

No

quartz kindle
#

i was hoping someone would get the reference

lament rock
split hazel
#

the ports are up to the server/service but discord always uses 80

#

for tcp/http*

serene cliff
#

alright thanks

quartz kindle
#

isnt 443 for rest?

split hazel
#

forgot to add that https uses 443

quartz kindle
#

since its https

split hazel
#

yeah

#

@serene cliff ^

quartz kindle
#

gateway should be 80, since its http plus upgrade

serene cliff
#

alright thanks, will configure librenms to listen to those ports thanks

random frost
#

Hl

split hazel
#

hello is that just a friendly greeting before you're going to post a question or chatter

feral aspen
#

Uh

#
.setThumbnail(member.user.avatarURL({ size: 4096 }))
(node:11604) UnhandledPromiseRejectionWarning: RangeError [IMAGE_SIZE]: Invalid image size: 4096
#

I got this error.

#

Did I do it correctly with my Math?

summer torrent
#

max image size is 2048 iirc

feral aspen
#

What. How can I see other bots using my avatarURL having more better quality.

outer perch
#

someone to follow me on my thoughts?

#

Ko-Fi's API doesn't exactly send how many months people have purchased for VIP

#

but it sends how much they've paid for

#

If I divide that for the price of one month, I get the exact amount of months to assign
e.g.: 15€ / 5€ (3 Months)

#

but the problem is people can pay for those months in other currencies, like USD or Yens

#

and the API sends me that info, in which currency was paid

#

I need to convert, but the only 2 modules I found, are outdated somehow

split hazel
#

that quality is more than enough for a good quality

outer perch
#

but if I make a function to convert, values can be outdated since 1 EUR is 1,21 USD, but can be 1,19 later

split hazel
#

yeah it gets a bit messy

quartz kindle
#

you need a currency converter api

split hazel
#

yep something updated

#

then get the conversion and do some math on your side

outer perch
split hazel
#

will probably be quite inaccurate but it'd get the job done

outer perch
split hazel
#

and while you're doing that maybe suggest to them to show how many months people are subscribed

eternal osprey
#

hey guys

eternal osprey
#
 var m = trainers[firstmember].spawnIds;
                        m.concat(founds.spawnId);
                        var d = trainers[firstmember].mons;
                        d.concat(given);
                        var p = trainers[targetMember.id].spawnIds;
                        p.concat(found.spawnId);
                        var n = trainers[targetMember.id].mons;
                        let h = n.concat(given1);```how do i actually update the trainers[targetMember.id].mons; to the variable named h (without the rest of the file to be changed)
outer perch
#

Donations are something else

#

and Shop... idk if it's a good option

#

like, Mudae does it through Commissions too

#

unless there's a simpler way

#

maybe the API could send me the bought item name

split hazel
eternal osprey
#

it doesn't work

#
{"345138133429649408":{"name":"Awsome","mons":[2571375],"currentBalls":3,"spawnIds":[3003152],"catching":false},"367251020914491392":{"name":"xGAMERSx","mons":[9811888],"currentBalls":3,"spawnIds":[4500501],"catching":true}}```this is how it looks like
#

@split hazel

#

i tried console.logging it and it looked like it contained all the expected info

#

it just doesn't write to the file.

quartz kindle
#

i told you

eternal osprey
quartz kindle
#

if you want to update the file, you need to use fs

eternal osprey
#

I tried doing it but it literally overwrites the whole file

quartz kindle
#

yes

eternal osprey
#

and only leaves me [id1, id2]

quartz kindle
#

thats why json is not recommended

split hazel
#

ah i thought so

quartz kindle
#

because the only way to update a json file is to overwrite the entire file

split hazel
#

i thought you were having trouble changing a value

outer perch
#

and that's why DBs exist

split hazel
#

yeah ^ something like sqlite would be much better since you can target that specific value

#

or anything really

#

mongo, mysql, postgres the list goes on

quartz kindle
#

with json you have to

  1. load the entire file
  2. change the value you want to change
  3. write the entire file back
split hazel
#

but assuming you dont want a whole database server you should use something like sqlite3

outer perch
#

not saying JSON should be swapped with a DB, cuz JSONs work as DBs if you don't need to change any data

#

but since it's not the case

eternal osprey
#

so there is no way how i can update the mons[] without losing all the other info?

outer perch
#

I use Firebase cuz it's simple as hell, but so different from MySQL - something I learned at school 😓

quartz kindle
#

load the entire file

#

and save the entire file

eternal osprey
#

okay

split hazel
#

no other way

outer perch
#

or that

eternal osprey
#

wait i am confused

outer perch
#

forget what I said, do what Tim says

eternal osprey
#

so i need to load the entire file. Using require

quartz kindle
#

yes

eternal osprey
#

i need to read it then

#

and then save it?

outer perch
#

require saves in cache

split hazel
#

be careful with require since it caches the object (if i remember correctly)

#

but that's fine if you only have one application running and modifying that file

split hazel
#

if you have things like clusters/worker threads you need to use fs#readFile

#

to read every time you want to write to it

eternal osprey
#

owh i already am using that to read it

#

but i am prob doing it wrong

#

as i am kinda confused

outer perch
# eternal osprey i need to read it then
  1. require() reads and caches to a variable
  2. the info will be in the variable, ready to edit
  3. after every change u can overwrite the file with the edited info (which is inside the variable)
eternal osprey
#
trainers[targetMember.id].mons = given1
                         trainers[firstmember].mons = given
                         const test = require("./trainers.json");
                         let data = fs.readFileSync(test)
                         fs.writeFileSync("./trainers.json",JSON.stringify(data));```so like this?
#

If i have understood it right

#

nvm you cant read from a variable

split hazel
#

no

#

readFileSync accepts a path so you'd put ./trainers.json

eternal osprey
#

yeah i saw that already!

#

but ehmm

#

it kinda writes the buffer into the file

#

instead of the right info

split hazel
#

so what's your current code

eternal osprey
#
trainers[targetMember.id].mons = given1
                         trainers[firstmember].mons = given
                         let data = fs.readFileSync("./trainers.json")
                         fs.writeFileSync("./trainers.json", JSON.stringify(data));
                    
                     });```
cinder patio
#

you need to set the encoding to utf8

eternal osprey
cinder patio
#

also, why are you reading and then immediately writing to the file again?

split hazel
#

and what you are doing now will result in absolutely no changes

cinder patio
#

There's no point in that

split hazel
#

you need to stringify the trainers object

#

remove the data variable completely

eternal osprey
#

ooh

split hazel
#

you also dont need to specify the encoding in writeFileSync since node will automatically detect the type, but since you aren't using readFileSync that's fine

#

then everything should work after you replace data with the stringified trainers object

eternal osprey
#

owwh okay i understand it now!

#

But wouldn't that replace the []?

#

fixed it

split hazel
#

it will only change the mons value to the value of given

eternal osprey
#

by adding the []

#

great support @split hazel ! Really helped me out a lot!

#

Thanks

outer perch
#

fast question

#
"message_id":"3a1fac0c-f960-4506-a60e-824979a74e74",
"kofi_transaction_id":"0a1fac0c-f960-4506-a60e-824979a74e71",
"timestamp":"2020-08-21T13:04:30.7296166Z",
"type":"Donation",
"from_name":"Ko-fi Team",
"message":"Good luck with the integration!",
"amount":"3.00",
"currency":"USD",
"url":"https://ko-fi.com"
"is_subscription_payment":false
"is_first_subscription_payment":false}```
#

Ko-Fi's API sends me something like this

#

when someone buys anything, "type" tells me if it's a Donation, Commission or Shop

#

but there isn't anything to tell me what they bought, until I reach their website

#

any ideas beside what I thought?

split hazel
#

i mean if they don't tell you in the data payload there isn't much you can do besides find some api route that would let you track what they bought or scraping since you mentioned you can see it on their website

outer perch
#

yeah, hope there is

split hazel
#

is there an api route that would let you find the transaction details?

outer perch
#

if there is, it's not official

#

I should either find an unofficial API or install a Node module for that xD

glossy spoke
#
 .addField("Bancolombia", dinero.get(`usuario${autor.tag}.dinero_banco`))
#

it returns undefined

#

😐

#

o wait nvm

feral aspen
#
// These are the models that we are going to be requiring to connect to the database.
const Server = require("../../models/guilds/server.js");

module.exports = async (bot, message) => {
    if(message.author.bot || message.channel.type === "dm") return;

    const server = await Server.findOne({
        serverID: message.guild.id
    });

    if(!server) {
        var prefix = process.env.PREFIX;
    } else if(server) {
        var prefix = server.prefix;
    };

    let args = message.content.slice(prefix.length).trim().split(/ +/g);
    let cmd = args.shift().toLowerCase();

    if(!message.content.startsWith(process.env.PREFIX)) return;
    let commandfile = bot.commands.get(cmd) || bot.commands.get(bot.aliases.get(cmd));
    if(commandfile) commandfile.run(bot, message, args);
};

I've been stuck on this message.js as it isn't able to perform commands! I've made it so it can detect different prefixes but it won't work.

cinder patio
#

you check if the message starts with the default prefix, not the custom one

#

if(!message.content.startsWith(process.env.PREFIX)) return;

#

Also, you should probably cache prefixes so you don't get them from every time from the database

feral aspen
#

Where can I drag that, after if(message.author.bot)?

cinder patio
#

It has to be after you get the prefix from the database, duh

feral aspen
#

Yet didn't work, and I dragged it to

    const server = await Server.findOne({
        serverID: message.guild.id
    });

    if(!message.content.startsWith(process.env.PREFIX)) return;
cinder patio
#

the problem is that you are checking if the message starts with the default prefix

#

Even if the server has a custom prefix

glossy spoke
#

also, that return ```js
if(!message.content.startsWith(process.env.PREFIX)) return;

cinder patio
#

uh it kinda is

glossy spoke
#

why?

feral aspen
#
    if(!server) {
        var prefix = process.env.PREFIX;
    } else if(server) {
        var prefix = server.prefix;
    };

    if(!message.content.startsWith(prefix)) return;

I guess it's fixed now?

cinder patio
#

Because you would always check if a command exists, and try to parse the message, even if the message isn't meant to be read by the bot

#

yes

feral aspen
#

But yet no commands are working.

pale vessel
#

you should cache your prefixes

cinder patio
#

console.log prefix to see what it is

feral aspen
#

Well, I tried performing the command to have it console log but didn't work.

#
    if(!server) {
        var prefix = process.env.PREFIX;
    } else if(server) {
        var prefix = server.prefix;
    };

    if(!message.content.startsWith(prefix)) return;
    console.log(prefix)
pale vessel
#

log it before

cinder patio
#

put it before you check if the message starts with the prefix

feral aspen
#

Ok

cinder patio
#

It's probably not what you think it is if it's not getting logged

feral aspen
#

tf

#

Ok.

#

Not be to mean!

#

I guess I was kind of stupid.

#

I had the prefix changed.

#

I was using the wrong prefix for the server.

cinder patio
#

well I guess it's working now

feral aspen
#

I'm making sure for multiple servers.

#
module.exports = async (bot, message) => {
    if(message.author.bot || message.channel.type === "dm") return;

    const server = await Server.findOne({
        serverID: message.guild.id
    });

    if(!server) {
        var prefix = process.env.PREFIX;
    } else if(server) {
        var prefix = server.prefix;
    };
    
    if(!message.content.startsWith(prefix)) return;

    let args = message.content.slice(prefix.length).trim().split(/ +/g);
    let cmd = args.shift().toLowerCase();

    let commandfile = bot.commands.get(cmd) || bot.commands.get(bot.aliases.get(cmd));
    if(commandfile) commandfile.run(bot, message, args);
};
#

So this is the final result to the code, it's correct right?

#

All is left is to cache?

cinder patio
#

sure

#

You can remove that if statement and use OR const prefix = (server && server.prefix) || process.env.PREFIX

feral aspen
#

Oh.

#

This made things more organised, thanks!

near stratus
outer perch
#

@split hazel there isn't anything 😢

pale vessel
#

wha

crystal wigeon
#

hey umm

#

does client.users.cache.get(id) find the user even with sharding?

#

idk why it sometimes returns undefined

earnest phoenix
pale vessel
#

because the user isn't cached in that shard

#

fetch the user

summer torrent
earnest phoenix
#
client.shard.broadcastEval(`this.users.cache.get(${userid})`)
``` @crystal wigeon  you have to reduce the result
earnest phoenix
pale vessel
lament rock
#

don't spoon-feed bad code

pale vessel
#

Where are the quotes

earnest phoenix
pale vessel
#

Just fetch the user, way easier

lament rock
#

Yes

summer torrent
pale vessel
#

Yes I use that module

earnest phoenix
pale vessel
#

Of course he does kekw

earnest phoenix
crystal wigeon
#

well idk that much xD

#

some users were not getting detected by the client so asked

summer torrent
#

im using dotenv and it doesn't seem to read my variables. I got undefined while logging to console (and invalid token error from discord)

crystal wigeon
#

i thought sharding only did the server spliting thing

pale vessel
summer torrent
#

paths are ```
src/.env
src/Bot.ts (where i use dotenv)

crystal wigeon
summer torrent
#

yes

pale vessel
#

You can fetch the user on any shard instead of relying on cache

pale vessel
earnest phoenix
#

@pale vessel I talked about @lament rock , He meant that the code was bad, Probably they do not have the know how about sharding. @crystal wigeon wanted it from the cache. I gave them the way, how to fetch them ^^

summer torrent
#

i tried ../ when im using dotenv in src/components/Client.ts

pale vessel
#

Have you tried using a full path?

summer torrent
#

lemme try

earnest phoenix
# pale vessel I said he knows.

the code is doing what it should do. fetch the user from the cache 🤷‍♂️ , .users.fetch() is not good , since you could hit the ratelimit on multiply fetch

pale vessel
#

The user isn't guaranteed to be cached in one of the shards

#

Plus why not just fetch?

earnest phoenix
lament rock
pale vessel
lament rock
#

That was what I was pointing out

pale vessel
#

Check your code

#

It says that whatever you defined as discord.js is undefined

quartz kindle
#

show code

pale vessel
#

show bob

quartz kindle
#

show vegana

pale vessel
#

Check how you called the function

#

You might forgot to provide Discord

earnest phoenix
#

🤔

quartz kindle
#

show the full stack trace

#

full error

solemn leaf
#

why would you pass discord through a function

#

that would be really slow

earnest phoenix
solemn leaf
#

@earnest phoenix No I dont?

#

why would you do that

earnest phoenix
summer torrent
#

error says "Discord" is undefined

earnest phoenix
#

hey is gibo down?

solemn leaf
#

I dont need anything from discord in my commands

pale vessel
#

Oh hello welcome back

#

don't complain about pings next time

quartz kindle
#

show votifier.js

solemn leaf
#

I will

quartz kindle
#

thats not the full file

#

show the full file

earnest phoenix
quartz kindle
#

then where is this line? const voteWebhook = new Discord.WebhookClient(dont look at this, dont look at this either bruh ;-;)

solemn leaf
#

@earnest phoenix bro fr

#

you can legit turn off mentions

earnest phoenix
solemn leaf
#

No you didnt

#

I still got the ping noise too

pale vessel
#

Aki for fuck's sake, stop

solemn leaf
#

and it will make it slower

quartz kindle
#

it will not make it slower

pale vessel
#

It's just pointless

solemn leaf
#

You sure you're passing through big objects

pale vessel
#

They're just references

quartz kindle
#

they are passed by reference

solemn leaf
#

still pointless

pale vessel
#

Pointless, but it doesn't make it any slower

earnest phoenix
crystal wigeon
#

"name":"AbortError","code":500,"method":"post","path":"/channels/755375798348677150/messages","level":"error"}

#

anyone know what this error means?

quartz kindle
#

wtf is this line module.exports = (app, Discord, voteWebhook);

#

that makes no sense

pale vessel
#

That only returns voteWebhook, no?

crystal wigeon
#

lol

solemn leaf
#

you dont declare what app is

#

then you are just requiring something

#

not doing anything with it

earnest phoenix
#

@solemn leaf So how can I access DIscord when I do not pass it? with require?

pale vessel
#

what are you trying to export

solemn leaf
#

module.exports = (app, Discord, voteWebhook); first off when is app declared second off why

quartz kindle
#

honestly the entire file makes no sense. i dont know what you're trying to do there, but i see many wrong things

#

is that the full file?

solemn leaf
#

and why do you even need to login

quartz kindle
#

are you sure the role exists and id is correct?

#

the above code should work, even though you should be using .get() not .find()

#

message.guild.roles.cache.get(id)

cinder patio
#

Maybe the role isn't cached, if the id is correct

pale vessel
#

It's stupid that you can't fetch one role from the API

#

you have to request for all of them

#

Try doing <@&roleid> and see if it's a valid role

#

Maybe it's a deleted role?

cinder patio
quartz kindle
#

it fetches all roles behind the scenes

#

then filters them

cinder patio
#

bruh

#

why not call it fetchAll then

solemn leaf
#

because discordjs is a bad library

cinder patio
#

lying to your users, good one d.js

earnest phoenix
#

Who need help whit python?

#

Nobody..

quartz kindle
#

i need help with convincing people python is bad

#

:^)

earnest phoenix
#

python is bad

#

FOR YOU

quartz kindle
#

that code makes no sense

earnest phoenix
#

Python is the easiest language

quartz kindle
#

just do ```js
let id = val.split(" | ")[1]

earnest phoenix
#

And its perfect

#

I've made a verified bot whit python

quartz kindle
#

it works, but in a stupid way

#

lol

solemn leaf
#

@earnest phoenix yeah but python developers don't know how to spell as you have just shown to us.

earnest phoenix
#

Oh wow im crying 😭

quartz kindle
#

lmao

#

we're joking, python is fine

#

i personally dont like it, but it has its merits

earnest phoenix
#

Ok

solemn leaf
#

Tim

#

what does type do in js docs

quartz kindle
#

where

#

like @type {typeName}?

solemn leaf
#

Yeah

#

what is it for

quartz kindle
#

defining types?

solemn leaf
#

whats a type

quartz kindle
#

describing objects, defining custom types, etc

solemn leaf
#

ah okay thnaks

quartz kindle
outer perch
#

issue update

#

gonna use Patreon from now on

summer torrent
#

what is typescript equivalent of require
for example require("xxx")()

pale vessel
#

thonk

#

import()?

quartz kindle
#

what do you want to require?

summer torrent
#

dotenv-json

pale vessel
#

Oh that's a thing

quartz kindle
#

it doesnt support types

#

so you have to load it with import

pale vessel
#

still prefer dotenv though

quartz kindle
#

import env = require("xxx")

#

then env()

#

i think

summer torrent
pale vessel
#

don't you have to declare the require function

#

or it'll like error

glossy spoke
#
let cantidadN = Number(cantidad);
          if (cantidadN == 0) {
            message.channel.send("No puedes depositar **0** barcoins!")
            return;
          } else {
            if (dinero.get(`usuario_${autor.tag}.dinero_banco`) == "0") {
              if (cantidadN > dinero.get(`usuario_${autor.tag}.dinero_mano`)) {
                message.channel.send("No tienes esa cantidad de dinero!");
                return;
              } else {
                dinero.set(`usuario_${autor.tag}.dinero_banco`, cantidadN)
                dinero.substract(`usuario_${autor.tag}.dinero_mano`, cantidadN)
                message.channel.send(`Se han depositado **${cantidadN}** Barcoins!`)
              }
            } else {
              dinero.add(`usuario_${autor.tag}.dinero_banco`, cantidadN)
              dinero.substract(`usuario_${autor.tag}.dinero_mano`, cantidadN)
              message.channel.send(`Se han depositado **${cantidadN}** Barcoins!`)
            }
          }

this part of the code doesn't get executed 😐

quartz kindle
#

another option is

#
{
  "compilerOptions": {
    ...
    "allowJs": true,
    "checkJs": false,
    ...
  }
}
#

then import * as env from "dotenv-json"

pale vessel
#

Are you sure your file is actually called .env

glossy spoke
#

all

#

that entire part

quartz kindle
#

then the problem is not there

glossy spoke
#

link of pastebin

#

?

summer torrent
pale vessel
#

Try turning on debug mode

crimson vapor
#

Tim how long does it take to make a discordjs MessageEmbed?

quartz kindle
#

wut

#

how long does it take?

crimson vapor
#

like

#

in ms

quartz kindle
#

next to nothing? idk measure it

#

its probably < 1ms

crimson vapor
#

I thought you guys did a shit load of tests?

glossy spoke
#

tim

quartz kindle
#

well yes, but for like 100k iterations

pale vessel
#

that's for like 100k iterations

quartz kindle
#

not just one

glossy spoke
#

that's the entire code

quartz kindle
#

if i recall correctly, 100k embeds took like 200ms

crimson vapor
#

so realistically there is no need to not use embed builders

quartz kindle
#

realistically no, only if you're a performance freak

crimson vapor
#

as its such a minimal difference on the small level

summer torrent
#

just send embed object

crimson vapor
#

atErwin

pale vessel
solemn leaf
#

Erwin is a different story

#

all I ever see from them is v: )

quartz kindle
glossy spoke
#

why?

summer torrent
#

autor

quartz kindle
#

if the person changes their username, they lose all their money

glossy spoke
quartz kindle
#

always use ID

surreal crest
#

is there anyone who can make a bot to combine servers in a master/slave kinda setup? Or does it already exist?

quartz kindle
# glossy spoke ow

besides that, it seems you put the entire code inside if (cantidad == "all" || cantidad == "All") {

#

so it will only work for all, and not work for any other kind of value

solemn leaf
#

if (cantidad.toLowerCase() == "all") {

glossy spoke
#

o

#

thx lol

solemn leaf
#

if (!cantidad.toLowerCase() == "all") return;

feral aspen
#
const reacted = await promptMessage(m, message.author, 60, reactions);
````(node:9108) UnhandledPromiseRejectionWarning: TypeError: promptMessage is not a function`

I figured out the problem to the error above as it isn't adding reactions unortunately, but when I added the `if(!message.guild.me.hasPermission(["ADD_REACTIONS"])) return;` code, it yet errored. Even though it works in other servers fine and normal.
glossy spoke
#

why it doesn't return?!

#
let cantidadN = Number(cantidad);
          if (cantidadN.length < 2) {
            message.channel.send("No puedes depositar menos de **10** barcoins!")
            return;
          }
solemn leaf
#

@feral aspen Uh read the error, promptMessage isnt a function

feral aspen
#
return message.channel.send("No puedes depositar menos de **10** barcoins!");
glossy spoke
#

xd

feral aspen
#

It has to do with permissions I think.

solemn leaf
#

bcs it has perms

#

and its

#

("ADD_REACTIONS")

feral aspen
#

In the server I am testing, It isn't adding the reactions and it errors, but in my main server, it does

feral aspen
solemn leaf
#

and also

#

it should be like

#

message.channel.me.has

feral aspen
#

Ha, it yet didn't return

solemn leaf
#

bcs channels can have their own permissions

feral aspen
#

It still doesn't return.

#

It isn't adding reactions and since it isn't adding reactions, it errors TypeError: promptMessage is not a function.

#

Hm, one sec, I may have figured it out.

#

Hm, it wasn't from the permissions, but somehow in my main bot, the function works fine but in my testing bot, it doesn't, unsure why!

mellow kelp
#

gotta love google

#

i was gonn search "is open source software good"

#

and the first suggestion i got was "is open source communism"

glossy spoke
#

lmao

crimson vapor
#
Array.from(new Set(commands.map(cmd => cmd.category)))``` is there a better way to do this?
feral aspen
earnest phoenix
feral aspen
#
    promptMessage: async function(message, author, time, validReactions) {
        time *= 1000;

        for (const reaction of validReactions) await message.react(reaction);

        const filter = (reaction, user) => validReactions.includes(reaction.emoji.name) && user.id === author.id;

        return message
            .awaitReactions(filter, { max: 1, time: time})
            .then(collected => collected.first() && collected.first().emoji.name)
    }
#

It works perfectly fine in my main bot, though.

#

Not sure why it is erroring in the testing bot.

#

Example on rock paper scissors command.

    const m = await message.channel.send(rpsembed);
    const reacted = await promptMessage(m, message.author, 30, chooseArr);

    const botChoice = chooseArr[Math.floor(Math.random() * chooseArr.length)];

    const result = await getResult(reacted, botChoice);
    await m.delete(rpsembed);
``` It works PERFECTLY fine on the main bot, but why does it error here?
grizzled raven
icy skiff
#

hey stupid question, where do i grab my dbl token

grizzled raven
#

on your bot's edit page, scroll down iirc

#

i don't have it open at the moment

icy skiff
#

ooo found it

#

ty

feral aspen
#

Welp.

icy skiff
#

Anyone knows why the webhook is not working? neither the test or the vote. Its the first time im messing with webhooks so bear with me plz

earnest phoenix
earnest phoenix
feral aspen
#

What??

#

How?

cinder patio
earnest phoenix
#
async function promptMessage(message, author, time, validReactions) {
        time *= 1000;

        for (const reaction of validReactions) await message.react(reaction);

        const filter = (reaction, user) => validReactions.includes(reaction.emoji.name) && user.id === author.id;

        return message
            .awaitReactions(filter, { max: 1, time: time})
            .then(collected => collected.first() && collected.first().emoji.name)
    }
cinder patio
#

In what object do you define promptMessage

#

more context

icy skiff
feral aspen
cinder patio
#

ah

#

Show how you export it and how you import it

earnest phoenix
earnest phoenix
feral aspen
#
const { promptMessage } = require("../../functions/functions.js");
earnest phoenix
feral aspen
#

The function works perfectly fine in my main bot, but doesn't work on my canary bot for some reason.

cinder patio
#

how do you export it

feral aspen
#
module.exports.run = {
    promptMessage: async function(message, author, time, validReactions) {
        time *= 1000;

        for (const reaction of validReactions) await message.react(reaction);

        const filter = (reaction, user) => validReactions.includes(reaction.emoji.name) && user.id === author.id;

        return message
            .awaitReactions(filter, { max: 1, time: time})
            .then(collected => collected.first() && collected.first().emoji.name)
    }
};
earnest phoenix
feral aspen
#

Bruh.

cinder patio
#

... you export it in a run object

#

so you need to do

import {run} from "...";

run.promptMessage(...
feral aspen
#

Why though? the function works perfectly fine on my main bot?

icy skiff
#

sorry for taking long to answer

cinder patio
#

try it

earnest phoenix
# feral aspen Bruh.

its better, when you would create a class, then you can save all functions on a client.function and access on them

earnest phoenix
feral aspen
cinder patio
#

umm... you import the run object from the file where you export it?

icy skiff
#

theres no error

#

but nothing happens

feral aspen
#

tf.

#

How did that work.