#development

1 messages · Page 1353 of 1

vague panther
#

@abstract perch I have the same problem

hollow sedge
#

How would it be the token

abstract perch
#

really?

vague panther
#

yes

abstract perch
#

idk really

#

haha

#

Like, it takes 4-5 minutes for the bot to start

#

it starts but not 100%

blissful coral
#

what lang and lib

abstract perch
#

node.js

blissful coral
#

lang

#

??

#

and lib

#

So

opaque hawk
#

If I put my whole music handler in a hastebin and put the link here would someone take time to read it and tell me what is wrong

blissful coral
#

Javascript

#

and

abstract perch
#

javascript

blissful coral
#

What library

abstract perch
#

discord.js

blissful coral
#

Version?

hollow sedge
#
const client = new Client({ ws: { intents: Intents.ALL } });```

@abstract perch

#

Nvm looks like u got it

abstract perch
#

the latest one

blissful coral
#

@opaque hawk you would have to provide the error

#

@abstract perch try regening token and seeing if it changes

opaque hawk
#

There are no errors

feral arch
#

Hi! anybody knows how could I access to the properties of every command defined as a Commando framework command?

opaque hawk
#

It just simply doesn’t work

blissful coral
#

A lot of bots got taken offline or messed up with intents and a lot of devs are just now testing with intents so there is probably a lot of logins happening rn

#

@opaque hawk ytdl?

abstract perch
#

yeah

opaque hawk
#

yes

sudden geyser
#

good

opaque hawk
#

@opaque hawk ytdl?
@blissful coral yes

blissful coral
#

YTDL got shut down

#

So there is your problem

opaque hawk
#

oh why

sudden geyser
#

dmca

opaque hawk
#

oH

blissful coral
#

dmca :/

opaque hawk
#

fun

#

so has nothing replaced it?

#

:(

hollow sedge
#

Lavalink is the go-to replacement I think

opaque hawk
#

and now I assume that bots like Rythm don’t work unless they haven’t used YTDL

hollow sedge
#

They definitely work

opaque hawk
#

:thoonnk:

#

I’ll look at this Lavalink

hollow sedge
opaque hawk
#

ah ok

hollow sedge
#

Not sure if that's official rhythm

opaque hawk
#

Thanks

hollow sedge
#

😆

#

I hope it is

sudden geyser
#

definitely not

hollow sedge
#

It's a discord music bot nonetheless

drifting wedge
#

how would i Delay on syncing all the statusus of every shard?

#

so make the statuses dif per bot?

#

dpy ofc

hollow sedge
#

You mean per shard?

#

Also that's not really an ofc

lucid nova
#

Discord says that: API and Gateway v8 are now available. v6 is still the default for the time being.
But my bot doesnt work anymore, how!?

hollow sedge
#

6 is deprecated

lucid nova
#

but i cant use it and my bot doesnt work anymore, what should i do?

hollow sedge
#

What part isn't working

lucid nova
#

My bot is online, but it doesnt find any users/servers and it doesnt answers to messages

hollow sedge
#

You need the intents

lucid nova
#

I coding in jda maven

frail atlas
#

YTDL got shut down
@blissful coral which "YTDL" are you referring to exactly? from a google search i can find a python library youtube-dl which was taken down, the javascript library ytdl-core is still up on npm and github, with no sort of notice that it doesn't work or anything like that

blissful coral
#

@frail atlas ytdl-core was taken down by DMCA

hollow sedge
frail atlas
#

really? i can't seem to find anything related to that library (thanks link cloudfox) being taken down, only an unrelated python library called youtube-dl

blissful coral
#

Read

frail atlas
#

that's youtube-dl, not ytdl-core

hollow sedge
#

^

#

Two different things apparently

#

Tbf probably not the best idea to use ytdl-core

#

Could also be taken down

frail atlas
#

it's not that easy to tell if they're very related since youtube-dl was removed from github, but from the summary which is still somehow public, it's in an different language and it's a command-line program actually (apparently not a library), and ytdl-core is a library for accomplishing a similar but not identical task

sudden geyser
#

doesn't ytdl-core rely on youtube-dl

hollow sedge
#

No

frail atlas
#

i don't think so, as youtube-dl is a command line program written in a different language than ytdl-core

hollow sedge
frail atlas
#

according to this description, it does not rely on a python program

tardy hornet
#

i tried

#
case 'test':
  const premium = ['723081690792067143']
  if(message.member.id !== premium){
    return message.reply('you cant use it')
  }
    message.reply('sup mate')
    break;
#

didnt manage to make it work

hollow sedge
#

That's still a list

tardy hornet
#

then how?

hollow sedge
#

Did you look at the link I sent?

frail atlas
#

you can check if an array includes an element with .includes(), i.e. myArray.includes(someElement)

hollow sedge
#

I thought it was .includes()

frail atlas
#

oh yeah you're right my b recently have used a lot of dart where it is contains

#

also why do i have the "Bot Developer" role in this server? i literally joined today to ask about this ytdl thing and somehow it knows i have made bots?

hollow sedge
#

Do you have any approved bots?

frail atlas
#

no?

hollow sedge
#

🤷

#

The system thought you deserved it

frail atlas
#

i mean it was correct i guess, but how does it know wtfrick

hollow sedge
#

Why does it exist

frail atlas
#

doesn't Discord.Net work in unity though? unity uses .NET afaik...

hollow sedge
#

Yes

frail atlas
#

yes, then i agree, why does it exist

#

it even runs bots, i assumed it might be some kind of non-bot discord library that might be used for rich presence or w/e (though i think discord already makes those?), but apparently not...

#

it's supposed to be unity based, then why does it use an external JSON library, if it only works in unity you'd think they would reduce the bundle size by using the unity built in one that is packaged even if you don't use it

hollow sedge
#

Lol

#

Oh wait

#

They said they want it to be usable as a standalone .NET library too

#

That doesn't make sense tho because anything in a standalone .NET library will work in Unity

frail atlas
#

fair enough it does say so in the readme, but the about description contradicts that

hollow sedge
#

Oof

#

I guess we'll never know

hollow sedge
#

is there an event for when a command is called in discord py?

#

nvm

#

found it

faint prism
#

You mean on message?

grizzled raven
#

what db would be best if you require fast writing speeds

faint prism
#

Depends on the system specs tbh

#

They are all pretty fast

#

SQL or NoSQL

dusky garden
#

and the kick command does not work, i cant kick anyone, this in my own server btw

floral rune
#

@dusky garden you need to send the DM before kicking the user, also can you send the full error trace?

sudden geyser
#

@dusky garden you're missing the self paramter.

floral rune
#

good catch lol I'm too used to nodejs

sudden geyser
#

actually no I'm dumb

#

I thought that was in a class

#

There are two parameters kickerror should have: ctx and error.

inner badger
#

Can some one help fiqure out why my bot is duping the responses when i reboot it?

sudden geyser
#

Can some one help fiqure out why my bot is duping the responses when i reboot it?
@inner badger what response is being duplicated?

#

Where in your source code is it happening?

#

Can you give us more info to help you?

inner badger
#

Uh its just duping the messeges when i use 1 command

sudden geyser
#

Any command?

inner badger
#

It happens every time i use "node ." In the cmd

#

All commands

sudden geyser
#

Can you show us your message event hanndler.

#

Via hastebin

inner badger
#

Uh

#

Tbh wth is hastebin

sudden geyser
inner badger
#

Im kinda new but all i know os that all the commands are in one file

sudden geyser
#

The <Client>.on("message", (message) => {...}) bit is your message event handler.

inner badger
#

Uh im sorry i belive im too new for this

earnest phoenix
#

If you want to divide them up, you can put each command in its own file, scan over them at startup, and run the according file when a command is ran

inner badger
#

I dont understand half of the sruff your saying

#

Im very sorry

frail yarrow
#

;;-;

sudden geyser
#

It's fine. If you do think you're too new for this, you could spend more time learning the language (JavaScript).

inner badger
#

Ty

frail yarrow
#

try start with a <client>.on in index

#

and testing

inner badger
#

I need a teacher

frail yarrow
#

it's easy:
name of your client.on("message" msg => {
here is the code of the event
})

#

you can change the two "message" and msg 🙂

sudden geyser
#

Moon moon sure, but can you state what issue you're having.

floral rune
#
client.on('message', message => {
  // message.content is the message as a string
  // message.channel.send('text') sends a reply
});
sudden geyser
#

What library are you using?

hardy ermine
#

Hello, I would have liked to know how we do to delete after a while the message that the bot has posted

sudden geyser
#

Yes, but what library are you using?

floral rune
#

Library?
@earnest phoenix discord.py, discord.js, etc

sudden geyser
#

@earnest phoenix you'll want to look into <User>.presences. That's where you can find presence data for the user: https://discord.js.org/#/docs/main/stable/class/Presence

#

The .activities property will hold an array of activity objects, which is where you'll look for reading the actual presence data.

floral rune
#

another approach: ```js
client.on('presenceUpdate', (oldmember, newmember) => {
if (newmember.presence.status.includes('string') {
// give role here
}
});

hardy ermine
#

Hello, I would have liked to know how we do to delete after a while the message that the bot has posted

floral rune
#

Hello, I would have liked to know how we do to delete after a while the message that the bot has posted
@hardy ermine library?

hardy ermine
#

Discord.js

feral arch
#

how could i put thumbnails in an embed message title?

sudden geyser
#

presence.status can only be online, idle, dnd and offline.

#

You still need to look into the array of objects (.activities)

floral rune
#

You still need to look into the array of objects (.activities)
@sudden geyser woops you're right

sudden geyser
#

NSoul wdym putting thumbnails in an embed title?

#

The thumbnail is an image.

floral rune
#

@hardy ermine ```js
channel.send('message').then(message=>{
setTimeout(()=>message.delete(), 5000);
});

hardy ermine
#

Ok thanks

sudden geyser
#

Your library may also come with some convenience so you can specify the time to delete the message after sending it.

floral rune
#

I don't think discord.js has that but I could be wrong, I think just using the promise is fine though

sudden geyser
floral rune
#

Ohh I see what you mean now

#

so @hardy ermine do this ```js
channel.send('message').then(message=>{
message.delete(5000)
});

#

i need to rtfm more

#

also if you supply a number as the first arg it assumes it to be the timeout so that's nice too

sudden geyser
#

I don't think it does the assumption part

#

You still need to give it an object

floral rune
#

hmm I can't find it in the documentation anywhere but every stackoverflow page uses just a number, I wonder if something changed or if it's just undocumented backwards-compatibility

sudden geyser
#

Nonunoisy that was old code in v11 of the library. They added the object bit in v12

floral rune
#

Nonunoisy that was old code in v11 of the library. They added the object bit in v12
@sudden geyser ok so it is something changing I see

sudden geyser
#

@earnest phoenix You check if the user has the message in their status. If they do, you can do something like <GuildMember>.roles.add("id")

#

yeah

floral rune
#

the documentation is quite unclear for this stuff, but there's no need to be rude

sudden geyser
#

I have some work I'm doing in the background. The way I explained it I think is satisfactory, but a demonstration may be more helpful: js // Nununoisy's example: client.on('presenceUpdate', (_oldMember, member) => { for (const activity of member.presence.activities) { if (activity.state.includes(...)) { // I don't know if it's `details` or `state` you should use. // ... } } });

floral rune
#

details/state is what I was hung up on

#

but I'm more tempted to do ```js
if (member.presence.activities.find({state}=>state.includes('status string'))) { // or details

sudden geyser
#

Yeah I'd do that too ^

floral rune
#

you have <GuildMember> as member in that example

#
client.on('presenceUpdate', (_oldmember, member) => {```
#
client.on('presenceUpdate', (_oldmember, member) => {
  if (member.presence.activities.find({state}=>state.includes('status string'))) {
    member.roles.add('role id');
  }
});
#

replace {state} with ({state})

#

@earnest phoenix

#

you are missing a parenthesis before {state}

#

there should be two

feral arch
#

How could I add a field with no value in a embed message?

#
embedMessage.addField("example", " ");

using the alt+255 (invisible character) does not work ):

floral rune
#

does the field have markdown formatting

feral arch
#

hmm how can i know that?

floral rune
#

i guess try using an italicized space _ _

#

_ _

feral arch
#

thank you, that works ^^
also, do you know how to add a field with bold name and normal value but in the same line?

#

i just can get this results, i want description in the same line with no bold

floral rune
#

@floral rune Client is not defined
@earnest phoenix I need to see more of your code then

most people call the client object client so replace with whatever you used here

const Discord = require('discord.js');
const client = new Discord.Client(); // if this is called something else use that name instead
#

i just can get this results, i want description in the same line with no bold
@feral arch i honestly can't remember if this would work but try this ```js
embedMessage.addField("_ _", "bold not bold");

#

so replace client.on with bot.on

feral arch
#

@feral arch i honestly can't remember if this would work but try this ```js
embedMessage.addField("_ _", "bold not bold");

@floral rune Worked flawless, thank you (: <3

floral rune
#

no problem

placid iron
#

How do you check if your bot is in a guild?

#

so preferably using the REST API

#

and it cant be the /users/@me/guilds endpoint because that will only return 100 max

rigid timber
#

Without using discord.py
Whelp another question I can’t answer

earnest phoenix
#

Two factor is required for this operation

#

what is this?

blissful coral
#

wait what

#

Do you not have 2fa on?

#

@earnest phoenix

earnest phoenix
#

it's a question from my friend

#

I will ask him

floral rune
#

How do you check if your bot is in a guild?
@placid iron crazy idea do /guilds/{guild.id} and if it returns with a 403 Unauthorized then you aren't in it

earnest phoenix
#

uh

dire obsidian
#

well, someone knows node.js for web server development?

blissful coral
#

kinda

#

sup

floral rune
#

well, someone knows node.js for web server development?
@dire obsidian express?

dire obsidian
#

hmm yes

blissful coral
#

express

#

hmm

dire obsidian
#

also http

blissful coral
#

http

#

isn't there one other

dire obsidian
#

emmm, fs?

#

body-parser

#

path?

floral rune
#

what about socket for the truly mad

blissful coral
#

path

dire obsidian
#

well, this is the problem, when i try to load the page, it load just the html

#

and not the css/js

floral rune
#

is your html/css/js in a seperate folder

dire obsidian
#

yes nun

blissful coral
#

hm

floral rune
#
app.use(express.static('folder'))
earnest phoenix
#

will it be if it is the server?

floral rune
#

will it be if it is the server?
@earnest phoenix what are you trying to do

earnest phoenix
#

a ticket bot

floral rune
#

what call specifically is causing the error

earnest phoenix
#

but when creating the ticket it appears

dire obsidian
#

wait no, without the .

earnest phoenix
floral rune
#

@dire obsidian just 'src/main' should work

dire obsidian
#

okthen

earnest phoenix
#

@floral rune you understand?

floral rune
#

i don't see where it's failing

#

can you send more of the stack trace

earnest phoenix
#

when he reacts to the emoji he doesn't do anything

#

ok

#

What is written in Portuguese is a welcome message to the ticket

floral rune
#

ok I get it

#

MANAGE_CHANNELS requires that the server owner have 2fa

earnest phoenix
#

but he has

floral rune
#

not the bot owner the server owner

floral rune
#

for every server it's in

earnest phoenix
#

The owner of the bot is the owner of the server

floral rune
#

you probably want to add a .catch() to the channel create promise to alert the server owner that they need 2fa

earnest phoenix
#
    at RequestHandler.execute (C:\Users\luisf\samuca\node_modules\discord.js\src\rest\RequestHandler.js:170:25)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:8756) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 9)```
#

ohh

#

one minute

dire obsidian
floral rune
#

awesome

dire obsidian
#

just need change some paths

earnest phoenix
#

yes, he has 2fa

floral rune
#

if you don't mind, my two cents:

button {
  border-radius: 2px;
}
#

yes, he has 2fa
@earnest phoenix the logs you posted earlier are what I want but I need more

earnest phoenix
#

he just gave it

placid iron
#

@floral rune yeah that is what ive decided to do XD thanks

earnest phoenix
#

I created in my account and it worked

#

Is it that discord update that limits bots?

#

I forgot the name

#

because you are giving errors that you didn't before

floral rune
#

how many guilds is the bot in

earnest phoenix
#

how many guilds is the bot in
@floral rune 1

floral rune
#

i just hit 76 so i applied to verify hopefully that goes well

placid iron
#

were you talking to me?

floral rune
#

were you talking to me?
@placid iron no but I don't mind

placid iron
#

goodluck

floral rune
#

@earnest phoenix i need more of the error because I just don't have enough to go on

earnest phoenix
#

I have already been verified

floral rune
#

node errors in promises are weird

earnest phoenix
#

that's the only thing he sends

#

sometimes don't even send anything

floral rune
#

does it create the channel or no

solemn latch
#

some permissions require two factor auth

#

the error i think is really clear about that

#

"Two factor is required for this operation"

floral rune
#

@solemn latch yeah the guild/bot owner is the same person and has 2fa so I'm confused here

solemn latch
#

are we absolutely 100% sure he/she has two factor on?

floral rune
#

@earnest phoenix is 2FA required for moderators in the guild

drifting wedge
#

how would i give each shard a specific status?

#

dpy?

floral rune
umbral zealot
#

Does the GUILD have 2FA requirement on though

drifting wedge
#

why r so many bot devs brazilian lmao

floral rune
#

Does the GUILD have 2FA requirement on though
@umbral zealot yes that's what I mean

solemn latch
#

lots of turkish bot devs too

drifting wedge
#

lots of turkish bot devs too
@solemn latch yee

floral rune
#

so many english bot devs...

drifting wedge
#

a big brazil + turkish presence + english ofc

#

but those 3

umbral zealot
#

Ok but you showed the user

drifting wedge
#

havent seen much else

umbral zealot
#

what about the server

drifting wedge
#

how would i give each shard a specific status?
dpy?

solemn latch
#

probably a big discord presence in those locations

floral rune
#

@earnest phoenix in server settings under moderation is the 2FA requirement enabled

drifting wedge
#

probably a big discord presence in those locations
@solemn latch ehh

floral rune
#

@floral rune Its not giving the role
@earnest phoenix try changing your presence by changing online to idle or something like that

abstract perch
#

Ugh, so intents have changed. I have tried implementing them but I get the following error:
Error [DISALLOWED_INTENTS]: Privileged intent provided is not enabled or whitelisted.

umbral zealot
#

clearly you need to turn them on in the portal

#

and if you're verified, well... you can't

floral rune
#

@floral rune Oh is it not possible with Online?
@earnest phoenix you just need your presence to change for the event to fire

#

you can set it back afterwards

abstract perch
#

I am not verified

ebon kelp
#

Does the .owner property work on a guild for anyone? (v1.14.1)
Example:

console.log(client.guilds.cache.get('yourGuildId').owner);
umbral zealot
#

The owner wouldn't be cached by default with the new intents changes

#

you need to fetch the owner member from the ownerID property

solemn latch
#

is it the presence intent that caused that 🤔

ebon kelp
#

you need to fetch the owner member from the ownerID property
@umbral zealot that's a bummer

umbral zealot
#

why? it's just a fetch. takes less than a second

ebon kelp
#

But .owner was easier

umbral zealot
#

You're gonna need a whole lotta fetches with the intents changes

solemn latch
#

.owner can still work once its cached

#

pretty basic just checking if owner is cached, which you should have been doing anyway imo

abstract perch
#

Fixed

floral rune
#

@floral rune Still not working
@earnest phoenix try with this just so I can see what's going on

bot.on('presenceUpdate', (_oldmember, member) => {
  member.presence.activities.forEach(a=>console.log(a.state, a.details,a));
  if (member.presence.activities.find(({state})=>state.includes('status string'))) {
    member.roles.add('role id');
  }
});

then change your status and show me the logs

earnest phoenix
#

@earnest phoenix in server settings under moderation is the 2FA requirement enabled
@floral rune ok

floral rune
#

@floral rune ok
@earnest phoenix if it is you have to disable it

earnest phoenix
#

ok

#

thank you

#

i go try

#

the discord is making devs' lives hell

#

the discord is making devs' lives hell
@earnest phoenix thats why i moved on from being dumb to making malware

floral rune
#

one more time

bot.on('presenceUpdate', (_oldmember, member) => {
  member.presence.activities.forEach(a=>console.log('state:',a.state,'details:',a.details,'obj:',a));
  if (member.presence.activities.find(({state})=>state.includes('status string'))) {
    member.roles.add('role id');
  }
});
earnest phoenix
#

easier to make mass dm bot than a bot that will really make a difference

#

I don't do mass dm bot

#

🤠 👍

floral rune
#

i don't do any moderation stuff in my bots

#

it's overdone and also unnecessarily difficult

#

all of my bots are fun

earnest phoenix
#

good idea

floral rune
#

@earnest phoenix anything?

#

try changing your custom status and your presence

#

hmm

#

are you on djs v12

#

ok apparently v12 does it a bit differently

#
bot.on('presenceUpdate', (_oldpresence, newpresence) => {
  newpresence.activities.forEach(a=>console.log('state:',a.state,'details:',a.details,'obj:',a));
  if (newpresence.activities.find(({state})=>state.includes('status string'))) {
    newpresence.member.roles.add('role id');
  }
});
#

try that

drifting wedge
#

how can i make statuses different per shard? dpy?

floral rune
#

@earnest phoenix nothing even when changing your presence/status?

#
bot.on('presenceUpdate', (_oldpresence, newpresence) => {
  console.log('got presenceUpdate');
  newpresence.activities.forEach(a=>console.log('state:',a.state,'details:',a.details,'obj:',a));
  if (newpresence.activities.find(({state})=>state.includes('status string'))) {
    newpresence.member.roles.add('role id');
  }
});
``` now I want to see if we're getting the event at all, try this
#

now i'm really confused

#

@earnest phoenix do you have the GUILD_PRESENCES intent listed on your bot

solemn latch
#

if you want presences

floral rune
#

give it a minute and restart the bot and try again

hollow sedge
drifting wedge
#

@hollow sedge like different status PER shard

hollow sedge
#

@hollow sedge like different status PER shard
@drifting wedge did you read it?

#

You can specify shard_id

drifting wedge
#

Oooh

#

Didn’t read it all thanks

hollow sedge
#

@drifting wedge you can use .shards to get the shards btw

drifting wedge
#

Wdym?

#

Also how can I get the shard id

#

I’m on?

hollow sedge
#

bot.shards

#

Iterate over that

drifting wedge
#

Wdym

#

Isn’t that total shards?

hollow sedge
#

No

#

It's a list

drifting wedge
#

But how would I find the one the specific shard is?

hollow sedge
#

A mapping

#

Idk how to get shard that you're "on"

floral rune
#

I would iterate over bot.shards and execute client.change_presence for each shard ID, does that make sense @drifting wedge

hollow sedge
#

That's what I said angeryBOYE

floral rune
#

Yes, I was just saying it a different way

#

Sometimes it helps to hear something worded differently

hollow sedge
#

Sure

drifting wedge
#

@hollow sedge @floral rune I got a lot of clusters

#

So trying to organize

hollow sedge
#

clusters? as in mongodb clusters?

#

what does that mean

#

clusters in your head?

floral rune
#

What info are you trying to display exactly? Maybe a different approach would be more helpful

hollow sedge
#

^

#

it's rare that you would want to do something to each shard

floral rune
#

I was thinking maybe you want to display a server count on each separate shard or something but I honestly don't have a good idea of a usecase

drifting wedge
#

Clusters as In groups of shards

hollow sedge
#

how many servers is your bot on

drifting wedge
floral rune
#

Dyno devs real quiet rn

drifting wedge
#

I have 30 clusters. Let that give you an idea

#

Jk, my bot is hella small

#

But I do need 30 clusters lol

floral rune
#

30 clusters with 2 servers each

drifting wedge
#

No,

#

So far we’re doing it as 3 shards = 1 cluster

floral rune
#

but regardless what are you trying to do

drifting wedge
#

Display what shard bot is on in status

#

And add some shard display commands

floral rune
#

If you map the shard id's to some number or even just use them outright it should be easy to add them to the status in the way described above

earnest phoenix
#

How can I check how much users are mentioned in JS

#

Please ping me if you can help

floral rune
#

if (msg.content.startsWith("e!kiss")) return msg.channel.send(<@!${msg.author.id}> UwU you kissed <@!${mentioned.id}>)

does anyone see anything wrong with this?
@earnest phoenix that should be OK as long as you also check that there is a mention in the message

sudden geyser
#

@earnest phoenix you may be looking for message.mentions.users

floral rune
#

are you defining mentioned beforehand?

#

i'm guessing the answer is no

#

no it is defined

sudden geyser
#

.user.thing

floral rune
#

you should check that message.mentions.users.size > 0 before trying to get first()

#

that way messages that say e!kiss without a mention don't error out like that

fast trench
#

how do I get the real time/date with Date.now()?

tiny sluice
#

discord.py
Does anyone know why ctx.guild.premium_subscribers not working? It worked like 20 hours ago but it doesn't work now

floral rune
#

@fast trench are you trying to get a formatted date

earnest phoenix
#

@tiny sluice what doesn't work with it

fast trench
#

@floral rune yes...I can't find my old code with it

tiny sluice
#

I didn't do anything to my bot

floral rune
fast trench
#

thank you

tiny sluice
#

It just returned an empty list for ctx.guild.premium_subscribers when there are many boosters

earnest phoenix
#

i see, then you haven't enabled Members intent

tiny sluice
#

I just did turn it on and restart my bot and still the same

earnest phoenix
#

what's your code on your intent

tiny sluice
#
@commands.guild_only()
    @commands.command(name="booster", description="Check if you're a booster", usage="booster")
    async def booster(self, ctx):
        if ctx.author in ctx.guild.premium_subscribers:
            await ctx.send("Yes")
        else:
            await ctx.send("No")
        await ctx.author.send(ctx.guild.premium_subscribers)
earnest phoenix
#

no

#

i meant your intents code

tiny sluice
#

Ohh

earnest phoenix
#

at your bot constructor

tiny sluice
#
def __init__(self, command_prefix: str):
        super().__init__(command_prefix, case_insensitive=True)

        handler = logging.StreamHandler()
        handler.setFormatter(logging.Formatter('%(asctime)s|%(name)s::%(levelname)s: %(message)s'))
        self.logger = logging.getLogger('Lily')
        self.logger.addHandler(handler)
        self.logger.setLevel('INFO')
        self.remove_command('help')

        c = [Admin, General]

        for i in c:
            self.add_cog(i(self))```
earnest phoenix
#

ya you didnt enable members intent

tiny sluice
#

Oh how do I enable it

earnest phoenix
#

you would need to declare discord.Intents, and use one of the classmethod, most people would just do this ```py
import discord
from discord.ext import commands

intents = discord.Intents.default()
intents.members = True # This is your members intent
bot = commands.Bot(command_prefix='!', intents=intents)

`default()` is a classmethod that enable all intents except for priviledge intents such as members, so you would need to enable them explicitly by assigning it's attribute to True
sturdy star
#

i got this problem

#
    if(message.author.bot || message.channel.type === "dm") return;

    let prefix = botsettings.prefix;
    let messageArray = message.content.split(" ")
    let cmd = messageArray[0];
    let args = messageArray.slice(1);

    if(cmd === `${prefix}help`){
        return message.reply("I sent you a list of commands in your DMs!")
        return message.author.send("What the hell do you want from me I'm new I don't have any commands like wtf")
    }```
#

it says @sturdy star, I sent you a list of commands in your DMs!

#

but it doesn't send a DM

#

console says no error

#

language is javascript

#

what should i do

rustic nova
#

Suschamp BetterDiscord

solemn latch
#

client mods ahh

hollow sedge
#

how do i wait until my async on_command event finishes before running the actual command (discord.py)

I'm trying to insert a document for a user in MongoDB and then run the command, but it's async so the actual command is messed up when the user is not found

solemn latch
#

calling admins

tiny sluice
#

Thank you so much @earnest phoenix ! It works!

earnest phoenix
#

alr

floral rune
#

@earnest phoenix ```js
Client.on ('message', msg => {
if (msg.author.bot) return null
const kiss = msg.content.slice(6)
if (msg.mentions.users.size < 1) return;
let mentioned = msg.mentions.users.first();
if (msg.content.startsWith("e!kiss")) return msg.channel.send(<@!${msg.author.id}> UwU you kissed <@!${mentioned.id}>)
})

hollow sedge
#

@floral rune you cant just give them the answer

neon heart
#

const kiss = msg.content.slice(6) lmao

oak timber
#

Hm

hollow sedge
#

ok, what was the problem then? @earnest phoenix

floral rune
#

it's not that

#

notice how first() came back that's important

hollow sedge
#

you see why i said that now?

floral rune
#

you see why i said that now?
@hollow sedge i'm sorry im too tired to do anything except spoonfeed

hollow sedge
#

@hollow sedge i'm sorry im too tired to do anything except spoonfeed
@floral rune yeah it's alright, it's just better for people to come to a solution themselves

solemn latch
floral rune
#

yeah i get that

#

@earnest phoenix if you want an answer, it's because let mentioned = msg.mentions.users.size > 0 sets mentioned to true or false, not to a user, so there is no id

#

so now you'll at least learn something

fast trench
#

@floral rune sorry to bug you again but do you know how to get it to also add in AM and PM or no?

floral whale
#

hey Dose this bot do conections For Eg give people a role who are folowers and that?

solemn latch
#

whats this bot?

pale vessel
#

yes

floral rune
#

@floral rune sorry to bug you again but do you know how to get it to also add in AM and PM or no?
@fast trench there isnt a method but there is a dumb way (hours >= 12) ? "PM" : "AM"

hollow sedge
#

to rephrase my question from earlier, is there a way to run a synchronous function before each command in discord.py?

floral rune
#

or use date.toLocaleString()

fast trench
#

so this is how I am getting the date and time js let [month, date, year] = (new Date()).toLocaleDateString().split("/") let [hour, minute, second] = (new Date()).toLocaleTimeString().split(/:| /)

floral rune
#

@sturdy star your code will simply stop at return message.reply("I sent you a list of commands in your DMs!") because the function will return there, just remove the return statements

#

@fast trench my only issue with this is calling new Date() twice since theres a tiny chance it will desync

fast trench
#

how would you do it?

floral rune
#
let now = new Date()
let [month, date, year] = now.toLocaleDateString().split("/")
let [hour, minute, second] = now.toLocaleTimeString().split(/:| /)
fast trench
#

oh duh lol but what about the am/pm?

floral rune
#

it seems to be appearing for me, but maybe you need to add 'en-US'

fast trench
#

oh that's weird let me try

floral rune
#

i would put it on the date too just to be sure

#

what version of node are you using

fast trench
#

didn't work 🤔 and v12

floral rune
#

ah i'm on v14

fast trench
#

oh no the latest

#

I thought you meant djs lol

floral rune
#

try ```js
now.toLocaleTimeString('en-US',{hour12:true})

fast trench
#

nope 🤔 wtf

floral rune
#
now.toLocaleTimeString('en-US',{hour12:true,timeStyle:'medium'})
```?
#

or ```js
now.toLocaleTimeString('en-US',{ hour: 'numeric', hour12: true })

pale vessel
#

moment gang

floral rune
#
now.toLocaleTimeString('en-US',{ hour: 'numeric', minute: 'numeric', second:'numeric', hour12: true })
tame kestrel
#

some creators of moment moved on to luxon

fast trench
#

this is what got this js let now = new Date() let [month, date, year] = now.toLocaleDateString('en-US', { hour12: true, timeStyle: 'medium' }).split("/") let [hour, minute, second] = now.toLocaleTimeString('en-US', { hour12: true, timeStyle: 'medium' }).split(/:| /)

#

I hate line breaks 😅

pale vessel
#

@tame kestrel haven't heard of luxon, what's it like?

tame kestrel
#

it's like moment js LOL

floral rune
#

what do you get from the strings

#

without splitting

tame kestrel
#

basically has the same features

pale vessel
#

but can you format durations

tame kestrel
fast trench
floral rune
#

most of luxon's changes are invisible from what i've read, mostly just modern JS and Intl API usage

#

@fast trench just run now.toLocaleTimeString('en-US',{ hour: 'numeric', minute: 'numeric', second:'numeric', hour12: true }) in a repl or in a console.log

fast trench
#

That fixed it...this is my end result with my code 😅

let now = new Date()
let [month, date, year] = now.toLocaleDateString('en-US').split("/")
let [hour, minute, second] = now.toLocaleTimeString('en-US', { hour12: true, timeStyle: 'medium' }).split(/:| /)
console.log(now.toLocaleTimeString('en-US', { hour: 'numeric', minute: 'numeric', second: 'numeric', hour12: true }))``` and my outcome is like you showed earlier but also with the date correct
floral rune
#

what does it end up logging

fast trench
#

10/28/2020 at 1:15:56 AM that's from the embed

floral rune
#

so it works now?

fast trench
#

yes it does...I owe you

floral rune
#

no you owe mozilla the MDN is a lifesaver

silver lintel
#
command.execute(message, args).catch((error) => {
//stuff
});

TypeError: Cannot read property 'catch' of undefined

neon heart
#

catch(error => console.log(error))

silver lintel
#

i have that in //stuff

neon heart
#

oh

floral rune
#

@silver lintel what is command.execute

silver lintel
#

fixed by using tryn and catch

floral rune
#

im guessing command.execute isn't a promise then

silver lintel
#

i guess

quartz hill
#

I wonder why the bot login twice in and shut down? I did not change the code, it started to happen today.

neat harness
#

API lag?

#

Or maybe you had a running instance and ran another one at the same time?

quartz hill
#

only 1 bot work

#

and 1 shard = no shard

faint bramble
#

Can someone pass me the link of the bot

solemn latch
#

which bot

tardy hornet
#
.setImage(message.author.avatarURL(), Set dynamic: true)

how do i set the dynamic good there?

pale vessel
#

make it an object

#

{ dynamic: true }

#

Set dynamic: true is not valid

#

also, put it INSIDE avatarURL() message.author.avatarURL(here)

tardy hornet
#

k ty

#

and i did what ever i could, still didnt manage to fix that

#
case 'test':
  const premium = ['723081690792067143']
  if(message.member.id !== premium){
    return message.reply('you cant use it')
  }
    message.reply('sup mate')
    break;
pale vessel
#

premium is an array

#

you want to use array.includes

#

if (!premium.includes(memberID))

tardy hornet
#

O

#

ty

pale vessel
#

this will be true if the id is not inside the array

tardy hornet
#

i can list it right?

pale vessel
#

list?

tardy hornet
#

like

#

(id, id, id)

pale vessel
#

yes, it's an array

#

[id1, id2, id3]

#

that's how arrays work pepega

tardy hornet
#

k ty

#

lol

pale vessel
#

(id, id, id) is a tuple in python

tardy hornet
#

im in js

pale vessel
#

yes

#

use []

tardy hornet
#

o so what i do with the const premium?

pale vessel
#

nothing

tardy hornet
#

ok

#

but wdym nothing like, const premium = [] leave it empty

ancient nova
#

Error: input stream: Error parsing info: Unable to retrieve video metadata

pale vessel
#

but wdym nothing like, const premium = [] leave it empty
@tardy hornet no

#

you said (id, id, id), which should be [id, id, id]

tardy hornet
#

if (!premium.includes(memberID))

#

in there right?

#

o wait

#

i get it now

pale vessel
#

thank you for getting it

tardy hornet
#

membersID is not define

pale vessel
#

please don't just copy and paste that

#

please

#

you're supposed to use this

#

what i gave was just an example

tardy hornet
#

ok ty

quartz hill
#

The bot seems to be running on the server but it is offline. When I open it, it enters 2 times and then it goes offline on discord. I haven't made any changes to the code. It just started to happen.

floral rune
#

The bot seems to be running on the server but it is offline. When I open it, it enters 2 times and then it goes offline on discord. I haven't made any changes to the code. It just started to happen.
@quartz hill dumb questions first: are you running two instances at once? they might be colliding and kicking each other out

quartz hill
#

no

floral rune
#

hmm odd

#

what library?

quartz hill
#

js

#

I didn't change the code, it was working yesterday. He is not working today. It happened the way I said. When opening, it says logged in more than 1 times. Then it goes offline discord even though it still appears active on the server(host).

#

I tried the code in another bot, it works. The problem cannot be in the code. I don't think there will be a problem with the code since I haven't changed the code anyway.

floral rune
#

that's quite odd

#

i guess try rebooting your server or maybe try redeploying and reinstalling node/djs

quartz hill
#

Normally I was using it with shard. It still is. But I tried to uninstall shard and never work.

#

and also I trying on my pc

#

again same problem

#

I think it is because the number of discord servers using the bot has increased. But this should not be a problem.

silver lintel
#

whats the class

earnest phoenix
#

@quartz hill if it looks like it's running two instances just reset the token, change it in your env file then restart the bot. Anywhere else where your bot was running will stop working.

#

whats the class
@silver lintel press F12, click the arrow thing on the top left of the big white box and select the button

quartz hill
#

There is only one sample Impossible to work elsewhere. But let me try to change bot token.

silver lintel
#

thank you

quartz hill
#

and not working

earnest phoenix
#

ok

#

@quartz hill are you running two processes on the same server thonkconga

quartz hill
#

no

earnest phoenix
#

well i can't help with sharding stuff so bye

quartz hill
#

bye

lean wing
#

Hello it came out the new version of node?

rocky hearth
#

anyone here mongoose expert?

earnest phoenix
rocky hearth
#

Can I populate a document after running exec()?

frosty mauve
#

hey. is there any free 24/7 online best hosting server for bots?

earnest phoenix
#

@frosty mauve i literally told you to read the pins

#

they already have it answered

frosty mauve
#

there are a lot of pins. which one should i read? @earnest phoenix

earnest phoenix
#

The first one

frosty mauve
#

okay thanks

earnest phoenix
#

Hey guys, Im looking for .gg domain to buy, where can I buy it at the cheapest price?

abstract coyote
#

idk i always look at namecheap but im sure there is cheaper stuff.. i heard name.com is also good ;p

earnest phoenix
#

ok , I'll look it up, thx

abstract coyote
#

np & gl

neon heart
#

Hii, can you help me? i want to make command like report command promblem and give create invite link to message author channel, but i can't and not give error. here my code

message.guild.channels.cache.find(c=> c.type === 'text' && c.id === message.author.lastMessageChannelID).createInvite().then(x=>e.setDescription(`this is link discord` + x.code))
message.channel.send({embed: e})```
#

i want to put it into embed description

sick fable
#

I am having a problem by building a calculator for my bot. I need it like if someone types that ,add 2+4 , it should show the result but I am confused on how to code my bot like it should tells the result and should analyse the input before Sending the result

#
@client.command()
async def add(ctx, num1: int , *, num2: int):
        embed = discord.Embed(title = "Hey! Here's The Result for your Question!" , description = f"{num1} + {num2} = {num1} + {num2}" , colour = ctx.author.colour)
        await ctx.send(embed=embed)```
earnest phoenix
#

*, num2: int, there isn't a reason to do this, just put it as (ctx, num1: int, num2: int): @sick fable

hidden scarab
#

My bot starts up without any problems, but when we use any command afterwards, it gives this error and crashes without responding. If I ask those who know the solution, can they write it to me?

sick fable
#

Kk @earnest phoenix

earnest phoenix
#

@hidden scarab message.member is null because the message is a DM

sick fable
earnest phoenix
#

terrible design tbh, you already specify that it's an addition

#

@sick fable why not use an external library for math

#

i use mathjs for javascript

sick fable
#

Hmmmm

#

@earnest phoenix ikr

earnest phoenix
#

to be honest i would just do calc <your math operation>

sick fable
#

But I want to code it instead of using an external library

#

I'll try my best tho

earnest phoenix
#

But I want to code it instead of using an external library
@sick fable bad idea but it's your bot anyways so ok

sick fable
#

:[

hidden scarab
#

Discord v11 is closed ?

earnest phoenix
#

Discord v11 is closed ?
@hidden scarab deprecated

#

you would need to learn lots of things, such as an expression tree to do that @sick fable

#

the simplest you can do is to map it out using dict, or using a regex

hidden scarab
#

Thx @earnest phoenix, There are bots that we made for streamers. They are used only on 1 server. And this bots at v11 and its work ? Why ?

earnest phoenix
#

also whatever you do, dont use eval or exec, it's not safe

sick fable
#

the simplest you can do is to map it out using dict, or using a regex
@earnest phoenix ok 🥺

earnest phoenix
#

Thx @earnest phoenix, There are bots that we made for streamers. They are used only on 1 server. And this bots at v11 and its work ? Why ?
@hidden scarab v11 is deprecated so they aren't gonna fix anything you report to discord.js
please upgrade to v12

hidden scarab
#

Thanks ❤️

earnest phoenix
#

Hey i want to see my bots age how do i do that

#

@earnest phoenix which library

#

Android

#

@earnest phoenix

#

Android library hm

green kestrel
#

soooo,
there WAS a breaking change to the live v6 discord api. here it is:

https://discord.com/developers/docs/topics/gateway#request-guild-members

in request_guild_members opcode 8, you can no longer send an array of guild_ids in the request.
it breaks JDA up to the version released yesterday, i think affects discord.js and a bunch of others.

they didnt communicate the change, and pushed it directly into the live API version 6. Be aware, if you can't do things you could before, your bot just sits there without responding... this is likely the cause, update your libs, bug your lib devs.

Discord Developer Portal

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

honest perch
#

Djs is fine

#

Mee6 custom bots got screwed too

green kestrel
#

yeah thats where i first heard about this, i DM'd brandon to ask if it was something that may be further reaching

#

for mee6 it was simply a case of tick the intents in the discord.com panel

#

because their bot already handled the chunks correctly

#

(so long as those were on)

honest perch
#

Yeah, it was quite annoying that discord just pushed it without any notice

earnest phoenix
#

Is there a known cause of PM2 not detecting certain files? I did pm2 start start.js to start my bot but PM2 logged saying '/root/Beycord/start.js' was not found but it is when I accessed it using FileZilla and the vi command.

#

soooo,
there WAS a breaking change to the live v6 discord api. here it is:

https://discord.com/developers/docs/topics/gateway#request-guild-members

in request_guild_members opcode 8, you can no longer send an array of guild_ids in the request.
it breaks JDA up to the version released yesterday, i think affects discord.js and a bunch of others.

they didnt communicate the change, and pushed it directly into the live API version 6. Be aware, if you can't do things you could before, your bot just sits there without responding... this is likely the cause, update your libs, bug your lib devs.
@green kestrel but we'll still get our bots declined for not responding

change my mind

honest perch
#

Is there a known cause of PM2 not detecting certain files? I did pm2 start start.js to start my bot but PM2 logged saying '/root/Beycord/start.js' was not found but it is when I accessed it using FileZilla and the vi command.
@earnest phoenix make sure you're in the right directory, pm2 doesn't have any issues with files

#

Do dir and it will list all the files in that folder

earnest phoenix
#

How do i know if my bot application is rejected

honest perch
#

You will get a dm

earnest phoenix
#

Ohh

#

Ok

#

Do i need to have commands in my bot ?

#

of course?

#

How many ??

#

iirc at least 3 or 5

#

Ok

honest perch
#

I mean its not really a bot if it doesn't do anything

earnest phoenix
#

Also, I did dir and start.js is in the Beycord directory.

honest perch
#

Could you try rebooting

earnest phoenix
#

in my express server i did this:

res.sendFile(`./public/index.html`);

but it threw the error smth along the lines of:

TypeError: Path must be absolute or relative

but when i changed it to this:

res.sendFile(__dirname + "/public/index.html");

it worked fine

can someone explain me why?

honest perch
#

Because it needs to be absolute

earnest phoenix
#

you mean using the reboot command or from the vps provider site?

honest perch
#

Any will work

earnest phoenix
#

alr

honest perch
#

Use the button from the site

earnest phoenix
#

also when i did res.sendFile("/home/runner/<repl name>/public/index.html it still threw an error

honest perch
#

Less chances for something to break

#

It needs an absolute path

earnest phoenix
#

oops i already did the command

#

even tho __dirname is still /home/runner/<repl name>

honest perch
#

With dirname

earnest phoenix
#

nope pm2 still doesnt detect the file

#

is it just me being dumb or something lol

#

vi reached the file without problems but pm2 doesnt seem to

honest perch
#

Are you actually inside the directory

#

Like did you cd into it

earnest phoenix
#

yes?

honest perch
#

Hmm thats very odd

#

Might want to make an issue on their gh

earnest phoenix
#

why not just right-click the file select properties then copy the address and use it tho not everyone uses windows

#

why not just right-click the file select properties then copy the address and use it
i did?

#

nvm i found the problem

#

ok

#

a required npm package was broken

#

wynaut

#

and reinstalling it doesnt work help

twilit rapids
#

@earnest phoenix can you not spam emojis

earnest phoenix
twilit rapids
#

open the debug log file

earnest phoenix
#

why is there a # at the end of the prompt text instead of a $

#

idk

#
root@overcold:~/Beycord#
#

weird

#

thats the latest version of ubuntu if it somehow explains that

#

never saw bash like that

#

should i try deleting node-modules and reinstalling stuff lol

green kestrel
#

Do i need to have commands in my bot ?
@earnest phoenix interesting question, it got starred sarcastically but technically... no?
If everything in your bot is controlled by a dashboard then no, you wouldnt need commands. but you DO need a way for people to interact with it.

#

and its strongly recommended to at least have a minimum of a help command, even if just to point people to said dashboard.

#

i wouldnt recommend a completely dashboard bot, either. it would confuse us when we come to review it.

#

and may get rejected as "no obvious entrypoint"

tired panther
#

You could name it commandless bot xD

#
ypeError [INVALID_TYPE]: Supplied parameter is not an User nor a Role.
    at Function.resolve (C:\Users\shahn\3D Objects\Botcode\sharding\node_modules\discord.js\src\structures\PermissionOverwrites.js:177:28)
    at C:\Users\shahn\3D Objects\Botcode\sharding\node_modules\discord.js\src\managers\GuildChannelManager.js:109:81
    at Array.map (<anonymous>)
    at GuildChannelManager.create (C:\Users\shahn\3D Objects\Botcode\sharding\node_modules\discord.js\src\managers\GuildChannelManager.js:109:51)
    at Object.execute (C:\Users\shahn\3D Objects\Botcode\sharding\commands\setup.js:56:41)
``` I am having this error , in channel creation an idea why?
honest perch
#

Show the code

earnest phoenix
#

K

tired panther
#
await message.guild.channels.create('bump', {
                
                permissionOverwrites: [
                   {
                     id: everyoneRole,
                     deny: ['VIEW_CHANNEL'],
                    },
                    {
     
                     id:  "735147814878969968",  //change here the id of the alpha bot
                     allow: ['VIEW_CHANNEL' , 'SEND_MESSAGES' , 'EMBED_LINKS' , 'ATTACH_FILES' , 'READ_MESSAGE_HISTORY'],
                    },
                    {
                      id:  "302050872383242240",
                      allow: ['VIEW_CHANNEL' , 'SEND_MESSAGES' , 'EMBED_LINKS' , 'ATTACH_FILES' , 'READ_MESSAGE_HISTORY'],
                  
    
``` @honest perch
abstract coyote
#

How can you make a hyperlink inside an embed? Using discord.js

tired panther
#

**[here](https://discord.gg)**

#

@abstract coyote

abstract coyote
#

oh

#

ty

tired panther
#

in " "

abstract coyote
#

yep

#

ohh

#

wait

#

nvm

tired panther
#

" **[here](https://discord.gg)** "

#

@abstract coyote

#

in set Description or Add Field

#

footer will not work

abstract coyote
#

ohhh makes sense then llol

#

ty!

haughty vortex
#

YTDL got shut down
@blissful coral no it didn't

#

only the git repo was shut

pale vessel
#

no

#

ytdl is fine

#

it's youtube-dl

#

they're entirely different

earnest phoenix
astral yoke
#

dumb question

#

whats with my bot not sending welcome message when someone joins

#

is it because of these being off?

#

and i cant even turn it on

pale vessel
#

yes

#

you have to be whitelisted

#

i'm assuming that bot is already verified but not whitelisted for those intents

astral yoke
#

how do you get it whitelisted?

pale vessel
#

contact support

grand stratus
#

Hey, I have a question, I'm currently creating a giveaway bot, but to launch a giveaway I would restrict that command to admin only while they've not config the role whitelist (ex: a command ;add-wh <command> <roleID>). So if I published my bot and I precise in description that you can config permissions, will my bot be refused because the base permission is "ADMINISTRATOR" ? Sorry for the english it's not my native langage

pale vessel
#

it's only a problem when the bot itself needs the administrator permission

#

if it needs the member to be an administrator, it's fine

grand stratus
#

Oh okey thanks you ^^

astral yoke
#

Hey so anyone know how to upload your console logging like to a file then send it to discord?

#

So that you can download it and see console logging?

#

if that makes sense?

stoic girder
#

log to a file instead to console maybe?

astral yoke
#

Kinda. Like you do !console, then it grabs the logging in the console, like "Bot is online!" and or errors, then sends it to a file and uploads.

stoic girder
#

i mean, instead of doing console.log, what about making a function to log in the file directly

#

which you can then read or add as an attachment or whatever

astral yoke
#

How would you do that? FS?

stoic girder
#

quick google search

#

node app.js > log-file.txt

grizzled raven
#

has anybody bought a vps from oneprovider?

#

if so, do you know what "Only compatible with hardware RAID" means?

green kestrel
#

yes i know what this means but i havent a vps from them.

#

hardware raid is where you have a pci-express card that handles multiple hard disks as one virtual drive

#

software raid is where your OS does it

#

hardware raid is far superior as it has a built in battery backed ram cache, in the event the power cuts to your server it will ensure that whats left in the buffer is correctly written to disk

#

well, good ones do

#

also software raid as its done at OS level takes some cpu time that could be used by your programs

#

sounds like you dont have hardware raid on your server, or if you do its abstracted above the level of your vps

willow mirage
#
(node:8648) UnhandledPromiseRejectionWarning: VersionError: No matching document found for 

Anyone help me

#

mongoose

earnest phoenix
#

Is it just me being dumb or is there something that caused ./ to sometimes go to the parent folder and sometimes go to the root folder?

vast shell
#

I want to add this image in the description box, what should i do??

blissful coral
#

Image in a description 🤔

#

There is a image in the thumbnail and the image

earnest phoenix
#

if you meant the small embed like thing, its a quote and can be recreated by doing something like > yes

#

yes

blissful coral
#

Ah

#

it is like this

#

> ez

grizzled raven
#

@green kestrel okay thanks

#

so apparently ubuntu requires hardware raid, and ubuntu is what i've always been using, so what OSs do you guys use apart from ubuntu?

#

or do you think i should just go for the more expensive ones with hardware raid?

umbral zealot
#

uhhhhh ubuntu doesn't require raid?

grizzled raven
#

well with one provider apparently it says only compatible with hardware raid

umbral zealot
#

provider?

#

if you mean your VPS... well that's a thing that they need to, y'know, take care of

#

Ubuntu itself doesn't require raid on a hard drive. that would be ridiculous.

grizzled raven
#

oh by one provider i mean oneprovider

blissful coral
#

Tf

#

Ummm

grizzled raven
#

oh so uh

blissful coral
#

Prob should find another provider

grizzled raven
#

oh

willow mirage
#
const guild = await require("../tools/getGuild")(client, message.guild.id);
let targetData = guild.warn.find(t => t.userId == target.id);
if (!targetData) {
    const object = {
        userId: target.id, time: 0, reason: " "
    }
    guild.warn.push(object);
    await guild.save();
    targetData = guild.warn.find(t => t.userId == target.id)
}
if (targetData.time == 0) return message.channel.send("That user don't have any warns to delete");
console.log(targetData);
if(targetData.time == 1){
    guild.warn.splice(targetData);
}else if(targetData.time > 1){
    targetData.time = targetData.time - 1;
    targetData.reason = `Deleted one warn for reason __${reason}__`;
}
await guild.save()
VersionError: No matching document found for id

Help

grizzled raven
#

oops

#

what's the second best os

willow mirage
#
VersionError: No matching document found for id "5f954cd916000c622a3e196e" version 32 modifiedPaths "warn"
pale vessel
#

luke uses oneprovider iirc

grizzled raven
#

yeah he told me to use them

#

what other vps do you guys use? besides digital ocean and galaxy gate

fluid basin
#

whats wrong with DO and GG? @grizzled raven

willow mirage
#

anyone could look at my issue :/ https://github.com/Automattic/mongoose/issues/9506

rotund vale
#

can anyone help me with this urban dictonary code it gives me this error

#
        const query = `?term=${encodeURIComponent(args.join(' '))}`;
        const { list } = await fetch(`https://api.urbandictionary.com/v0/define?${query}`).then(response => response.json());
        if (!list.length) {
            return message.channel.send(new Discord.MessageEmbed()
                .setColor('RED')
                .setDescription(`No results found for **${args.join(' ')}**.`));
        }
        const [answer] = list;
        return message.channel.send(new Discord.MessageEmbed()
            .setColor('RANDOM')
            .setTitle(answer.word)
            .setURL(answer.permalink)
            .addField('Definition', client.shorten(answer.definition, 1024), false)
            .addField('Example', client.shorten(answer.example, 1024), false)
            .setFooter(`Rating: ${answer.thumbs_up - answer.thumbs_down} Upvotes.`)
        );
    }
}```
kind thicket
#

I have that command sitting somewhere, let me take a look

rotund vale
kind thicket
#

you havent defined what list means

#

(at least thats the only .length i could find)

rotund vale
#

so you mean that .length is wrong?

grizzled raven
#

whats wrong with DO and GG? @grizzled raven
@fluid basin nothing, just wanted to hear about others first cause i already know them

spark wharf
#

Does anyone know why this code won't work the way I want it to? I want it to create a channel for any user that messages the bot and send the message in that channel, but if the user already has a channel then send it in that channel.

@client.event
async def on_message(message):
    if message.author.bot:
        return

    if isinstance(message.channel, discord.channel.DMChannel):
        guild = discord.utils.get(client.guilds, name="Snappy Support")
        role = discord.utils.get(guild.roles, name="Support")
        role1 = discord.utils.get(guild.roles, name="Member")
        overwrites = {
            role: discord.PermissionOverwrite(read_messages=True),
            role1: discord.PermissionOverwrite(read_messages=False),
            guild.me: discord.PermissionOverwrite(read_messages=True)
        }
        category = discord.utils.get(guild.categories, name="Support")
        e = discord.Embed(title=f"{message.author} said:", description=f"__`Content:`__ **{message.content}**\n \n __`Their ID:`__ {message.author.id}", color=0x0000ff, timestamp=message.created_at)
        channel = client.get_all_channels()
        if channel == f"{message.author}":
            return await channel.send(embed=e)
        else:
            channel1 = await guild.create_text_channel(f"{message.author}", overwrites=overwrites, category=category)
            await channel1.send(embed=e)
    await client.process_commands(message)
    pass
grizzled raven
#

but actually nevermind i'll stick with what i have for now

fluid basin
#

there are great vps hosts in pinned messages

kind thicket
#

so you mean that .length is wrong?
@rotund vale it is saying that it cannot read whats before .length

#

or however you spell it

fluid basin
#

for dedicated server (do you really need one?) you can check out hetzner for bidding of dedis

rotund vale
#

so i should ! remove the ! in !list.length?

kind thicket
#

I think it should be list instead of { list }

rotund vale
#

let me try brb

#

lemme test it now

#

Damn it im lagging

kind thicket
#

F

rotund vale
kind thicket
#

Then I really dont know

waxen tinsel
#

How would I run commands to start a screen on ubuntu and start a python program on an Ubuntu server, with another python program?

#

@ me when answering, please.

rotund vale
#

I dont use python so idk

dusky garden
#
@define.error
async def deferror(ctx, error):
    await ctx.send("An error occured. For those developers out there: The error was: {0}".format(error)

bot.run("token")

someone tell me why the bot.run line is a invalid syntax

pale vessel
#

close your ctx.send()

#

also, you should use f strings, they're way nicer to use

dusky garden
#

ah

#

yeah i do i just tried something new

abstract coyote
#
.setDescription(`**Servers:** ${client.guilds.cache.size}\n**Users:** ${client.users.cache.size}```

Tht does not work the best :P

That `client.users.cache.size` sends a rather small number instead of the way higher one it had before..
#

:(

dusky garden
#

what was the difference in code?

abstract coyote
#

none that would affect that command

dusky garden
#

oh

#

thats weird

#

im not that fluent in python so idk

wary flame
#

Thats js

abstract coyote
#

oh

#

thats js

#

:p

dusky garden
#

oh

wary flame
#

The problem is that not all your users are cached

#

client.users.cache.size returns the size of your user cache

#

So if a user is not cached it wont be included

dusky garden
#

do client.users.size

abstract coyote
#

oh okay

dusky garden
#

i think

#

or is tht the old version

wary flame
#

That doesnt work

dusky garden
#

yea it is

wary flame
#

Thats the old version yeah

abstract coyote
#

thanks ill find the issue now c:

dusky garden
#

oh just do client.users

#

that returns a list

#

no

#

do str(len(client.users))

abstract coyote
#

oh oki!

#

thanks ill try it out

dusky garden
#

yep

wary flame
#

Thats python

#

His bot is in js

dusky garden
#

oh shit

#

im dum

abstract coyote
#

yeah :c but ur not dumb!

dusky garden
#

ye

abstract coyote
#

and ur rly kind for helping me out c:

dusky garden
#

np

rocky hearth
#

I need help with mongoose, does anyone knows it better? Ping me....

waxen tinsel
#

@rocky hearth be 300x more specific about your issue or you probably wont be helped.

rocky hearth
#

do u know mongoose?

fluid basin
#

"I need help with Discord, and bot, does you knows it better?" @rocky hearth

#

just ask, be specific

earnest phoenix
#

literally told this guy twice before not to ask2ask

waxen tinsel
#

@rocky hearth do you know any python, I could use some help picardgiggle literally noone is about to answer such general questions, unless they are a dev that is nolife even among dev standards

carmine summit
#

I want to get string

rocky hearth
#

ok, then

earnest phoenix
#

How do I deal with
<image of a Promise>
I want to get string

Promise.then((arg1, arg2, arg3, ...) => { ... });
quartz kindle
#

or await

carmine summit
#

wat??????

rocky hearth
#

So I want to find a document, and if it doesn't exist, I want to create one and use it. I know I could use upsert and stuff. But that doesn't add the required fields. So what I need to do?

earnest phoenix
quartz kindle
#

@carmine summit result = await promisehere

earnest phoenix
#

@quartz kindle that example bad not even var keyword is used to tell js that result is a new variable

carmine summit
#

alright

willow mirage
#

@quartz kindle what do u prefare await or then()

quartz kindle
#

situational

earnest phoenix
#

I'll use .then since I don't use async functions much

willow mirage
#

hmm

pale vessel
#

why not

earnest phoenix
#

synchronous programming is useful sometimes

fluid basin
#

I'd say that you try to stick with one for most situations

carmine summit
#

How do I get rid of guilds that is deleted

fluid basin
#

guildDelete*

carmine summit
#

something like guild.available

quartz kindle
#

you use .then if you dont need to return to the current context and are fine with concurrency
you use await if you need to return to the context and need to run stuff sequentially

earnest phoenix
#

you use .then if you dont need to return to the current context and are fine with concurrency
you use await if you need to return to the context and need to run stuff sequentially
@quartz kindle I need to do stuff after fetching the data using axios and i don't want a big callback so await

carmine summit
#

guild.deleted

rocky hearth
#

See that's why, I was first trying to find a mongoose expert.

fluid basin
#

@rocky hearth don't only explain, show (your code/errors)

#

no one will get what is not working for you and they have no idea what the context is

#

people above got replies because they gave examples of their code where they were having issues or don't understand

earnest phoenix
#

See that's why, I was first trying to find a mongoose expert.
@rocky hearth are you saying we suck

abstract perch
#

Message Edited Event
Hello, any one knows why newMessage is not working? oldMessage works fine.

fluid basin
#

newMessage?

earnest phoenix
#

@abstract perch can you provide more info about it

abstract perch
#

Yup wait

earnest phoenix
#

also i think it probably has smth to do with the heavy intent changes

abstract perch
carmine summit
earnest phoenix
abstract perch
fluid basin
#

you don't need d.js source code

#

whats the error then?

abstract perch
#

const { Events } = require('../../../util/Constants');

module.exports = (client, packet) => {
  const { old, updated } = client.actions.MessageUpdate.handle(packet.d);
  if (old && updated) {
    /**
     * Emitted whenever a message is updated - e.g. embed or content change.
     * @event Client#messageUpdate
     * @param {Message} oldMessage The message before the update
     * @param {Message} newMessage The message after the update
     */
    client.emit(Events.MESSAGE_UPDATE, old, updated);
  }
};
#

this is the intent

#

I mean... idk 😂

#

I have the latest build

fluid basin
#

uh

earnest phoenix
#

why are you sending d.js source code instead of your own code lmao KEK

fluid basin
#

there is nothing wrong with d.js code

abstract perch
#

wdym?

fluid basin
#

its your own code that has issues

abstract perch
#

I sent my own code

#

i know

#

here my code ^

fluid basin
abstract perch
#

I sent it abobe

#

yeah

fluid basin
#

yeah?

abstract perch
#

that's what I was thinking but what should I put there?

fluid basin
#

the issue is right there

abstract perch
#

Old works fine

#

yeah I can tell, I just do not know how to fix it

fluid basin
#

what is message then

earnest phoenix
#

@abstract perch are you passing the fourth parameter newMessage when running the function?

carmine summit
abstract coyote
#

How could I get the size of all users from all the servers my bot is in?

fluid basin
#

@carmine summit unknown guild

carmine summit
#

Unknown GUild

abstract perch
#

wait let me try something brb

fluid basin
#

@abstract coyote library?

abstract coyote
#

discord.js

earnest phoenix
#

client.users.cache.size

fluid basin
#

what is message then
@abstract perch figure out whats message first, then figure out whats oldMessage

abstract coyote
#

ye i tried that however it doesn't get the entire count

earnest phoenix
#

one line of code is not spoonfeeding btw