#development

1 messages · Page 882 of 1

royal portal
#

its only reacting to the command I sent

quartz kindle
#

show full code

royal portal
#

not the message bot sent

#

if(command === "someone") {

const embed = new Discord.MessageEmbed()
.setDescription('reaction')
message.channel.send(embed).then(() => {
message.react('486453662923751424')
message.react('486453681940594699')

quartz kindle
#

i told you

#

newMessage => {

#

newMessage.react()

#

message is the old message, not the new

digital ibex
#

so uh, (probably wrong) message.channel.guild.getAuditLogs().then((e) => e.executor));

quartz kindle
#

how about you console.log(e) ?

digital ibex
#

would that be correct to get the way to get the member who done the action

royal portal
#

so

#

if(command === "someone") {

const embed = new Discord.MessageEmbed()
.setDescription('reaction')
message.channel.send(embed).then(newMessage => { newMessage.react() })
message.react('486453662923751424')
message.react('486453681940594699')

digital ibex
#

ok

royal portal
#

would that work

quartz kindle
#

so you can actually see what's going on instead of coding blindly

#

@royal portal no

royal portal
#

where would I add the reaction id

quartz kindle
royal portal
#

oh

digital ibex
#

ok, this is hard uh

#

im kinda confused

quartz kindle
#

did you log e?

digital ibex
#

yeah

quartz kindle
#

and?

#

what does it show

digital ibex
#

and it logs users which is an array

#

then it says promise pending again

#

so

royal portal
#

newMessage is not defined

digital ibex
#

i add .then((e) => console.log(e)) and same output

#

¯_(ツ)_/¯

quartz kindle
#

show it

royal portal
#

message.channel.send(embed).then(newMessage => { newMessage.react() })
newMessage.react('486453662923751424');
newMessage.react('486453681940594699');

digital ibex
#

what it logs?

quartz kindle
#

@royal portal dude...

royal portal
#

message.channel.send(embed).then(newMessage => { newMessage.react('486453662923751424'); })

quartz kindle
#

yes

#

newMessage only exists inside that block

royal portal
#

newMessage is not defined

quartz kindle
#

?

#

did you not remove the newMessages outside the block?

royal portal
#

wait it works now

#

but would I do

#

'291489214891284218' , '192481248192481' for two reactions?

quartz kindle
#

same as before

royal portal
#

in order so tick then cross

quartz kindle
#

just all newMessage lines have to be INSIDE the {} block

#

you can do like this js message.channel.send().then(newMessage => { newMessage.react() newMessage.react() })

royal portal
#

yay

#

I did it different way

bright meadow
#

@winged mulch so you have maps in python too right

winged mulch
#

What are maps?

bright meadow
#

did you ever code before

earnest phoenix
#

dictionaries

winged mulch
#

Ah, yes

royal portal
#

message.channel.send(embed).then(newMessage => { newMessage.react('486453662923751424'); newMessage.react('486453681940594699'); })

bright meadow
#

so in a map you can put two values each

royal portal
#

I did that @quartz kindle

slender thistle
#

dictionaries for Python but commands extension allows you to add cooldowns to commands with decorators nekothinking

winged mulch
#

They are called dictionaries in python

bright meadow
#

ah okay

quartz kindle
#

@royal portal yes, it doesnt matter if its all in the same line, or separated in multiple lines, what matters is that its inside {}

royal portal
#

what about an error log

bright meadow
#

so you will make a dictionary and everytime a user executes a command, you put in the user id and the number 1, in case he isnt in the map yet
if he is in the map, you increase this number

royal portal
#

do I add .then(console.error); at end?

quartz kindle
#

.catch(console.error)

royal portal
#

message.channel.send(embed).then(newMessage => { newMessage.react('486453662923751424'); newMessage.react('486453681940594699'); }).catch(console.error);

#

so that works?

bright meadow
#

then you make a limit, how many commands a player should be able to run within a time
check everytime he runs a command if the number in the map is bigger than ur limit, then cancel the command

#

and you also create a timer which will run every X seconds, which clears the dictionary

#

done

winged mulch
#

@bright meadow I thought about doing that but I don't know how to use time.

wide ridge
#

Hamburger is your bot sharded?

quartz kindle
#

@royal portal that will work for errors during the sending of the embed, not for errors during the reacting

bright meadow
#

I did 5 commands every 3 seconds, so it cancels a command if the number in the dictionary is 5 or greater (greater shouldnt be possible tho)
and so I created a Timer, which clears the map every 3 seconds
@winged mulch

quartz kindle
#

to catch errors on the reactions, add it to the reactions as well: .react().catch(console.error)

royal portal
#

shard?

restive furnace
#

i prefer 5 seconds cooldown

bright meadow
#

i dont

restive furnace
#

and 0.5 cmds per second

earnest phoenix
#

Hey

bright meadow
#

no wtf xD

restive furnace
#

yes xD

slender thistle
#

@winged mulch Do you use discord.py's commands.Bot or discord.Client

bright meadow
#

depends on bot type ig

earnest phoenix
#

Chi e ita?

winged mulch
#

@slender thistle Bot

bright meadow
#

i have a game bot so it will get boring if you have a too long cooldown

winged mulch
#

@bright meadow Thanks for the information.

bright meadow
#

yw

#

xd

coarse topaz
#

Hey!
How can I make a system that when a message receives a specified reaction, the bot will edit the message and change a number from 0 to 1? and then when it gets another reaction it will edit the message again and change 1 to 2, etc? - I'm using Discord.js
This is my current code:

let hotw_committee_role = "698660218040483921";
  let hotw_committee_members = message.guild.roles.cache.get(hotw_committee_role).members;

if (message.content === `example command`){
  if (message.author.bot) return;
        message.delete()
    const Embed = new Discord.MessageEmbed()
        .setTitle(`example`) 
        .setDescription(`example`)
        .setColor('color')
  message.channel.send(Embed)
    const Embed2 = new Discord.MessageEmbed()
        .setDescription(`Current votes: **(number/${(hotw_committee_members.size/2) +1})** \n\n(**Bot's reaction doesn't count!**)`)
        .setColor('color');
  const m = await message.channel.send(Embed2)
    m.react("698687776421445654")
    const a = db.fetch("message")
    if(!a) db.set("message", [m.id])
    else db.push("message", m.id)
    message.channel.send(`Test Message`)
  };  
});
  const approvedIDs = new Set();
  const upvoteID = "698687776421445654", committeeRoleID = "698660218040483921";
  const committeeMembers = message.guild.roles.cache.get(committeeRoleID).members;
  const requiredCount = Math.ceil(committeeMembers.size / 2) + 2;
  if (emoji.id !== upvoteID || count < requiredCount || approvedIDs.has(message.id)) return;
  approvedIDs.add(message.id);
  message.channel.send(`Test Message");
});

Thank you very much, please Ping me when replying 😛

#

The word 'number' is where the function should be at:
(number/${(hotw_committee_members.size/2) +1})**

earnest phoenix
#

hi installed ubuntu nodejs and npm ```sudo apt install nodejs

sudo apt isntall npm

node -v
v8.10.0

npm -v
3.5.2``` WHYY????

#

WHY Version

#

node js 12 ??

topaz fjord
#
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt install nodejs
#

@earnest phoenix

earnest phoenix
#

Tanks bro

#

npm verssion really 6.14.4 ?

digital ibex
#

hi uh

#
module.exports = () => {
    console.log('edited');
};
#

in my messageUpdate.js and uh

#

it just spams edited for some reason

#

any ideas why?

#

nothing else spams

#

like same dir and everything, but

#

¯_(ツ)_/¯

#

spams

royal portal
#

@quartz kindle how would I send an emoji in a message

#

I tried it and it only sends the id

digital ibex
#

@royal portal <:emojiname:emojiId>

royal portal
#

doesn't work

#

it just sends the name

#

figured out

digital ibex
#

@royal portal is ur bot in the server the emoji is from?

royal portal
#

no I used a different method

#

for custom emojis

#

it works now

#

thanks for helping too

digital ibex
#

np

earnest phoenix
#

How can i fix "process.send is not a function" i am not tried this code but i am seeing it on every opening..

v12?

#

what is the full stacktrace

amber fractal
#

What node version do you have?

digital ibex
#

is process.send all the code?

amber fractal
#

It's in the discord.js shardingutil file

#

It must be a parent process, where process.send() isn't defined

restive furnace
#

I don't really understands Eris's sharding system, can someone please explain me little bit about it, example how do I shard my bot?

digital ibex
#

its ur client options

#

in ur*

#

eris doesn't have djs' wack sharding manager

restive furnace
#

so I just make sharded true or something like that?

digital ibex
#

no

#

just maxShards: number

restive furnace
#

oh, nice.

digital ibex
#

maxShards: number?: amount of shards

#

yep

#

got me sharding at 24 servers

restive furnace
#

and are there way to get all shards to execute some code, like d.js has broadcastEval?

digital ibex
#

i haven't really looked into sharding much since i don't really need it but, i do not believe so

restive furnace
#

so I need to use some process.send or so. thanks for the help :)

digital ibex
#

np

quartz kindle
#

i believe eris does internal sharding

restive furnace
#

okay

quartz kindle
#

there is a separate sharding manager for eris if you prefer process sharding

restive furnace
#

okay, well ill probably use it if eris own shard manager wont provide such info as: current shard, current cluster, shard guilds, shard users.
Well, I looked little bit into the docs, and I dont seem so it doesnt.

amber fractal
#

That's kinda the point of internal sharding I believe

quartz kindle
#

all that info is available

#

its just harder to get with internal sharding

#

for example, you need to loop over guilds and count the number of guilds on a given shardID

white sun
#

is it allowed to add a german bot to top.gg?

sudden geyser
#

are you resolving the promise first?

low bolt
#

ye

#

always says [object Promise] or Promise { 'MESSAGE' }

#

Shows message correct

vast oxide
#

Any ideas on how to check if my bot has permission to post in a text channel?

sudden geyser
#

What library.

#

@low bolt can you show how you're resolving it.

iron steeple
#

@vast oxide I believe there is a channel.permissionsfor(member) method

low bolt
#

Function:

    if (language !== "en_US" && language !== "tr_TR") return console.log(`${language} dili bulunamadı!`)
    const file = require("../languages/" + language + ".json");
    const text = file[message]
    if (!text) return console.log(`${language} dilinde ${message} mesajı bulunamadı!`)
    return text;
  };```

**Tests:**

console.log(client.locale("en_US", "testtest"))
console.log(client.locale("trtadkt", "testtest"))
console.log(client.locale("en_US", "Version"))

const test = client.locale("en_US", "Version")
console.log(test)```

en_US.json:

"Version" : "1.0.0"
}```

**Results:**
```testtest is invalid message!
Promise { undefined }
trtadkt is invalid language!
Promise { undefined }
Promise { '1.0.0' }
Promise { '1.0.0' }```
vast oxide
#

@iron steeple doesn't seem like it. I can get overrides but if there is no override then it won't show right?

low bolt
#

client.channels.get("CHANNEL ID").send(test)

Cannot send an empty message

sudden geyser
#

yeah see, your locale function is async. You need to resolve the function first, then log it.

iron steeple
#

One second @vast oxide

sudden geyser
#

Either by using await, or .then

copper viper
#

might count as off-topic, but how do some bot pages have websites embedded in them?

#

e.g: dank memer

hasty sparrow
#

Use an iframe

low bolt
#

@sudden geyser I deleted async and it works idk why, I never see an error like that but thanks

sudden geyser
#

yeah you didn't need async in the first place but I don't know if that'll work in the long run

raven urchin
#

My bot is offline but no error in the logs. How can I start it up?

copper viper
#

node botname.js?

raven urchin
#

?

copper viper
#

if it says it's offline just restart it

raven urchin
#

How can I restart it?

earnest phoenix
#

node mainfile.js

#

or pm2 restart <processname> if you're using that

sudden geyser
#

how'd you start it the first time?

earnest phoenix
#

^

raven urchin
#

I just made it atm. it's a hangman bot.

#

Only use Utils.json and Hangman.js but I don't know how to start it

sudden geyser
#

Assuming it's a nodejs project, use node mainfile.js

#

If you have a main prop in your package file, you may be able to do node .

earnest phoenix
#

in your case it would be node hangman.js most likely

copper viper
#

oh but you might have to ctrl+c

raven urchin
#

I'ma go try it, hold on

outer niche
#

How would I mention a channel in Python Would it be something like {channel. mention} like if I wanted it to mention the channel rules every time the command was ran

slender thistle
#

channel_object.mention
Or put <#id> in string

outer niche
#

Ok thx

modest maple
#

Thats not how f string work

#

have you tried: Reading the message next to that big red X with that lil pop up that you have to click on to do anything else on

earnest phoenix
#

i don't even understand the logic of that one facepalmp

modest maple
#

also that indentation is bc_noelle_why

outer niche
#

I get it It says if there's nothing in it but I have put stuff there

umbral socket
#

How much would it cost to get a bot developed? Like would $200 be enough to get something with good quality?

split hazel
#

People most likely charge much less than that

quartz kindle
#

questionable quality tho

split hazel
#

Though if you hire an expert with years of experience

#

I'm not sure

quartz kindle
#

depends on the features requested

#

and developer experience of course

umbral socket
#

It'd be a pretty slightly complex trivia bot with a trusty database

#

I've paid $50 for one before and it was great quality, but not as intense

slender thistle
#

I mean you can order customization

fallow quiver
#

I need some help, I'm actually building a website for my bot and I'm trying to make one image fade to another:

async function changeImg(element, iterator) {
    if(iterator < image.length - 1) { iterator++ }else { iterator = 0 }
    for(n = 255; n > 0; n--) {
        await setTimeout(() => {  element.style.opacity = (n / 255); }, 1000);
    }
    element.src = image[iterator];
    for(n = 0; n < 255; n++) {
        await setTimeout(() => {  element.style.opacity = (n / 255); }, 1000);
    }
    return iterator;
}

This is called to change images, however, the delay doesn't exist

slender thistle
#

So you could dynamically add stuff on the go without paying the dev to add them

tired cloud
#

quick: easy, reliable, free, unlimited GWrjkKappaLUL

quartz kindle
#

dont use javascript animations like that

#

use css transitions

#

animating with javascript like that is very inefficient

fallow quiver
#

Can I call a CSS animation in the JS?

quartz kindle
#

yes

fallow quiver
#

Oh

quartz kindle
#

but you dont even need to

#

define a transition in css, then swap the img opacity

#

the transition will do the rest

fallow quiver
#

Ok I'll look into that

toxic plinth
#

I found a bot on github and it was completely broken and didn’t have a license file, if i fixed it, can i put it on top.gg?

split hazel
#

Sure

toxic plinth
#

Ok thanks

split hazel
toxic plinth
#

Ok

split hazel
#

This is more of a development questions channel

toxic plinth
#

Wasn’t sure what is was related to

craggy cave
#

If a repository has no license, then all rights are reserved and it is not Open Source or Free. You cannot modify or redistribute this code without explicit permission from the copyright holder. @toxic plinth @split hazel

modest maple
#

have you ever heard of this lil thing called

#

dont copy someone elses code tho

mossy vine
#

copied bots arent allowed on the website afaik

modest maple
#

think about this: if its broken if your gonna go through the effort fixing why even copy it in the first place

#

I could remake that bot in about 5 minutes

hidden bone
#

I need help using aiohttp to access the bot vote pages in discord.py. I mostly figured out how I'm supposed add a header, but it says it has to be a dict. I tried at least 10 combinations but I cant figure out how to authenticate it

modest maple
#

you know theres a lib for dbl right

quartz kindle
#

isnt it simply this in python? js headers: { Authorization: token }

modest maple
#

its very simple

still merlin
#

I'm meddling around with my code and I tried to make a bot suffix, would this code work (what I'm trying to do is when I go -ping. it will respond but without the full stop nothing happens?)

var SUFFIX = ".";
var prefix = "-"

bot.on("message", message => {
    let args = message.content.substring(SUFFIX.length).split(" ");
    let args = message.content.substring(prefix.length).split(" ");
  
    switch (args[0]) {
      case "ping":
        message.reply("Pong!");
        break;
    }
  });

tag me with a response please I'm not active here

modest maple
#

but i thought i'd share the idea that theres a lib for it which most people have anyway with topgg

quartz kindle
#

@still merlin that will simply error out because args is already defined

modest maple
#

also wouldnt regex be better for that

still merlin
#

how do I do it I go -ping. it will respond but without the full stop nothing happens then?-

quartz kindle
#

just do js if(message.content.startsWith(prefix) && message.content.endsWith(SUFFIX)) { continue the code here }

still merlin
#

ok thanks so much!

hidden bone
#

This is my code and it still doesnt work:
async def get_votes():
async with aiohttp.ClientSession() as session:
headers={'Authorization':'token'}
async with session.get('http://top.gg/api/bots/655157441612349453/votes', headers=headers) as r:
js = await r.json()
return js
and it says nauthorized

still merlin
#

@quartz kindle so sorry for the tag the code you sent isnt working

modest maple
#

he wasnt just gonna spoon feed u the code

#

...

fallow quiver
#

Switching Command Line Args has me so confused

modest maple
#

if you insist in not using the lib

quartz kindle
#

@still merlin of course you still need to define your args

earnest phoenix
#

When exactly do DBL votes reset? I assume the first day of the month, but what timezone does that follow?

quartz kindle
#

you can remove both ends from a string using .slice

#

for example: "1iwubeouweouhwoueh9".slice(1).slice(0,-1) = "iwubeouweouhwoueh"

#

@earnest phoenix i assume UTC

earnest phoenix
#

yeah I thought so too

quartz kindle
#

most servers servers follow timestamps

#

which are utc

earnest phoenix
#

I'll just assume they restart at that timezone then

lofty iron
#

Hey, someone wanna make a bot whit me? Then pls contact me! 🙂

heavy marsh
#

Is it possible to do an eval to get the first 10 user joins?

quartz kindle
#

first people who joined the server where you eval from?

heavy marsh
#

First 10 people to join a server

quartz kindle
#

you will need to fetch all members of the guild to be able to do that

#

which will cost a lot of memory and cpu if the guild is very large

heavy marsh
#

I am doing that on my private bot

#

So it will be fine

summer torrent
#

sort guild members by join date

#

sort()

heavy marsh
#

then display the first 10 members?

quartz kindle
#

yes

heavy marsh
#

ooh ok ..

pale vessel
#

does anyone know whether you really need python2.7 and a cpp compiler for eris voice support?

mossy vine
#

you do to build its dependencies

pale vessel
#

that sucks

earnest phoenix
#

I updated my quick db to the latest version so i can now use db.delete and stuff like that, i have a command that is resetting the coins by fetching all members and settings for each one 0 coins.
Should i change it?
What is faster / better?

pallid harness
#

Is somebody using BDfD

mossy vine
#

its widely hated around here so you are not going to get useful answers

grizzled raven
#

what is bdfd

#

better discord for discord? lmao

earnest phoenix
#

I updated my quick db to the latest version so i can now use db.delete and stuff like that, i have a command that is resetting the coins by fetching all members and settings for each one 0 coins.
Should i change it?
What is faster / better?

#

Asking again because idk if you can see it

grizzled raven
#

i can see it i just went to do a quick google search

quartz kindle
#

the faster and better way is to delete the table

grizzled raven
#

anyway, deelet

#

tim meanie

quartz kindle
#

haha noob

grizzled raven
earnest phoenix
#

So is it like db.delete(message guild id)

quartz kindle
#

lmao

earnest phoenix
grizzled raven
#

yes

quartz kindle
#

if that works, yes

#

i dont use quick.db so idk

topaz fjord
#

quick.db is a synonym of shit

earnest phoenix
#

Oh ok
Guess its better than fetching all users lmao

topaz fjord
#

daily opinion spreading by turtle

grizzled raven
#

hey im going to take a quick quick.db

earnest phoenix
#

I love quick.db

grizzled raven
earnest phoenix
topaz fjord
#

I'd rather git commit than use quick.db

#

quick.db = sqlite wrapper

#

just use

#

sqlite

quartz kindle
#

they dont wanna bother learning sql

topaz fjord
#

then use a json db

#

that's better than fucking quick.db

quartz kindle
#

quick.db is basically json+sql

#

lmao

grizzled raven
#

lol why do you hate it so much

topaz fjord
#

I hate it a lot

#

since it's a waste of time

split hazel
#

quick.db is just a wrapper for better-sqlite3

topaz fjord
#

and fucking shit

grizzled raven
#

how is it a waste of time lmao

#

if people wanna go the easy way and struggle later, let them

topaz fjord
#

you're better off learning sqlite and applying those skills to MySQL instead of learning how to use quick.db

#

future proof™️

#

sadly the easy way is also the shit way most of the time

quartz kindle
#

i mean, better start with something simpler that works, than starting with a full database system and building it all wrong

modest maple
#

alternatively instead of using MySQL which is slow as fuck, you use sqlite for testing systems then use postgres

split hazel
#

I started with keyv at first, then moved onto raw sql

heavy anchor
#

How do I get a url for the message author profile picture?

quartz kindle
#

i started with json :)

earnest phoenix
#

What is the difference between
DisplayAvatarURL
avatarURL

quartz kindle
earnest phoenix
#

Oh

#

So its better using displayAvatarURL

heavy anchor
quartz kindle
#

probably

heavy anchor
#

well it works here

quartz kindle
#

what do you want to use it for?

#

you can specify the format in the options

heavy anchor
#

okay thx

quartz kindle
stark burrow
#

• Autoplay video or audio
So you're not allowed to put a muted html video that autoplays into your bot page? html (mp4) videos load better and filesize/quality is better. 🤔

amber fractal
#

it says autoplay video

#

so take a guess

scenic kelp
#

a muted video is still a video

heavy marsh
#

Is it possible to get information from a playing link in v12.1.1

earnest phoenix
#

what

heavy marsh
#

Let say the bot is playing this link http://20103.live.streamtheworld.com/TLPSTR09.mp3. Is it possible to get information about what the bot is playing?

still merlin
#

My code

bot.user.setActivity("watching for commands");
});
``` is coming out "playing watching for commands"
pale vessel
#

god

heavy marsh
#

Playing is default

finite bough
#

playing is the default activity type

#

there are 4 activity types

#

listening, playing, watching, streaming

summer torrent
#

{type:"WATCHING"}

earnest phoenix
#

Let say the bot is playing this link http://20103.live.streamtheworld.com/TLPSTR09.mp3. Is it possible to get information about what the bot is playing?
@heavy marsh
playing as in presence-wise?

#

i don't get what you mean

#

be more descriptive with your goal

finite bough
#

mp3 as presence?

heavy marsh
#

presence-wise ??

#

I am confussed

earnest phoenix
#

so am i

#

what do you want to do

pale vessel
#

define "information" that you want from the stream

heavy marsh
#

Like say what is currently playing on that link

pale vessel
#

what

earnest phoenix
#

you can't

quartz kindle
#

is that like a radio station?

heavy marsh
#

http://20103.live.streamtheworld.com/TLPSTR09.mp3 - Radio Station Link

#

Yes

quartz kindle
#

then you cant

earnest phoenix
#

they need to provide you with an API which gives you the current playing song

heavy marsh
#

any way to do it?

earnest phoenix
#

the stream is just sending audio data

finite bough
#

^

opaque seal
#

Hi guys, I would like to set up a bot web dashboard. The fact is that I just know the basics of html / css. Do you guys think I can do it? Any advice?

heavy marsh
#

then can I do something like this ...
!play <link> then i do !np - This will give the link that its playing.

Is that possible or should I store it?

quartz kindle
#

@heavy marsh where are you supposed to get the information from?

pale vessel
#

probably not @opaque seal

quartz kindle
#

where is it available?

#

can you see it anywhere?

earnest phoenix
#

i'd suggest first learning more about web development @opaque seal

turbid bough
#

can i use xml instead of database?

knotty steeple
#

no

#

u should not

earnest phoenix
#

that's equivalent of json, which is just as bad

knotty steeple
#

exactly

opaque seal
#

So I need to change the database of my bot to something else? Is json that bad that I have to switch?

knotty steeple
#

yes it is

turbid bough
#

json isnt even a database lol

earnest phoenix
#

you're more likely to experience blocking on data insertion and data corruption

turbid bough
#

its never made to

heavy marsh
#

I mean I was looking for some examples and I so something like this

        if (!station) message.error("An error occured.");

        const broadcast = this.client.stations.get(station);

        message.reply(`Playing **${broadcast.current.title}** on the **${station}** station.`);```
opaque seal
#

Ahhhh

#

Rip me

#

Shouldn't be that hard to learn, let's say, SQlite

turbid bough
#

thats ok

#

but not for big databases

opaque seal
#

What would you suggest

heavy marsh
#

mongooes

#

mongoDB

earnest phoenix
#

i personally love using postgres for big scale

#

it's opensource and outperforms most databases out there

heavy marsh
earnest phoenix
#

yup

heavy marsh
#

ooh

turbid bough
#

but beware, it does not support ulong's

#

and discord uses ulong

#

for id's

earnest phoenix
#

guess what

#

postgres supports 64 bit (un)signed ints

turbid bough
#

are u sure?

amber fractal
earnest phoenix
#

yup, there's an extension for it

#

advantage of it being open source

turbid bough
#

wait, bigserial

#

i just found it

#

oh wait nvm, that just is bigint, but cut half

#

weird how "big int" is 8 bytes, that is signed
but bigserial is also 8 bytes but unsigned. but still has the same positive max range value

fallow mango
#

Do you have any idea on how to run multiple JavaScript files from one JavaScript file?

quartz kindle
#

there's a billion ways to do that, what exactly do you mean?

#

the correct way depends on what you want to do

turbid bough
#

require()?

fallow mango
#

I want all my js files to load when I run the main js file

quartz kindle
#

then require them

#

btw thats not "running" then, its just importing/loading them

fallow mango
#

What would I put in the require() exactly?

turbid bough
#

filename

quartz kindle
#

the file you want to load

fallow mango
#

Ok

quartz kindle
#

the path to the file

fallow mango
#

Thanks you

quartz kindle
#

for example const something = require("./file.js") if the file is in the same folder as your main file

valid frigate
#

ok to add on to my problem there is a .gradle directory and gradle-wrapper.properties is not in it

royal portal
#

how would I make it so the bot reacts to its own message and if ppl react to it then it gets pinned

valid frigate
#

you mean like starboard?

royal portal
#

kind of

valid frigate
#

assuming it's djs then you can just listen for a message reaction add event

#

i think

vernal basin
#

how does one find what version of node.js you're on?

royal portal
#

node -v

#

I think

vernal basin
#

ah yes ty

#

wait hold up

#

last time i checked i was not on 8.11.3

quartz kindle
#

you get that if you install it with apt

#

linux repos for node are outdated

vernal basin
#

did I screw up again notlikenoot

#

also I can't find this anywhere in the docs, but there's no hasRole right

#

for Member

#

or GuildMember rather

still merlin
#

i typed node .

royal portal
#

do you have the node modules installed

#

node install discord.js

#

i mean

quartz kindle
#

@still merlin client is not defined

royal portal
#

npm install discord.js

quartz kindle
#

thats a problem in your code

still merlin
#

oh

#

Im not getting any errors

quartz kindle
#

that is the error lol

still merlin
#

my code is

const Discord = require("discord.js");

const bot = new Discord.Client();

const token = "*my token*";
bot.login(token);

var prefix = "-";

client.on("ready", () => {
  console.log("Bot is up and running");
});

bot.user.setActivity("for commands", {
  type: "LISTENING",
});

bot.on("message", (message) => {
  let args = message.content.substring(PREFIX.length).split(" ");

  switch (args[0]) {
    case "pfp":
      message.reply(" message.reply(message.author.displayAvatarURL())");
      break;
  }
});
quartz kindle
#

you dont have client

#

you have bot

royal portal
#

@quartz kindle possible to check if user is nitro?

still merlin
#

ooh

turbid bough
#

yes

royal portal
#

@still merlin change client.on to bot.on

still merlin
#

my bot still is not coming on

turbid bough
#

whats the error?

still merlin
#

none

royal portal
#

show me

still merlin
#

im not getting a error it wont turn on

royal portal
#

show

vernal basin
#

if one of my arguments is a ping, i.e. @vernal basin, why does args[0].roles not work?

still merlin
royal portal
#
const Discord = require("discord.js");
const bot = new Discord.Client();

var prefix = "-";

bot.on("ready", () => {
  console.log("Bot is up and running");
});

bot.user.setActivity("for commands", {
  type: "LISTENING",
});

bot.on("message", (message) => {
  let args = message.content.substring(PREFIX.length).split(" ");

  switch (args[0]) {
    case "pfp":
      message.reply(" message.reply(message.author.displayAvatarURL())");
      break;
  }
});

bot.login('token')
quartz kindle
#

@still merlin did you save the file and run again

still merlin
#

is that fixed code

#

i saved and re-opend

royal portal
#

should be

#

try mine

quartz kindle
#

its still showing the old error in the terminal

royal portal
#

tim

prime cliff
quartz kindle
#

you still have client

royal portal
#

is it possible to check if user is nitro

prime cliff
#

That's clearly wrong

quartz kindle
#

you still have client there

still merlin
#

oH

royal portal
#

message.author.premium?

still merlin
#

bot is not coming online still

#

and I have to go

bitter nexus
#

Hi all
I need some help
I want to create a bot which will choose one of the group of my friends who wrote a special command on the server
And after that bot randomly sends someone a private message that will include a code information
So i cant understand how to make the bot send direct messages to someone from the group
Sry for my broken english :(
Thank you in advance

turbid bough
#

probably a missing quote

heavy marsh
#
connection.play(`http://20103.live.streamtheworld.com/TLPSTR09.mp3`);
message.channel.send(`![music](https://cdn.discordapp.com/emojis/678746440595406856.webp?size=128 "music") **Now Playing ...**\n**Radio Station:** 538 Non-Stop`);

The bot joins starts playing and stops. I have not got any errors on the console

quartz kindle
#

@royal portal you cant check for nitro with discord.js

royal portal
#

aw

hardy vector
#

how do u add a slowdown to a command in discord.js so a user can use it only once every hour

#

pls dont ban me for cross posting in general as well

iron steeple
#

It’s under cooldown when you define the command

hardy vector
#

wdym

#

for discord.js?

iron steeple
#

So like commands.command(cooldown=)

hardy vector
#

.js not .py

iron steeple
#

In python not sure about js sorry

royal portal
#

lol

#

you pinged someone

iron steeple
#

Oops!

hardy vector
#

me?

royal portal
#

👀

bitter nexus
#

No one can help me?
Im using python

hardy vector
#

untethered can

turbid bough
#

cooldown per user?

hardy vector
#

me, yes

iron steeple
#

@bitter nexus what do you need help with

turbid bough
#

create a pool of users when the last user has used that command and check how much time since that command has been used

bitter nexus
#

Hi all
I need some help
I want to create a bot which will choose one of the group of my friends who wrote a special command on the server
And after that bot randomly sends someone a private message that will include a code information
So i cant understand how to make the bot send direct messages to someone from the group
Sry for my broken english :(
Thank you in advance
@bitter nexus

hardy vector
#

uses all brain power to try to understand

#

@turbid bough can u show me how it looks like but dont spoonfeed me

iron steeple
#

@bitter nexus simply use member.send

bitter nexus
#

i have group of my friends and i want to randomly choose one of them
And sent him direct message with some information

iron steeple
#

So get the member as a variable @bitter nexus

turbid bough
#

create an array, and do an if(member.time > time.now)

hardy vector
#

create an array of all users

royal portal
#

how would I make it so if anyone is in a specific server then they have access to a command and if they aren't in the server, they get an error message

hardy vector
#

but my bot is in a 6k person server how

turbid bough
#

not all users lol

hardy vector
#

then which onez

turbid bough
#

just the ones who used that command

hardy vector
#

oh how to do that

earnest phoenix
#

When I open the bot (@earnest phoenix) , it opens late. But the other bot (Eagle's test) does not open late. What is the reason for it to open late? (the same infrastructure) (Note: Eagle has 767 server count.)

bitter nexus
#

Yea that my problem
I cant create variable which contains someone of the group

iron steeple
#

@earnest phoenix it has to cache messages

royal portal
#

how would I make it so if anyone is in a specific server then they have access to a command and if they aren't in the server, they get an error message
@royal portal

#

anyone know how

iron steeple
#

@bitter nexus DM me your code for that

quartz kindle
#

what do you mean "opens late"

iron steeple
#

I think he means there is a delay

earnest phoenix
#

I don't know English so much

quartz kindle
#

a delay in what? in logging in? in getting ready? in replying to messages?

iron steeple
#

Do you mean it takes some time to activate

earnest phoenix
#

Yeah logging and getting ready

iron steeple
#

Yes I believe that is due to the need to cache messages and fully initialise

quartz kindle
#

how much delay?

earnest phoenix
#

Usually doesn't logging

#

And no error

turbid bough
#

@hardy vector when your command is used, just add the user to the list with data with time when the command was used.
then check how long ago it was since the bot was used, currentTime - user[id].time or something like that

earnest phoenix
#

Sometimes 5 minutes or later

quartz kindle
#

discord.js?

earnest phoenix
#

Yes

quartz kindle
#

v11 or v12?

hardy vector
#

@turbid bough do i need a database for that

#

or no

iron steeple
#

Hmm 5 minutes seems very weird

turbid bough
#

not needed no

hardy vector
#

k

earnest phoenix
#

11.5.1

turbid bough
#

but only if you want to make it persist trough instances and reboots

hardy vector
#
var user = [message.author.id]```
#

so like that

quartz kindle
turbid bough
#

nah not like that

earnest phoenix
#

Thanks 🙂

royal portal
#

I guess I can't do it

earnest phoenix
#

Btw I love Eri 😄

royal portal
lapis stirrup
#
if (message.guild.id !== 'ID') return (error message)
turbid bough
#

So, you initialzie an array at the start of the program, then once the command has run, you add user users.add(userid, time.current) if py has something like that,
then compare it when the command has been executed again

royal portal
#

I mean if the user is in a specific server and uses command anywhere then it works but if they aren't then it says you don't have perms

lapis stirrup
#

ah

earnest phoenix
#

Also I am using Mongodb and it too many connections. How/can I fix it?

royal portal
#

so if I'm in DBL then I can use cmd

quartz kindle
#

you need to fetch it because they might not be cached

royal portal
#

and if I'm not, it says I don't have perms

#

but how would I check if the user is in the server?

hardy vector
#

@turbid bough im using js

quartz kindle
#
let member = await client.guilds.cache.get(guildID).members.fetch(userID).catch(() => false)
if(member) {
  member is in the server
} else {
  member is not in the server
}```
lapis stirrup
#

Also I am using Mongodb and it too many connections. How/can I fix it?
@earnest phoenix Haven't used Mongo, but for SQL you can fix by making sure you close connections after you are done with them. There is also a way to increase the 'max connections'. Might be the same for mongo

royal portal
#

so I replace guildID with '2421712712741233213124'

turbid bough
#
var obj = {
    userId: time
};

if(obj[id] == undefined || obj[id].time + delay < currentTime){
  obj[id] = currentTime;
}

basically

#

i think

#

obviously var initialization on the start of the program

#

and the if statement in the command

hardy vector
#

ok

fallow quiver
#

Can You Get A Members Tag? member.get(id).username works but is there a way to get the tag?

turbid bough
#

discriminator

fallow quiver
#

discord.js

lapis stirrup
#

^

earnest phoenix
#

@earnest phoenix Haven't used Mongo, but for SQL you can fix by making sure you close connections after you are done with them. There is also a way to increase the 'max connections'. Might be the same for mongo
@lapis stirrup Frankly, I don't have much money, so I don't want to increase max connections. Closing the connections, it going into the bug.

#

Sorry for ping

turbid bough
#

discord js documentations isnt very googleable :/

lapis stirrup
#

Oh do you have to pay for more connections in mongo?

royal portal
#
let member = await client.guilds.cache.get('4819248192481924129').members.fetch(userID).catch(() => false)
if(member) {
  member is in the server
} else {
  member is not in the server
}
#

would that work tim

quartz kindle
#

discord.js documentation is one of the best documentations out there

lapis stirrup
#

I'm not too sure then, but I'm sure there are some answers on google

quartz kindle
#

its so easy to find everything

lapis stirrup
#

Hamburger that should yeah

turbid bough
#

yeah you can find it when you are in discord.js docs

quartz kindle
turbid bough
#

but not when searching it from google

quartz kindle
#

user.tag

#

or member.user.tag

fallow quiver
#

There is an issue with discord.js that I don't know how to fix

earnest phoenix
#

it is reach max connections by opening and closing connections. And opening in the place where it will close and reaching the maximum connection again.

fallow quiver
#

calling message.delete() works fine but saying message.delete(100) causes a crash. It's recent and I didn't see where the argument changed

earnest phoenix
#

Anyway, good night to all of you 🙂

#

Thanks for helps

lapis stirrup
#

Night! Sorry I couldn't help too much

turbid bough
#

you could try keeping a connection open all the time?

quartz kindle
gritty bolt
#

How do I remove the reaction of the user I collected from?

message.awaitReactions(filter, {max: 1}).then(collected => {
   const reaction = collected.first()
         if (reaction.emoji.name === "✅") {
             message.reactions.remove(collected.user.id)```
earnest phoenix
#

It was already like that, Thaun

fallow quiver
#

It's just a number right?

turbid bough
#

message.delete() would only delete the message you referenced

fallow quiver
#

Correct

turbid bough
#

you would use something like channel.deletemessages or something if you want to delete multiple messages

fallow quiver
#

Why would I delete a channel?

quartz kindle
#

@fallow quiver options is an object

fallow quiver
#

I just want a delay before the delete

royal portal
#

@quartz kindle for the userID how would I make it so if the user uses the cmd it checks their servers

turbid bough
#

ok ok

royal portal
#

not just someones

#

the person who used the cmd

turbid bough
#

delete(null, timeout)

fallow quiver
#

Which saying message.delete(100) used to do

lapis stirrup
#

@gritty bolt you can try reaction.remove(userID)

fallow quiver
#

Just pass a null obj?

turbid bough
#

or delete(timeout=100)

quartz kindle
#

an object

#

do you know what an object is?

turbid bough
#

if that works

fallow quiver
#

Yes

royal portal
#

anyone know?

quartz kindle
#

then give it an object

gritty bolt
#

how do I get a user ID to use that with from the collector>

royal portal
#

to check the userID of the person who used command

quartz kindle
fallow quiver
#

Ok, but it is using message as the object, the crash was just happening from the delay

quartz kindle
#

?

#

message.delete() takes an options object

#

message.delete({option1:value1,option2:value2})

topaz fjord
#

the proper object for a timeout would be { timeout: <whatever> }

fallow quiver
#

It's optional, right? So saying message.delete(timeout = 100) would work instead of passing an optional argument

topaz fjord
#

no

gritty bolt
#

@lapis stirrup I tried that and it says that userID is undefined

#

i dont know where to get the id from

topaz fjord
#

.delete() takes an object so .delete({ timeout: 100 })

fallow quiver
#

Ok

lapis stirrup
#

If collected.user.id works then you can use that, userID is just a placeholder

gritty bolt
tired cloud
#

collected user?

gritty bolt
#

yes I want to get the Id of the user who reacted

#

@tired cloud

tired cloud
#

collected is a collection

#

get the first and get the id

#

collected user isnt a thing

gritty bolt
#

can you give an example?

tired cloud
#

i literally told you what to do

#

use collected

#

get the first

gritty bolt
#

like collected.first()

tired cloud
#

and get the id

#

then id

gritty bolt
#

so collected.first(id)?

tired cloud
#

assuming its for a awaitMessages/awaitReactions

#

._.

#

.id

gritty bolt
#

yes its awaitReactions

#

so collected.first().id

tired cloud
#

no

#

have you ever read d.js documentation?

gritty bolt
#

yes

tired cloud
#

then you must know the difference between a property and a method

copper cradle
#

properties and methods have nothing to do with a library such as d.js

royal portal
#

anyone know how to dm user if once they join a specific server

#

so like id 2491204210492104

#

and if user joins that then they get DM

icy crane
#

You can check the users ID when the guildMemberAdd event is fired, and compare it against that ID

heavy marsh
#

message.guild.voiceConnection.dispatcher.volume - Is this not vaild for v12.2.0

royal portal
#

and then a 'verified' role in every server its in

icy crane
#

@heavy marsh, I dont think so, if I remember correctly I think its .connection.voice now

#

Could be wrong

heavy marsh
#

hmm let me check

lapis stirrup
#
bot.on('guildMemberAdd', member => {
    if (member.guild.id === "ID") <send dm>
royal portal
#

thank you

icy crane
#

breh spoon fed

#

Re

heavy marsh
quartz kindle
#

voice channels dont have dispatchers

#

voice connections do

heavy marsh
#

ooh okhttps://cdn.danbot.xyz/6UrHvk6n

#

Also 1 = 100% right?

topaz fjord
#

try changing it and see

#

but afaik yes

heavy marsh
#

is 0 - 3 Idea or 0 - 2?

#

the range I mean

earnest phoenix
#

for my page

heavy marsh
#

You mean embed?

earnest phoenix
#

yeah

topaz fjord
#

set meta tags

#

read up on them

heavy marsh
earnest phoenix
#

js?

heavy marsh
#

yep

topaz fjord
earnest phoenix
#

is for my page, not for my bot

topaz fjord
#

you can't do that with js

amber fractal
#

he means on youtube

topaz fjord
#

read the link I sent @earnest phoenix

amber fractal
#

lmao

earnest phoenix
#

ok

amber fractal
#

has nothing to do with discord.js

earnest phoenix
#

Eris and Discord.js has the same functions right?

amber fractal
#

or embeds

copper cradle
#

what you want is metatags

amber fractal
#

it's OG tags

topaz fjord
#

no @earnest phoenix

#

@amber fractal nou

#

oh wait

#

shit

amber fractal
topaz fjord
#

wrong link

earnest phoenix
#

@topaz fjord i mean like their functions like sending messages and stuff

#

@amber fractal yes

#

they are just different in function and properties names right?

#

but not for yt

topaz fjord
#

wrong link lmao @earnest phoenix

earnest phoenix
#

oh

amber fractal
#

They're called OpenGraph tags

earnest phoenix
#

@topaz fjord so?

amber fractal
topaz fjord
#

^

earnest phoenix
#

ok

topaz fjord
#

I'm a bit slow and confused the names for some reason

earnest phoenix
#

so does Discord.js and Eris has all the functions that each other has but just at different places with different names?

topaz fjord
#

some features in d.js aren't in eris

#

since they're different libs

amber fractal
#

they both offer full coverage of the discord api, I believe

#

if that's what you mean

earnest phoenix
#

yes thats what i mean

#

im working on a project that is recoding eris so it’s function and properties names are the same to save time for developers wanting to switch

#

what does eris lacks from discord.js?

#

like what does d.js has that eris doesnt?

quartz kindle
#

that will take a lot of work, good luck

amber fractal
#

they're very different

#

they handle data very differently

#

that's not a simple task

earnest phoenix
#

ik

quartz kindle
#

discord.js has a lot more helper functions and internal methods to make it easier to access certain things, they treat and process events differently as well

amber fractal
#

could he hook into each though?

#

could make it a little easier

earnest phoenix
#

how does eris fetches users?

topaz fjord
#

Eris doesn't have message collectors afaik

earnest phoenix
#

ok work, how i select the color? @topaz fjord

topaz fjord
#

good question

#

I don't know

earnest phoenix
#

xd

topaz fjord
#

haven't used them in a long time

amber fractal
#

select the color of the bar?

quartz kindle
#

<meta name="theme-color" content="#7289DA">

amber fractal
#

^

#

that's the one non OG tag that it uses I believe

quartz kindle
#

its not the only one

#

theres also <meta name="twitter:card" content="summary_large_image">

amber fractal
#

oh discord uses twitter meta tags too?>

#

Which one is that

quartz kindle
amber fractal
#

oh just an image and title

#

I didn't even know that existed

quartz kindle
#

neither did i, until now

topaz fjord
#

lmao

#

time to read an objc style guide to see everything I've been doing wrong

earnest phoenix
#

@quartz kindle @topaz fjord ty

heavy anchor
#

I have another stupid question for you awesome devs.
When I try using var myGuild = bot.guilds.cache.find(g => g.id == [Guild ID]); in a command it gives me this error Cannot read property 'guilds' of undefined

blissful scaffold
#

bot is undefined

heavy anchor
#

So is this wrong const bot = require("../bot.js"); I have it to get bot from my main page were it is defined

#

@blissful scaffold

blissful scaffold
#

I have no experience with making JS bots, so I can't give you any details
All I did was reading the error message

heavy anchor
#

ok

heavy marsh
#
message.guild.voice.connection.dispatcher.speaking
``` - Can we check is the bot is speaking like this
#

Evaled it and got null

#

How can I make it get true or false

amber fractal
#

well

#

speaking is on the voiceconnection

#

not the dispatcher

#

but it returns a Speaking class, which is a bitfield

heavy marsh
#

Then how could I check if the bot is speaking or not

quartz kindle
#

guild.voice.speaking

heavy marsh
#

I get it as null

quartz kindle
#

idk then

#

what do you want to do with it anyway?

heavy marsh
#

I am trying to check the volume

#

So if the bot is not playing anything return it

quartz kindle
#

what does guild.voice.connection.speaking return?

heavy marsh
#

guild not defined

quartz kindle
#

i mean

#

message.guild

heavy marsh
#

null

#

But the bot is conneted and playing

quartz kindle
#

.connection.speaking also returns null?

heavy marsh
quartz kindle
#

what about .connection.speaking.serialize()

heavy marsh
quartz kindle
#

you forgot voice

heavy anchor
#

When I try using var myGuild = bot.guilds.cache.find(g => g.id == [Guild ID]); in a command it gives me this error Cannot read property 'guilds' of undefined

heavy marsh
quartz kindle
#

well i guess that works

heavy marsh
#

Then how to just get spreaking?

quartz kindle
#

.serialize().SPEAKING

heavy marsh
#

then I get null

#

nvm got true

#

Thank you

amber fractal
#

is serializing faster than using any or has @quartz kindle ?

#

on the bitfield*

quartz kindle
#

no, its way slower

#

just wanted to see the entire contents of the bitfield

amber fractal
#

ah

quartz kindle
#

the fastest way would be to simply do .connection.speaking.bitfield & 1

amber fractal
#

I have 0 knowledge of bitfields or bit operators

#

suppose I should learn at some point

quartz kindle
#

basically bitfield & bit = if bit exists in bitfield

#

1 & 1 = true
2 & 1 = false
3 & 1 = true
4 & 1 = false

sick cloud
#

is there any way to get both a variable and function under the same name with a class

amber fractal
#

permissions are bitfields right?

sick cloud
#

ie.

thing.avatar // 'url.jpg'
thing.avatar() // 'url.png'```
terse girder
#

I don't think so

quartz kindle
#

i dont think so

amber fractal
#

I don't think so, let me see

#

you can in java I think mmLol

#

but you know

quartz kindle
sick cloud
#

yeah thought so

#

my idea was that using it alone would provide you with the hash but using it as a function provided the url

quartz kindle
#

you could make one lowercase and the other uppercase

#

most people seem to simply prefix methods with get

#

this.avatar
this.getAvatar()

lyric mountain
#

Getters 'n setters

sick cloud
#

oh ok

pale bloom
#

OK SO

amber fractal
#

..?

lyric mountain
#

First of all, disable caps

pale bloom
#

Earlier, my friends and I made a server due to a joke on a different server.
So yeah
and uh
ever since I added most of the needed bots I've had no idea how to do the things with the moderation bots?? and I don't know what bots that I don't already have to get???
and also I'm dummy and can't figure out channel things dsuiu

lyric mountain
#

Errr...what's your native language?

knotty steeple
#

anyone here use mongodb/mongoose

#

i need some help with setting up a basic db

pale bloom
#

my native language is english I'm just tired haha

#

I have no idea what that is hahahha cries

knotty steeple
#

if u arent coding a bot move to a different channel

scenic kelp
#

js i'd assume?

knotty steeple
#

me?

scenic kelp
#

yeah

knotty steeple
#

well mongoose is js specifically is it not

#

idk

scenic kelp
#

That's why I assumed JS

#

I've only used the node mongo driver, not mongoose so I wouldn't be able to help you with it specifically

coarse topaz
#

Hey! I have a question
Can I have a bot.on("message", async (message) => { listener and a bot.on("messageReactionAdd", ({ message, emoji, count }) => { listener in the same line? If so.. How? 😛

knotty steeple
#

i need to know how i should go by connecting to my mongodb and making a place to actually store stuff

#

its just for my economy

#

so i would like to store like money and id whatever

scenic kelp
#

For making a db you can use the command line mongo tool

lyric mountain
#

@coarse topaz you can, but there's no reason for that

knotty steeple
#

also im using atlas

lyric mountain
#

Since the latter will not execute

scenic kelp
#

Oh

knotty steeple
#

yea i cant really host it on a laptop

#

too much hassle

scenic kelp
#

Uh then I guess you could use code to make the db

knotty steeple
#

will probably localhost when it gets on a vps

coarse topaz
#

What's happening is that i need to put a await in the messageReactionAdd listener but it sends me an error :/, @lyric mountain

knotty steeple
#

so im looking at the mongoose npm page and is this how u would make a db

const Schema = mongoose.Schema;
const ObjectId = Schema.ObjectId;
 
const BlogPost = new Schema({
  author: ObjectId,
  title: String,
  body: String,
  date: Date
});
magic geyser
#

-play rave dos fluxos

knotty steeple
#

except replace whatever i want

lyric mountain
#

@coarse topaz you can't await outside of async methods

scenic kelp
#

^ @magic geyser bot commands only work in testing channels

knotty steeple
#

but what about accessing it and storing data

magic geyser
#

Música

scenic kelp
coarse topaz
#

@coarse topaz you can't await outside of async methods
@lyric mountain Then, putting the messages and the reactions listeners in the same line could fix it?

lyric mountain
magic geyser
scenic kelp
#

Don't really know anything about mongoose

lyric mountain
#

@coarse topaz no, you shouldn't ever need nested listeners

scenic kelp
#

But that looks more like you're making a schema not a db

knotty steeple
#

wait whats the difference

scenic kelp
#

A schema is a data formatting thing afaik

#

It's like type checking for dbs

lyric mountain
#

What's your use-case for that listener?

knotty steeple
#

well heck should i use the official mongodb one then

#

where do i get it

scenic kelp
#

If you don't need schemas then I'd just use the node mongo one

knotty steeple
#

i just want to store and get data for my economy commands

scenic kelp
#

I think it's just npm mongodb

knotty steeple
scenic kelp
lyric mountain
#

Or you could use sqlite lol

coarse topaz
#

@coarse topaz no, you shouldn't ever need nested listeners
@lyric mountain Ok, then I'll need to ask you something else then, x)

Is there a way to save the new Date(message.createdTimestamp).toDateString() thing of a message, and then include it in the messageReactionAdd listener?

knotty steeple
#

i know sql but i want to use mongo

lyric mountain
#

@coarse topaz just use a variable for that

scenic kelp
#

sqlite might be better for your use case

#

but if you insist

knotty steeple
#

moving to something bigger like mysql is a hassle

coarse topaz
#

@coarse topaz just use a variablr for that
@lyric mountain Thank you! I'll try it 🙂

knotty steeple
#

when i get to the point of where i have to

lyric mountain
#

@coarse topaz remember that everything inside brackets will be run when that event is called

#

So no need to put everything in one line

knotty steeple
#

@scenic kelp so does the example code make the db

scenic kelp
#

That's a no, but as far as I can tell when you connect to a db and it doesn't exist, mongo will make it

knotty steeple
#

coolio

scenic kelp
#

then so long as you create a collection it should save it

coarse topaz
#

So no need to put everything in one line
@lyric mountain I see...

Well, see this, I've tried it, and I know I'm doing it wrong, but, how should I figure it out then? 🤔

var createdDate = (Embed2).new Date(message.createdTimestamp).toDateString();

It's sending an error: Unexpected Token Date

#

(It's under the line of the message.channel.send(Embed2) thing)

lyric mountain
#

That....looks quite wrong

#

Why Embed2?

#

Why is it inside parentheses?

willow wasp
#

Does anyone want to tryout for a goated team

glad charm
#

@willow wasp please don't ask non channel related questions.

knotty steeple
#

ur slow™️

coarse topaz
#

@lyric mountain
if (message.content === `vm!vote`){ if (message.author.bot) return; message.delete() const Embed = new Discord.MessageEmbed() .setTitle(`Example Title`) .setDescription(`Example test`) .setColor('GREEN') message.channel.send(Embed) const Embed2 = new Discord.MessageEmbed() .setDescription(`Example test`) .setColor('YELLOW'); const m = await message.channel.send(Embed2) var createdDate = (Embed2). new Date(message.createdTimestamp).toDateString(); m.react("698687776421445654") const a = db.fetch("message") if(!a) db.set("message", [m.id]) else db.push("message", m.id) message.channel.send(`example test`) };

lyric mountain
#

I don't think that's right

earnest phoenix
#

you're thinking correctly

lyric mountain
#

You should send Embed, not Embed2

coarse topaz
#

it works correctly, lol

earnest phoenix
#

Wait... Are you trying to delete the message it's responding to if it's a bot?

coarse topaz
#

I only need to know what's the date the message was created, to use that variable in the reactions listener

#

It's supposed to send a first embed and then a second one

earnest phoenix
#

var createdDate = (Embed2). new Date(message.createdTimestamp).toDateString();
what are you trying to accomplish here

coarse topaz
#

that's why I named it Embed2

earnest phoenix
#

literally makes no sense

coarse topaz
#

Then it will take the Created Date from the second embed (Embed2)
@lyric mountain

earnest phoenix
#

I literally didn't understand what hector is trying to do lmao

#

i dont understand it either

#

from what i got they're trying to get the Date of the message creation

#

but they're doing it blindly without actually looking at what they're doing

#

But Creation of the second embed which is not even sent yet...waitWhat

#

it is sent

#

and not the creation of the embed, the message

#

I mean yea that

#

they're also mixing async and sync code which is even worse

#

It's like a pile of spaghetti code

#

they're a help vampire stitch_shrug

#

Lol

#

@earnest phoenix wait a second... Why is he Creating the first embed when he only have to do something with the second one?

#

i dont even know

#

i dont question it

#

lol

#

Oh he is sending the first one... But I'm confusing about what he doing with it lol

knotty steeple
#

what is even happening

earnest phoenix
#

Nothing

sick cloud
#

our second biggest airline just went into voluntary administration in Australia

#

^ virgin australia

knotty steeple
#

tony this is development

sick cloud
#

ah ok channel switcher

#

fail me

earnest phoenix
#

love the code on that one

sick cloud
knotty steeple
#

lmao

coarse topaz
#

But Creation of the second embed which is not even sent yet...waitWhat
@earnest phoenix Yep, it's sent at the same time than the first one

#

and not the creation of the embed, the message
@earnest phoenix ah... is there a way to get the embed creation date?

#

@earnest phoenix wait a second... Why is he Creating the first embed when he only have to do something with the second one?
@earnest phoenix The first one just gives an information, but the important one, is the second one x)

earnest phoenix
#

Oh lol

coarse topaz
#

I literally didn't understand what hector is trying to do lmao
@earnest phoenix Haha lol, it sends a message > the bot reacts to the second embed sent > if the bot gets a specified amount of reactions, it sends a message > in that message the bot will send, i want to include the date of the first sent message :p

#

Well, would thank it a lot if someone could tell me how to get the creation date of an embed to be able to use it in another listener... Please ping me if you get it 🙂

earnest phoenix
#

I have no idea how to lmao

copper cradle
#

héctor, have you tried, idk, reading the docs?

#
earnest phoenix
#

read the description of the property

#

@coarse topaz thats not how object creation works

#

objects are created within microseconds

#

they don't block

#

just put Date.now() in a variable

#

and there you go

copper cradle
#

oh shoot

#

you're right, the desc says the date displayed

knotty steeple
#

uhh

#

do classes have to have constructors

#

because if i dont put one it dies