#development

1 messages ยท Page 931 of 1

mossy vine
#

messages

quartz kindle
#

i personally disable voicestates, roles, members, channels, channel permissionOverwrites, presences, users

#

but doesnt your bot require presences?

viral spade
#

not yet but its a feature in consideration

quartz kindle
#

ah i though your statistics involved presences, hence why such cpu usage

viral spade
#

na thast only because of not caching the totalScore

#

i guess

fickle arch
#

wait is it just me or i'm wrong writing the codes so it appear a error like this "Discord.RichEmbed is not a constructor".

quartz kindle
#

if your resources were already that bad i cant imagine with presences lol

#

@fickle arch RichEmbed was removed in v12

#

and replaced with MessageEmbed

fickle arch
#

ah alright

viral spade
#

but it seems to me i cannot really deactivate caches, so it will not make much ram difference what lib i use, right?

quartz kindle
#

if you need to track changes, you cannot disable caches

#

but there is a difference between how each lib caches

#

in you case, you could get a fairly decent improvement by caching small objects containing only the info you need

#

compared to storing full instances of a class

viral spade
#

yes, like you said deactivating f.e. voicestates?

quartz kindle
#

voicestates are also disablable via intents

viral spade
#

(i dont use voicestate, only if the user is part of the channel)

#

and those are also disablable in d.js?

#

all intents?

#

dude i rellay dont know should i switch now from discord.js to eris, or something else. i feel like its not worth it to switch for now. what would you do?

steel drum
humble plaza
#

Hi guys, simple discord js bot question. I want my bot to send an image file. It basically sends street fighter combos which are in an image.

I've got it with if statements to send an image based on a command but instead of having hundreds of if statements I want the user to define it and the bot will find and send the image file by that request. So a user can go !cammy and the bot will see if there's an image with that name and send it.

Sorry I'm new to all this and had trouble trying to google an answer.

earnest phoenix
#

where are you getting the images from?

humble plaza
#

stored as jpgs in my github repo

knotty steeple
#

have on object of images with the keys being the command name/combo

earnest phoenix
#

^

#

or name them in a way so that when you request the image it matched the args

knotty steeple
#

check if whatever args is used is a valid key

#

a object is easier

humble plaza
#

So at the moment we have it as

if(msg==prefix+'akumasf2'){
message.channel.send("Akuma's Moves for Street Fighter II", {
files:["./SF2moves/akuma.PNG"]})}

#

lots of times for each character

knotty steeple
#

so if args includes Object.keys(images)

#

images being the object of image paths and names

humble plaza
#

Is there a way instead, the user can just define the name they want and it can be filled in. So for example, where it says "Akuma", instead this can be a placeholder for the whatever the user puts in and the code runs based on the argument the user sends.

#

Sorry, still learning

quartz kindle
#

there are many ways to do this

grizzled raven
#

wish i could be able to opt out of presence packets but i cant

#

so i just stop caching them

white anvil
#

why cant you opt out

grizzled raven
#

because of the way it affects guild members

quartz kindle
#
let command = msg.slice(prefix.length);

// method 1
files:[`./SF2moves/${command.toLowerCase()}.png`] // must match exact name. no built in option to change sf2 to another game

// method 2
let list = {
  "akumasf2":"./SF2moves/akuma.pnk",
  ...
}
files:[list[command.toLowerCase()]] // must match exact name and exact game

// method 3
let list = [
    {
        names: ["akuma","akumasf2"],
        url: "./SF2moves/akuma.pnk"
    }
    ...
]
files:[list.find(item => item.names.includes(command.toLowerCase()))] // more flexible, can have multiple names and aliases for the same url
``` @humble plaza
humble plaza
#

Holy shit

#

Wow

#

Thanks Tim

grizzled raven
#

how are you impressed, im just confused

humble plaza
#

can learn from this

quartz kindle
#

another option is to change your command to something like !moves character game

grizzled raven
#

what language is that

quartz kindle
#

its pseudocode lol

grizzled raven
#

lol okay

humble plaza
#

Will play around with this, it's a great start

#

I owe you a drink

grizzled raven
#

anyone know if discord has some formula for welcome messages?

quartz kindle
#

formula?

white anvil
#

there is a list of them

#

its random

quartz kindle
#

ah you mean the system messages

grizzled raven
#

yeah idk why i said formula im tired

#

anyway eris does something with an outdated list that isnt used anymore

quartz kindle
#

eris and outdated, name a better duo

white anvil
grizzled raven
white anvil
#

wait

#

this is also outadted

#

epic

grizzled raven
#

outdated

#

i got the hopefully new and updated list so i was wondering if eris' formula was actually a valid formula

#

guess not

quartz kindle
#

is there even a formula?

grizzled raven
#

eris does

quartz kindle
#

also, whats the point of tracking these client side?

grizzled raven
#
~~(message.createdTimestamp % lengthOfJoinMessages)
quartz kindle
#

since the api sends you them anyway

grizzled raven
#

they dont

#

its an empty string

#

isnt it?

quartz kindle
#

oh is it?

knotty steeple
#

what does that do

#

~~()

grizzled raven
#

math.floor alternative apparently

quartz kindle
#

bitwise double invert

grizzled raven
#

it inverts then inverts again i guess

quartz kindle
#

yes it does work as math.floor

#

interesting

knotty steeple
#

idk shit about bitwise

quartz kindle
#

let me benchmark this

grizzled raven
#

apparently ~~ is faster

#

but

#

ยฏ_(ใƒ„)_/ยฏ

queen needle
quartz kindle
#

jsben.ch said Math.floor() is like 0.1% faster

#

ran the test 3 times

#

lmao

grizzled raven
#

wait what

#

lol great

#

now i dont have to think that im sacrificing speed when i use math.floor

quartz kindle
#

thats way beyond microoptimization

#

lmao

grizzled raven
#

but stilll

quartz kindle
#

thats insanity

grizzled raven
#

im different

quartz kindle
#

benchmark every single like of your code

#

:^)

grizzled raven
#

my code is

#

uh

#

my code is the array.map of iterating

quartz kindle
#

lmao

grizzled raven
#

im the type of guy to sacrifice speed for looks lmao

quartz kindle
#

what kind of "looks" are we talking about?

#

ascii art in your code?

grizzled raven
#

LOL

white anvil
#

im the opposite

quartz kindle
#

actually, someone should make an editor plugin that formats your code to ascii art

grizzled raven
#

this piece of code is faster, BUT this piece of code has a secret image of kirby in ascii art and therefor is better

#

hire luke

#

and force him

#

like the time he made functional code that looked like luca

quartz kindle
#

luca's code best code

#

everyday i dream of being capable of coding like that

#

luca is my inspiration, my role model

#

it is

#

as long as it has permissions to manage roles

queen needle
quartz kindle
#

client.user is a user, not a guild member

grizzled raven
#

sorry i was just in shock after revisiting luca's code

#

now i wanted to do something but i forgot

sudden geyser
#

Shock from its beauty?

astral yoke
#

okay so

#

if I got let user = message.mentions.members.first() || message.author;How could I make it so if theres also an id instead of mentions it would also be able todo it, if that makes sense

sick cloud
#

will something like this be a decent enough indicator if a guild is a bot farm:
bots > 100 && humans < 50 (more than 100 bots and less than 50 humans/users)

digital ibex
#

hi, how can i update an array?

stark needle
#

Is it easy to code a bot as never done it

digital ibex
#

like i have js ['hi']; how can i make it be something like ```js
['hi', 'bye'];

#

@stark needle if u know whichever language u r using to create it with, it is but not as hard as starting the language and creating a bot as ur learning so many things at once, u can't differentiate whats part of the lib and whats not

stark needle
#

I was looking at the replay bot

digital ibex
#

any bot will be, doesnt really matter what the functions of it are

sudden geyser
#

will something like this be a decent enough indicator if a guild is a bot farm:
bots > 100 && humans < 50 (more than 100 bots and less than 50 humans/users)
@sick cloud that really depends on if you think it's satisfactory. What if I get a bot farm with 51 people? What if I get a bot farm with 1 person and 99 bots? I also like logging how many bots a server has (if it has a lot just run a command to leave the server).

#

If you wanted to be more correct you can simply check the percentage of bots to humans (just one way).

sick cloud
#

also i can't really log and look through as i can get 100+ servers a day

sudden geyser
#

yeah for large bots that's a big no no

turbid bough
#

you can try checking if people are using your commands or not

#

like, after a week or so, if they have yet used a command at all

unborn fulcrum
#

how would I get a whois command to show if someone is in a server e.g support server

turbid bough
#

MutualGuilds

#

hmm, js does not have anything like that thonk

unborn fulcrum
#

yea I use js

#

But I have seen people do it with js

pale vessel
#

just check in every guild your bot is in

turbid bough
#

would require parsing every guild

pale vessel
#

shouldn't take long

#

guilds.cache.map(guild => guild.members.cache.has(id))

#

something like that

turbid bough
#

lol nvm, discord.net just added a function with it

public IReadOnlyCollection<SocketGuild> MutualGuilds
    => Discord.Guilds.Where(g => g.Users.Any(u => u.Id == Id)).ToImmutableArray();
grizzled raven
earnest phoenix
#

one question...

#

are we allowed to give away code for free volintarily without anyone asking for it?

turbid bough
#

uuuh, not really?

earnest phoenix
#

lol

turbid bough
#

not in here atleast

#

github is probably the place to go where nobody will look at it anyway

earnest phoenix
#

nah

turbid bough
#

unless you post a token, then they are really into that

earnest phoenix
#

i just wanted to share my corona command

pale vessel
#

no thanks

clear wraith
#

I have been getting this in my logs lately, and Im not sure why it does that, or what it wants...

    at RequestHandler.execute (/rbd/pnpm-volume/3e0e7ff0-a6f9-4413-afc4-43ee427079be/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
    at processTicksAndRejections (internal/process/task_queues.js:88:5)
(node:10781) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 6)```
#

any ideas?

pale vessel
#

missing permissions

turbid bough
#

Missing permissions

#

idk what could it say, it might be something else

pale vessel
#

what don't you get about that

earnest phoenix
#

ur bot is missing required permissions

clear wraith
#

It has perms in my server...

earnest phoenix
#

you can change permissions in the developer portal

turbid bough
#

your server?

clear wraith
#

so idk why it needs perms when it already has perms for my server

pale vessel
#

your bot is in other servers too

clear wraith
#

Ok...

turbid bough
#

Ok?

clear wraith
#

nvm

earnest phoenix
#

lol

turbid bough
#

soo, i managed to fix my bot so it stopped used 3gb of ram

#

now it only uses 130mb of ram

grizzled raven
#

what

#

excuse me

viral spade
#

what did you do to achieve that? @turbid bough
Which lib?

turbid bough
#

c#

#

but not beacuse of the library

#

i made a dbcontext transient and only put it on the root servicecollection, and it never got disposed.
so everytime i needed to access the db, it would create a new instance, store it in ram, and keep it there forever till the app crashed

#

cause i thought scoped was not working, cause i didnt even actually create a scope in the messagehandler

digital ibex
#

hi

sonic lodge
#

is it possible to get a user's friends with d.js?

digital ibex
#

no

#

any ideas why this is happening?

#

guild is the guild in the db btw

copper cradle
#

bc that item only exists on the instance you defined it

#

lets say

digital ibex
#

oh

copper cradle
#

on the first command you pushed it and returned it

#

so it showed it

#

then the eval thingy got flushed

#

and it's now empty

digital ibex
#

ah

#

another question

copper cradle
#

yeah

digital ibex
#

u kno when i do guild.updateOne({ mod: { $push: { role: 'h' }}}), even in eval it usually updates, why doesn't it?

#

mod is an object with role inside

copper cradle
#

no idea

digital ibex
#

oki

#

oh

#

i'm retarded

#

role isn't a thing, roles is

#

๐Ÿคฆโ€โ™‚๏ธ

copper cradle
#

lol

#

oh lol

neat ingot
#

I ended up randomly writing a little minigame manager module thing today and did a simple reaction based tic tac toe minigame ๐Ÿ˜„

copper cradle
#

I'm blind

#

nice

digital ibex
#

wait, that didn't change anything ๐Ÿ—ฟ

grizzled raven
#

huh

#

nice

neat ingot
#

it has pvp too ๐Ÿ˜„

#

quite happy with it for a few hours work tbh

#

#flex

#

lol

grizzled raven
#

oh yeah? i made text based uno in swift once imcool

digital ibex
#

with djs?

neat ingot
#

not the neatest code, but thats pretty much the entire minigame ๐Ÿ˜„

digital ibex
#

lemme save that

#

jk lol

grizzled raven
#

now everyone's bots all of a sudden all have ttt commands

neat ingot
#

o0

#

how did you know my command? lmao

grizzled raven
#

wdym

#

you said it was a ttt command

turbid bough
neat ingot
#

yea tic tac toe lol

#

tbh thats probably quite true

turbid bough
#

doubt

pallid zinc
neat ingot
#

lol yea iw as lazy in making my player square objects

grizzled raven
#

I ended up randomly writing a little minigame manager module thing today and did a simple reaction based tic tac toe minigame ๐Ÿ˜„
and uh, you know, this message

neat ingot
#

need to make it more effieicnt and junk, but it was just a fairly quick mock up ๐Ÿ˜„

#

wondering what other ascii based minigames i could maybe do

grizzled raven
#

mario party

#

smash bros

#

im goignto bed

turbid bough
#

chrome dino

neat ingot
#

i honestly would do animated stuff if embeds would allow for image files to be changed

grizzled raven
#

i actually started making a text based emoji based smash bros game but

#

oh you can

neat ingot
#

huh

#

wtf

grizzled raven
#

yeah just

#

edit the message with a new image?

neat ingot
#

every time i tried the image would come out of the embed ๐Ÿ˜

grizzled raven
#

huh

#

weird

#

well imma head out

neat ingot
#

sec, i was more nub with d.,js then and rewrote my code since, ill try again

#

np, hf ๐Ÿ˜—

pallid zinc
#

@neat ingot bot name?

digital ibex
#

guild.updateOne({ mod: { $push: { role:s 'h' }}}) anyone got any ideas why it doesnt update in the db? using mongoose

#

mod is an object

#

which has roles which is an array inside

neat ingot
#

yea, no. the image still comes right out of the embed for some reason ๐Ÿ˜ฆ

#

my bot is called DekBOT, but its undergoing changes atm that arent live. ๐Ÿ™‚

pallid zinc
#

Ok

queen needle
#
    ctx.beginPath();
ctx.rect(0, 0, canvas.wdith, canvas.height);
ctx.fillStyle = "#7289DA";
ctx.fill();```
neat ingot
#

๐Ÿ˜ฎ canvasery โค๏ธ

queen needle
#

im trying to set the background color for my canvas but its not wrking

neat ingot
#

this is regular browser canvas, or like, canvas js, or what?

queen needle
#

canvas with discord.js

neat ingot
#

so canvas js for node

#

?

queen needle
#

yes

neat ingot
#

k i use that, sec ๐Ÿ™‚

#

hmm

#

it appears i set the font color and then fill rect

#

sec, i wrote a bitmap class to handle it all so its all abstract atm lol

#

ok yea, the updating fonts handles fillStyle as well

#

so lets see

#

ok

#

for just filling an area in, all i do is:

ctx.fillStyle = '#C9B037';
ctx.fillRect(x, y, w, h);
queen needle
#
ctx.fillStyle = "#7289DA";


    // Since the image takes time to load, you should await it
    
ctx.fillRect(0, 0, canvas.wdith, canvas.height);```
#

im trying to fix the whole backgroun

#

background

#

@neat ingot

neat ingot
#

has a typo

queen needle
#

thank you

neat ingot
#

np, working now? ๐Ÿ™‚

queen needle
#

yeah but i have another trouble

neat ingot
#

f ๐Ÿ˜›

unborn steeple
#

what does [object Object] mean i done forgot ๐Ÿ˜‚๐Ÿ˜‚

clear tiger
#

Using discord.js

I've been trying to generate a list of what games people are playing on a server, though it doesn't seem to catch my current game and records it as me playing nothing

I'm using this:

GuildMember.presence.activities.name

Which feels wrong but it's the only lead I can get from the discord.js documentation, and the code isn't returning errors so I'm not really sure...

Not sure if this is a place where I should ask questions like this, sorry in advance if not

earnest phoenix
#

activities is an array

#

you can't call object properties on it because you don't have a reference to the object, you have a reference to the array of objects

clear tiger
#

any idea how to get their current activity then? I tried activities[0] as well which was probably smooth brain, obviously with no luck

#

actually, I managed to get it via eval thinkbby

#

I appreciate your time, hopefully I can figure it out before 4am brain hits me too hard

earnest phoenix
#

a user can have multiple activities concurrently, the solution on the top my head is just to use .map() to map the array to the activity names and then use .join() to join the newly created array of strings into a single string

clear tiger
#

I figured it out, I was checking for activities[0].type === "PLAYING", as it turns out they're integers

#

so it threw me off

#

I appreciate the help a bunch, sorry if it was trivial smolbrain stuff

clear wraith
#

what does this mean?

#

I was trying to install beautify as a module, and it says this.

#

witch are in the package.json file.

sick cloud
#

can someone explain to me why this is undefined

    <script src="assets/js/jquery.min.js"></script>
    <script src="app.js"></script>
    at download (app.js:70)
    at HTMLButtonElement.onclick (index.html:21)```
earnest phoenix
#

something's wrong with the jquery installation ig

bronze sail
#

is there a way to get a list of the people that reacted to a message? (discord.py)
like this:
$$reactions <messageid>
gets a list of the people who reacted

earnest phoenix
sweet cloak
#

JSON.stringify((JSON.parse(data || null).concat(obj))),

#

Does not work and i already have one stringify soo

sick cloud
#

JSON.stringify(obj)

neat ingot
#

you think it would it be faster to fully edit an embed from a message, or replace it, or negligible? (discord.js)

#

i mean, either way your fully changing the message content

pure lion
#

Dumb question

#

Nvm I'll break my code ahahahahahah

flat pelican
#

fun ๐Ÿ˜‚

earnest phoenix
pure lion
#

Ikr

#

ok please actually help me

earnest phoenix
#

JS?

pure lion
#

Yr

#

Ye

earnest phoenix
#

I write in python ._.

pure lion
#

Fc

earnest phoenix
true tundra
#

How do i make my bot give people the voted role? I used discord.js

pure lion
#

Uhhhh

#

Wait I know this one

#

Are you making it as part of a poll function?

true tundra
#

No like on top.gg when they vote for the bot

pure lion
#

Ohhhhhh

#

Nvm I don't know

#

How do I make roles changeable instead of fixed, E.g.

let mainrole = msg.guild.roles.cache.find(role => role.name === "New");

#

How to I make the role "New" variable

true tundra
#

Libary?

pure lion
#

Oh oops

#

discord.js

true tundra
#

Wdym changeable instead of fixed?

pure lion
#

Like

#

I run a command like q!setrole mute @muted or something like that, instead of it being hard coded

sick cloud
#

so i have an input

<input class="input-condensed" type="text" name="savepath" id="savepath" value="out/" disabled />

the value should be out/, but it's somehow being set to true:

#

need help sorting that

honest perch
#

true

pure lion
#

Very funny

sick cloud
#

ok?

iron scroll
sick cloud
#

map(item => db.delete(item)) something like this @iron scroll

#

i don't use quick.db so look at its docs for the right method

pure lion
#

Is there a function that acts the same as the enter key when writing a help command, e.g ('first line of help here') ('second line under it') etc, but I don't want the bot to send 50 separate messages either

golden condor
#

\n

pure lion
#

Js?

golden condor
#

Yes

#

Like this

#

Line 1\nLine 2\nLine 3 etc.

pure lion
#

Ok thx so much

golden condor
#

Np

pure lion
#

Do I need to use backticks?

golden condor
#

No but with backticks you can just do enter

pure lion
#

Oh alright

#

Thx!

earnest phoenix
#

Has anyone had a problem with bot double messages? (Language - Python)

#

||Sorry if there are errors (I'm not too good in English)||

slender thistle
#

Make sure you are restarting your bot properly

earnest phoenix
#

More precisely all my commands are repeated, except for Help (I restart the bot correctly)

nocturne grove
#

maybe you're hosting it somewhere else too, without the help command

earnest phoenix
#

can you type what you need to say in one cohesive message

pure lion
#

sure gimme a sec

#

i wish to make "New" and "mute" editable from within the server:
let mainrole = msg.guild.roles.cache.find(role => role.name === "New")
let muterole = msg.guild.roles.cache.find(role => role.name === "mute");

#

library discord.js

earnest phoenix
#

uh

#

what

pure lion
#

Idk

earnest phoenix
#

roles are always editable...?

pure lion
#

No I mean

earnest phoenix
#

oh you mean change which role to assign

pure lion
#

I wanna make the actual roles it's looking for editable in the server, so it's not hard coded

#

Yeah exacc

earnest phoenix
#

you need to use a database to store the id of the role

#

then simply get the role object with the id from the database

pure lion
#

Uhhhhhh

#

Would it update per server?

earnest phoenix
#

if you structure it like that, yeah

#

in an SQL database you'd have a table and in the table fields like guildId, mainRoleId etc etc

#

based on that

#

you can query for the role id of a specific guild id

pure lion
#

So, example, if I were to do:
q!setrole mute {role}

#

Ooooooooo

earnest phoenix
#

are you using JSON as a database

#

uh, maybe don't do that

pure lion
#

Cry is there any npm stuff that I need to install for SQL?

earnest phoenix
#

uh i have no idea i don't work with node that often

#

do some googling around

pure lion
#

D a m

#

Oki thx anyway

nocturne grove
#

@pure lion don't you just want to search any role? For example:
!find Muted
Bot reacts: There is no role called Muted

Like that in another format?

#

that's what I understand you want to do

earnest phoenix
#

they want the ability to freely set which roles are used for what

#

not being restricted to a name lookup

pure lion
#

Ye that

nocturne grove
#

ohhh okay

pure lion
#

Why is there a p in my name

#

Brb

#

Nvm

#

Someone change the p to a d please

Anyway

nocturne grove
#

a mod can do that for you, you can better ask that in #general I think

slender thistle
#

We don't do custom nicknames. Yours was changed to make it easily mentionable

pure lion
#

Can't I run a fetch command for the roles in the server and check if the argument matches the role or am I just talking gibberish

earnest phoenix
#

We don't do custom nicknames. Yours was changed to make it easily mentionable
a mod probably changed it thinking that the d was a p (it's filpped)

nocturne grove
#

but if you read it how it's supposed to read, it's a d

pure lion
#

It's fiiiine

nocturne grove
#

Can't I run a fetch command for the roles in the server and check if the argument matches the role or am I just talking gibberish
@pure lion yes you can do that

pure lion
#

Oooooo

earnest phoenix
#

that'll only be in memory though

#

once you restart your process all of the data you stored is going to be gone

#

it's why you have to use a database

pure lion
#

Aw

#

Looks like it's time to hopefully not destroy my bot and create SQL stuff yaaaay

nocturne grove
#

think I still don't understand you then ๐Ÿ˜…

earnest phoenix
#

don't be afraid to play around with it - it's the best way to learn

digital ibex
#

hi

pure lion
#

i mean i literally started coding 2 days ago for the first time maybe i should relax a bit

earnest phoenix
#

you seem to be a fast learner then

digital ibex
#

if i have js let o = ['hi', 'bye']; let p = ['hi', 'nobye']; how can i check if any value of o is equal to p, in his case, it would return true

earnest phoenix
#

95% of newbies we get here complain about how they can't do anything and demand to be spoonfed lol

pure lion
#

bruh lol

digital ibex
#

i've tried ```js
o.includes(p);

earnest phoenix
#

@digital ibex for loop through o, that way you get each string separately, use p.includes(o[your index from the for loop]) and break out of the for loop when the includes returns true

digital ibex
#

ah, ok, thank u

earnest phoenix
#

you'd also have some bool value laying around that you can set to true when p.includes returns true

nocturne grove
#

o.some() works too right? Think that's better

earnest phoenix
#

yeah, that does the same thing like what i said above

#

but some is easier

digital ibex
#

how would i do it with some?

#

kinda confused

earnest phoenix
#

same logic

#

check if array b contains the element from array a

digital ibex
#

can i do like

#
let o = ['hi', 'bye'];
let p = ['hi', 'nobye']; o.some((e) => e === 'hi');```
nocturne grove
#

yes you can, but that doesn't do what you want

earnest phoenix
#

^

quartz kindle
#

You need to combine .some with .includes

nocturne grove
#

you want to check if the element is the same as an element in the other array

digital ibex
#

kk, thanks guys

nocturne grove
#

np

quartz kindle
#

.some(e => p.includes(e)

nocturne grove
#

You need to combine .some with .includes
@quartz kindle o[key] will do the same, right? Or is includes() better? Just asking

#

like this: .some(e => p[e]

quartz kindle
#

.some will iterate over an array and give yoi each item from it

#

So for each item, you need to check if it exists in the other array

nocturne grove
#

yes I know, but I'm asking if one of e => p[e] and e => p.includes(e) is better

quartz kindle
#

you cant do p[e] in this case

#

Because p is an array, and e is a value, not an index

#

[a,b,c][0] = a
[a,b,c][a] = undefined

#

[a,b,c].includes(a) = true

nocturne grove
#

ow yeah oops

#

thx

pure lion
#

aaaaaaaa

earnest phoenix
#

if(newPresence.user.presence.status !== oldPresence.user.presence.status){
Cannot read proprety user of undefined

#

how can i do please

#

params > module.exports = async function(client, oldPresence, newPresence) {

pure lion
#

MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit

#

uh oh

earnest phoenix
#

use a single listener and handle all of your commands in that listener

pure lion
#

oki

balmy knoll
#

By now I develop bots in discord.js, but for my first bot I used discord.js-commando because it was easier to use. Now I would like to modify my first bot in commando, but I don't know how I can insert the custom prefix functionality. Can someone help me?

raven bronze
#

Aaaaaaaa ! I have found intelligent life on this planet!

#

Tim has a handle on it! @balmy knoll

nocturne grove
#

@balmy knoll you need to have a database to do that properly

#

@earnest phoenix https://discord.js.org/#/docs/main/stable/class/Presence?scrollTo=user
I see a ? there, I guess that means the property is not always there

I don't know why, but I think it will properly work if you first check if newPresence.user exists

balmy knoll
#

@nocturne grove Can i make this in a .json?

nocturne grove
#

you can, but many don't recommend it

#

I did that too, and spent another couple of hours to convert it to a proper database (which is also easier to use)

balmy knoll
#

@nocturne grove Ok thanks

cinder dove
#

any ideas how can I check the message is an emoji? (excluding custom emojis, only emojis like ๐Ÿ–๏ธ ๐Ÿ’  ๐Ÿ™ˆ etc)

#

Apparently I can't check them by trying to .get and see if it returns undefined or not, since they're unicode I guess.

#

Also making it inefficient like trying to use react doesn't seem like an idea, so maybe anyone has other ideas? ๐Ÿค”

earnest phoenix
cinder dove
#

oh great.

#

thanks.

grizzled raven
#

if you are ready to admit you cant use that, try using one of the emoji regexes

#

i could use that emoji map but im lazy bigbrain

earnest phoenix
#

yes but i check how @nocturne grove

fickle arch
#

erm 1 quick question how to use db for bot ?.

modest maple
#

which db

fickle arch
#

mongodb

#

you mean only people that doesn't get banned could vote ?.

gloomy imp
#

How to get GuildMember from user id?

fickle arch
#

for welcome message ?.

quartz kindle
#

guild.members.cache.get() or guild.members.fetch()
(discord.js v12)

gloomy imp
#

is the ID I send with or without the @

fickle arch
#

displayed ID but not member name ?.

gloomy imp
#

like Gigawolf#4406

fickle arch
#

bot mentioning user ?>

gloomy imp
#

just needs the object

#

then I save that and take values from it later on

surreal sage
#

how

#

do i

#

let a user join a guild with oauth2

#

i have it setup now only the script to let it join

neat ingot
#

im having tons of fun making dumb minigames lol

sudden geyser
#

I'd go against you in connect four _kannaFightMe

neat ingot
#

๐Ÿ‘€

#

bot update wont be live for a while, when it is we can have a game in test room ๐Ÿ™‚

#

ive made 4 minigames already ๐Ÿ˜„

#

tic-tac-toe, connect-4, maze runner, and a number version of hangman ~ 'guess my number man'

autumn quarry
#

I have a question, how do I make a bot say something different at a certain time?

earnest phoenix
#

uh

sullen patrol
#

I am creating a dashboard for my bot and I was wondering how you can get the look of the official discord website and mee6 dashboard

earnest phoenix
#

do you mean schedule a message, or send a random message each time @autumn quarry

#

@sullen patrol what do you mean

#

the styling?

sullen patrol
#

yes

#

and the switches

earnest phoenix
#

they hired professional web designers

sullen patrol
#

and stuff

#

because they both look the same

earnest phoenix
#

they don't

#

mee6 just draws inspiration from discord's design guidelines

autumn quarry
#

@earnest phoenix I mean, if the command is executed at 8:00 it says something, but if it is executed at 10:00 it says something different

sullen patrol
#

ok

earnest phoenix
#

which language are you using tirenity

autumn quarry
#

Discord.js (v11)

earnest phoenix
#

ok so js, that's a lib

autumn quarry
#

javascript

#

woops

earnest phoenix
#

use Date.now() and getHours() on that

#

though this is a problem because almost everyone is in a different timezone

#

so you'll probably want getUTCHours() for the UTC timezone

autumn quarry
#

ah

#

okay

earnest phoenix
#

that'll return an int (0-23) and then you can switch case on it and do a response that you want for certain hours

autumn quarry
#

timezones are definitely a problem in the servers i am in, barely anyone are in the same timezones lmao

nocturne grove
autumn quarry
#

@earnest phoenix I am confused on where to use the Date.now() and getHours()

earnest phoenix
#

wherever your command handling logic is

autumn quarry
#

I mean, do I use them like this:
let hours = getCDTHours() if(hours = ("8")){ message.channel.send("user is unavailable") };

earnest phoenix
#

oh, are you doing the "user is unavailable" for yourself?

autumn quarry
#

yes

#

for if i am asleep

earnest phoenix
#

where are you hosting the bot

autumn quarry
#

wym?

#

like on glitch?

earnest phoenix
#

home or a vps

autumn quarry
#

home

earnest phoenix
#

ah then you can just use getHours

#

it'll be in your timezone

autumn quarry
#

o

earnest phoenix
#

if(hours = ("8")){
this line is completely wrong

#

hours is an int

#

= is for assignment, == is for comparison ignoring types, === is for type sensitive comparison

#

you probably want to use the last one

autumn quarry
#

okay

#

makes sense why it gives me an error when i mistype

#

so would it just be:
getHours(8){}

earnest phoenix
#

no

#

getHours doesn't take in any arguments

#

it returns an int of the current hour

autumn quarry
#

oh

#

I put it in, and it says: "getHours is not defined"

#

I am just confused on how to do the second part

torn nebula
earnest phoenix
#

re-read what i said here

#

converting a date to a string takes time (not to mention overhead time for the includes method which is slow)

#

there's no reason to do that when you only need to check the amount

white anvil
#

if you want to run discord bot dont use heroku

tight plinth
#

getHours is a function of Date

#

if you want to run discord bot dont use heroku
^

white anvil
#

what are you running

#

ok

#

is it a web app

tight plinth
#

best way to code with heroku is to make a github repo, put ur code in and run it with heroku

#

yes

earnest phoenix
#

<b>

#

mindblowing, right?

tight plinth
#

<b> </b>

autumn quarry
#

lol

fickle arch
#

this is weird everytime i'm updating script the bot didn't show the console.log and it remain offline.

tight plinth
#

@fickle arch updating != running

autumn quarry
#

did you press ctrl + c and type node .?

fickle arch
#

yes

tight plinth
#

you need to restart the script

#

hm

fickle arch
#

ctrl+ s then ctrl + c and do node . or maybe node index.js

next mica
#

how would i do a command that shows the uptime of my bot discord.js v12

fickle arch
#

restart the script like how ?.

earnest phoenix
#

yes @nocturne grove

tight plinth
#

@next mica <Client>.uptime is a value that shows, in miliseconds, for how many time the bot is running. simply use it

next mica
#

ok thanks

tight plinth
#

np

next mica
#

the name

#

your name thou

#

ok

nocturne grove
#

@earnest phoenix use this:

if(newPresence.user && newPresence.user.presence.status !== oldPresence.user.presence.status){```
#

(ping me if you react)

next mica
#

i get the thin g humanize is not defined

fickle arch
#

i just want to said that xd.

next mica
#

ok

#

i also keep getting this

#

(node:13324) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit

#

idk

#

humanize still aint working

grizzled raven
#

what is an emoji identifier used for?

next mica
grizzled raven
#

like, if i change the getter to something different, would there be any consequences?

next mica
#

that gives 4 errors

earnest phoenix
#

lol

balmy knoll
#

Error: sqlite: filename is not defined How can i fix this error?

grizzled raven
#

define filename

balmy knoll
#

@grizzled raven I've never used this package. What's a filename and what do I put in it?

granite girder
#

A filename is something like:** index.js**

next mica
#

i got this righ there

#

(node:15092) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit

#

im wondering where yo i put the emiiter.setmaxlisteners at

balmy knoll
#

@granite girder Ok, but...

client.setProvider(
    sqlite.open(path.join(__dirname, 'database.sqlite3')).then(db => new commando.SQLiteProvider(db))
).catch(console.error);

The database.sqlite3 file where should I create it and what should I put in it?

granite girder
#

if it is in the same Folder you can type: ./database.sqlite3

next mica
#

would i do client.on(emitter.setmaxlisteners())

balmy knoll
#

@granite girder Ok, but i take this code online, what should I replace this file with?

granite girder
#

Do you mean you upload it in to an cloud or something like this?

balmy knoll
#

@granite girder I got this code from the official discord.js-commando github. It servers me so I can save data from each guild. But I've never used the sqlite library, so I don't know how to use it.

honest perch
#

i need help, pm2 decides to just shut off my main bot

#

but not my other bots

next mica
#

i fixed the emiiter with client.setMaxListeners(0);

torn nebula
#

better you should not do that

next mica
#

me

torn nebula
#

yes

next mica
#

why

granite girder
#

@balmy knoll i also donยดt know anything about sqlite3. Sqlite3 is a Database type right?

quartz kindle
#

its not a fix, its simply turning off the fire alarm lmao

torn nebula
#

nested events gives maxlisteners error

next mica
#

how do i fix it then

quartz kindle
#

dont add so many listeners

next mica
#

i need to set up a prefix thing?

quartz kindle
#

no, you need to do ```js
client.on("bla", bla => {
command1,
command2,
command3
})

#

and not ```js
client.on("bla", bla)
client.on("bla", bla)
client.on("bla", bla)

next mica
#

thats not what im doing

balmy knoll
#

@quartz kindle Can you help me?

next mica
torn nebula
#

nested events Use single listner

next mica
#

so how do i combind that to one event

quartz kindle
#

@next mica thats doing exactly that i said not to do lol

next mica
balmy knoll
#

@granite girder I don't know anything, I got the code online, I don't know what to do.

granite girder
#

@next mica you can make it like this:
client.on('message',(message) => { if(message.content === 'help'){ console.log('help') } if(message.content === 'yeet'){ console.log('yeet') } }

#

@balmy knoll If it is a normal Database you could use Mysql

next mica
earnest phoenix
#

Cannot ready proprety user of undefined @nocturne grove

next mica
#

like this if i dont want to log it

torn nebula
granite girder
#

yes

balmy knoll
#

@torn nebula sqlite.open(path.join(__dirname, 'database.sqlite3')) Yes, but in this code, database.sqlite3 is a file that i have to add in the bot folder?

next mica
#

i cant do it for all of mine i have some async functions

torn nebula
#

if database.sqlite is your database file
use
sqlite.open(../database.sqlite,)

#

to open db file

next mica
#

crafty how would i put a async funtion into that

granite girder
#

@next mica then use: client.on('message',async (message) => {
})

torn nebula
#

don't use async until you good with that

balmy knoll
#

@torn nebula Ok, but what does a database file look like and what do I put in it? Is there an online guide?

torn nebula
#

wait

next mica
#

so do one for async funtions

quartz kindle
#

@balmy knoll you dont make the file yourself

#

sqlite will create and manage the file for you

#

everything you do has to be done by sqlite, you never mess with the file yourself

balmy knoll
#

@quartz kindle I found this in the discord.js-commando documentation to use the built-in command to set different prefixes for each server. But to do that I need this database, but I don't know how.

next mica
#

ok crafty

#

finished it

#

thanks all to yalls help

unborn steeple
#

how do i fix [object Object]

#

im using discord.js 11.2.1

#

@balmy knoll look at the quick.db npm package it can be useful.

quartz kindle
#

object is a data structure that contains many items

#

you need to chose which item you want

#

otherwise, if you want to dump the entire object, you need to stringify it

#

JSON.stringify(object)

still merlin
#

Whats a eval command for

quartz kindle
#

for you to run tests and experiments in your bot

#

for example you can access your bot's code without having to change anything or restart your bot

earnest phoenix
#

anyone know hoo to make discord oauth2?

#

anyone know hoo to make discord oauth2?
you don't make it, you implement it

#

and it all depends on what you're using

hardy vector
#
let y = process.openStdin()
y.addListener("data", res => {
    let x = res.toString().trim().split(/ +/g)
    client.channels.cache.get("681657479691632641").send(x.join(" "));

});```i have this code to talk from console to channel but how do i make it so that i can also see messages sent by others in that channel
still merlin
#

MS question, How do I display the GMT time, Is it like {TIME:GMT}

quartz kindle
#

console.log messages coming from that channel

amber fractal
#

in what lang @still merlin

#

also what gmt time

#

gmt+0?

still merlin
#

Javascript

#

and uh normal gmt if thats a thing

next mica
#

how would i do music commands for my discord.js v12 bot

still merlin
amber fractal
proper escarp
#

is it possible to hyperlink an image (different than the source image link)? with the markdown it only supports linking text and not images, so im wondering if it's even possible

hardy vector
#

console.log messages coming from that channel
@quartz kindle how do i do that

quartz kindle
#

how do you receive messages from discord?

hardy vector
#

message.channel.send

#

wait nvm

#

thats to send messages

#

await message.channel.send? this way its waiting for a response

earnest phoenix
#

you should really learn how async/await works and how to use the lib you're working with

quartz kindle
#

where do all your discord messages come from?

hardy vector
#

a channel?

quartz kindle
#

no

#

in your code

#

what is the origin point of all messages?

hardy vector
#

the user

quartz kindle
#

where is the variable message first defined?

hardy vector
#

oh

fickle arch
#

anyone can help me solve this error ?.

    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received an instance of Object```
rugged brook
#

would I be able to get more information on my bot being denied

mossy vine
#

The "listener" argument must be of type function. Received an instance of Object

#

@rugged brook check who declined your bot in #mod-logs and dm them

rugged brook
#

tyty

fickle arch
#

@rugged brook mostly your bot got denied because
offline
lack of commands
etc.

wet scroll
#

@dusty onyx I believe you can make it reach all shards using broadcastEval (discord.js). Not sure about other libraries.

dusty onyx
#

mm yea i use py

pure lion
#

Uhhhhh I need help making a music bot

#

discord.js

wet scroll
#

good luck lol

pure lion
#

Ughhhhhh

wet scroll
#

I gave up on mine lmao

dusty onyx
#

would my bot still be able to send dms?

#

i assume so sksj

wet scroll
#

Should be able to yes.

pure lion
#

can someone help me

#

connection.play

#

@earnest phoenix

fickle arch
#

ytdl is not define
but i have const ytdl = require('ytdl-core')

copper cradle
#

show your code

fickle arch
#
server.dispatcher = connection.play(YTDL(server.queue[0], {filter: "audioonly"}));```
ytdl is not defined.
copper cradle
#

are you blind

#

you defined it as ytdl

#

and you're trying to use YTDL

#

javascript is case sensitive

#

ytdl is not the same as YTDL

fickle arch
#

oh yeah i'm forget i just looking up on my music script.

#

anyways thanks.

copper cradle
#
let x = 4;
let X = 3;
console.log(x, X); //4 3
fickle arch
#

oh yes work perfectly.

#

oh anyways how to make bot showing activities for (elapsed time) ?.

copper cradle
#

yeah

#

first get the current date and the length of the video

#

then do some math to get the remaining time

#

I don't remember the formula for that

fickle arch
#

i mean like
playing (apps name/watching servers) elapsed times : xx:xx.

lethal hawk
#

I have an issue with LowDB:

sudden geyser
#

Make sure you're saving the IDs as a string.

lethal hawk
#

Can't I save them as numbers? Because I have to compare them to server ID's I get from the discord API and those are decimal

fickle arch
#

oh lol my bot could play but can't stop xd.

sudden geyser
#

Why would a server ID be a decimal?

lethal hawk
#

Sorry, I mean integer :D
something lost in translation

sudden geyser
#

is the ID not a string itself? Are you using a library? What language are you using (I assume js from the screenshot)?

lethal hawk
#

I use discord.js and just looked in their docs. The ID is indeed a string, so that solves my issue. Thanks for pointing that out.

#

never the less, If I would like to store a large integer via LowDB, it will not be possible?

fickle arch
#
                var server = servers[message.guild.id];
                
                if (server.dispatcher) server.dispatcher.end();
                break;```
skip commands stop music and not skipping to other and also stop commands doesn't do anything
```case "stop":
                var server = servers[message.guild.id];
    
                if (message.guild.voiceConnection) message.guild.voiceConnection.disconnect();
                break;```
pure lion
#

ytdl is not define
but i have const ytdl = require('ytdl-core')
@fickle arch i already have this

sudden geyser
#

I use discord.js and just looked in their docs. The ID is indeed a string, so that solves my issue. Thanks for pointing that out.
never the less, If I would like to store a large integer via LowDB, it will not be possible?
@lethal hawk JavaScript is rounding the number because it's an overflow of what's allowed.

fickle arch
#

@pure lion fixed already but thanks.

sudden geyser
#

That's why you should store it as a string or use BigInt (it's new but I don't know what it does in detail).

lethal hawk
#

Ok, thanks for the good response!

pure lion
#

@fickle arch but i need help

fickle arch
#

jeez my music scriptpretty messed up
firstly my skip function stop the current music and not skipping to the next one
second my play function when added another music it stop the current play
third my queue function doesn't work xd.

pure lion
#

oh

mossy vine
#

okay so in mongodb i have the following document structure {id: 1234, nodes: [{from: 1, to: 2}, {from: 2, to: 1}]} how could i query the node objects based on only the to or from value?

sudden geyser
#

@pure lion what is your issue (as in the problem you're having)?

pure lion
#

im not sure how to phrase it

fickle arch
#

what does erela.js used for ?.

pure lion
#

@sudden geyser connection.play isn't defined even though i have the correct npm packs installed and set as a constant

fickle arch
#

show the error.

pure lion
#

alright

sick cloud
#

@mossy vine maybe fetch them all and do a find on them if its practical

const docs = // docs from mongodb
const item = docs.find(doc => {
  const val = doc.nodes.find(node => node.from === 1 && node.to === 2);
  return val;
});
fickle arch
#

@pure lion are your code same like this ?
server.dispatcher = connection.play(ytdl(server.queue[0], {filter: "audioonly"}));

pure lion
#

yeah

earnest phoenix
#

Hey can someone help me? my little brain cannot understand this.

pure lion
#

but connection.play are showing as "any" when i hover my mouse over them

#

Hey can someone help me? my little brain cannot understand this.
@earnest phoenix what with?

sick cloud
#

don't use that @pure lion

fickle arch
#

what.

sick cloud
#

you're not using typescript so djs won't show it properly, just use the docs

pure lion
#

im looking at the docs rn

sick cloud
#

whats your issue

earnest phoenix
#

@earnest phoenix what with?
@pure lion So i am trying to make a currentprefix command and this is what i have used.

client.on("message", (message) => {
    if (message.content === ("/currentprefix")) {
        message.channel.send(`Your current prefix is ${fetched}`);
    }
})```
Now there is an error that says `fetched` is not defined even though i have defined it here:
```js
  let fetched = await db.fetch(`prefix_${message.guild}`);
fickle arch
#

@sick cloud i had issues where my skip function turned into stopping music, play function stop the current music playing.

sick cloud
#

show code

fickle arch
#

can i show it on dm ?.

sick cloud
#

no, send it here

fickle arch
#

alright wait.

copper cradle
#

@fickle arch you can't have rich presence on a bot

fickle arch
#

play function

                if (!args[1]) {
                    message.channel.send("Please provide a valid link.");
                    return;
                }
    
                if (!message.member.voice.channel) {
                    message.channel.send("Please join a voice channel first.");
                    return;
                }
    
                if (!servers[message.guild.id]) servers[message.guild.id] = {
                    queue: []
                };
    
                var server = servers[message.guild.id];
    
                server.queue.push(args[1]);
    
                if (!message.guild.voiceConnection) message.member.voice.channel.join().then(function(connection) {
                    play(connection, message);
                });
                break;```
skip function
```case "skip":
                var server = servers[message.guild.id];
                
                if (server.dispatcher) server.dispatcher.end();
                break;```
stop function
```case "stop":
                var server = servers[message.guild.id];
    
                if (message.guild.voiceConnection) message.guild.voiceConnection.disconnect();
                break;```
#

stop function literally doesn't working because skip function actually stop the current music.

sick cloud
#

if (server.dispatcher) server.dispatcher.end();
well that's why?

#

you're ending the music

midnight blaze
#

I have a list like this in my json.
{ "test": [{"name":"test","age":"number"},{..}]}
I wanted to send in the channel this: Name:test, Age:numbers
question
this wont work, right?
list.test[0][0].join(", ")

sick cloud
#

no

#

you'd do list.test[0].name @midnight blaze

midnight blaze
#

ah, ok thanks โค๏ธ

pure lion
#

alright its working now

fickle arch
#

so i need to replace skip with stop and delete the voiceconnection.disconnect() ?.

sick cloud
#

dispatcher.end goes in stop

#

how you handle skipping depends on how you play music

fickle arch
#

when playing music the music that been played is replaced with other music.

earnest phoenix
#

So i am trying to make a currentprefix command and this is what i have used.

client.on("message", (message) => {
    if (message.content === ("/currentprefix")) {
        message.channel.send(`Your current prefix is ${fetched}`);
    }
})```
Now there is an error that says `fetched` is not defined even though i have defined it here:
```js
  let fetched = await db.fetch(`prefix_${message.guild}`);
#

can someone help me?

lethal hawk
#

try using var fetched instead of let fetched

fickle arch
#

like custom prefix ?.

earnest phoenix
#

yea i have a working custom prefix command but i am trying to make a currentprefix command in case someone forgets their prefix

#

try using var fetched instead of let fetched
@lethal hawk will do

fickle arch
#

well before i had function that when you mention bot like (namehere) current prefix it would shown the prefix.

lethal hawk
#

When I synchronize a voice channels permissions with its parent category using channel.lockPermissions().catch(console.error) (discord.js) I get the following discord API error.
Note that the bot does have the 'Manage Channels' permission in its role and the permissions are synced as they are supposed to.

DiscordAPIError: Missing Access
    at RequestHandler.execute (/rbd/pnpm-volume/36094c96-e504-4ecf-ab99-62f02cdefd9c/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
    at processTicksAndRejections (internal/process/task_queues.js:88:5) {
  name: 'DiscordAPIError',
  message: 'Missing Access',
  method: 'patch',
  path: '/channels/711671087355658290',
  code: 50001,
  httpStatus: 403
}
earnest phoenix
#

well before i had function that when you mention bot like (namehere) current prefix it would shown the prefix.
@fickle arch How'd you do that?

wary kraken
#

can someone help me figure out why my MarkDown text isnt showing? Well some is only 1 of the commands, all the rest aren't showing. ._.

#
___________________________________________________

Commands :

NonAdmin :

Economy (Work in progress) :

-X-

Social (Work in progress) :

-X-

Fun :

+avatar Shows your charactars avatar
+random Gives you a random number from 1-100

Other :

+help Shows the list of commands
+ping Shows how laggy the bot is

Admin :

Moderation (Work in progress) :

+kick Kicks a player from the server
+purge Deletes a certain amount of messages (Up to 999)

Other :

+react React to your message (Good for polls)
+say Have the bot say something (Work in progress)

___________________________________________________
#

and it gives me this

#

Commands :
NonAdmin :
Economy (Work in progress) :
-X-
Social (Work in progress) :
-X-
Fun :
+avatar Shows your charactars avatar +random Gives you a random number from 1-100

Other :
+help Shows the list of commands +ping Shows how laggy the bot is

Admin :
Moderation (Work in progress) :
+kick Kicks a player from the server +purge Deletes a certain amount of messages (Up to 999)

Other :
+react React to your message (Good for polls) +say Have the bot say something (Work in progress)


#

even tho there is clearly more than those lines

quartz kindle
#

make sure there is a space between * and the line

#

for example, if you want to create a bullet list

#

if you're not using bullet lists, just normal lines, you need to use double lines, otherwise MD will put them in the same line

astral yoke
#

if i have this ```const errors = require("../../../utils/errors.js");
const { ownerid } = require("../../loaders/reader");

module.exports = {
config: {
name: "test",
aliases: ["testing"],
},
run: async (bot, message, args) => {
let channel = bot.db.fetch(channel_${message.guild.id})
if (ownerid.includes(message.author.id)) {
if(channel) return channel.send("test")

        }
        
    }
}       ``` why does it throw an error saying channel.send isnt a function
delicate zephyr
#

because

#

you need to await the fetch by the looks of it

astral yoke
#

okay

#

ill test with it

#

ty

pure lion
#

play function

                if (!args[1]) {
                    message.channel.send("Please provide a valid link.");
                    return;
                }
    
                if (!message.member.voice.channel) {
                    message.channel.send("Please join a voice channel first.");
                    return;
                }
    
                if (!servers[message.guild.id]) servers[message.guild.id] = {
                    queue: []
                };
    
                var server = servers[message.guild.id];
    
                server.queue.push(args[1]);
    
                if (!message.guild.voiceConnection) message.member.voice.channel.join().then(function(connection) {
                    play(connection, message);
                });
                break;```
skip function
```case "skip":
                var server = servers[message.guild.id];
                
                if (server.dispatcher) server.dispatcher.end();
                break;```
stop function
```case "stop":
                var server = servers[message.guild.id];
    
                if (message.guild.voiceConnection) message.guild.voiceConnection.disconnect();
                break;```

@fickle arch where do i paste the skip and stop functions?

delicate zephyr
dusty onyx
#

discord.errors.HTTPException: 502 Bad Gateway (error code: 0): <html> <head><title>502 Bad Gateway</title></head> <body> <center><h1>502 Bad Gateway</h1></center> <hr><center>cloudflare</center> </body> </html> I keep getting this error- does anyone know what it means/a fix for it?

modest maple
#

What version of d.py r u on

earnest phoenix
#

0.01

dusty onyx
#

i can ch eck

#

hh where can i find the vers im on? im pretty sure its the latest but im not certaim

modest maple
#

what IDE r u using

earnest phoenix
#

are you having a slight stroke btw?

dusty onyx
#

pycharm

modest maple
#

go to file -> settings -> interpreture settings

dusty onyx
#

ok! 1.2.5

modest maple
#

update

dusty onyx
#

will i have to change my code at all?

earnest phoenix
modest maple
#

no

#

its nothing breaking

dusty onyx
#

oh good qwq

modest maple
#

it just fixes some cloudflare issues

dusty onyx
#

ugh upgrade packages failed

modest maple
#

what version of py r u on

#

and whats the error

dusty onyx
#

oh wait i got the error but it still upgraded

#

the pip anyway

#

huh

modest maple
#

probably upgrade pip

#

yh

dusty onyx
#

aa tysm ๐Ÿ’ž๐Ÿ’ž

#

hhh iโ€™m still getting the error

pure lion
#

YOOOOO I GOT THE MUSIC BOT TO WORK

#

only took me 2 days of no sleep

digital ibex
#

hi

pure lion
#

Can I have some help

#

Uh

#

Hi

earnest phoenix
#

Can I have some help
@pure lion no you cant

#

ask the question first

pure lion
#

That's a bit rude

earnest phoenix
#

nothing beats rudeness more than me yelling at my teammate because his frontend design attempt sucks

#

anyway

#

whats your problem

digital ibex
#

how can i check the users which have a certain role from an array of strings? so its like ```js
let array = ['role 1', 'role 2'];

pure lion
#

Ok so I'm using the ms npm pack for a timed mute, it's doing it in milliseconds so how do I make it last seconds and not milliseconds

earnest phoenix
#

try multiplying by 1000

pure lion
#

Already tried

#

Didn't work

earnest phoenix
#

damn

pure lion
#

Ikr

grizzled raven
#

what

digital ibex
#

wdym "how do I make it last seconds and not milliseconds"

grizzled raven
#

what did you try

earnest phoenix
#

dont know much about d.js development, im more of a py guy so

grizzled raven
#

1000ms = 1s

pure lion
#

Wait lemme try again

#

I may just be an idiot

#

Nope didn't work

earnest phoenix
#

that's not how that works

digital ibex
#

uh

pale vessel
#

array is not a number

steel drum
#

i mis interpreted the question

digital ibex
#

that won't be how u do it

steel drum
digital ibex
#

nor am i using djs

#

lmao

pale vessel
#

uh

#

did you realize

#

oh

#

nice

steel drum
#

you should specify what you are using then

pale vessel
#

still wrong though

steel drum
#

???

#

i said i misinterpretted the question

pale vessel
#

no

steel drum
#

i thought he meant a user having those roles

pale vessel
#

the answer is still wrong despite you misinterpreted the question

steel drum
#

provide the correct solution then

digital ibex
pale vessel
#

ah shit

#

read docs

earnest phoenix
#

i'm too high for this shit

pale vessel
#

just debug

digital ibex
#

no ik how to get the members roles & stuff, i just can't seem to filter it to which role & the members in tht role

quartz kindle
#

users that have any of the roles in the list, or users that have all roles in the list?

digital ibex
#

any role in the list

pale vessel
#

some, ig

quartz kindle
#

if a user has any role of the list, or find all users that have any role of the list?

pale vessel
#

all

#

it would be easier if you put role id

quartz kindle
#

guild.members.filter(member => member.roles.some(role => arrayofroles.includes(role)))

digital ibex
#

oh

quartz kindle
#

but keep in mind that you are limited by the members existing in the cache

#

uncached members will not be found

digital ibex
#

when i was doing it, it would return an empty array, i'll try and use it

#

ty, i cache all users

pale vessel
#

you can enable cacheAllUsers in client options but memory

#

my bot is small so i have that enabled for now

#

and i didn't read haha

fickle arch
#

jeez my music functions start breaking apart.

pale vessel
#

do something about it

fickle arch
#

i'm still figuring out why play function actually replace current played music, and skip function actually stop the music xd.

wispy roost
#

could not switching to the new intents thing slow down your bot? I have a bot I made yeeeeeaaaaarrrrssss ago and I haven't changed anything and it's having problems now

fickle arch
#

because update.

sterile mesa
#

Can i ask is this the right one?

client.guilds.cache.size
pale vessel
sterile mesa
#

;-;

#

ok thanks it works ;;--;;

earnest phoenix
#

well.. yeah

pale vessel
#

this is why you try first

earnest phoenix
#

why are people so afraid of just letting it run

#

do people not want to deal with errors

#

or smt

sterile mesa
#
(node:4) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined
#

Welp, help

fickle arch
#

well i'm letting my music function run and ended up having trouble.

pale vessel
#

because it will delete all files in the working directory

#

@sterile mesa x is not defined (x.id)

#

have you tried reading the error

sterile mesa
#

;;--;;

pale vessel
#

author is undefined

grizzled raven
#

always been thinking of making a discord.js-optionalCaching of some sort lmao

#

me and my fantasies

regal saddle
#

๐Ÿ˜Ž

pale vessel
#

discord.js-light

earnest phoenix
stable nimbus
#

Whoops

#
            const embed = new MessageEmbed()
                .setTitle('Deisel Fuel!')
                .setColor('#a1ee33')
                .setDescription(':fuelpump: Please wait 30 seconds for your truck to be refuled!')
                .setFooter(copyright);
                await message.delete();
                await message.channel.send(embed);
    
            setTimeout(function() {
                embed.setDescription(':white_check_mark: Your truck now has a full tank!');
                message.channel.send('Hey ' + `<@${message.author.id}>` + '!', embed);
            }, 30000);
            break;
        }```
Line 97 is: 
```await message.delete();```
Andy my error is the following: 
```(node:7132) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Message
    at RequestHandler.execute (C:\Users\dargc\Desktop\Coding\betarpbot\node_modules\discord.js\src\rest\RequestHandler.js:170:25)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)```
Unsure why this is happening
#

Discord.js is 12.2.0

sterile mesa
#

is it async

stable nimbus
#

Yes my code is async

sterile mesa
#

what do you want to delete?

#

author message or bot

stable nimbus
#

Author message.

sterile mesa
#

if (message.deletable) message.delete();

stable nimbus
#

So it deletes it.

pale vessel
#

it didn't say anything about line 97 in the error

sterile mesa
#

i use eventhandler ;-;

stable nimbus
#

Yes it does.

pale vessel
#

where?

digital ibex
#

hi @quartz kindle sorry i took so long, uh, it still returns an empty array for some reason

stable nimbus
#

at processTicksAndRejections (internal/process/task_queues.js:97:5)

pale vessel
#

that's not the file is it?

#

that's just a coincidence

stable nimbus
#

Not. As thats where the error is cropping up.