#development

1 messages · Page 1249 of 1

earnest phoenix
#

why not .startsWith

pale vessel
#

because one letter queries can be bad

earnest phoenix
#

nope

feral aspen
#

if(role.role.position > message.author.highest.position) return;??

earnest phoenix
#

collection.find only returns one thing

pale vessel
#

message.member

#

author is a user

vernal rivet
#

What type is role?

#

And that

pale vessel
#

and it would be member.roles.highest

feral aspen
#

let role = message.guild.roles.cache.find(r => r.name == args[1]) || message.guild.roles.cache.find(r => r.id == args[1]) || message.mentions.roles.first()

earnest phoenix
#

let role = message.guild.roles.cache.find(r => r.name == args[1]) || message.guild.roles.cache.find(r => r.id == args[1]) || message.mentions.roles.first()
@feral aspen lmfao code block fail

#

@feral aspen OMG STOP USING INLINE CODE BLOCKS MAN USE HASTEBIN OR ACTUAL CODE BLOCKS NOT INLINE

feral aspen
#

@earnest phoenix why u mad..

earnest phoenix
#

welcome to the developer community of madlads

thick gull
#

c o d e

#

ch i l l

earnest phoenix
#

o k a y

thick gull
#

its a literal one liner

vernal rivet
#

Yea change the message.author to message.member

thick gull
#

give hima break

#

i would check for a role mention first tbh

#

imo

slender thistle
#

@quartz kindle I usually recommend Sanic because it's for the basic parts similar to Flask

earnest phoenix
#

a l s o i d o n t h a v e a 2 k l i n e i n d e x . j s

thick gull
#

o k

slender thistle
#

few lines changed at best to run an async server, which is nice

earnest phoenix
#

i h a v e a 2 k l i n e b o t - c o d e . j s

slender thistle
#

😂

quaint hornet
#

Be prepareted

slender thistle
#

still gets me

earnest phoenix
#

Be prepareres
@quaint hornet i wasn't prepared for a r/BoneAppleTea congrats you're now a meme

charred kindle
#
import brain
print(brain.iq)

> -34
thick gull
#

congrats you just linked a subreddit outside of reddit

charred kindle
#

lol

thick gull
#

COMEDY

charred kindle
#

funy

thick gull
#

anyway lets go back to cODing

earnest phoenix
#

o k

charred kindle
#

lets go back to code913ing

earnest phoenix
#

it's a pseudonymous name idot

charred kindle
#

HOW DARE YOU CALL ME AN IDOT

earnest phoenix
#

Ok how do I handle HTTP exceptions to stop being ratelimited by discord?
@earnest phoenix anyone?

torpid tiger
#

Which version of node.js should I install for Discord.js v12?

vernal rivet
#

10+

torpid tiger
ionic dawn
#

hey @earnest phoenix so that finally happends the other day developer

cinder patio
#

12+

vernal rivet
#

That's for better-sqlite 3

torpid tiger
#

Hmm, how can ı fix that

cinder patio
#

Install node.js 12+

#

Node.js 12.0.0 or newer is required. https://discord.js.org/#/docs/main/stable/general/welcome

vernal rivet
#

Did they change d.js to require 12+? Last I remember it was 10+

cinder patio
#

v12 has always required node.js 12+

vernal rivet
#

Interesting

fluid widget
#

can anyone help me to fix could not find player config

slender thistle
#

Nothing better than a "type mismatch" error for fuck knows what!

#

Lovely VBA!

vernal rivet
#

Lol

#

Wdym rocket?

fluid widget
#

???

torpid tiger
cinder patio
#

I don't think that's related to discord.js

vernal rivet
#

This is glitch?

fluid widget
#

@vernal rivet you use server lunix or win

torpid tiger
#

yes, i added it to glitch via github to test v12 @vernal rivet

vernal rivet
#

I don't use server linux.

#

Have you tried doing pnpm enabled?

fluid widget
#

you can help me to fix could not find player config @vernal rivet

torpid tiger
#

@cinder patio I know the problem is from better sqlite but how can I solve it

vernal rivet
#

@torpid tiger are you using pnpm or nom?

#

@fluid widget idk what you mean by player config. Can you elaborate on that please

torpid tiger
#

@vernal rivet pnpm ı think

vernal rivet
#

Ok try doing npm enabled

shy turret
#

a l s o i d o n t h a v e a 2 k l i n e i n d e x . j s
@earnest phoenix i do jkjk 305 lines

slender thistle
#

Please tell me how the living fuck 0.7 * Abs(Tan(Sqr(Log(y * x)))) can raise a type mismatch error

#

if everything is a Double

torpid tiger
#

Let me try

#

@vernal rivet then?

fluid widget
#

I created a new music bot and it worked well, but there is a problem. There is some adult-only music on YouTube that he cannot play and see the picture

#

@vernal rivet

vernal rivet
#

It should rebuild all the packages you installed

#

This is ytdl core?

fluid widget
#

I have fixed it over and over but the same problem there is a problem with packages ytdl-core

#

yes

#

look

vernal rivet
#

Ummmm I honestly never encountered that before. I use ytdl-core + simple-youtube-api.

fluid widget
#

I downloaded the new update but nothing happened

delicate zephyr
#

You've probably been 429'd from youtube

fluid widget
#

I did not understand you

#

@delicate zephyr

vernal rivet
#

429 means too many requests

fluid widget
#

But the problem is not in 429 that the problem is in ytdl-core

vernal rivet
#

Have you check the docs, or git repo for ytdl-core for the player config?

fluid widget
#

yes @vernal rivet

vernal rivet
#

You have to pass a json object through. Check lib/info.js of ytdl-core in the git repo. Line 83, that will explain everything

fluid widget
#

I did not understand you
@vernal rivet

vernal rivet
#

Check line 83

fluid widget
#

I know that it is a page for adults, but it requires a login and how to log in to get it @vernal rivet

#

@vernal rivet ok how to login to use +18

vernal rivet
#

Did you not read the method. It requires a json string. Which is passed through the options parameter of the class I would assume

fluid widget
#

I understand you but I don’t know how to do it in order to fix it. Can you help me do it? @vernal rivet

wheat jolt
#

i mean, at the second if, it doesn't redirect me at the correct page

#

it doesn't redirect me to /login?redirectUrl....., but to /login

wheat jolt
#

nvm

fluid widget
earnest phoenix
#

can anybody just help walk me through the process of creating a bot

sudden geyser
earnest phoenix
#

oof heck. my computer doesnt let me open the thing that lets me code. Like visual studio isnt supported

#

I can't do this. I really needed this bot for mah discord. I just dont have the tools to do it. Heck. Sorry guys ;-;

thin turret
#

Watch an up to date ytb tutorial

earnest phoenix
#

use atom

sudden geyser
#

@thin turret what OS are you using (and/or what version of it). Have you heard of Visual Studio Code as well (not the same as Visual Studio)?

#

@earnest phoenix *

earnest phoenix
#

I'm on a chromebook. It doesnt let me open downloads at all

#

and because I am poor as heck I can't get anything else really.

sudden geyser
#

So you can't download software

earnest phoenix
#

nope

sudden geyser
#

An online code editor may be what you're looking for. I used a chromebook for a lot of my time, but it's no where as good as downloading the software.

earnest phoenix
#

School Chromebook

#

I dont even know how to set the bot up. I just woke up and was like "Yeah Ill try to make a bot."

#

i would need some serious hepl to just get the one command I need

thick gull
#

Well, what's the command

earnest phoenix
#

especially the last two lines

#

Basically somebody types one thing, the bot waits approximetely 7-10 seconds then responds

thick gull
#

i mean you can do that with tagging on some bots

#

like carlbot iirc

earnest phoenix
#

I know java. And from school CoffeScript(dumb dumb Javascript)

#

so you should just be able to use the lib's docs to get started

#

where's the problem

#

I just needed something that can just comment a couple seconds later. I don't know how to write that in java and I dont know how to get that into a bot either. I know how to write it in a simplisctic version of javascript but I mean Im just lost

#

😦

#

you see. I dont understand what that is

#

I can't download files on my chromebook

#

and I dont know how to do it online, nor how to make the command I need compatable with discord, nor how to make the command cooldown before the response. nor how to make the code work with a discord bot

#

I'm just not ready for this, but I want to be, but I'm not

#

and I dont know what to do now

#

the top 2 results returned from the lmgtfy are thoroughly documented libs

#

you need a machine to dev on

#

if you don't know what a lib is or how to use one, you don't have enough knowledge

#

i'm assuming you learnt it in CS

#

um... I speak java, (albeit not well) And I dont have enough knowledge.

#

But I need this bot so I have to learn

#

where can I start learning?

#

pretty much any library requires you to have extensive knowledge of the language you're going to work with

#

I dont have extensive of java and I hardly think anybody even knows what coffescript is

#

so............. I cant. I just cant.

#

ok

#

All I need is it to literally respond to somebody saying ;p

#

heck

#

are you trying to get pity or what

#

but again it has to say it 7 seconds after somebody types ;p

#

no lol.

blazing portal
#

Well there's 2 options then. Learn java, by looking at the links cry has given you, or second option is don't do it.

earnest phoenix
#

i'm confused as to what you want to do

#

do you want someone to make it for you?

#

I know basic java. I dont know how to code the specific command

#

if you had just clicked any of the links i sent you (which are just lmgtfy, you could've googled it and gotten your answer)

#

no. Nobody has to make anything for me. No I dont want pity. I just... I dunno.. I guess I just need help because I obviously can't make this on my own. But nobody has to do anything.

#

but I just think I'm going to give up. I cant do this and thats ok

#

this channel isn't for teaching basics per se, it's more of "i have an x problem, looking for a y solution"

#

for basics there are a plethora of resources online which are just a google away

#

I've tried searching my problem specifically but I havn't found anynthing

thin turret
#

Javascript epic for bots

earnest phoenix
#

I know how to make the command to respond

#

I dont know how to delay the response

#

i literally sent you two links that answered over half of your questions

#

Javascript epic for bots
@thin turret well uh no, but whatever floats your boat

#

I dont understand them. Which is why I am just going to give up. I dont know how to understand this yet. I'm very grateful for your help. I'm sorry for wasting your time.

thin turret
#

My opinion wasnt requesting input

earnest phoenix
#

are you implying anyone was asking for your opinion in the first place

thin turret
#

@earnest phoenix take your time and learn

#

You wont get the hang of it overnight

#

Its a slow process which needs dedication

earnest phoenix
#

I have been having a hard time finding a software to actually code it. From there I'm pretty sure I can figure out how to make a command

#

but I cant download stuff. I have to use it from a website.

#

that's the problem here

#

well the first problem

#

you need a machine which you have control over

thin turret
#

The ide you use wont define your success in learning the language

#

You could even use notepad

#

Ofcourse it will be a bit harder to troubleshoot

earnest phoenix
#

I only need one command

#

and I dont know what notepad is ;-;

#

I'm sorry. I'm trying to learn the best I can but I'm still really new at this. I've never made a bot

#

I can barely make a functional line of code in the course I'm taking

#

but I mean I know how to send a message

thin turret
#

Start by learning a supported language, then later on try making a bot

earnest phoenix
#

um..

thin turret
#

Alot of people jump into making a bot when they have 0 programming experience, and every 10 seconds they need help with something basic

earnest phoenix
#

^

#

well I wanted to try javascript, as I already know coffescript really well. and I assume coffescript isnt supported

unreal tapir
earnest phoenix
#

I used to be one of those people before i decided to go through the proper route

#

that's java right?

#

@unreal tapir you learn js

fluid widget
unreal tapir
#

discord.js

thin turret
#

Javascript

#

Java and Javascript are totally different

#

Dont get them mixed up

earnest phoenix
#

ok. I know some java. Just the general basics. Like making different files and stuff

#

I just need something that I can code in that doesn't require a download

thin turret
#

Theres online ide's

#

You just have to google search for them

earnest phoenix
#

um.. I'm not quite sure what those are. Can you send a link to one?

#

like do I just search "online ide's"?

thin turret
#

Ide's are the coding software you are asking about

#

Yeah

#

Like for java: "online java ide"

ionic dawn
#

does online IDE have any perk?

unreal tapir
ionic dawn
#

I mean... dnst look comfy to work with your files using online stuff

thin turret
#

They're on a chromebook and say they cant download anything

#

@unreal tapir you messed up your syntax somewhere

earnest phoenix
#

I found a JS one

#

it works

thin turret
#

Epic

earnest phoenix
#

so I need one more thing and I can get started

unreal tapir
#

else if (command === 'args-info') { if (!args.length) { return message.channel.send(You didn't provide any arguments, ${message.author}!); } else if (args[0] === 'foo') { return message.channel.send('bar'); };

ionic dawn
#

@unreal tapir you cant start and else if if theres no if statement before

unreal tapir
#

the one before is a try catch

ionic dawn
#

so?

earnest phoenix
#

how do you get it to work in discord. Like how will the bot be able to read and respond to comments. How do you get the input and write the output

#

@unreal tapir google this: javascript syntax

thin turret
#

Thats all djs

#

What you'll need to learn for discord bots

ionic dawn
earnest phoenix
#

Can you explain a bit more. Like what do I need to google to learn that

ionic dawn
#

rolan

thin turret
#

Theres discord.js documentation online, tutorials on youtube ect

unreal tapir
thin turret
#

Just have to research

ionic dawn
#

read the djs guide/docs

#

and ull be fine to go

misty sigil
#

docs are better

ionic dawn
#

both are better

#

one to read about it and other to practice

#

and some examples

thin turret
#

I dislike reading, so I watch videos at times Lol

ionic dawn
#

I do all, read, videos, github, guide...

earnest phoenix
#

so like. Can sombody walk me through this. If I want to run my code when somebody types a command, what would I write in the code itself

ionic dawn
#

everything is good

#

if it helps you it is fine

#

@earnest phoenix look for a command handler

#

when someone sends a message an event is triggered

earnest phoenix
#

if (message.content === ';p;{}

ionic dawn
#

you can read the message and see if theres a "prefix" in it

thin turret
#

Start small tho, you still need to create and setup your bot

earnest phoenix
#

like that?

ionic dawn
#

start with the basic ping pong command

earnest phoenix
#

if(message.content === 'p' )?

ionic dawn
#

startsWith prob better

#

thats an example from djs guide

earnest phoenix
#

message.content is the message itself

misty sigil
#

yes

earnest phoenix
#

do I need to define client, or message? or channel? or does the djs do that?

thin turret
#

Yes

misty sigil
#

Message is emitted

#

message.channel is a part of the emitted object

earnest phoenix
#

So I just want to know what variables I have to define

misty sigil
#

and client is a new Discord.Client()

earnest phoenix
#

and basically what to define them

ionic dawn
#

yeah you have to define the clinet like that const client = new Discord.Client

blazing portal
misty sigil
#

and log it in

ionic dawn
#

and you also want to add some stuff on the message event, like disabling everyone, disabling bot messages, etc..

earnest phoenix
#

ok So I'm going to need to get some help there but thank you SO MUCH

#

Really you are awesome

misty sigil
#

a whitename willing to learn how nice

ionic dawn
earnest phoenix
#

wait. I dont know how to se this ip tho

misty sigil
#

you’re literally one of the nicest people here

#

wait. I dont know how to se this ip tho
@earnest phoenix what do you mean

earnest phoenix
#

I need to learn more

misty sigil
#

by IP

thin turret
#

Just make sure the tutorials you follow match your djs version

earnest phoenix
#

thats what I mean. I dont know how to make this compatable with discord

blazing portal
#

that's why i linked you the guide

earnest phoenix
#

thank you 🙂

#

that video is a bit of a problem. I cant download and run files from my chromebook?

#

so would the online JS I'm using still work with that tutorial?

#

I like how I'm trying to do this to make one command. Then I might never use it again. I hope people in the server like this lol

thick gull
#

i mean you can use services like repl.it but expect bad hosting and stuff

earnest phoenix
#

que?

thick gull
#

there are some sites that let you code & host in side but they arent made for discord bots

#

and they are usually as learning tools rather than a proper final solution

#

but if you have no other option, it's something you might wanna look into

earnest phoenix
#

I just don't know if it's even worth it at this point. It's only one command. I can't make this the intended way and have to go off random sites. That alone is a struggle but I don't know how to make the code either. Plus I can't get somebody else to make it for me because I don't have a job yet. So.... I'm just done. My brain is mush and I havn't even started the precalc homework. Sorry guys, IK it's frustrating to deal with people like me who don't know how to use stuff like this and thank you all for your time. ❤️

fluid widget
thick gull
#

@earnest phoenix its okay, people have to start from somewhere ❤️

earnest phoenix
#

the thing is tho. I don't need this skill. I mean I don't need to make discord bots other than this one, and this one only needs one text command either way. I don't know if its worth it to learn this for one command.

thick gull
#

You might make one command and wanna keep going, that's what happened to me 😛

earnest phoenix
#

;-; I'm trying to balance online learning, learning java, and now js too, plus trying to learn how to do get it compatiable with discord. I can't lol. Like I dont think I can do it, and if I do, I'd put all of this effort into this thing for one command.

thick gull
#

fair Kooleyyspeedywave hope you can get all your stuff done kooleyyHeart

earnest phoenix
#

I mean I won't be able to. No dinero lol. So I dunno how I can get somebody to make it for me. But thats just what happens. It was my choice.

thick gull
#

create a message collector?

white vapor
#

is there a way to prevent my bot from sending an everyone or here ping from a repeat command in node.js

olive rune
#

allowedmentions

white vapor
drifting wedge
#

coinstogive = random.randomint(10,30)

#

gives error randomint isnt an atributwe

summer torrent
rancid bramble
#

I am getting an error TypeError: Cannot read property 'SPEAK' of undefined while trying to overwrite a roles permissions

summer torrent
#

show code

rancid bramble
#

the role is defined

#

the permission part or the whole code?

summer torrent
#

permission part

rancid bramble
#
        await channel.overwritePermissions({

  deny: ['ADD_REACTIONS'] ['SEND_MESSAGES'] ['SPEAK'] 

})```
summer torrent
opal plank
#

that was one hell of a rewrite

#

1745 additions and 2031 deletions

rancid bramble
#
        await channel.overwritePermissions(muterole, [
  {
     id: muterole.id,
     deny: ['SEND_MESSAGES'],
  }
])
}
                                          ) ```
```TypeError [INVALID_TYPE]: Supplied overwrites is not an Array or Collection of Permission Overwrites```
sudden geyser
#

You can remove the first arg to see.

fluid widget
opal plank
#

did it at least query the arguments?

#

i'd assume it either:
Did not grab your arguments
Didnt find the video somehow(URL encoding or poorly usage of returned query value)
Stream buffer problem
@fluid widget

#

you arent providing much info

rancid bramble
#
  {
     id: muterole.id,
     deny: ['SEND_MESSAGES'],
  }
])

doesn't deny the permission

opal plank
#

why do that when you can just make a role without SEND_MESSAGES perm and assign it to a user? @rancid bramble

#

why change all channel overrides rather than just use a role without that perm?

rancid bramble
#

¯_(ツ)_/¯

opal plank
silver lintel
#
message.channel.awaitMessages(msg => msg.author.id === message.author.id,
        {max: 1, time: 15000}).then(collected => {
          //poll Text Collector
          pollText = collected.first().contents;
          message.channel.send(pollText);
        }).catch(() => {
          message.channel.send('No answer for 15 seconds. Set up has been cancelled. ');
        });

the logs say it cant send an empty message

opal plank
#

console log pollText

silver lintel
#

ok

opal plank
#

cuz its likely undefined

#

also contents?

#

it returns a MessageType

#

Discord.Collection<string, DiscordMessage>

#

iirc

#

so Message doesnt have contents

#

its content iirc

silver lintel
#

it is undefined

opal plank
#

try content

silver lintel
#

ohh

#

ok

opal plank
#

rather than contents

silver lintel
#

oh wait

#

yes

#

sorry typo

#

thank you

opal plank
fluid widget
#

See the picture

opal plank
#

it shows the error there

#

could not find player config

fluid widget
#

Yes, but how do I solve this error

opal plank
#

either use a debugger attached to your node or check the documents for ytdl

fluid widget
#

how to do this either use a debugger attached

#

@opal plank

opal plank
fluid widget
#

@opal plank and

opal plank
#

and what?

#

read it

fluid widget
#

Did you mean to download the program and use it to fix the error? @opal plank

opal plank
#

wait

#

what do you use for coding?

fluid widget
#

notepad++

opal plank
#

you should likely use something better for coding than that

#

VSC or ATOM are my recommendations

#

if you really dont want to

#

your other option is exposing a debugger on chrome

#

but vsc handles all that for you

#

¯_(ツ)_/¯

fluid widget
#

It tells me the error is in ytdl-cord-discord

#

at exports.getBasicInfo (/home/ubuntu/m1/node_modules/ytdl-core- discord/node_modules/ytdl-core/lib/info.js:59:13)

opal plank
#

did you read the guide/docs for that package?

#

also VSC is for debugging, its not realated to the error, its a tool to make your life easier spotting WHAT is erroring

#

WHAT and WHY

fluid widget
#

When I work on the bot in the free server in repil.it it works fine and there is no error, but when I transfer the file to a private server lunix, this problem occurs when I play music for adults only.

#

@opal plank

opal plank
#

then you likely missing a dependency

fluid widget
#

I did not understand you

opal plank
#

you missing a file or package, likely

fluid widget
#

I downloaded all the private files in my music file but still this error

#

That error was in ytdl-core-discord

opal plank
#

you for some reason didnt move your package.json and node_modules did you?

silver lintel
#

how to check if a user has permission to type in a channel? in discord.js

opal plank
#

<member>.permissionsIn(<channel>).has(<PERM> or <[PERMS]>)

#

iirc

silver lintel
#

hmm okay thanks ill check

fluid widget
#

There was no node_modules free file in the server @opal plank

#

only package.json

opal plank
#

did you not build your folder once you moved?

#

npm init

#

?

fluid widget
#

I downloaded everything, and the bot music works, but your music for adults is not only played on YouTube@opal plank

opal plank
#

then im not sure, check the documentation for ytdl-core-discord

fluid widget
#

I have accessed ytdl-core-discord files and there is no error

opal plank
#

i said documentation

#

documents, not the file

fluid widget
#

You have entered the file info.js in which the logs error is

opal plank
#

info is likely only the handler that sends the error on your console

#

hence why i told you to use a debugger

fluid widget
#

I opened the debugger and there was no error

opal plank
#

did you START the debugging session?

fluid widget
#

I don't know how to use a correction session

opal plank
fluid widget
#

how can i downlode in vsc

#

@opal plank

drifting wedge
#

collection.update_one({"_id": member_id}, {"$set":{"purse":str(purse + coinstogive)}}, upsert=True)

fluid widget
#

discord.js

drifting wedge
#

py

#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: can only concatenate str (not "int") to str

silver lintel
#
destinationChannel = collected.first().content;
        let permCheck = destinationChannel.permissionsFor(message.member).has("SEND_MESSAGES");
        console.log(permCheck);

nothing shows up in console. no errors, but no permcheck thing

fluid widget
#

@opal plank My friend, I worked on the file that I said about on the personal computer, and it worked and you did not have any problem, and when I transferred it to the private server lunix , I encountered the problem again

opal plank
#

i dont know

silver lintel
#

does permissionsIn return true or false?

quick dune
#
    if (message.content.includes("@lost barn") {
message.reply('Hello, I am disco bot. You may help d!help to view a list of my commands. If you\'d like to invite me to your server you may do so by saying "d!invite".')
  }```
This does not work.
summer torrent
#

it returns permissions @silver lintel

silver lintel
#

@quick dune how doesnt it work? does anything show up in the logs?

#

or the bot isnt responding?

quick dune
#

Hold on.

silver lintel
#

also try @lost barn

#

with an ! added

quick dune
#

Alright.

earnest phoenix
#

add it as name only

#
  if (msg == `<@${client.user.id}>`
#

or use this

summer torrent
silver lintel
#
let permCheck = destinationChannel.permissionsFor(message.member);
        //let permCheck = message.member.permissionsIn(destinationChannel)//.has("SEND_MESSAGES");
        console.log(permCheck);
#

its not console.logging anything

lament rock
#

If there's a condition that could prevent that code from being executed, that's probably why it wouldn't log anything.
If it did reach that code and permCheck was undefined, it would log undefined

silver lintel
#
destinationChannel = collected.first().content;
        //let permCheck = destinationChannel.permissionsFor(message.member);
        //let permCheck = message.member.permissionsIn(destinationChannel)//.has("SEND_MESSAGES");
        //console.log(permCheck);
        message.channel.send(destinationChannel);
#

i did this and its sending the destinationchannel alright

opal plank
#

i give up

#

(╯°□°)╯︵ ┻━┻

errant perch
#

in discord.js whenever I write to a JSON file it adds an extra curly bracket } at the end

wanton aurora
#

made a bot but dont know a single line of code

silver lintel
#

then how did you make it? took code from github?

wanton aurora
#

Discord Dev stuff idk if it works

errant perch
#

v11 tutorials

wanton aurora
#

Bet

opal plank
#

agressively Copy pasting

silver lintel
#

welp

wanton aurora
#

Yes

errant perch
#

he's a lost cause

opal plank
#

100%

#

Do it like i did a couple minutes ago. Cant solve an issue? Submit a request to the platform to increase your ratelimits mmulu

#

no joke,i 100% just did that

errant perch
#

just hack the main frame

wanton aurora
#

If i knew how to code yes i just know control c + v

opal plank
#

nah, i mean it,unironically i just sent an email to staff requesting increased rate limits

errant perch
wanton aurora
#

Ill try to make coffee tomorrow and find out how to awaken my boy

errant perch
#

are you talking about the bot or the man downstairs

wanton aurora
#

Both

opal plank
#

Have you tried js? its pretty good to wake up screaming UNHANDLED PROMISE REJECTION early in the morning

umbral zealot
#

I love the smell of TYPE ERRORS in the morning.

errant perch
#

hey you have a unhandled promise rejected this will soon be deprecated hey hey hey update your code hey do it now

wanton aurora
#

If only i had a laptop

opal plank
#

Js deprecated, start using Ts mmulu

wanton aurora
#

Im on a tablet with a keyboard addon

errant perch
#

yea that would probably increase your development progress from 0% to 100%

prisma oriole
#

js and ts are dumb, use jsfuck

opal plank
#

jquery is the solution for every question in the universe

wanton aurora
#

ill just figure out how to awaken my creation

opal plank
#

have you tried turning it off and back on? mmulu

carmine summit
#

if you have a advanced command handler, and where should i put my functions???

wanton aurora
#

It doesnt even have an on switch yet

opal plank
#

huh?

wanton aurora
#

Im using the API

prisma oriole
#

lol what

opal plank
#

wdym advanced command handler?

carmine summit
#

on the index.js file or the

opal plank
silver lintel
#

i dont really know what you mean, but you could have a core file with functions which you can get when you need

carmine summit
#

main file

#

which

opal plank
#

what about it?

carmine summit
#

the command is in

prisma oriole
#

like client.commands = new Collection(); ??

carmine summit
#

no

opal plank
#

if you want functions, put them inside the file that function needs to be

carmine summit
#

function (){}

prisma oriole
#

function purgeCommand() ?

opal plank
#

if you need to pass a function as a callback to your handler, pass it as an argument

prisma oriole
#

im actually lost wtf lmao

silver lintel
#

are you gonna use the functions a lot?

#

or just for a command

opal plank
#

commands.get(something).run/execute(params, FUNCTION HERE)

carmine summit
#

So I will have a lot of duplicated functions???

silver lintel
#

ok i shut i leave pro to do it

wanton aurora
#

Welp i gotta figure out how imma use java online without getting viruses

opal plank
#

then export your functions

prisma oriole
#

bro i dont understand what he means doe

wanton aurora
#

I could use my Obama phone but it’s laggy af

carmine summit
#

im so confused

errant perch
#

in discord.js whenever I write to a JSON file it adds an extra curly bracket } at the end

silver lintel
#

send the code then

opal plank
#
//functions.js
function a() {};
function b(){};

export {a,b};

//index
import a from 'functions.js';
a();



//comand ping
import {a,b} from '../functions.js'
a();
b();

@carmine summit

wanton aurora
#

Found java app time to figure out how to make something

carmine summit
#

Directories are BS

#

too complicated

opal plank
#

stop being dumdum and learn it

carmine summit
#

whats the site to learn how directories work

opal plank
#

you mean relative pathing?

#

or be smart

silver lintel
#

i use function.js like

blahblah (stuff, stuff) {
//code....
}

and when i need it

const functions = require("../functions.js");
then you can use functions.blahblah() {}

thats not correct syntax tho so

opal plank
#

require

#

eeew

silver lintel
#

._.

opal plank
silver lintel
#

;-;

opal plank
#

import > require

silver lintel
#

require better for noobs liek me

opal plank
#

lazy devs who are afraid of beter and newer tools

silver lintel
#

B}

carmine summit
#

whats the defference of absolute and relative

opal plank
#

relative is relative to the folder you are currently in

#

absoulte is like your system path

#

c:/users/downloads/somefile

#

thats asbolute

carmine summit
#

so relative is more confusing

opal plank
#

./sameworkingfolder

#

relative takes a bit to learn

#

./ . ../

carmine summit
#

would rather absolute

opal plank
#

bad

carmine summit
#

teach me how to absolute

opal plank
#

no, i sent u docs

#

read it

carmine summit
#

ill read it

opal plank
#

if you switch your bot folder you fucked

#

move your folder and enjoy all the errors

#

or move your bot to a vpn

#

more errors

#

¯_(ツ)_/¯

#

relative path is the way to go

carmine summit
#

how to i go up a folder using absolute?

opal plank
#

you dont

carmine summit
#

aw

opal plank
#

get current path then remove last /{thing}

carmine summit
#

thats bad

silver lintel
#

whats a good image generation thing for node? im considering canvas

carmine summit
#

get current path then remove last /{thing}
what?

opal plank
#

path C:\Users\DELL\Desktop\NotABotBeta
dir above C:\Users\DELL\Desktop
aka, remove \{thing}

carmine summit
#

is that absolute?

opal plank
#

yes

#

though you are being a sturborn mule if you do it that way

#

stop being lazy and learn relative path

carmine summit
#

how do i go up a folder using relative?

opal plank
#

,,/

carmine summit
#

is that a comma or a period

opal plank
#

period

carmine summit
#

ok

silver lintel
#

lazy devs who are afraid of beter and newer tools
@opal plank bc i quit coding for like 2 years so i use outdated stuff ;-;

opal plank
#

then update it

carmine summit
#

./ - same folder, ../ - last folder, / - ???

opal plank
#

4h ago i just did a commit with 2300 removals and 1700 additions

#

like bruh,stop being lazy

#

@carmine summit you'd get if you read the docs i sentyou

carmine summit
#

reading the docs is too complicated for me

opal plank
#

i cant hold your hand dude

#

sorry

#

¯_(ツ)_/¯

carmine summit
#

/ - ??

opal plank
#

if you dont want put effort into it,why shall i?

carmine summit
#

???

#

is / a thing as a relative?

#

last question ^^

#

please

opal plank
carmine summit
#

Where am i going to put

a();
b();```
in ```module.exports = {
    name: 'ping',
    description: 'Ping!',
    execute(message, args) {
        message.channel.send('Pong.');
    },
};```
silver lintel
#

at the top

#
const filter = (reaction, user) => {
    return reaction.emoji.name === '👍' && user.id === message.author.id;
};

message.awaitReactions(filter, { max: 4, time: 60000, errors: ['time'] })
    .then(collected => console.log(collected.size))
    .catch(collected => {
        console.log(`After a minute, only ${collected.size} out of 4 reacted.`);
    });

i took this code from discord.js guide, but how do i make it so the user reacts to the message and the bot registers the reacted emoji?

wanton aurora
#

Just found out I need a laptop to actually do anything with this bot

#

So it’s just there

#

Waiting for a code that’s never coming

opal plank
#

no u dont

#

vps? rasp pi? cellphone? old unused device? smart fridge? You can use any of those to host a bot @wanton aurora

#

what u on about?

wanton aurora
#

Wh

#

what

opal plank
#

you dont need a laptop to either code or run a bot

faint prism
#

cellphone?
@opal plank are you talking about me? :3

opal plank
#

@faint prism god have mercy on those souls that do that

#

i hosted mine on an old Wii i had

wanton aurora
#

I’m trying to figure out how to even activate this thing

faint prism
#

I mean

#

As long as the cpu isn't bottle necking

#

You have redundant internet and a UPS (battery)

opal plank
#

i ran fine,though much more stress and it wouldve likely throttled

faint prism
#

More resilient than my rpi 4 tbh

wanton aurora
#

I saw this thing on how to activate your bot and how to ping it, but then I saw GitHub and I stopped

faint prism
#

Why

opal plank
faint prism
#

GitHub is just repos of other code

opal plank
#

oh shit my nitro expiring tomorrow

#

hopefully i should get back from the twitch staff tomorrow too, hopefully it counters out the emotions

wanton aurora
#

sad

opal plank
#

@faint prism guess what i did a couple hours ago

wanton aurora
#

Also the keyboard stopped working so I have to wait another week for it to do something

silver lintel
#

whats a permission should be for mute command? KICK_MEMBERS?

opal plank
#

my preference is MANAGE_MESSAGES

#

if you can delete chat message you likely a moderator at least

#

thats my smallest perm

silver lintel
#

ohh yes

wanton aurora
#

God my brain is full ooga booga right now I don’t have a clue what these people are saying

opal plank
#

then dont listen to them

silver lintel
#

well learn to code

opal plank
faint prism
#

@faint prism guess what i did a couple hours ago
@opal plank hmm?

opal plank
#

take a guess

#

it's giggle worthy

faint prism
#

I have no idea

#

You exploded your db

#

You ran your bot from your switch

opal plank
#

not there yet

#

So, i was getting rate limited on twitch

#

rather than doing the obvious and working around it

faint prism
#

You used tor

#

Or you made a new token

opal plank
#

i went and harrassed twitch staff into taking my request to increase rate limit rather than properly handling it

silver lintel
#

ahah

opal plank
#

im legit trying to pull this off on twitch staff

carmine summit
#

is it possible to read a variable but is declared on a different file???

#

people here hate me lol

faint prism
#

Lmao nice

solemn leaf
#

I need help with api

#

holy cow

#

here is what response.data give me

#
{"data":[{"targetId":3,"state":"Completed","imageUrl":"https://t2.rbxcdn.com/a4a3317a6b6509b5de81786bb7d5e959%22%7D]%7D
#

but doing this

#

response1.data.data.imageUrl

#

isnt anything

#

but it should be?

faint prism
#

data[i].imageUrl

solemn leaf
#

?

#

that is the api

#

@faint prism

#

bcs that didnt work

faint prism
#

What did you type

#

Because it's an array of objects

#

You I hope you didn't actually type data[i]. The i is the index of the array

silver lintel
#
const filter = (reaction, user) => {
    return reaction.emoji.name === '👍' && user.id === message.author.id;
};

message.awaitReactions(filter, { max: 4, time: 60000, errors: ['time'] })
    .then(collected => console.log(collected.size))
    .catch(collected => {
        console.log(`After a minute, only ${collected.size} out of 4 reacted.`);
    });

i took this code from discord.js guide, but how do i make it so the user reacts to the message and the bot registers the reacted emoji?

solemn leaf
#

@faint prism i didnt

#

I firgured it out

#

but when trying to put it into a thumbnail it doesnt show

earnest phoenix
#
if (message.member.roles.cache.has('713367575769383006')){
        message.channel.send(embed1)
    }else{
        message.channel.send(embed2)
        
        message.member.roles.add('713367575769383006')
        let verificationresult = new Discord.MessageEmbed()
        .setAuthor(message.member.user.tag, 'Verification Result')
        .setDescription(`*Member:** ${message.member.user.tag} **[${message.member.id}]**\n**Creation:** ${moment.utc(message.member.user.createdAt).format("dddd, MMMM Do YYYY")}\n**Suspicious:** No\n\n**More Information:**\n**Verification Passed?** Yes`)
        .setTimestamp()
        .setFooter('Your local automation')
    const logchannel = client.channels.cache.get('713365213151494221')
    logchannel.send(verificationresult)
        
    }```
#

(node:20812) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined

modest crane
#

logchannel is undefined

hoary delta
#

@earnest phoenix I think it may be because logchannel is of type cache whic does not have a function .send()

opal plank
#

logchannel is a variable

thick gull
#

what

opal plank
#

if they attach the log channel to a channel,it does

earnest phoenix
#

you should

opal plank
#

i would assume they wouldnt be stupid to call a variable logchannel and not referencing a channel

earnest phoenix
#

do

#

.fetch

#

incase if it isn't catched

opal plank
#

channels/guilds should all be cached iirc

hoary delta
#

yes but it is running the get function on a cache, im assuming that returns a cache not a channel

opal plank
#

what

#

that returns a <Channel>

hoary delta
#

oh i see

#

i wasnt reading docs

opal plank
#

Then dont suggest if you dont know

#

you'll get in the way more than you're helping with false information

arctic cape
#

@earnest phoenix define log channel first 😅 or set there only to send it in a channel by id or name 😁

earnest phoenix
#

.fetch will return the channel if it is in cache

#

so yeah

opal plank
#

its a map

#

should be cached

earnest phoenix
#

i did do that though

opal plank
#

show me what your logchannel is

#

@earnest phoenix

earnest phoenix
silver lintel
#

ive got an empty json file

{}

and i want to check if it has a muteRole, like settings[message.guild.id].muteRole. that doesnt work because muteRole doesnt exist. how would i do it?

earnest phoenix
#

{
"muterole": "id-here"
}

arctic cape
#

He wants to check in code @earnest phoenix

thick gull
#

are you using a JSON “database” AngryEyes

earnest phoenix
#

A permission so that only users and not administrators can use a command? Someone help me please

#

is for the antifloob

ionic shard
earnest phoenix
#

check does he has admin role, if not return; else continue ur code @earnest phoenix

#

admin perms*

#

@ionic shard u better save it in .env file

sonic lodge
#

@silver lintel you want to check if muteRole is defined?

ionic shard
#

any reason for saving it in a env file?

earnest phoenix
#

faster

#

better

#

ez

#

ezier

ionic shard
#

okay let me see

#

no wait

silver lintel
#

yes, how to define it?

earnest phoenix
#

??

ionic shard
#

im not doing static prefix

silver lintel
#

why?

ionic shard
#

im doing custom prefix

silver lintel
#

env is only for secret stuff like tokens

sonic lodge
#

settings[message.guild.id].muteRole = ...?

earnest phoenix
#

@ionic shard then u better save it in database

ionic shard
#

quick mongo or sqlite?

earnest phoenix
#

like database has infomations of all guilds

#

@ionic shard mongo fornme is ezier

ionic shard
#

eh i just need guild it and prefix

slender thistle
#

Mongo is more performant than SQLite, as far as I'm aware

silver lintel
#

how to check if it doesnt have muteRole? because if they redo the command, it will reset the muteROle

sonic lodge
#

settings[message.guild.id].muteRole !== undefined

earnest phoenix
#

@ionic shard ok go google and search fo mongo docs

silver lintel
#

ohh yes thank you pooled

earnest phoenix
#

i suggestbu should use mongoose

#

it is a npm and makes Mongo ezier

ionic shard
#

okay imma check

#

thanks

wanton aurora
#

Currently almost 11 and not a single line of code has been writen

#

Mostly because the code doesn’t know what discord.js is

#

So I’ve been sitting here looking at the error for about an hour with no solution and I feel like a bitch asking for help

lament meteor
#

Mongo is more performant than SQLite, as far as I'm aware
@slender thistle it also depends on what data you are saving

strong tundra
#

yeah if you aren't saving/accessing much it doesn't matter what database you use

silver lintel
#

is there a way for the user to react to the bots message and the bot registers the emoji in discord.js?

earnest phoenix
#
 if (!member.hasPermission("MANAGE_MESSAGES")) member.hasPermission('MANAGE_MESSAGES') = 'yes';
    let test = member.hasPermission('MANAGE_MESSAGES')
    message.channel.send(test)
silver lintel
#

i dont think you can do that, but just try changing 'yes' to true

earnest phoenix
#

no

#

that wont do anything

#

im trying to make it

#

so

#

if they have the perm

#

when you use test

#

it will say

#

yes

#

or no

#

but now

#

I need to put no in

#

and idk how to

silver lintel
#

ohh, okay you cant do it that way, you gotta do it this way

#
.overwritePermissions(guild.member {
    'VIEW_CHANNEL': true 
    'SEND_MESSAGES': true 
    'READ_MESSAGE_HISTORY': true
})
``` something like that iirc
earnest phoenix
#

no lmao

#

im not overiding

#

I need to see if the user has the perms

#

and if they dont

#

it says

#

no

#

and if they do

#

it says

#

yes

silver lintel
#

then just do

if (!member.hasPermission("MANAGE_MESSAGES")) message.channel.send("no");
if (member.hasPermission("MANAGE_MESSAGES")) message.channel.send("yes");
earnest phoenix
#

that wouldn't work

silver lintel
#

invalid left hand in asignment means the = sign is wrong

earnest phoenix
#

it needs something to change to if the user dosen't have the perm

silver lintel
#

then just make a variable like let YorN = true (starts off true but doesnt really matter)
then run the if statements and let YorN = false or true

earnest phoenix
#

can you write out a example as i'm quite confused

silver lintel
#

me too, can you elaborate on your question? from what youve said i think you said that you needed something to change if the user can manage messages or not

small zenith
#

message.member.roles.remove("717575259338833930") is it correct? bot didnt remove my role

earnest phoenix
#

so for a more in depth userinfo I'm going to check for the members perms, and have it display like this

Manage Messages No
Kick Members No

#

like that

#

or yes or no

silver lintel
#

okk

#
var manageMessagesYesOrNo;
if (!member.hasPermission("MANAGE_MESSAGES")) manageMessagesYesOrNo = "No";
if (member.hasPermission("MANAGE_MESSAGES")) manageMessagesYesOrNo = "Yes";
message.channel.send("**Manage Messages** " + manageMessagesYesOrNo);
earnest phoenix
#

holy shit

#

thankyou so much

#

lmao saved like 2 hours of my time just thinking

#

lmao

silver lintel
#

lol

slim heart
#

Yo I'm having really big trouble github actions and trying to deploy pm2, for some reason everytime the action is finished, the pm2 daemon shuts down the process or itself (not sure)

name: Node.js CI

on: [push]

jobs:
  build:
    runs-on: self-hosted

    strategy:
      matrix:
        node-version: [12.x]

    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - run: npm install
    - run: echo "DISCORD_TOKEN=$DISCORD_TOKEN" > .env
      env:
        DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
    - run: pm2 kill
  start:
    runs-on: self-hosted

    strategy:
      matrix:
        node-version: [12.x]

    needs: build

    steps:
    - run: pm2 start . -n "glenn"```
silver lintel
#

np

#

check logs

earnest phoenix
#

** - run: pm2 kill**

#

lmao

slim heart
#

i did, there's nothing

#

** - run: pm2 kill**
@earnest phoenix whenever i dont do this, it literally just doesn't start at all

earnest phoenix
#

I don't know this but try logging it

slim heart
#

just said there's nothing in logs at all

earnest phoenix
#

like in js can you go

#

log

slim heart
#

the process

#

doesn't start

earnest phoenix
#

console.log

slim heart
#

sorry it does until the job is finished

#

and im sure of it because the bot comes online, and everything console.log's yes

silver lintel
#

sorry, i dont know that much pm

#

just wiat for someone else to come and see

shell narwhal
#

!p marron

gilded lily
#

How to make Dank Memer Bot

silver lintel
#

that is such a general question. which part of it?

gilded lily
#

I was jk sorry lol

earnest phoenix
#

anyone have a document of all valid checkable permissions eg MANAGE_MESSAGES

silver lintel
valid frigate
#

awealaweawe;laksdm

#

guys

#

real talk how the fuck do i make a 32 bit aes256 key

earnest phoenix
#

how do i add embeds to my bot commands?

valid frigate
#

.send({ content: "", embed: {title: "hi"}})

earnest phoenix
#

you mean discord.js version?

#

hey @earnest phoenix so that finally happends the other day developer
@ionic dawn waitWhatSpin

#

um

#

it gives me a eroor

#

error

silver lintel
#

whats the error

#

check logs

earnest phoenix
#

nvm i fixed it

#

yay now i have embed commands!

silver lintel
#

nice

earnest phoenix
silver lintel
#

you sent the previous messages too

earnest phoenix
#

hmm

#

let me restart the program

#

its fixed now

main chasm
#

hello

earnest phoenix
#

Is rate limit is per ip or token?

#

My website has an Authorize thingy
And got rate limited

#

per ip

#

in bots it's per server

#

Ah ok

#

So buying lots of hosts will help?

main chasm
#

when my bot a person discconect it not join voice again how i can fix
note: music bot

earnest phoenix
#

X)

#

@main chasm please explain better

#

your English seems bad
can you speak something else?

main chasm
#

if a person

#

discconect my bot

#

bot not join again to voice channel

earnest phoenix
#

discconect my bot
@main chasm Bot is removed from voice channel?

main chasm
#

no

earnest phoenix
#

wut

main chasm
#

do u know what discconect ?

earnest phoenix
#

i don't get it

main chasm
#

when i discconect bot in voice channel bot working all commands but can’t join voice channel again

#

i want fix

#

it

earnest phoenix
#

@green kestrel ask em

#

your english isn't making sense to me

#

Can you speak another language?

main chasm
#

bro i speak english not arabic

earnest phoenix
#

but i can't understand

main chasm
#

u can’t understand your problem bro i speak english proper bur idk why u can’t understand me

#

i said when i discconected my bot in voice channel bot can’t join voice channel again when i used !play

earnest phoenix
#

DUDE

#

WHY CAN'T DISCORD DISPLAY PNG IMAGES PROPERLY

pale vessel
#

because that file is extensionless

earnest phoenix
#

wtf

silver lintel
#
let muteRole = message.guild.roles.cache.find(role => role.name === args[1]);
```ive got this code to find a muted role, but it doesnt work with role mentions and is case sensative. how can i make it so it works for: muted, Muted, @‌muted, @‌Muted and stuff like that
cinder patio
#

check if there are role mentions before searching the cache, use toLowerCase() to make the names lowercase

silver lintel
#

ok i did the lowercase thing but how to check the mentions?

cinder patio
#

message.mentions.roles is a collection of all the mentioned roles in the message, get the first mentioned role with the first method, if there are no mentions, fall back to finding the role from the cache

silver lintel
#

so message.mentions.roles.first()? then if mutedrole is undefined do the guild role find thing?

cinder patio
#

yup, or you can do let muteRole = message.mentions.roles.first() || (find from cache...)

silver lintel
#

ahh okay thanmks ill test

#

it says DiscordAPIError: Cannot send an empty message

cinder patio
#

You are sending a message which is empty

silver lintel
#

yes

cinder patio
#

Check all your send calls to see if the string you are passing is empty, or you are attempting to send something that isn't a string

silver lintel
#

i got it working by doing ```js
message.channel.send(<@&${muteRole.id}>);

#

thank you for the message.mentions.roles.first()

opal plank
#

Do a OR check

#

Check for both embeds or string lemgth

#

Not OR, AND

#

!payload.content.length && !payload.embed return

silver lintel
#

let muteRole = message.mentions.roles.first() || message.guild.roles.cache.find(role => role.name.toLowerCase() === args[1].toLowerCase()); how do i make it say something when it couldnt find a role

opal plank
#

Typing on mobile is a hassle ffs

#

If!muteRole return 'no role found'

#

ok im on pc now

#

jesus fucking christ that as annoying to type

silver lintel
#

how do i remove the square brackets

opal plank
#

substring()

silver lintel
#

substring (1, thing.length-1)?

opal plank
#

yup

silver lintel
#
let {body} = await superagent.get(`https://api.thecatapi.com/v1/images/search`);    
``` i did this to get the link, but what format and how do i change it so i can edit the json, and how to turn it back
earnest phoenix
#

Typing on mobile is a hassle ffs
@opal plank KEKWLaugh Guess who does that always

opal plank
#

i sure hope nobody

#

no soul should suffer that

earnest phoenix
#

Bruv

#

I literally coded my entire bot, website and npm package on mobile

#

Man how did you not notice

opal plank
#

Im afraid to ask how many sins you commited to be doing that much cleansing

earnest phoenix
#
let {body} = await superagent.get(`https://api.thecatapi.com/v1/images/search`);    
``` i did this to get the link, but what format and how do i change it so i can edit the json, and how to turn it back

@silver lintel You mean of getting the json, editing it then doing a post request to return it back

silver lintel
#

yes

earnest phoenix
#

Or what I'm confused

#

Well

#
let { body } = await superagent.get(<URL>);

// Edit the body deconstructed from the promise object that was resolved

superagent.post(<URL>, {
body: {
// The body you edited here
}
});```
#

But remember that the url that awaits or receives the post requests might be different than the base url

silver lintel
#

what i want to do is substring it

#

so take the first character and the last character of the json out

earnest phoenix
#

What do you mean by slicing off the first char and the last char from the json?

#

Show an example?

opal plank
#

i literally told you though

#

substring()

silver lintel
#

.substring(1, body.length - 1) (obviously body.length dont work i think, so that why i want to convert it into editing format)

earnest phoenix
#

But, using substring on what?

silver lintel
#

on the whole json

earnest phoenix
#

Property values?

opal plank
#

JSON.stringify().substring()

silver lintel
#

:O

opal plank
#

actually

#

wtf

#

no

#

what response you getting?

silver lintel
#

[{"breeds":[],"id":"c26","url":"https://cdn2.thecatapi.com/images/c26.jpg","width":852,"height":569}] i want to remove the [] from both sides

#

thats the json

opal plank
#

theresno way thats the json

#

json is an object

#

objetcs are {} not []

earnest phoenix
#

Array is an object type

silver lintel
#

;-;

#

well i just sucked you guys into the wrong thing and wasted yur time

#

;-;

earnest phoenix
#

Wait lemme do a test

silver lintel
#

so its an array

#

ok

#

what i want is just the body.url

earnest phoenix
#

So you just want the url

silver lintel
#

yes

earnest phoenix
silver lintel
#

yes

earnest phoenix
#

In superagent as it returns the body as an array in the response of that API,
You can do

body[0].url```
silver lintel
#
.setImage(body[0].url);
``` this?
earnest phoenix
#

Yes

silver lintel
#

oh it works

#

tysmtysm

earnest phoenix
#

Np

silver lintel
#

is there a way to await reactions where the user reacts to the bots message and the bot finds out what emoji the reaction was? or should i just use a simpler system?

earnest phoenix
#

Reaction collectors can do that

silver lintel
#

all reaction collectors i could find are like reaction role sorts

#

and dont read the reaction

#

well

earnest phoenix
#

They have a collect event which is emitted when a reaction is received

#

Returns 2 parameters of reaction and user who reacted

silver lintel
#

i can do messgae collectors easily

#

hmm

#

wait

#

bot: react to this message with the emoji you want
user reacts with an emoji
bot: the emoji is :emoji:

opal plank
#

bruh how many things you doing

#

every 2 minutes i look in chat u asking something completely different

silver lintel
#

this is last

opal plank
silver lintel
#

every 2 minutes i look in chat u asking something completely different
@opal plank bc im noob and dont know how to code

opal plank
#

w3schools

earnest phoenix
#

For example

let someFilter = (reaction, user) => user.id === <message>.author.id;

let someCollector = <message>.createReactionCollector(someFilter, {
time: 35000
});

someCollector.on("collect", (reaction, user) => {
// 'reaction' is the reaction that the user reacted with

// 'user' is the user who reacted
});```
opal plank
#

all ur problems are solved here

silver lintel
#

unexpected token ':' for time: 35000

opal plank
silver lintel
#

wait nvm

earnest phoenix
#

I suspect this is what you're trying to do

silver lintel
#

yes

#

it works thanks

earnest phoenix
opal plank
#

3 months

#

¯_(ツ)_/¯

arctic cape
#

discord.js v12 js if(message.member.hasPermission('ADMINISTRATOR'||'MANAGE_MESSAGES'))

#

does this not work ? think

slender thistle
#

hasPermission returns a boolean

#

and it only accepts one permission string