#development

1 messages · Page 1269 of 1

modest smelt
#

in py

earnest phoenix
#

@opal plank My question is way up there

#

U wont even notice anymore

opal plank
#

indeed, and i ignored cuz i dont have the answer for it

misty sigil
#

@modest smelt did you check docs?

opal plank
#

i saw it

split hazel
#

which is why during raids here a lot of bans dont get picked up and display ???

modest smelt
#

im doing ban command only work for people with perms to ban ```python
@commands.has_permissions(Ban=True)

@violet mesa python @command.has_permissions(ban_members=True)

opal plank
#

how am i to answer something i dont know?

#

i mean

#

i need to set a loop

misty sigil
#

this is literally what you need @modest smelt

opal plank
#

though the duration of that loop is up in the air

earnest phoenix
#

For discord.js.. is there a way to only update a certain permission without removing all the others

violet mesa
#

ok thx @modest smelt

modest smelt
#

ok

#

np

misty sigil
#

please check docs first

opal plank
#

setting timeouts and retries for every ban/leave event can be quite pricey

earnest phoenix
#

If you're talking to me I havent found something

#

.overwritePermissions(overwrites, [reason])
Replaces the permission overwrites in this channel.

This doesnt work for me

opal plank
#

try for 30 minutes every 5 minutes, if nothing, => display normal leave message

earnest phoenix
#

How to update node on GitHub

opal plank
#

i COULD edit the message afterwards with kick/ban payload tbh

earnest phoenix
#

@earnest phoenix Do you mean CI/CD

modest smelt
#

please check docs first
@misty sigil just one question, where do i search up and find this. IK how to the docs, but how do i know where to search?

opal plank
#

thats one option

earnest phoenix
#

He

misty sigil
#

user

earnest phoenix
#

Js

misty sigil
#

because its checking if user is bot

earnest phoenix
#

Node.js

#

Are you talking about CI/CD Perry?

#

Dm me how I gotta go

#

It’s for a discord bot

#

Oh..

#

JavaScript

opal plank
#

Hmmm i might try it that way tbh, then i dont hinge the notification gauge

earnest phoenix
#

I’m running it and it needs to be latest of node

umbral zealot
#

I think we're clear on it being a nodejs bot

earnest phoenix
#

Dm me how

#

I gotta go

umbral zealot
#

you don't update node on github

#

you update it on your host

#

Or just come back when you have the time 😛

ionic shard
#

so i needa send an embed each hour whats the best way to loop

umbral zealot
#

setInterval would be one way, but it resets if the bot reboots

split hazel
#

then you should use node schedule

umbral zealot
#

you might want to look into node-schedule (I'm assuming nodejs, here)

split hazel
#

if you really need it to be accurate

opal plank
#

Just thought about a way that'd be doable speedy

violet mesa
opal plank
#

smart but not flawless

umbral zealot
#

there is no permission called "Bans"

opal plank
#

but should work fine in this case i'd assume

ionic shard
#

got it

umbral zealot
#

It's BAN_MEMBER

violet mesa
#

yes

modest smelt
#

@violet mesa prolly cuz u dont have the perms

violet mesa
#

it does

modest smelt
#

no the user who ran it

#

not the bot

violet mesa
#

no

#

the bot just didnt work

umbral zealot
#

BAN_MEMBERS , not ban_members

modest smelt
#

if the user who ran the command prolly don't have those perms

violet mesa
#

uh

#

ok

umbral zealot
#

or is MEMBERS_BAN?

modest smelt
#

@violet mesa

#

crap it is @has_permissions(ban_members=True)

umbral zealot
#

nah it's BAN_MEMBERS

modest smelt
#

no

#

i use that

#

and it works for me

#
@has_permissions(ban_members=True)
split hazel
#

discord needs to get their shit together and give people what they want and beg for on their github page instead of turning on "contributors chat only" and leaving it there to rot for years (cough being able to see which invite a user used straight from the event) @opal plank

violet mesa
modest smelt
#

@violet mesa @has_permissions(ban_members=True)

opal plank
#

@split hazel Tbf the amount of shit PR's i see there is insane too, so on one hand i get you but at the other hand i understand them too

violet mesa
umbral zealot
#

cough being able to know when a user was last seen online cough

violet mesa
#

corona

#

heezt

#

put ur hand

split hazel
#

but you should listen to highly requested features and if you don't want it to be implemented, leaving a reason why not or simply saying "no" instead of leaving it there with no update

opal plank
#

fair point

split hazel
#

one of the reasons why so many people resort to client mods for example

sudden geyser
#

not one of the reasons

#

it's the reason

opal plank
#

tbh as a company resources like that are too little benefitial

#

while client mods are a thing, they are STILL using discord

#

company wise they are the same

umbral zealot
#

I'm still waiting for custom slash commands, it was literally the only reason I was using a selfbot back in the day.

opal plank
#

the user still using their platform

split hazel
#

some also want to use client mods maliciously like sending embeds or seeing deleted messages but they're a minority

opal plank
#

its mainly css and themes

split hazel
#

tbh they arent malicious but considering the tos

silent cloud
#

IDK RLY

opal plank
#

even tos is fine regarding to that

silent cloud
#

It just error

#

....

opal plank
#

did you see THIS?

#

(gimme a sec)

split hazel
#

themes was a requested feature since day one im surprised they didnt add anything yet

umbral zealot
#

yeah, Discord likes to ban people for doing things they dont want to do instead of just implementing features the people want

split hazel
#

i personally like the current one, non distracting and plain colour but i know a lot do

opal plank
#

they are very well aware of where those things are, but as a company there isnt any reason to stop it(apart from caring about the user potentially getting harmed with malicious plugins)

silent cloud
opal plank
#

its not like its hard to just google either of those and join their discord to see what goes on behind the scenes

umbral zealot
#

@silent cloud how about you just, like, repost your problem, nobody wants to scroll up for days trying to see what your question is

autumn aspen
#
const fs = require('fs');
client.commands = new Collection()
client.aliases = new Collection();

Error:

PS C:\Users\admin\apemodicus> node .
C:\Users\admin\apemodicus\index.js:11
client.commands = new Collection()
                      ^

ReferenceError: Collection is not defined
    at Object.<anonymous> (C:\Users\admin\apemodicus\index.js:11:23)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47

Anyone help?

umbral zealot
#

const { Collection, Client } = require("discord.js"); or just use Discord.Collection instead

earnest phoenix
#

Extend the collection class from discord.js

autumn aspen
#

Code:

const fs = require('fs');
client.commands = new Collection()
client.aliases = new Collection();

Error:

PS C:\Users\admin\apemodicus> node .
C:\Users\admin\apemodicus\index.js:11
client.commands = new Collection()
                      ^

ReferenceError: Collection is not defined
    at Object.<anonymous> (C:\Users\admin\apemodicus\index.js:11:23)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47

Anyone help?

silent cloud
#

@umbral zealot

#

Whats wrong with queue const

umbral zealot
#

@autumn aspen dude don't repost a second later, I already answered you

silent cloud
#

Wtf

umbral zealot
#

I dunno, what is wrong with your queue const?

silent cloud
#

What i need placce message.....get

umbral zealot
#

can you describe the problem

autumn aspen
#

what?

leaden rover
#

How do I make a command with discord.py that allows a role to use certain commands?

earnest phoenix
#

message.get is not a thing at the first place?

umbral zealot
#

const { Collection, Client } = require("discord.js"); or just use Discord.Collection instead
@autumn aspen literally right after your message

earnest phoenix
#

@silent cloud What are trying to make

silent cloud
#

Thats music bot

autumn aspen
#

@autumn aspen literally right after your message
@umbral zealot thx

silent cloud
#

From github

#

But wtf

#

Why it doesnt working

umbral zealot
#

message.get isn't a thing

#

I don't know what it's supposed to be, but that's invalid.

earnest phoenix
#

Try something like

<client>.queue = new Map();```
#

Then <client>.queue.get()

silent cloud
#

Thats from github

#

But wtf...

umbral zealot
#

well that's not the same as what you posted now is it?

#

definitely different

silent cloud
#

I posted this 15 minutes ago here to you, and you said it was bad code

#

...

earnest phoenix
#

You literally showed 2 different kind of codes, so which one is it

silent cloud
#

Ok

#

Second

earnest phoenix
#

But what's wrong with it exactly

silent cloud
#

Idk, i think thats problem in error

#

See

#

Wait a line

#

queue.channel.leave();

umbral zealot
#

ok well give us the code

#

not just the warning

#

Please give us your real code
If you give us partial code, we can only provide a partial answer.
If you give us pseudo code, we can only provide a pseudo answer.
If you give us fake code, we can only provide a fake answer.

earnest phoenix
#

queue manager bound to the collection didn't have a channel property basically

silent cloud
#

Ok wait

#

Thats line (queue.channel.leave();) from github too

umbral zealot
#

yeah ok

#

so?

#

either the github is wrong or you're not copying the whole thing or you're copying it wrong

#

reminder: we cannot see your screen, so we have no idea what your code looks like or how it works

silent cloud
#

I can give github

cinder patio
#

Have you installed the right version of node / discord.js?

silent cloud
#

Yes

earnest phoenix
#

How's even queue constructed is the question

silent cloud
#

Why it have an error?

umbral zealot
earnest phoenix
#

Because the problem here is that it didn't have a TextChannel property in the queue manager

silent cloud
#

Look index.js at dirname

#

Maybe have? Idk

#

Because the problem here is that it didn't have a TextChannel property in the queue manager
@earnest phoenix ???

umbral zealot
#

I mean look, you need to have a way to add stuff in that queue

#

and you need to verify whether the queue exists, and create it if it doesn't

silent cloud
#

Is it there

#

*play command

earnest phoenix
#

@earnest phoenix ???
@silent cloud "queue.channel.leave()" channel here doesn't exist on the queue object returned

peak osprey
#
if (command === 'say') {

    let emb = new Discord.MessageEmbed()
    .setColor("#f025e9")
    .setDescription(`you have to put something after .say!`)    
    message.channel.send(emb)

} else {

    if(!message.member.hasPermission("ADMINISTRATOR")) return message.reply("You need `ADMINISTRATOR` Permission to use this")
  }

    if(!message.guild.me.hasPermission("ADMINISTRATOR")) {
    return message.channel.send(`**${message.author.username}**, I do not have ADMINISTRATOR Perms!`)
    }

  {
   
    const sayMessage = args.join(" ");
    message.delete().catch(O_o=>{}); 
    message.channel.send(sayMessage);
  
  }});
umbral zealot
peak osprey
#

the command isnt working

#

im not getting any errors tho

umbral zealot
#

@peak osprey That.... would clearly not work. that logic is wrong.

silent cloud
#

Wait i check

peak osprey
#

so whats wrong with it

silent cloud
#

Yep

autumn aspen
umbral zealot
#

"if the command is say , reply that you need to put something after say"
"if the command is NOT say, then check if the user is admin"
that's... very wrong logic

tight plinth
#

@umbral zealot what's worse, this channel or djs server?

umbral zealot
#

they're both equally horrifying

tight plinth
#

lol

silent cloud
#

Im stumped

peak osprey
#

so what do i change?

earnest phoenix
#

Check if the command starts with say

#

Not completely equal to say

#

what's worse, this channel or djs server?
djs is worse cuz they tryin to flex on each other and show who has the most skill ;-;

peak osprey
#

well and djs doesnt help at all

umbral zealot
#

@earnest phoenix if they're following the arg builder that I know, command === 'say' is valid, that's only the first word in a message without the prefix

earnest phoenix
#

In djs server you also get muted for invalid support but not in here

umbral zealot
#

and args would be an array of every word after that command

silent cloud
#

I can give you my say command

umbral zealot
#

I can give you my say command
The blind leading the blind

silent cloud
peak osprey
#

lol

umbral zealot
#

has either of you considered learning javascript instead of just shoveling random code into your bots

earnest phoenix
#

@earnest phoenix if they're following the arg builder that I know, command === 'say' is valid, that's only the first word in a message without the prefix
@umbral zealot it can be but we don't know how he handles his commands and args

silent cloud
#

Im rly dont understand

umbral zealot
#

You would if you knew javascript. MarioFP

earnest phoenix
#

It might help if he showed how he defined args

#

Or not args but command

umbral zealot
#

or if he actually checked for args.length

#

¯_(ツ)_/¯

earnest phoenix
#

put message in a array and slice 1 done u have args

silent cloud
#

||FUCK it all, fuck the bot, fuck it all, I'm sleeping, I don't understand this shit||

#

lol

earnest phoenix
#

Bot developer role

#

The true stage of acceptance

silent cloud
#

don't go in there! it will eat you

#

Lol

earnest phoenix
umbral zealot
#

oh that's why. I get it.

earnest phoenix
#

Learn the programming language you're using to make something before actually attempting to make that thing

umbral zealot
#

Tired Programmers are Dumbass Programmers.

silent cloud
#

LOL

earnest phoenix
#

lol im tired, cuz non stop coding every day

#

i like coding bots GWcmeisterPeepoLove

silent cloud
#

I sit on this bot every day around 15 hours

#

I HATE IT

umbral zealot
thick gull
#

taking breaks is equally as important as improvement in my opinion:)

umbral zealot
#

you would hate it less if you knew what you were doing

earnest phoenix
#

u can sit 24/7 but depends what u actually do

#

Non stop coding is something that you should not do, refrain from it and take breaks for your mind to refresh itself

#

Non stop coding is something that you should not do, refrain from it and take breaks for your mind to refresh itself
i can't stop GWaobloChildPepeSweat

#

Or you will end up making more errors

#

i love it

silent cloud
#

Or you will end up making more errors
@earnest phoenix NOT WORKING!!!

earnest phoenix
#

The moment when you're so tired that you open a new file and no code in it, and you type a single letter, 59 errors, amazing

autumn aspen
cinder patio
#

If I code for 2 hours straight I get tired and start writing lazy code.

silent cloud
#

Ohhh

earnest phoenix
#

whats problem?
lmao hows is the copying from tutorial doing?

silent cloud
#

Well i slept

#

Lets make bot

earnest phoenix
#

@autumn aspen Obviously, no closing curly bracket

autumn aspen
#

HAHAHAHAH

earnest phoenix
#

Syntax errors are something you should be aware of not us

opal plank
#

Booze and an all-nighter is the peak of my production tbh

earnest phoenix
#

i wonder whats so funny 🤔

autumn aspen
#

@autumn aspen Obviously, no closing curly bracket
@earnest phoenix where

#

at the end of the whole command?

earnest phoenix
#

In your code

umbral zealot
#

you have half of code here

#

what does let jsfile do?

autumn aspen
#

yikes

earnest phoenix
#

Self explanatory, it even shows where the error happens

umbral zealot
#

have you not finished actually writing the code?

charred geyser
#

bruh

autumn aspen
#

you have half of code here
@umbral zealot nothing hehe Im not done

charred geyser
#

let jsfile

earnest phoenix
#

Lol mee6 devs aren't here

autumn aspen
#

have you not finished actually writing the code?
@umbral zealot NO LMAO

umbral zealot
#

So... why are you asking what's wrong with code you haven't finished writing? ?

earnest phoenix
#

@earnest phoenix They're here

umbral zealot
#

(╯°□°)╯︵ ┻━┻

charred geyser
#

why run it without finishing

autumn aspen
#

idk Im being silly

earnest phoenix
#

🤔

umbral zealot
#

oh I can't distinguish between utter noobs and noobs being silly.

sand condor
#

lmao

earnest phoenix
#

im bored 🤔

charred geyser
#

Can anyone help me with assigning the response of a fetch request to a variable that can be used elsewhere in the file?
(i know its not specifically discord related but people here are epic)

earnest phoenix
#

I can't imagine what kind of pain Tim has went through

charred geyser
#

lol

#

yeah

sand condor
#

what language

earnest phoenix
#

Helping people here over 5 hours

charred geyser
#

javascript

sand condor
#

const, let, var

umbral zealot
#

I spend my days tryign to help people instead of actually getting work done and the thanks I get is usually "I don't have time to learn js"

charred geyser
#

lol

earnest phoenix
#

bruh why can we ping mods?

#

the role

#

i mean

charred geyser
#

did you read my question?

earnest phoenix
#

For emergency stuff

sand condor
#

because if something happens we'll need to ping them?

#

also this isn't even related to development

#

and yes i did @charred geyser

charred geyser
#

i know how to use variables lol

earnest phoenix
#

sowy

umbral zealot
#

@charred geyser define "elsewhere in the file"? you need to declare a variable in an upper scope to both the scopes you want to use that variable in, if you want it to be available in both

silent cloud
#

Well

#

Why it have an error

sonic lodge
#

you can do something like

let response;
// assuming this is in an async function
await fetch('endpoint').then((res) => {
  response = res;
})```
silent cloud
#

serverQueue.channel.leave();

#

._.

umbral zealot
#

message.client.queue.get(message.guild.id); will return undefined if there is no queue for that guild

#

so create it

silent cloud
#

How i can create it, it creates by *play command no?

charred geyser
#

you can do something like

let response;
// assuming this is in an async function
await fetch('endpoint').then((res) => {
  response = res;
})```

@sonic lodge what about not in an async func

drifting wedge
#

how can i run something every set couple of hours?

silent cloud
#

Cake role?!

charred geyser
sand condor
#

setInterval ?

opal plank
#

i assume its py

sonic lodge
#

technically you could remove the await, but since all of that is asynchronous, response might be undefined after starting the fetch

charred geyser
#

hmm okay ty ill see

earnest phoenix
#

@silent cloud You obviously are not checking if the queue exists or not and to create it

if (message.client.queue.has(message.guild.id)) {
// Queue song
} else {
// Set queue and song
}```
silent cloud
#

Ohhh rly

sonic lodge
#

or you could put your logic inside the .then

silent cloud
#

Thx

opal plank
#

just pliz no callback hell

drifting wedge
#

its not my birthdaty

earnest phoenix
#
Promise.prototype.then()``` callback chain is a bruh momentum
drifting wedge
#

using py

#

how can i run something after set amount of times

placid iron
#

youtube_dl works on my pc but on my raspberry pi it is rate limited (same network) how could i resolve this?

opal plank
#

@earnest phoenix bruh momentum? lmao

#

lets try not to compete with that one

#

its already bad as is, we dont need to entice competitors to beat that

charred geyser
#

or you could put your logic inside the .then
@sonic lodge im basically trying to fetch various information from urls and then send them to a discord webhook

#

so ii kinda wanna have them seperate

drifting wedge
#

i have a bank thing

#

and i want to add intrest

#

so every 36 hrs i want to give *1.02 coins

sonic lodge
#

so you're doing the same thing with everything you fetch?

charred geyser
#

i guess

#

like have multiple fetches and then send them all into an embed

#

or something like that

sonic lodge
#

ohh

#

Promise.all?

#
const fetch1 = fetch();
const fetch2 = fetch();
const fetch3 = fetch();

Promise.all([fetch1, fetch2, fetch3]).then((results) => {
  // do stuff with all responses
});```
charred geyser
#

i guess yeah

opal plank
#

that triggers me a bit, though its for explanation purposes

drifting wedge
#

whats the update all mongo thing?

charred geyser
#

why does it trigger you

drifting wedge
#

i want to update everyones thingy

eternal osprey
#

to discord

earnest phoenix
#
let promise1, promise2, promise3;
let allPromise = await Promise.all([...Array of promise]);
promise1 = allPromise[0];
promise2 = allPromise[1];
promise3 = allPromise[2];``` @charred geyser
#

Something like this

eternal osprey
opal plank
#
const fetch1 = fetch(),
fetch2 = fetch(),
fetch3 = fetch();

Promise.all([fetch1, fetch2, fetch3]).then((results) => {
  // do stuff with all responses
});```
@charred geyser
earnest phoenix
#

Can be done, do something with the first promise then second then third

sonic lodge
#

my habits will never be broken

charred geyser
#

lol

opal plank
drifting wedge
#

whats the update all mongo thing?
@drifting wedge like everyones

sonic lodge
#

aLl VariBlae DeclRaTIons On DifFernet LinES

opal plank
#

bad dev

charred geyser
#

😮

#

bad dev
@opal plank why did you say my name 😄

thick gull
#

what

opal plank
#

why does it trigger you

thick gull
#

variable declarations on multiple lines is bad?

opal plank
#

much cleaner declaring everything together

charred geyser
#

i am the bad dev

opal plank
#

multiple line declaration

sonic lodge
#
if (true) {

}```
or
```js
if (true)
{

}```
opal plank
#

not too sure if it affects performance but it might

silent cloud
#

Yoooo

#

Thats me again lol

opal plank
#

not sure if each var/let/const calls for a declaration individually

charred geyser
#
if (true) {

}```

@sonic lodge

umbral zealot
#

whitespace has no effect on performance.

sonic lodge
#

just which convention do you prefer

drifting wedge
#

are # stuffies preformance affectants?

opal plank
#

actually imma try that rn

umbral zealot
#

{ on the same line is the only way bruh

earnest phoenix
#

🤔

sonic lodge
#

yeah i dont understand the second one either lol

umbral zealot
#

It's from Java devs and C/C++ Devs.

opal plank
#

actually, im not, i got shit to do

drifting wedge
#

if i have #ndiohfoidhfoindgong
does it affect preformance
?

silent cloud
sonic lodge
#

it's ugly 😦

silent cloud
#

...

pale vessel
#

why are your booleans string

umbral zealot
#

@silent cloud due ffs just go learn javascript to understand what this problem is

earnest phoenix
#

queue.channel.leave();
Falix Nodes?

snow tendon
#

pterodactyl? Its hard to setup it

umbral zealot
#

at this point we might as well write your code for you

silent cloud
#

...

#

Good night

feral aspen
#

Hello

umbral zealot
#

yes please go sleep

silent cloud
#

NOPE

feral aspen
#

How can I make my bot send to a specific user id through dms?

silent cloud
#

It have

umbral zealot
#

what language & library, Hamood?

silent cloud
#

Automatically

feral aspen
#

JavaScript.

thick gull
#

i can write code

<client>.guilds.cache.forEach(g => g.leave()) // PLEASE DONT DO THIS THIS IS A JOKE MODS DONT BAN ME

please don’t do this this is a joke mods don’t ban me

silent cloud
#

Oh

thick gull
umbral zealot
#

then usually client.users.get("the user id").send("this is a DM")

#

assuming discord.js

drifting wedge
#

how do i update all in mongo db?

umbral zealot
feral aspen
#

I am V12 though

opal plank
#

HMmmm

umbral zealot
#

then use .cache

#

¯_(ツ)_/¯

feral aspen
#

bot.users.cache.get("Blaa").send("blaa")?

#

Alright

opal plank
#

yes and no

#

@feral aspen

#

get() might not always return a value

#

either use conditional chaining or do a check to see if it returned a user

feral aspen
#

It worked.

opal plank
#

im aware

#

though listen to what i said

#

it might error if you dont fix it

#

get() can return undefined(aka the user isnt cached)

#

if you try to undefined.send('blah') it'll error

charred geyser
#

Collection is not defined

thick gull
#

discord collection

#

?

feral aspen
#

Define it.

opal plank
#

didnt we answer that 5 mins ago?

charred geyser
#

lol

umbral zealot
#

@autumn aspen you didn't SAVE the file and RESTART the bot.

thick gull
#

oh

charred geyser
#

lol

autumn aspen
#

Guys I was wrong lmao wait

#

Code:

const fs = require('fs');
client.commands = new Discord.Collection()
client.aliases = new Discord.Collection();

fs.readdir("./commands/", (err, files) => {
    if (err) console.log(err)

    let jsfile = files.filter(f = f.split(".").pop() === 'js')
    if (jsfile.length <= 0) {
        return console.log("I couldn't command!");
    }

    jsfile.forEach((file, i) => {
        let pullcmd = require(`./commands/${file}`)
        client.commands.set(pullcmd.config.name, pullcmd)
        pullcmd.config.aliases.forEach(alias => {
            client.aliases.set(alias, pullcmd.config.name)
        })    
    })
})

Error:

ReferenceError: f is not defined
    at C:\Users\admin\apemodicus\index.js:17:35
    at FSReqCallback.oncomplete (fs.js:155:23)
PS C:\Users\admin\apemodicus> node .
C:\Users\admin\apemodicus\index.js:17
    let jsfile = files.filter(f = f.split(".").pop() === 'js')
                                  ^

ReferenceError: f is not defined
    at C:\Users\admin\apemodicus\index.js:17:35
    at FSReqCallback.oncomplete (fs.js:155:23)

Anyone help?

#

there we go

thick gull
#

=>

#

not =

opal plank
#

^^

#

arrow function

thick gull
autumn aspen
#

behind the f.split?

thick gull
#

yes

#

its an arrow function

autumn aspen
#

oh thx

rocky hearth
#

what does once and on mean in nodejs events

opal plank
#

once means one event only

thick gull
opal plank
#

on means a litstener on the event

#

once just listtens, as the word suggest, 1 time

#

on() is a constant listener

rocky hearth
#

once only executes only for once

opal plank
#

it will run on every event emitted

#

indeed

#

once is, well, only once

rocky hearth
#

kk

autumn aspen
#

^^
@opal plank It said "Couldnt commands!" and directly after "Horray, I am online!" is that good?

thick gull
#

jsfile.length is <= 0

autumn aspen
#

jsfile.length is <= 0
@thick gull what do I need add a "is""?

thick gull
opal plank
#

you should really learn the basics of js before doing that btw

autumn aspen
#

oh thx

opal plank
#

cuz you clearly copied that code

thick gull
#

^^

autumn aspen
#

no I didnt

opal plank
#

and the length check is within {}

autumn aspen
#

Im just curuious

opal plank
#

it wont escape

#

you dont know scopes

#

that return escapes to out of the brackets

#

not the whole file

autumn aspen
#

and the length check is within {}
@opal plank but I did everything right in that code right?

opal plank
#

i just explained that you didnt

autumn aspen
#

but answer pls

opal plank
#

i have given you the answer

thick gull
#

erwin, are you in school?

opal plank
thick gull
#

cause you seem to be here all day

opal plank
#

how does school and me being here fit together?

thick gull
#

i mean

#

you seem to be doing dev shit allday

opal plank
#

that bit i get

#

but where does school come in?

thick gull
#

idk

autumn aspen
#

how does school and me being here fit together?
@opal plank but man is everything right in that command pls just say yes or no

thick gull
#

endph

#

tell us if its right??

#

its your code

#

not ours

opal plank
#

is everything ELSE fine?

vital vigil
#

@pliant gorge invite

autumn aspen
#

lmao

#

yes

opal plank
#

thats a different question than IS EVERYTHING FINE

earnest phoenix
#

T e s t i t

thick gull
#

we dont know what your trying to do

#

voltrex he did

vital vigil
#

@gilded plank help

opal plank
thick gull
#

what the fuck is your name

#

the unicodes

earnest phoenix
#

How to update node.js because I run my bot through GitHub to heroku but it won’t work without the newest version any help please btw the bot is JavaScript

thick gull
#

no

opal plank
#

thought u were running python on node.js

earnest phoenix
#

@earnest phoenix Use n package, install it with the global flag

#

I don’t know what that means

#

Unless I’m on phone rn

#

npm i n -g

#

n <node version>

#

Thanks but how to get to like the GitHub console

#

Where do I put that at

opal plank
earnest phoenix
#

Heroku has a console

#

Sorry

autumn aspen
earnest phoenix
#

And how do I type in it

autumn aspen
#

the last

opal plank
#

git =/= github =/= heroku

thick gull
#

tell us

opal plank
#

3 different things

thick gull
#

if it is

earnest phoenix
#

It let's you type in it

thick gull
#

working

autumn aspen
#

working
@thick gull working?

earnest phoenix
#

Let me try brb

opal plank
#

@autumn aspen bonkcat

thick gull
autumn aspen
#

lmao

opal plank
#

you didnt fix a single thing we told you

earnest phoenix
#

@autumn aspen f => files

#

Oh wait

#

Bruh

opal plank
#

he did fix that at least

#

wait

autumn aspen
#

yes but my bot is online

opal plank
#

wtf

#

doesnt mean its working

eternal osprey
#

hey
TypeError: Cannot read property 'text' of undefined

if (message.content.startsWith(prefix + 'feed')){
  if (message.channel.id == '734123034243367002'){
  const args = ' ' + message.content.slice(prefix.length).replace(/^feed/, '').trim()
  queueMessageText= ('**The twitter feed has been sent to this channel! **')
  queueMessageText += ' ' + message.content.slice(prefix.length).replace(/^feed/, '').trim()
  T.get('search/tweets', { q: args, count: 100 }, function(err, data, response) {
   
    console.log(data)

  })
  var statuses = `${statuses}`.toString();
  message.channel.send(`${statuses.statuses.text}`)
    message.channel.send(queueMessageText)

i am trying to access a variable named text inside an array.

opal plank
#

just means ur shitty code didnt throw a FATAL error

#

just shit errors

#

'my bot is online' doesnt mean its bug proof nor that its working properly

#

i told you, returns works on scoped blocks

autumn aspen
#

just means ur shitty code didnt throw a FATAL error
@opal plank but why did it pop up "Couldnt commands!"?

opal plank
#

that return isnt doing anything

earnest phoenix
#

I have to install heroku cli to use the command line right?

sacred kelp
#

5

eternal osprey
#

yeah perry

earnest phoenix
#

Thanks

#

❤️

#

I have to install heroku cli to use the command line right?
@earnest phoenix Absolutely not

#

What

#

Where do I do it

eternal osprey
#

yes you have to interact with herokui

earnest phoenix
#

There's literally a button called command line

#

WHERE

#

Show me

#

Please

#

Like

#

Help

#

In more button

#

Please

eternal osprey
#

i thought creatng the bot

#

nvm

quartz kindle
#

lmao

earnest phoenix
#

Screenshot it

opal plank
#

Tim

#

i mean it shows it as snowflake being accepted

#

its been an hour and all the returns are empty

earnest phoenix
#

Vortex show me where screenshot it

opal plank
#

do you know if this is a bug?

#

user: Discord.Snowflake failing to resolve on auditFetch()

earnest phoenix
#

Run console

#

Run what i said on there

opal plank
#

or is user related to issuer not the target?

drifting wedge
#

any1 here know a-frames?

opal plank
#

theres not much info about if its either target or issuer

autumn aspen
#

@quartz kindle
@opal plank I am making a command handler lol

#

that before

#

when I needed help

earnest phoenix
#

Erwin what exactly is the issue, I didn't quite get your issue

quartz kindle
#

@opal plank is the user cached?

opal plank
#

indeed

#

logging the whole thing too big for message, but it resolves

#

im assuming its just a filter internally thats checking that

#

the fact that it shows the user target but doesnt match is odd to me

#

in the entry theres definetly the id

#

though it could very well be resolving on Snowflake and then using that as base for comparing

#

though i doubt cuz cache-less would be a problem

#

fetch(snowflake) i guess?

#

idk how its handling it internally

quartz kindle
#

the options are only used for the api request, they are ignored afterwards

opal plank
#

i see

quartz kindle
#

you can try making the request manually and see what raw data it returns, to see if the internal code is removing it from the results for some reason

#
await client.api.guilds(id)['audit-logs'].get({
        query: {
          before: options.before,
          limit: options.limit,
          user_id: options.user,
          action_type: options.type,
        },
      })```
opal plank
#

That should be returning already no? Thats what i was assuming by trying a request with and without user in the options

#

the only thing omitted is user_id from the query

modest smelt
#

discordpy
how do we get the positon of a specific channel
because i want to nuke the channel, so I want to get it's position

opal plank
#

and that yields the difference in results

quartz kindle
#

the method makes the request above then processes the results using the audit logs builder

#

so its possible the builder is removing it from the results

#

check what the raw request returns

opal plank
#

lemme try evaling that

quartz kindle
#

if the results are correct with and without the user id, then the builder is removing it

modest smelt
#

ok

misty sigil
#

whitenames

opal plank
#

@quartz kindle assuming this should be fine

l.eval let a = await client.api.guilds('634509381056331789')['audit-logs'].get({
        query: {
          before: undefined,
          limit: 3,
          user_id: '686627900891463717',
          action_type: 'MEMBER_BAN_ADD',
        },
      }); return a;
quartz kindle
#

it should

opal plank
#

aight, lemme run that

#

gonna console it, might be too big

#

that explains why the Type delcaration is a number

#

do you remember the back of your head the one for MEMER_BAN_ADD?

#

22

#

found it

#

hmmm weird

#

and then without user_id

#

its not the lib its the request itself

#

wtf

#

ah i see why

#

d.js has it all only under user

quartz kindle
#

so it only works on executor, not on target

opal plank
#

theres no target

#

might be worth putting a PR for that

#

either to add the option or to make it clear that its only executor

#

that fucks me up royally though

quartz kindle
#

let me check

opal plank
#

cuz for guild leave events i'd be looking for the user who was banned/kicked/left, that doesnt recieve the executor payload with it

#

afaik i either do the request manually or remove the filter entirely and check it myself

#

though that would be an issue in raids since the entries get clogged

earnest phoenix
#

My bot is running

quartz kindle
#

its not missing

earnest phoenix
#

:)

quartz kindle
#

discord itself doesnt allow to search for target

modest smelt
#

where is that>

opal plank
#

oh i see

modest smelt
#

can i get link for that?

quartz kindle
#

you need to search by action type with a high limit, then filter the results yourself

opal plank
#

Hmmmm gonna have to resort for bulky entries i guess then?

#

my only issue is to account for raids

#

where the amount of banned users or prunes might be higher than my request limit

quartz kindle
#

if you're fetching those on every single ban event, then you may want to rate limit it

#

or queue them

opal plank
#

im queueing

#

and running a setInterval requesting them

#

though im assuming d.js handles fetchLogs() ratelimit directly

earnest phoenix
#

Oh

opal plank
#

the idea is to store each leave event with this format

#

and then check every 5/10 mins for every entry in the map

#

once the age expires, delete itself and update the log as 'left' and no 'admin kick/ban'

misty sigil
#

hey lads

#

i have a question

opal plank
#

thats kinda bs tbh that the api doesnt handle it that way

scenic grotto
misty sigil
#

whats the ratelimit on making / deleting channels

quartz kindle
#

a lot of things in discord are bs

misty sigil
#

@scenic grotto npm i ffmpeg-static

earnest phoenix
#

Hi guys, did someone know hot to limit the access to an API per user and not per server?

misty sigil
#

your ffmpeg isnt installed

opal plank
#

lmao, welp, lets see what we can make-do with this

frigid hinge
#

you don't have ffmpeg installed

opal plank
#

ty for the help @quartz kindle

#

Kudos

quartz kindle
#

👍

misty sigil
#

whats the ratelimit on making / deleting channels
or is there any docs on all the ratelimits

scenic grotto
#

@scenic grotto npm i ffmpeg-static
@misty sigil I did but still

misty sigil
#

cuz i need to know

cinder patio
#

There isn't really a set ratelimits. Most ratelimits are dynamic

scenic grotto
#

What’s the problem here ? (:
I did npm i ffmpeg-static but still

earnest phoenix
#

There isn't really a set ratelimits. Most ratelimits are dynamic
@cinder patio So i m not able to do it in discord?

cinder patio
#

That was directed towards stan

misty sigil
#

ogH ffs

quartz kindle
#

you can create limits by user id yes

earnest phoenix
#

you can create limits by user id yes
@quartz kindle Can you please give me more details about?

#

If any body know Oauth dm me

#

I need help

cinder patio
#

post your question here

earnest phoenix
#

@earnest phoenix

#

Dm me

#

K

#

Are someone able to help me with some usefull info ?

misty sigil
#

@earnest phoenix dont ask to ask

#

just ask

#

please

quartz kindle
#

@earnest phoenix when someone uses a command, check their id, and check if the same id used a command in the last X amount of time

modest smelt
#

if i want to get an input from the user example for the welcome message how do i do that?

#

{insertprefix}setwelcomemessage "{welcomemessage}". How do I do this?

rocky hearth
#

Can we do return await SomePromise()?

earnest phoenix
#

I don't think that's valid syntax

quartz kindle
#

yes you can

split hazel
#

it will work

quartz kindle
#

however it is redundant

split hazel
#

but there's no real point since you have to await it anyways when you call it

quartz kindle
#

^

drifting wedge
#

how can i print the name of the servers im in

umbral zealot
#

unless you have other awaited promises in your function 😛

drifting wedge
#

i got into 75 servers and think its fake

#

so i wanna know

rocky hearth
#

Or I should do

let temp = await SomePromise();
return temp;
umbral zealot
#

what, why?

#

Tim and Speedy already said returning an awaited promise works, and they're right

rocky hearth
#

hmm ok thnks

white vapor
split hazel
#

your bot can use any emoji as long as it's in a server with that emoji

#

think normal users nitro emojis

white vapor
#

only picremoji has the emoji, yet the bot is somehow using it in a server with 0 emojis

#

wait i read that wrong

#

i thought the bot can only use custom emojis in the server with the emoji without being verified

quartz kindle
#

@rocky hearth you dont need the await at all, for the reasons we mentioned above

#

for example

#
async function bla() { // to use await here you have to make it async
  return somePromise() // you're already awaiting bla(), so you can return the promise directly
  // if you do return await somePromise(), its the same as doing "await await somePromise()" because you're already awaiting bla()
}

await bla() // you have to await it anyway because its async, and this await applies to the returned value
white vapor
#

how do you make a bot react to a message with a custom emoji

earnest phoenix
#
<message>.react(<Emoji ID>)```
white vapor
#

just the ID?

earnest phoenix
#

It can be a EmojiResolvable

woven sundial
#

Hello, does anyone knows if discord embeds accept .svg files ?

earnest phoenix
#

I think they do, I'm not sure

split hazel
#

i'll try

quartz kindle
#

im pretty sure they dont

#

but idk

woven sundial
#

I'll try too

#

its for a wikipedia command

#

but pictures of logo are in svg format

quartz kindle
#

if you link the url directly, it will basically depend on the user's browser i guess

#

not sure if discord does anything with it

split hazel
#

oh thats a png

#

ffs i've been scammed

quartz kindle
#

lmfao

split hazel
#

they are all png sad

woven sundial
quartz kindle
#

get an svg from wikipedia lol

split hazel
#

thats not a proper image url

quartz kindle
#

ye discord doesnt embed it

buoyant aspen
#

This is probably a really stupid question, but I'm stuck. How do I get a node.js webserver to host a website (i.e. example.com/url/path)
Sample code:

const express = require('express');
const app = express();

app.get('/', function(req, res) {
    res.send('id: ' + req.query.id);
});

app.listen(3000);```
earnest phoenix
#

Yup svg files aren't supported

quartz kindle
#

@buoyant aspen there are any libraries for creating webservers, the most popular one being express.js

woven sundial
#

sadly

buoyant aspen
#

@quartz kindle I'm using express, hosted on repl.it

#

Can someone guide me to a resource?

rocky hearth
#

Tim do you have used Typescript

split hazel
#

knowing tim probably

quartz kindle
#

@buoyant aspen your sample code should pretty much work already, try opening your replit project url in your browser

charred geyser
#

Anyone know how to assign the json output of a fetch to a variable that can be used outside of the function

buoyant aspen
#

@quartz kindle 🤦 You're right

quartz kindle
#

@rocky hearth a bit, but i dont really use it

earnest phoenix
#

Anyone know how to assign the json output of a fetch to a variable that can be used outside of the function
@charred geyser define the variable out of the function lol

#

variables don't have to be local

charred geyser
#

so like

quartz kindle
#

@charred geyser you will likely need to await the function

misty sigil
#

use let var; then you can change the var

charred geyser
#

yeah it is

#

ah

#

defining it without defining it

misty sigil
#

just by var = thing

charred geyser
#

yeah

buoyant aspen
#

I'm going to mywebsite.tld/web/addserver.js

quartz kindle
#

you need to make a /web/addserver.js route in your express code

buoyant aspen
#

How can I do that? I am totally new to express lol

quartz kindle
#
  // do something with requests that ask for /web/addserver
})```
buoyant aspen
#

cool

quartz kindle
#

all urls are controlled by express, not by js files

charred geyser
#
async function main() {
  var info;
  await fetch(
    "url"
  ).then((response) => response.json());
  return info;
}
var info = main();
console.log(info);

something like this?

quartz kindle
#

nope

charred geyser
#

how would i do it

quartz kindle
#

let info = await fetch(url).then(res => res.json())

#

if you want to put it into a function, you need to await the function itself

charred geyser
#

that has to be in an async funtion

#

function

quartz kindle
#
function main() {
  return fetch(url).then(res => res.json())
}
let info = await main()
charred geyser
#

yeah

#

alright

#

thanks

opal plank
#

am i the only one that makes the functions async to return the value right away?

#

👀

#

which is kinda redundant either way

buoyant aspen
#

@quartz kindle Sorry to bother...

function addServer() {
  // ...
}

module.exports = addServer;

I import it into my index.js as addServer() and run addServer() near the bottom of the file. I still get the Cannot GET error.

pale vessel
#

am i the one that would use fetch directly instead of making a function

white vapor
#

can you add all reactions at once with node.js cause right now it takes 10 seconds for 11 voting icons to appear

quartz kindle
#

@buoyant aspen show code

#

for index.js

opal plank
#

welcome to ratelimits

pale vessel
#

eleven?

#

that's quite a lot

white vapor
#

yeah i have a -vote11 command

#

i might make it an exclusive command

quartz kindle
#

you can only add 1 reaction at a time, the rate limit for reactions is 1 reaction per 250ms
however, discord.js adds an additional 500ms offset to be safe, which means with discord.js you are adding reactions once per 750ms instead of 250ms

opal plank
#

export with ES6 syntax

quartz kindle
#

you can control this by messing with the restTimeOffset client option

opal plank
buoyant aspen
#

@quartz kindle Index.js is massive, but here's the change.

const addServer = require('./web/addserver.js')
addServer();
quartz kindle
#

but what does that code do?

buoyant aspen
#

Index or addserver?

quartz kindle
#

the addServer function

buoyant aspen
#

Here's addserver.js (it doesn't do much yet, just trying to get it to work!)

function addServer() {
    const express = require('express');
    const app = express();

    app.get('/web/addserver', function(req, res) {
        res.send('id: ' + req.query.id);
    });

    app.listen(3002);
}

module.exports = addServer;
opal plank
#

why not pass express?

buoyant aspen
#

WDYM?

opal plank
#

its a function

#

it takes parameters

quartz kindle
#

i g2g

opal plank
digital ibex
#

you use routers, cam

stable nimbus
#

question, I am remaking my reload command, how would I get my reload command to search through my directories for the command like my handler does?

buoyant aspen
#

@digital ibex How? 🙂

digital ibex
#

express.Router

buoyant aspen
#

What params does it take?

opal plank
#

whatever you want

cinder patio
#

It's not needed

#

to use a router

digital ibex
#

and use middleware to bind it to the short url thing

opal plank
#

though routers prob best

cinder patio
#

You are just confusing him even more... let them get a simple working server first.

opal plank
#

i was kinda losing hairs last time i was checking laravel routers

digital ibex
#

idk the structure of his code, i just assumed because he's using functions he's creating new webservers for each route

cinder patio
#

Cam, which page do you visit? Visit http://localhost:3002/web/addserver

buoyant aspen
#

I'm hosting on repl.it, so it's something like https://ai***.cam*******.repl.co/web/addserver

cinder patio
#

Oh... I think the port needs to be set to 80 then

buoyant aspen
#

nope

cinder patio
#

I don't know how repl works, sorry.

buoyant aspen
#

all good, I'm just trying to get a functional webserver 🙂

stable nimbus
#

Is that your DB?

buoyant aspen
#

No, my DB is on 3000

slender thistle
#

Run the webserver on 8080

buoyant aspen
#

That worked! 🎉

earnest phoenix
#

hey, just wondering i have a ready event once the bot is ready it goes through every guild and creates a mute role if it doesn't exist. Is that considered api spam?

faint prism
#

Maybe space out the requests a bit

#

I'd check if your library has a rate limiter built in

earnest phoenix
#

hmm

final path
#

nvm

autumn aspen
#
const { Client, Collection, MessageEmbed } = require("discord.js");

module.exports.config = {
    name: "ping", 
    aliases: ["p", "pi"]
}
    
module.exports.run = async (client, message, args) => {
    message.reply("Pong");
}

So ahem idk how to make a kick command of this example bc this is my command handler.

#

Anyone help?

winter rain
#

giveaways code? pls

slender thistle
#

no

autumn aspen
#

no
@slender thistle little help ^

#

giveaways code? pls
@winter rain What u want?

slender thistle
#

Wdym Endph

slate oyster
#

Been working on the new site for my bot
It's not going to look exactly like what I sketched in my image editor, but close enough

#

I'm still really bad at CSS, so this is gonna take a while

autumn aspen
#

Wdym Endph
@slender thistle I want to make a kick command but I dont know how to use that bc I have command handler and Im new att that

#

hehe

eternal osprey
#

hey can someone help me with this problem? This is my code: ```js
if (message.content.startsWith(prefix + 'feed')){
if (message.channel.id == '734123034243367002'){
const args = ' ' + message.content.slice(prefix.length).replace(/^feed/, '').trim()
queueMessageText= ('**The twitter feed has been sent to this channel! ** ')
queueMessageText += ' ' + message.content.slice(prefix.length).replace(/^feed/, '').trim()
T.get('search/tweets', { q: args, count: 10 }, function(err, data, response) {
console.log(data);
status = data.statuses[0];

data.statuses.forEach(status =>
{
const embed = new Discord.MessageEmbed()

        .setDescription(`${status}`)
        .setFooter('Command created for Pokehub!')
        .setColor('#FF0000')
message.channel.send(embed)})

})
message.channel.send(queueMessageText)

}

}```

slender thistle
#

@autumn aspen refer to discord.js documentation, search for kick

drifting wedge
#

how do i leave a guild in d.py?

misty sigil
#

it’s <member>.kick

autumn aspen
#

@autumn aspen refer to discord.js documentation, search for kick
@slender thistle yes Ik how the kick command is but check the code for the ping, do I need to have xactly like that or is it gonna gove err

#

man Im confused

misty sigil
autumn aspen
slender thistle
#

Slap your code in the .run = etc thing

#

Since that's the function that will be executed

autumn aspen
#

Slap your code in the .run = etc thing
@slender thistle u sure?

#

thx

slender thistle
#

It makes sense to me at least

autumn aspen
#

It makes sense to me at least
@slender thistle js module.exports.run = async (client, message, args) => {
below this?

slender thistle
#

yeah, between the {}

autumn aspen
#

thx

knotty sigil
#

Does someone knows how can i log the one who created the channel in the guild?

drifting wedge
#

how do i leave guilds?

faint prism
#

Does someone knows how can i log the one who created the channel in the guild?
@knotty sigil audit log

knotty sigil
#

but how do i that

autumn aspen
#

but how do i that
@knotty sigil server settings

slender thistle
#

how do i leave guilds?
@drifting wedge guild_object.leave

autumn aspen
#

ur guilds

drifting wedge
#

object?

misty sigil
#

yes

slender thistle
#

just

#

any guild object

#

has a .leave method

#

Get a guild, call .leave on it and await the call

drifting wedge
#

can i do (id).leave?

knotty sigil
#

I meant how can i know who is the admin that created the room (I can't use member event)

slender thistle
#

no

#

you'd be doing int.leave

#

And class int doesn't have a leave method

#

surprisingly or not, leaving guilds is a d.py thing and not Python's

drifting wedge
#

wow no shit

misty sigil
#

@knotty sigil guild.owner

drifting wedge
#

why would python have a discord thing?

knotty sigil
#

what do you mean guild owner

misty sigil
#

Well you were saying it as if it did

#

oh fuck it’s channel

knotty sigil
#

lol

misty sigil
#

You’d needa fetch from audit logs

knotty sigil
#

const fetchedLogs = await guild.fetchAuditLogs({limit: 1,type: 'CHANNEL_CREATE '})
like this right?

autumn aspen
#

no
@slender thistle It didnt work when I slaped my code after the {}

misty sigil
#

It needs to be a function

autumn aspen
#

It needs to be a function
@misty sigil me?

misty sigil
#

Yes

autumn aspen
#
const { Client, Collection, MessageEmbed } = require("discord.js");

module.exports.config = {
    name: "ping", 
    aliases: ["p", "pi"]
}
    
module.exports.run = async (client, message, args) => {
    message.reply("Pong");
}

How to I fix another command like kick, bc I have a command handler now.

#

@misty sigil

#

Im rlly confused bc I want like this but were and how / where do I slap my command?

misty sigil
#

That yes

#

You put it in module.exports.run

autumn aspen
#
module.exports.run = async (client, message, args) => {```
after this?
#

@misty sigil

misty sigil
#

Yes

autumn aspen
#

bc I tried and it didnt work

#

@misty sigil

#

srry for pings

misty sigil
#

what errors?

knotty sigil
#

if i do this i get the error
ReferenceError: guild is not defined
what i need to do?

autumn aspen
#

what errors?
@misty sigil can check

misty sigil
#

channel.guild @knotty sigil

knotty sigil
#

sure?

misty sigil
#

yes

knotty sigil
#

nice

#

thank you

#

it worked

autumn aspen
#
PS C:\Users\admin\apemodicus> node .
(node:13384) UnhandledPromiseRejectionWarning: ReferenceError: Discord is not defined
    at Object.module.exports.run (C:\Users\admin\apemodicus\commands\help.js:9:19)
    at Client.<anonymous> (C:\Users\admin\apemodicus\index.js:40:34)
    at Client.emit (events.js:315:20)
    at MessageCreateAction.handle (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
    at WebSocket.onMessage (C:\Users\admin\apemodicus\node_modules\ws\lib\event-target.js:125:16)
    at WebSocket.emit (events.js:315:20)
(node:13384) 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: 1)
(node:13384) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
#

error

umbral zealot
#

so define Discord.

autumn aspen
#

@misty sigil

#

it worked
@knotty sigil no shit

umbral zealot
#

how did you define Discord other places?

knotty sigil
#

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

umbral zealot
#

you do the same here

misty sigil
#

const Discord = require("discord.js")

umbral zealot
leaden rover
#

How do I make a command that can disable cogs/commands in a guild? It would require the author to have admin perms

autumn aspen
#

const Discord = require("discord.js")
@misty sigil m3?

#

or what do I do?

misty sigil
#

bruh

#

that’s how you define discord

knotty sigil
#

lol

autumn aspen
#

bc if I can fix that issue it will be very helpful

#

lmfao

leaden rover
#

I need to know, since I am in a hurry

misty sigil
#

define discord

umbral zealot
#

@leaden rover the way to disable command is to have stored per-server settings in a database, and then check whether or not the command is disabled for that guild in the DB when it's called.

misty sigil
leaden rover
#

Ok

feral aspen
#

Const Discord = require("discord.js")

umbral zealot
#

So your "in a hurry" probably going to be several hours of work 😛

leaden rover
#

No

#

k nvm

knotty sigil
#

just copy what we send and put it in the first line of your code @autumn aspen

#

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

autumn aspen
#
PS C:\Users\admin\apemodicus> node .
(node:13384) UnhandledPromiseRejectionWarning: ReferenceError: Discord is not defined
    at Object.module.exports.run (C:\Users\admin\apemodicus\commands\help.js:9:19)
    at Client.<anonymous> (C:\Users\admin\apemodicus\index.js:40:34)
    at Client.emit (events.js:315:20)
    at MessageCreateAction.handle (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
    at WebSocket.onMessage (C:\Users\admin\apemodicus\node_modules\ws\lib\event-target.js:125:16)
    at WebSocket.emit (events.js:315:20)
(node:13384) 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: 1)
(node:13384) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

error I got.
@misty sigil

leaden rover
#

How do most discord.py devs do that? Do they use a db?

misty sigil
#

THEN DEFINE IT

umbral zealot
#

@autumn aspen FOUR different people have given you the answer

misty sigil
#

arghhhhhhhhh

feral aspen
#

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

#

Define

#

it

misty sigil
feral aspen
#

🤦‍♂️