#development

1 messages ยท Page 1300 of 1

tardy hornet
#

thats the part that is not working:


                  if (!message.guild.me.hasPermission("ADMINISTRATOR")){
                    return message.channel.send("I don't have permission to that.");
                  }
                    if(!message.member.hasPermission('ADMINISTRATOR')){
                      message.reply('you dont have the premissions to use this command!');
                      return;
                  } 

i keep getting that i dont have the right permissions

honest inlet
#

When should I expect my bot to be approved?

solemn latch
tardy hornet
#

๐Ÿ˜ฆ

pure lion
#

WOO

solemn latch
#

do you have admin perms @tardy hornet

pure lion
#

do you css?

tardy hornet
#

yes i do

solemn latch
#

i suck at css

pure lion
#

also isnt it member.permissions.has in this case?

misty sigil
#

so do I

solemn latch
#

haspermission works

pure lion
#

mat

#

ple

dark kestrel
#

@tardy hornet omg ur Pfl

pure lion
#

ase

dark kestrel
#

i thought my screen broke

#

pfp*

tardy hornet
#

lol

solemn latch
#

is it because its not in an array ๐Ÿค”

#

message.guild.me.hasPermission(["ADMINISTRATOR"])

#

oi @misty sigil @pure lion are intents now required?

misty sigil
#

idk

solemn latch
#

its october 6th

dark kestrel
#

or

#

permissions.has("ADMINISTRATOR")

#

v12 style

#

:))

tardy hornet
#

message.guild.me.hasPermission(["ADMINISTRATOR"])
@solemn latch worked!
but what about the member perms?

solemn latch
#

put it in an array

#

[]

tardy hornet
#

i did

#

wait

#

i know the problem

honest inlet
#

Does anybody know the approximate approval time for bots?

solemn latch
#

it also said it on the page you submitted on iirc

honest inlet
#

Ok ty

tardy hornet
#

nvm i didnt fixed that

solemn latch
#

F

#

whats your code look like

tardy hornet
#

@solemn latch
any idea what is wrong in this one?

if(!message.member.hasPermission(["ADMINISTRATOR"])){
                      return message.reply('you dont have the premissions to use this command!');
                      
                  } 
solemn latch
#

๐Ÿค”

#

i dont see anything wrong with it

#

i know you probably already did, but double check you do infact have admin

tardy hornet
#

lol i dont have

solemn latch
#

so its working?

opaque seal
#

Intents are just a list of events the bot listens to right?
const client = new Client({ ws: { intents: ['GUILDS', 'GUILD_MESSAGES'] } });

solemn latch
#

yep

opaque seal
#

no nvm

misty sigil
#

uh I mean

#

yes

solemn latch
#

just what the bot gets

tardy hornet
#

so its working?
@solemn latch nope

opaque seal
#

GUILDS isn't an event I guess

misty sigil
#

fUCK THAT REMINDS me

pure lion
#

can someone plesaseseaseaseasease help me and @misty sigil with seeeee essssssssss essssssssssssssssssssssssssssssssss

misty sigil
#

fuck off I am in no way involved with the css

pure lion
#

you are now

#

+eval require("node-fetch")("https://top.gg/").then(res => res.text()).then(body => body)

misty sigil
pure lion
tardy hornet
#

@solemn latch so any idea?

solemn latch
#

nope

tardy hornet
#
if(!message.member.hasPermission(["ADMINISTRATOR"])){
                      return message.reply('you dont have the premissions to use this command!');
                      
                  } 

please someone

faint prism
#
<html>
  <head>
  </head>
  <body>
  </body>
</html>

There you go

misty sigil
#

@faint prism will that fix me and diceโ€™s site?

faint prism
#

Yeah, probably if you don't have it already

misty sigil
#

we do

faint prism
#

Well then no

solemn latch
#
#

get ahead of the curve ;p

sudden geyser
#

1 day until the storm comes

opal plank
#

thats only for verified bots i assume?

solemn latch
#

no, all bots need to be on intents right?

misty sigil
#

Iโ€™ll do my intents later

#

thats only for verified bots i assume?
@opal plank all

opal plank
#

fuck....

solemn latch
#

yeee

#

its so worth doing if it wasnt required though

sudden geyser
#

wait is it really all bots

opal plank
#

imma just do all and fuck it

sudden geyser
#

I may be fucked

solemn latch
#

yeah

#

lol

misty sigil
#

lmao

#

just put all the fucking intents

opal plank
#

i hope that passes tbh

misty sigil
#

if it works it works

#

inb4 discord.js already has default intents

solemn latch
#

probably does

opal plank
#

i would assume so tbh

misty sigil
#

notinb4 Sad

#

wait a sec

#

Iโ€™ll look at src

solemn latch
#

wait a minute ๐Ÿค”

opal plank
#

please do tell me if you find something, im hella hangover rn and ive got no patience to go look myself kekdog

solemn latch
misty sigil
#

I do not understand the src.

solemn latch
#

i think the update will just be priv intents

#

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

opal plank
#

i wonder though

#

doesnt NOT having member intents fuck everything up?

#

like, how you gonna cache all members in guilds without that?

solemn latch
#

so when new members join, update, or leave right?

#

you can still request members afaik

earnest phoenix
#

Why does discords oAuth2 user object not include premium_type anymore?

clever thunder
#

can someone gimme a script for a command for a certain role

earnest phoenix
#

quick c# question, are async functions better than threads?
can two different async functions work at once just like threads

#

e.g. for listening to messages

clever thunder
#

...

#

ok?

earnest phoenix
#

can someone gimme a script for a command for a certain role

#

wym, u want to give user a role?

clever thunder
#

mememememmememeeeeeeeeeeeeee

#

no

earnest phoenix
#

explain

#

splain

clever thunder
#

the command is for a role

earnest phoenix
#

ok, what exactly should command do

clever thunder
#

like lets say.. Mega member can use it

earnest phoenix
#

so, only member with specific role can use specific command?

#

Why does discords oAuth2 user object not include premium_type anymore?

drifting wedge
#

async def bio(self, ctx, *, arg):

#

how can i make arg like if not defined == none

earnest phoenix
#

javascript?

#

@drifting wedge

#

python

drifting wedge
#

pythonnn

earnest phoenix
#

big rip

#

JS is muuuuuuuuuuch better

#

no offence to python

drifting wedge
#

i should get renamed: 0exe the python gamer

clever thunder
#

im confused ima just look it up on yt cause none of you are helping

earnest phoenix
#

u didnt explain the question

#

@clever thunder

clever thunder
#

dafuq yes i did

earnest phoenix
#

maybe give more details

clever thunder
#

...

earnest phoenix
#

i cant guess ur problems, maybe show some code

solemn latch
#

i left my mindreading orb at work.

misty sigil
#

same

clever thunder
#

WHAT I MEAN IS ROLE PERMISSIONS

#

OR SOMETHINGS

solemn latch
#

what about role permissions

misty sigil
#

Iโ€™ll go fetch them if you want @solemn latch

solemn latch
#

plox

misty sigil
#

WHAT I MEAN IS ROLE PERMISSIONS
@clever thunder what about them tho

clever thunder
#

AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH

earnest phoenix
#

if member has a role?

misty sigil
#

and what library

#

and what fucking language

clever thunder
#

you aren't HELPING MEEEE

solemn latch
#

and whats the actual issue

earnest phoenix
#

u arent explaining shit

clever thunder
#

I DID

misty sigil
#

TELL US YOUR FUCKING ISSUE

#

WHAT LANGUAGE

#

WHAT LIBRARY

clever thunder
#

sigh

misty sigil
#

EXPLAIN YOUR PROBLEM IN DETAIL

clever thunder
#

im fucking stupid\

earnest phoenix
#

@misty sigil big up top gear

misty sigil
clever thunder
#

now be quiet

solemn latch
#

when i ask a question, I typically take 3 or 4 minutes to type it out ๐Ÿคทโ€โ™‚๏ธ

#

in depth

earnest phoenix
#

lmao lets go

misty sigil
#

okavaConfused

earnest phoenix
#

Why does discords oAuth2 user object not include premium_type anymore?

solemn latch
#

the dev docs says it still provides it

#

it is an optional thing it looks like

earnest phoenix
#

There is ?

solemn latch
#

so if its not included it means they have no premium

earnest phoenix
#

Might not provide

#

I made a request to it and all that comes up is this:

{
   id: '420366170428801025',
   username: 'SK1LL',
   avatar: 'b6af7d7d27d1337e65ff0f383e9679a0',
   discriminator: '0291',
   public_flags: 131200,
   flags: 131200,
   locale: 'en-US',
   mfa_enabled: true,
   provider: 'discord',
   accessToken: 'NOPE',
   fetchedAt: '2020-10-06T20:34:55.641Z'
}
solemn latch
#

do you have nitro?

earnest phoenix
#

lol no but it says premium_type would show up as 0

#

0 = no premium

#

1 = classic nitro

#

2 = $10 nitro

solemn latch
#

if it doesnt have premium_type then it means you dont have nitro afaik

earnest phoenix
#

$10 nitro? defoq

solemn latch
#

ye

#

overpriced ๐Ÿคทโ€โ™‚๏ธ

earnest phoenix
#

aaaaaaaaaaaa

clever thunder
#

tell me if this fucking works

#

if(!messege.member.roles.find(r => r.name === "CHAOS INSURGENCY")) return messege.channel.send('You might wanna change your team to Chaos Insurgency')

solemn latch
#

we are not testers

earnest phoenix
#

no

#

it will not work

clever thunder
#

then thats just great

solemn latch
#

why dont you try it ๐Ÿค”

clever thunder
#

i did

solemn latch
#

did it work

clever thunder
#

no

solemn latch
#

then why did you ask if it works

earnest phoenix
#

xd

clever thunder
#

return did not work

earnest phoenix
#

so you want to check if user has a role

#

ait

clever thunder
#

yes that what ive been trying to tell you

solemn latch
#

doesnt have a role

#

!

clever thunder
#

?

earnest phoenix
#

Hello hello !

I would like to split a Discord message that looks like this mysuperprefix.allmyuserinfo <server> "my super username here" "my super password"

I would like to retrieve the contents of the username and password, but I don't know how to do it.

Can someone please help me?

In JavaScript

#

please ping me if you have the solution

#
let role = msg.guild.roles.cache.get("roleID")
if (!msg.member.roles.cache.has(role)) {
  return False 
} else {
 return True
}
solemn latch
#

ahh spoonfeeding ๐Ÿค”

clever thunder
#

Hm o

earnest phoenix
#

u can use .find for string

clever thunder
#

the red dot

earnest phoenix
#

๐Ÿคฎ

solemn latch
#

probably shouldnt copy paste code ๐Ÿค”

earnest phoenix
#

what is that

#

it hurts

clever thunder
#

i cant use VSC

#

.env wont work

proven lantern
#
if (!msg.member.roles.cache.has(role)) {
  return False 
} else {
 return True
}```

```let role = msg.guild.roles.cache.get("roleID")
return msg.member.roles.cache.has(role);```
opal plank
#

True False

#

wtf

earnest phoenix
#

ye kinda reverse

opal plank
#

not that

#

why the heck you put first letter uppercase?

earnest phoenix
#

professional python deformation

proven lantern
#

msg.member.roles.cache.has(msg.guild.roles.cache.get("roleID");

opal plank
#

but thats js

clever thunder
#

yea?

proven lantern
#

muscle memory from python is my guess

clever thunder
#

and?

opal plank
#

and it wont work

solemn latch
#

i mean, kinda just threw the code randomly at the bottom

clever thunder
#

was i not supposed to do that

opal plank
#

you werent suppose to be spoonfed nor ask for code in the first place

solemn latch
#

it wont be exported like that.

opal plank
clever thunder
#

AHHHHH YOU GUYS CONFUSE MEEEEEEEEE

solemn latch
#

๐Ÿค”

#

what dont you understand

#

we cant understand for you

clever thunder
#

IM NOT A GENIUS LIKE ALL OF YOU

solemn latch
#

psh the only smart one here is erwin

clever thunder
#

..

earnest phoenix
#

@clever thunder at least learn basics of javascript, discord.js is very easy when combined with Visual Studio Code, also just read the docs for roles or anything you need, its very simple

#

rushing is just gonna make a mess and annoy you

drifting wedge
#

async def bio(self, ctx, *, arg): how can i make arg like not required?

earnest phoenix
#

just dont use it

drifting wedge
#

but like i want to make it so if you dont put arg, it sends something

#

and if you do it sends something else

earnest phoenix
#

split the message later

drifting wedge
#

now all i need is just make like arg not req

solemn latch
#

?

earnest phoenix
#

args = msg.content.slice(" ") or .split(" ") im not sure

#

if thats what you mean by arg

solemn latch
#

looks like your giving js, 0exe is asking python i think

drifting wedge
#

so basically can i make arg optional?

solemn latch
#

the link i gave i think does it

earnest phoenix
#

content on that link looks like redstone

#

if they are new they wont understand shit

solemn latch
#

he isnt

earnest phoenix
#

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

drifting wedge
#

thanks ๐Ÿ‘

#

yea @earnest phoenix im a pro ๐Ÿ˜Ž

clever thunder
#

dafuq you want

solemn latch
#

hmm?

clever thunder
#

@clever thunder at least learn basics of javascript, discord.js is very easy when combined with Visual Studio Code, also just read the docs for roles or anything you need, its very simple
@earnest phoenix oh? WELL I NEED A FUCKING .env

earnest phoenix
#

process.env ?

clever thunder
#

no

solemn latch
#

env is always optional?

clever thunder
#

sigh

earnest phoenix
#

bruh

clever thunder
#

Enviroment Variable

solemn latch
#

yeah

earnest phoenix
#

yes

solemn latch
#

process.env is an enviorment variable

earnest phoenix
#

access it with PROCESS.ENV.SOMETHING

clever thunder
#

...

drifting wedge
#

@clever thunder we don't have to help you, we want to, so if you treat us like idiots we wont help you

clever thunder
#

WELL IM SORRY

#

IM A FUCKING IDIOT

noble shuttle
#

E

errant perch
#

do command handlers cut down on memory usage

clever thunder
#

tf is that

solemn latch
#

yes and no?

noble shuttle
#

E

errant perch
#

good enough

noble shuttle
#

E

solemn latch
#

its so minimal it doesnt matter.

#

please stop @noble shuttle

errant perch
#

thats what i thought just curious

noble shuttle
#

O.o

solemn latch
#

only reason i know if it would lower mem usage is less repeating code

earnest phoenix
#

o _ _ _ _ _ _ _ _ o

solemn latch
#

or, you know, just dont

clever thunder
#

process.env? are you sure

#

nothings there

solemn latch
#

process.env not processs.env

earnest phoenix
drifting wedge
#

for example if i have cogs in a folder, and images in another and both folders are in a main folder, can the cog get it image?

clever thunder
#

idk

#

huh

timid nebula
#

cog?

clever thunder
#

yes i have a cog

drifting wedge
#

like if i have my bot file in a folder

#

can it access files in another folder?

timid nebula
#

yes

drifting wedge
#

or do they have to be a folder in the bot files folder?

timid nebula
#

but if they are images

drifting wedge
#

can it access files in another folder?
@drifting wedge how?

timid nebula
#

i would reccomend imgur

drifting wedge
#

i cant

#

they are changing

#

its complicated

timid nebula
#

oh like a gif?

clever thunder
#

im just ded inside now

drifting wedge
#

the bot edits the images

timid nebula
#

ah

solemn latch
#

generating images with code, ie welcome images or avatar modification

drifting wedge
#
font = ImageFont.truetype('fonts.PTSansCaption-Bold.ttf', 37)```
#

so this is in a cog

noble shuttle
#

O.O

solemn latch
#

shiv would know ๐Ÿคทโ€โ™‚๏ธ

drifting wedge
#

and the fonts folder isnt a sub folder

noble shuttle
#

i-

solemn latch
#

shame we have like no python users

timid nebula
#

are u using discord.js?

drifting wedge
#

op1.save('saved.op1.png')

drifting wedge
#

how do i save it to a folder?

#

nor in saves folder

#

not*

solemn latch
#

process.env is a variable, not a file @clever thunder

#

google it plox

clever thunder
#

inner rage

#

im doing a enviroment variable

#

er trying

solemn latch
#

yeah, process.env is how you access those

#

process in an object

clever thunder
#

but nothings fucking there

#

so what do i do

solemn latch
#

YOU MADE A FILE NAMED PROCESS.ENV

clever thunder
#

yes i did

solemn latch
#

YOU SHOULD NOT DO THIS

opal plank
#

in .vscode

solemn latch
#

PLEASE DONT

opal plank
#

he put it inside the vscode folder btw

clever thunder
#

moved it

static wraith
#

wag1

clever thunder
solemn latch
#

not sure what else to say pandasad

clever thunder
#

I~I

earnest phoenix
#
// file
async run (client, message, args) {
    message.channel.bulkDelete(5);
};

// message-event
await command.run(client, message, args).catch(() => message.channel.send("oops something went wrong");
#

Why doesn't it send an error msg to the channel when something goes wrong

#

but instead

clever thunder
#

{ TERM: 'xterm-256color', SHELL: '/usr/local/bin/bash', USER: 'maciej', PATH: '~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin', PWD: '/Users/maciej', EDITOR: 'vim', SHLVL: '1', HOME: '/Users/maciej', LOGNAME: 'maciej', _: '/usr/local/bin/node' } this?

earnest phoenix
#
 name: 'DiscordAPIError',
  message: 'Missing Permissions',
  method: 'post'...
opal plank
#

@earnest phoenix your bot likely doesnt have MANAGE_MESSAGES perm

earnest phoenix
#

that wasnt the problem, but i fixed it

#

thanks anyways brav

opal plank
static wraith
#

How can you get the bot dev role?

opal plank
clever thunder
static wraith
#

that dosnt answer my question erwin?

opal plank
static wraith
#

im confused

#

its not in faq

opal plank
#

just submit and get your bot approved

clever thunder
#

nu

#

im an idiot bot maker

#

be quiet

proven lantern
#

submit to the will of DBL

opal plank
#

@clever thunder chill dude, this is not your personal suport server

solemn latch
#

lol

clever thunder
#

.

#

..

#

...

solemn latch
#

please stop doing that ๐Ÿค”

#

half your messages are spam

clever thunder
#

and why should i

opal plank
#

triple dotpost

solemn latch
#

against rules

#

kek

earnest phoenix
#

pre puberty showing up

static wraith
#

damn woo

clever thunder
#

why should i even talk then

opal plank
#

@cosmic forum im not exactly sure what oyou want to do tbh

earnest phoenix
#

im not like the other girls phase

solemn latch
#

talk, dont spam

static wraith
#

how long did it take to install that ๐Ÿ˜ฟ

#

"flight simulator"

clever thunder
#

you guys are Genius's

cosmic forum
#

@cosmic forum im not exactly sure what oyou want to do tbh
@opal plank Wait, I'll send what I have so far

clever thunder
#

ima fucking idiot who uses glitch

opal plank
#

aight

static wraith
#

watch youtube @clever thunder

#

there are loads

clever thunder
#

I FUCKING TRIED

static wraith
#

of tutorials

#

go back to basics

clever thunder
#

no

static wraith
#

people try jumping in

clever thunder
#

no

static wraith
#

you need to litrally start at the bottom

clever thunder
#

no

static wraith
#

okay ๐Ÿ‘

clever thunder
#

no

placid iron
clever thunder
#

no

earnest phoenix
opal plank
#

he doesnt KNOW the basics, thats the issue, he simply jumped into bot development without knowing a pint of knownledge about Js, thats why he's now here hoping for us to spoonfeed him

clever thunder
#

no

solemn latch
#

can one of the mods step in ๐Ÿค”

clever thunder
#

no

placid iron
#

@glad charm Thonk

clever thunder
#

no

#

no

static wraith
#

yeah please mute

#

or

#

something

clever thunder
#

fine ill stop

cosmic forum
#

@opal plank this is what I have the command make so far: https://tixy.js.org/t/761703550707040288.html

It basically creates an array of all the messages in the channel, then writes it onto an html file. The only problem is that mentions show up in the <@userid> format. How would I fix that?

opal plank
#

@cosmic forum oh i see what you mean

#

aight, heres what you should do

#

grab the userid

#

then fetch it from your users cache

#

client.users.cache.get(userid)

clever thunder
#

let role = msg.guild.roles.cache.get("roleID")
if (!msg.member.roles.cache.has(role)) {
return False
} else {
return True
}

#

will this work..

opal plank
#

then simply grab the name of it

clever thunder
#

but no

glad charm
#

Yo what's up

opal plank
#

@glad charm @clever thunder being awfully obnixious and rude

clever thunder
#

....

#

as you are no help

glad charm
#

Alright now let's take a step back.

clever thunder
#

why am i in thid

lilac gorge
#

uhm.

#

how do i make a discord ๐Ÿ‘€

#

i mean uh.

#

ykw.

opal plank
#

a bot?

lilac gorge
#

yes.

glad charm
#

copy slack

cosmic forum
#

@opal plank Ok, but the problem is, how would I get the user id of all mentions across multiple messages? And then how would I have it replace the <@userid> places?

glad charm
#

easy discord

opal plank
lilac gorge
#

ty.

opal plank
#

last bit

#

@cosmic forum string.replace(usermention, user.name)

glad charm
#

Why are you getting mentions across multiple messages?

opal plank
#

it seems to be a ticket system

clever thunder
opal plank
#

just replacing userid mention with their actual name

cosmic forum
glad charm
#

Why not

const userIds = message.mentions.cache.members(m => m.id);```
clever thunder
#

smol brain thinking

cosmic forum
#

@cosmic forum string.replace(usermention, user.name)
@opal plank what does the usermention part mean?

opal plank
#

better to get it with index

solemn latch
#

@clever thunder the code you copy pasted you said doesnt work already, not sure why you are asking if it works since you know it doesnt

opal plank
#

maps are indexes, so its much more efficient than iterating thru the whole server list

clever thunder
#

idk

opal plank
#

@cosmic forum usermention would be a regex

#

i got a few handy regexes there

solemn latch
#

o

glad charm
#

never use regex if you don't need to

opal plank
#

indeed

placid iron
#

regex moment PepeHands

glad charm
#

Why not just map out the ids like I did above and append to an array of ids?

#

I'm not exactly sure what you're trying to do so that was my solution

opal plank
#

i'd personally go with get userid from cache and simply .replace() it with user.name

#

if it exists in cache of course, i'd likely have a fallback routine to fetch id from api if i didnt have the user

clever thunder
#

everybody else: beeg brain

Me:

smol

solemn latch
#

please stop spamming

glad charm
#

Why

opal plank
#

just mute them dylan

solemn latch
#

ive asked like 4 times now

glad charm
#

@clever thunder ๐Ÿ˜ 

solemn latch
glad charm
#

I will

clever thunder
#

jeez

opal plank
#

legit been obnixous this whole time

glad charm
#

@clever thunder final verbal warning my guy, stop.

silver lintel
#

if i have array.join(" "), how can i make it so it only joins max 10?

clever thunder
#

then can you help me do a script for a command that needs a certain role?

lilac gorge
#

svjhqeguhbech ur

opal plank
#

@silver lintel you'd need to loop it for that

static wraith
#

shy

glad charm
#

No I'm not going to code for you

static wraith
#

dm me

clever thunder
lilac gorge
#

@opal plank i dont understand i have a chromebook.

static wraith
#

@clever thunder if it shuts you up dm me

opal plank
#

what?

static wraith
#

and ill try sort you out

opal plank
#

how is making a bot and chromebook related? @lilac gorge

lilac gorge
#

how is making a bot and chromebook related? @lilac gorge
@opal plank IDK.

opal plank
earnest phoenix
#

what is this discord channel

cosmic forum
#

@glad charm and @opal plank

var str1 = message.channel.name;
var str2 = "ticket-";
if (str1.indexOf(str2) != -1) {
  message.channel.messages.fetch({
    limit: 100
  }).then(async fetched => {
    fetched = fetched.array().reverse();
    const mapped = fetched.map(msg => `<p><b>${msg.author.tag}</b> - ${msg.content}</p>`).join('\n');

    fs.writeFile(`t/${message.channel.id}.html`, `<link rel="stylesheet" href="https://aakhilv.js.org/css/transcript.css">\n<link href="https://fonts.googleapis.com/css?family=Roboto:100,100i,300,300i,400,400i,500,500i,700,700i,900,900i" rel="stylesheet">\n<title>${message.guild.name} | ${message.channel.name}</title>\n<link rel="icon" type="image/png" href="https://discord.com/assets/eedd4bd948a0da6d75bf5304bff4e17f.svg">\n<div id="textlog">\n<h2>${message.guild.name} | ${message.channel.name}</h2>\n${mapped}\n<footer>Transcripts powered by <a href="https://tixy.js.org" style="font-weight: bold;background: #23272A;" target="_blank">Tixy</a></footer>\n</div>`, function(err) {
      if (err) throw err;
      let transcriptembed = new Discord.MessageEmbed()
        .setTitle(`Transcript for #${message.channel.name}`)
        .setDescription(`https://tixy.js.org/t/${message.channel.id}.html`)
        .setColor("#fcb251")
        .setFooter("Powered by Tixy", "https://i.imgur.com/SdcXbyw.png")
        .setTimestamp();
      if (ticketlog !== null) {
        logchannel.send(transcriptembed);
        message.channel.send(`Transcript sent to ${logchannel}.`);
      } else if (ticketlog === null) {
        message.channel.send(transcriptembed); 
      };
    });
  });
};
opal plank
#

they arent

cosmic forum
#

It's what I have so far

lilac gorge
#

ok so how do i make a bot on chromebook buddy.

cosmic forum
#

At least the main part

glad charm
#

Is this server side rendering or something?

cosmic forum
#

ok so how do i make a bot on chromebook buddy.
@lilac gorge Online IDE's?

glad charm
#

What is it in tags?

lilac gorge
#

ok.

opal plank
#

@cosmic forum i assumed as much, you can get it from cache and resolve it like i said

earnest phoenix
#

@lilac gorge did u try restarting?

cosmic forum
#

Is this server side rendering or something?
@glad charm No, it just writes the html code onto an html file it creates

#

@cosmic forum i assumed as much, you can get it from cache and resolve it like i said
@opal plank Ok

glad charm
#

Oh I see

#

It embeds it, neat

lilac gorge
#

@lilac gorge did u try restarting?
@earnest phoenix huh.

opal plank
cosmic forum
#

@cosmic forum you can actually put all that into here
@opal plank Ok, I'll see.

glad charm
#

I'm still confused on what the issue is, please elaborate your end goal?

opal plank
#

you can do an inline if there with a bit of function on ${message}

#

check that

glad charm
#

Right I see that

opal plank
#

it'll give you a good idea

#

they simply want to replace the mentions with a name

glad charm
#

Oh lmao

cosmic forum
#

I'm still confused on what the issue is, please elaborate your end goal?
@glad charm I'd like the mentions to change into the user's username rather than be in the <@userid> format

glad charm
#

I see now

opal plank
#

probably spoonfeed but i need a bit of a warmup for my brain rn

glad charm
#

I can see how regex would actually be nice here lmao

solemn latch
#

can you spoonfeed me an entire command, please thanks @opal plank

glad charm
#

or sed I guess to replace

#

Okay I kinda have an idea of how to do it

opal plank
#
${message.mentions.size > 0 ? let ctx = message.content for(let m in message.mentions) ctx.replace(m.userid, client.users.cache.get(m.userid) ? client.users.cache.get(m.userid).name : client.users.fetch(m.userid)?.name) ctx  : message.content  }
#

this is one hell of a one liner

#

lmao

cosmic forum
#

I see

#

Yes, quite long lmao

glad charm
#

I mean

#

I think mines a bit shorter

opal plank
#

you absolutely shouldnt do what i did btw, simply for readability purposes

glad charm
#

lemmie write it out

opal plank
#

thats all a single line

cosmic forum
#

Ah, I understand how Not Erwin did it

opal plank
#

const mapped = fetched.map(msg => `<p><b>${msg.author.tag}</b> - ${msg.content}</p>`).join('\n');

#

you'd basically replace ${message.content} with that big ass function i did, though it may not work, since promises and such

#

its not waiting for the promise to finish and is likely to break

#

but that is all you'll need tbh, just dont do it inside a single line like i did

cosmic forum
#

Yeah

opal plank
#

the more i look at what i wrote the more disgusted and impressed i get about what i did

#

but can we make it bigger? SataniaEvil

solemn latch
#

thats what she said, the answer was no

opal plank
#

LMAO

#

@glad charm stil writing it?

glad charm
#

I'm bad at regex

#

if you gimmie the regex to remove <@> I could send it

#

lmao

opal plank
#

i got a bunch

#

yeah, holdon

#
 channel_mention: /^<#(\d+)>$/
everyone_mention: /^(@โ€‹(?:everyone|here))$/
    role_mention: /^<@โ€‹&(\d+)>$/
    user_mention: /^<@โ€‹!?(\d+)>$/

            bold: /\*\*([\s\S]+?)\*\*/
       codeblock: /\`\`\`(([a-z0-9-]+?)\n+)?\n*([^]+?)\n*\`\`\`/i
      codestring: /`([\s\S]+?)`/
         italics: /_([\s\S]+?)_|\*([\s\S]+?)\*/
         spoiler: /\|\|([\s\S]+?)\|\|/
          strike: /~~([\s\S]+?)~~(?!_)/
       underline: /__([\s\S]+?)__/
             url: /^((?:https?|steam):\/\/[^\s<]+[^<.,:;"'\]\s])/```
glad charm
#

Thanks

opal plank
glad charm
#
const mapped = fetched.map(msg => {

  const content = msg.content;

  for(const m of msg.mentions.members()) {
    content.replace(/^<@โ€‹!?(\d+)>$/, m.user.tag)
  }

  return `<p><b>${msg.author.tag}</b> - ${content}</p>`
}).join('\n');``` Fuck me if I'm wrong, but this should be it
opal plank
#

thats a good approach too

glad charm
#

More readable imo

opal plank
#

actually i think its better than mine

#

mine is just pulling their name, not nickname

#

which idk if its a good or bad thing

glad charm
#

if the user was mentioned it's already on the msg object

#

no need to check cache

#

also I forgot to plug the member id in the regex

#

lol

opal plank
#

hmmm

glad charm
#

the \d+ could be m.user.id

#

Right?

opal plank
#

does the member object comes with the payload?

glad charm
#

it should yes?

opal plank
#

then its fine

glad charm
#

only one way to findout amirite

opal plank
#

lets get ratelimited again

glad charm
#

:^)

open spindle
#

ok so now my site page looks better with the update, but I still don't know how to make the edges of the site the right color
this is what it looks like right now, but I want the parts around where I put my description to be grey or black as well

opal plank
#

that looks like a negative filter ngl

glad charm
#

I believe the css class name is long-description

#

You can probably override it and do border: none;

#

Right?

sick cloud
#

inspect element is your friend

glad charm
#

Yeah it is Xd

opal plank
#

^^

open spindle
#

ok

opal plank
#

i finally got this shit to work

#

now just gotta handle internal commands

glad charm
#

Is this a Disc/Twitch bot

#

Also TS gang

opal plank
#

@glad charm indeed

lucid prawn
#

heyyy can someone help me

solemn latch
#

maybe, i dont know

opal plank
#

not if you dont ask your question

glad charm
#

-ask2ask

gilded plankBOT
#

Don't ask to ask.
Just ask your question, it wastes time if you say "i need help" or "can someone help me?" instead of just saying what the problem is. Save your time and other people's time and just ask the question.

Please read https://dontasktoask.com/ for an explanation on why this is an issue.

lucid prawn
#

what did this mean MODULE_NOT_FOUND

opal plank
#

means your path is wrong or you didnt install the library you trying to use

lucid prawn
#

throw err;
^

Error: Cannot find module 'C:\Users\nevaehAnmie\Documents\GitHub\index.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}

opal plank
#

'C:\Users\nevaehAnmie\Documents\GitHub\index.js'

#

that path is wrong then

open spindle
#

so if I found this thing:
<section class="page id="bot-details-page">
and I wanted to set the css, I would do

section: {
    background-color: DarkGray;
}```
right?
lucid prawn
#

how can i fix it?

opal plank
#

by putting the proper path

#

what exactly are you running?

#

like what command you running on your terminal

#

and where you running it

lucid prawn
#

node .

opal plank
#

that explains it

#

use node index.js

lucid prawn
#

got the same error

opal plank
#

show me your terminal

solemn latch
#

token leak

#

oof

lucid prawn
#

lol

solemn latch
#

reset it :p

lucid prawn
#

ok

glad charm
#

I wish I caught that sooner. Yikes.

lucid prawn
#

why u delete pic

opal plank
#

cuz tokens

solemn latch
#

token leak

opal plank
#

you arent suppose to share your token

solemn latch
#

"" around discord.js

#

that part

glad charm
#

@lucid prawn if you share your bot token, others could steal it and potentially do harmful things to servers that your bot is in.

lucid prawn
#

ok

earnest phoenix
#

i love when people just carelessly reply ok

#

play with fire until you get burned

lucid prawn
#

the bot is not bot online and it just a test bot btw

earnest phoenix
#
bot.on("message", async (message) => {

if (message.content.startsWith(PREFIX)) {
const args = message.content.slice(PREFIX.length).trim().split(/ +/);
const commandName = args.shift().toLowerCase();

const command = bot.commands.get(commandName) ||
bot.commands.find((cmd) => cmd.config.aliases && cmd.config.aliases.includes(commandName));

if (!command) return;

if (!cooldowns.has(command.config.name)) {
    cooldowns.set(command.config.name, new Collection());
  }

  const now = Date.now();
  const timestamps = cooldowns.get(command.config.name);
  const cooldownAmount = (command.config.cooldown || 1) * 1000;

  if (timestamps.has(message.author.id)) {
    const expirationTime = timestamps.get(message.author.id) + cooldownAmount;

    if (now < expirationTime) {
      const timeLeft = (expirationTime - now) / 1000;
      return message.channel.send(
        `**${message.author.tag}**: ${command.config.name} adlฤฑ komutu kullanabilmek iรงin \`${timeLeft.toFixed(1)}\` saniye beklemelisin.`
      );
    }
  }

  timestamps.set(message.author.id, now);
  setTimeout(() => timestamps.delete(message.author.id), cooldownAmount);

  try {
    command.run(message, args);
  } catch (error) {
    console.error(error);
    message.reply("bu komut yรผrรผtรผlรผrken bir hata oluลŸtu.").catch(console.error);
  }
}
});

I want to add a cooldown to the command. but it gives an error.

TypeError: Cannot read property 'members' of undefined

cooldown is running. but the command is still used.

#
module.exports = {
  config: {
    name: "avatar",
    aliases: ["av", "pp"],
    category: "resim",
    description: "Kullanฤฑcฤฑnฤฑn avatarฤฑnฤฑ gรถsterir.",
    usage: "[@bahsetme] veya [id] veya [takma ad] veya [kullanฤฑcฤฑ adฤฑ]",
    cooldown: 60,
    accessableby: "\`Mesaj Gรถnder\`",
    botyetkisi: "\`Mesaj Gรถnder\` | \`BaฤŸlantฤฑ YerleลŸtir\`"
  },
  run: async (bot, message, args) => { 
blissful coral
#

Are you returning it?

open spindle
blissful coral
#

Set the id for that section in the css

earnest phoenix
#

if (message.channel.type === 'dm' || message.guild === null) return message.channel.send("Use an actual server, not the dm. It's how the api works :expressionless:")
It doesn't stop spamming until I terminate the bot. What do I do?

#

delete return?

#

But then it will execute commands in dms and it'll crash it

solemn latch
#

any loops?

earnest phoenix
#
if (message.channel.type === 'dm' || message.guild === null) 
{ 
message.channel.send("Use an actual server, not the dm. It's how the api works :expressionless:") 
}
#

Would you try it maybe it will work.

#

I got it. The bot triggers the command so I have to return bot messages in dm.

solemn latch
#

probably should only do this if the user is doing a command

earnest phoenix
#

yes it is spamming.

#

This command stops it if (message.author.bot) return;

#

place it above the code

#

forgot to do that

faint prism
#

When the bot sends a msg, it triggers the event again

blissful coral
#

Should prob always return if it is a bot message OR -- if you are attempting to get messages from a bot then just make it if the author is the client.user.id then return.

sudden geyser
#

It's typically good practice to ignore bots to prevent most forms of loops.

cosmic forum
#
const mapped = fetched.map(msg => {

  const content = msg.content;

  for(const m of msg.mentions.members()) {
    content.replace(/^<@โ€‹!?(\d+)>$/, m.user.tag)
  }

  return `<p><b>${msg.author.tag}</b> - ${content}</p>`
}).join('\n');``` Fuck me if I'm wrong, but this should be it

@glad charm I tried it, and tried fixing the bugs, but the end result doesn't differ.

glad charm
#

Did you replace the \d+?

#

I'm tempted to test the code on my own bot now

cosmic forum
#

What would I replace it with? The userid?

glad charm
#

yes

cosmic forum
#

Ok, let me try it

sudden geyser
#

are you supposed to call .members()

glad charm
#

yeah it should return an iterator of member objects that were mentioned

sudden geyser
#

but .members is a collection of snowflakes as the key and member objects as the value, so the call shouldn't be necessary

cosmic forum
#

@glad charm

const mapped = fetched.map(msg => {
  for (const m of msg.mentions.users) {
    msg.content.replace(/^<@โ€‹!?(msg.mentions.users.id)>$/, m.tag)
  };

  return `<p><b>${msg.author.tag}</b> - ${msg.content}</p>`
}).join('\n');
glad charm
#

m is the member object

#

should be m.user.id

cosmic forum
#

Ah, ok

solemn latch
pale vessel
#

tag?

glad charm
#

tag should be like Panku#0721 (mine)

cosmic forum
#

Still doesn't work: https://tixy.js.org/t/761703550707040288.html

const mapped = fetched.map(msg => {
  for (const m of msg.mentions.users) {
    msg.content.replace(/^<@โ€‹!?(m.id)>$/, m.tag)
  };

  return `<p><b>${msg.author.tag}</b> - ${msg.content}</p>`
}).join('\n');
sudden geyser
#

It's just straight up confusing.

  • .replace(...) returns a new string, so you need to re-assign msg.content to the result.
  • You aren't even evaluating the result of m.id in the regular expression.
lucid prawn
#

how can i fix this
Error: Cannot find module 'C:\Users\dogli\Documents\GitHub\index.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []

sudden geyser
#

also you may need the g flag on the regex so it matches all mentions of that user

open spindle
#

Set the id for that section in the css
@blissful coral sorry I went offline, what do you mean?

#

like hwo do I do that

blissful coral
#

Look into this^

cosmic forum
#

@open spindle

#idofelement {
  cssoption: something;
}
open spindle
#

ohh ok

#

ok so this is not working

#
bot-details-page: {
    background-color: DarkGray;
}```
#

but that is the id

#

do I need a # in front of it?

#

@cosmic forum

#

oh wait

#

LMFAO

#

I'm so sorry

#

I did not read your example through

#

aaand it still does not work tho

#
#bot-details-page: {
    background-color: DarkGray;
}```
#

ok now this is not working

karmic compass
#

in js what does export { thingy as default } do?

earnest phoenix
#

Help

#

I cant add bot me server ??

solemn latch
#

its used for exports, exports are like different portions of code.
for example command handlers with different files for each command use exports to have each command file seperate @karmic compass

#

what do you mean @earnest phoenix ?

#

cant invite a bot to your server? or your bot?

primal plinth
#

Aand the command dont work

faint prism
#

Uh

sonic lodge
#

that's a token

faint prism
#

@scenic kelp token leak

blissful coral
#

Bruh

#

@primal plinth delete and change your token

scenic kelp
#

@primal plinth regen your token if you haven't already

static wraith
#

someone help please?

faint prism
#

It's 401 when I checked just now

blissful coral
#

Whatโ€™s up @static wraith

open spindle
#
#bot-details-page: {
    background-color: DarkGray;
}```
There's a page element with the id bot-details-page, but for some reason this is not editing it. anyone know why?
static wraith
#

so im trying to create a ticket function

#

and when you do the command if you havnt got a support role it replies

#

no support role create one or i will

#

or should

#

but instead it replies with 5 of them messages

blissful coral
#

Do a if statement checking for a role

static wraith
#

and keeps sending them

#

i am

blissful coral
#

Then you probably have multiple clients logged in

#

Check for multiple instances

static wraith
#

if (!Supportrole) {
return message.channel.send ('Sorry there is no support role in this server, Either create one or give me the permissions to do it for you...')
}

blissful coral
#

Check for multiple instances
@blissful coral

static wraith
#

Sorry can you explain multiple instances sorry im pretty new

#

i normally can find most things out myself as i go

#

i know i sound stupid

solemn latch
#

for example, if you donode .
then without properly closing the bot, doing node . again will log the bot again a second time

#

if you do it 5 times, the bot will respond 5 times, because its logged in 5 times.

open spindle
static wraith
#

it starts replying to itself

#

though

#

how does it trigger

solemn latch
#

Make the bot not respond to bots

dusty sapphire
#

Can bot create instant invite link of a server?

solemn latch
#

Yes, but don't do that unless a user requests it

#

Making invite links can easily turn into privacy concerns.

static wraith
#

is the not responding to bots a code?

dusty sapphire
#

I am making a Personal Bot for my server. At that server @ everyone don't have the perm to create invite link so i want to made a command like >invite and after that bot will give a temp invite Link. How can i do that?

static wraith
#

im pretty sure there will be a generate inv lnk

#

then its just the case of creating a const or something

#

is the not responding to bots a code?
@static wraith anyne?

solemn latch
#

You should be checking if a bot is the one writing it. Otherwise it responds to itself

#

Or responds to other bots

static wraith
#

thanks for trying ill do it in morning

#

too tired

blissful coral
#

@dusty sapphire you create a invite to the channel

#

If DJS:

channel.createInvite()
  .then(invite => console.log(`Created an invite with a code of ${invite.code}`))
  .catch(console.error);
dusty sapphire
#

I got it. I am DJS User

blissful coral
#

Ok โค๏ธ

lilac gorge
#

@opal plank Is there a way to make a bot on chromebook?

blissful coral
#

@lilac gorge

lilac gorge
#

ty.

compact echo
#

So I'm trying to get it to send a message when it joins a server but it says that prefix returns null. How would I fix it if the guild isn't in the database? Code: https://srcb.in/c75acbafee
Using discord-akairo btw

crimson vapor
#

I think this is because you are defining prefix in a different scope

compact echo
#

But if I do this, js if (!data) { const newGuild = Guild.create({ guildID: guild.id, }); newGuild.save().catch((err) => console.error(err)); let prefix = newGuild.prefix; return prefix; } else { prefix = data.prefix; } and in vsc, it says that prefix isn't defined think

crimson vapor
#

try

#

one sec i typing it in discord

compact echo
#

?

crimson vapor
#
let prefix;
if (!data) {
            const newGuild = Guild.create({
                guildID: guild.id,
            });
            newGuild.save().catch((err) => console.error(err));
            prefix = newGuild.prefix;
            return prefix;
}```
compact echo
#

Ok,

#

I'll try that

#

Works perfectly, I don't even know how I have a verified bot

#

Thanks!

opal plank
#

@compact echo pls tell me you arent doing database calls for every message

compact echo
#

@opal plank Nope, doing it for guildCreate

opal plank
#

aight

crimson vapor
#

me over here doing like 4 db calls every message

vernal rivet
#

That's too much

#

0 db calls is better

compact echo
#

me over here doing like 4 db calls every message
@crimson vapor I'm making like a message count soooooooo rip mongodb and my ram lmao

cosmic forum
#

It's just straight up confusing.

  • .replace(...) returns a new string, so you need to re-assign msg.content to the result.
  • You aren't even evaluating the result of m.id in the regular expression.
    @sudden geyser Sorry, I'm confused. What do you mean by I need to re-assign msg.content?
sudden geyser
#

Calling .replace returns a new string.

#

So if you don't re-assign it to msg.content, it does nothing.

#

By that, I mean msg.content = ...

clever thunder
#

sigh im back

compact echo
#

@clever thunder ?

lilac gorge
#

hes using glitch website.

compact echo
#

I know

lilac gorge
#

So uhm.

grizzled isle
#

Is there an event for audit log updates, or is that a GuildUpdate?
More specifically, an audit log for invites

lilac gorge
#

and.

#

Idk if I should use it because supposingly it makes your bot online.

compact echo
#

No, change it to process.env.TOKEN

lilac gorge
#

Okay.

compact echo
#

that's all

#

it should login?

lilac gorge
#

Okay.

quartz kindle
#

dafuq is botkit-discord

#

never seen it before

compact echo
#

idk

quartz kindle
#

apparently this botkit uses discord.js v11

#

which means it will stop working tomorrow

#

lmao

solemn latch
#

f

lilac gorge
#

so wtf do i do

solemn latch
#

well, v11 djs is deprecated

lilac gorge
#

what does that mean?

solemn latch
#

its no longer maintained, and is supposed to stop working

lilac gorge
#

ok.

#

so now what.

solemn latch
#

best guess, make a bot in something else.

opal plank
#

like v12

pearl pine
#

l

solemn latch
#

U

pearl pine
#

v

prisma oriole
#

imagine using an api wrapper, raw http requests are the way to go mmLol

dreamy eagle
#

lol

heady sail
faint prism
#

Uh

drifting wedge
#

yoooooo so me is making dashboard and ig im using flask, (py) and i dont know where to start, i looked it up but no tutorials, anyone can point me in the right direction?

#

found one!

#

๐Ÿ˜

carmine scarab
#

!nick

lilac gorge
#

fbwhfbeqhfbgeq'

solemn latch
#

agreed

thick gull
#

imagine using an api wrapper, raw http requests are the way to go mmLol
@prisma oriole imagine using raw http requests, opening the gateway in your browser is the way to go mmLol

prisma oriole
#

@prisma oriole imagine using raw http requests, opening the gateway in your browser is the way to go mmLol
@thick gull imagine opening the gateway in your browser, using raw cli curl requests to the gateway is the way to go mmLol

sudden geyser
#

It'd be fun to write a bot without using a library.

prisma oriole
#

fr tho, the libs def make it whole lot more abstracted and easier (eventemitters and all), would be a cool challenge

sudden geyser
#

until you need voice support

prisma oriole
#

LmAo

#

im the type of person to make a library out of trying to use raw http requests

#

like

#
superagent.get({...})

#

hmm

#

lets make this a class

#

Lmao

quartz kindle
#

imagine using superagent, node's built-in http is the way to go

sudden geyser
#

all my homies use node-fetch

blissful coral
#

All the homies back that shit up

thin turret
#

Fuck MongoDB, all my homies use J S O N D A T A B A S E

sudden geyser
#

You should have seen this dude's bot I was reviewing once. He essentially wrote his own database from scratch with plain text

blissful coral
#

Felt that

sudden geyser
#

It was quite impressive

blissful coral
fervent goblet
#

Im confused on something. Im using lavalink on my pc. When i run the command to play a song. the bot says its playing but it wont play. I have to stop the bot and run it again. then it plays. any idea?

carmine summit
#

how do i message.channel.send if i got a 400 error?

solemn latch
#

missing permission?

#

whats the specific error message

carmine summit
#

Error: Request failed with status code 400

solemn latch
#

400 just means bad request

carmine summit
#

yeah

solemn latch
#

double check your code is right.

carmine summit
#

how do i messsage.channel.send it

solemn latch
#

send the error as a message?

#

message.channel.send(error) ?

#

lol?

carmine summit
#

brUH

quartz kindle
#

what piece of code generates the error?

carmine summit
#

axios

mild flower
#

if(ruser.roles.cache.has(rrole.id)) return message.channel.send(`Successfully added the role to ${ruser}`)
I've added this at the end of a ;role add command to check if the user has the role in the end but it doesnt seem to be working

carmine summit
#

it must be a guildMember

#

not user

mild flower
#

??

#

are you talking about ruser?

#

its a member var not a user

#

let ruser = message.guild.member(message.mentions.users.first()) || message.member || args[0]

#

everything else is working

#

the role is being added

#

but the if statement not work

carmine summit
#

ruser.roles.add('<role id>')

mild flower
#

uh

#

can you read my question

#

pls

tepid gust
#

don't need to be mean, and you are not adding the role but you are just checking if the user has the rrole

solemn latch
#

the question can be interpreted a few ways which is why I didnt respond ๐Ÿค”

mild flower
#

am sorry

tepid gust
mild flower
#

add?

#

doesnt that add the role

#

to the user

tepid gust
#

I suppose is what you trying to do ?

carmine summit
#

why the cache?

mild flower
#

no

tepid gust
#

it's v12

mild flower
#

thats not what im trying to do

#
let ruser = message.guild.member(message.mentions.users.first()) || message.member || args[0]
                if(!ruser) return message.channel.send(Erole)

                let rrole = message.mentions.roles.first() || args[1]
                if(!rrole) return message.channel.send(Erole)

                if(ruser.roles.cache.has(rrole.id)) {
                    return message.channel.send(`โŒ ${ruser} already has that role!`)}

                 let roleName = message.guild.roles.cache.find(r => r.name === rrole)


                 message.member.roles.add(roleName).catch(err => {
                     ruser.roles.add(rrole.id).catch(err => {
                         return message.channel.send('Please enter a valid role!')
                     })
                 })
                if(ruser.roles.cache.has(rrole.id)) return message.channel.send(`Successfully added the role to ${ruser}`)
                if(ruser.roles.cache.has(r => r.name === rrole)) return message.channel.send(`Successfully added the role to ${ruser}`)```
#

look at the last two lines

#

htats what im trying to do

#

to send the success message only when the user has the role on him

tepid gust
#

in your first snippet you wrote "Successfully added the role to ${ruser}"

#

so i used this as indicator

blissful coral
#

I could be wrong, but looking at this code snippet, your last 2 lines of code are outside of the scope

tepid gust
#

yes

blissful coral
#

So it is a syntax error at that point

mild flower
#

yeah how to fix it

tepid gust
#

but you have two if statement doing the thing you are trying to do

blissful coral
#

move the }) LULW

quartz kindle
#

@carmine summit ```js
try {
let something = await axios.get(url)
} catch(e) {
message.channel.send(e.message)
}

#

or

#
axios.get(url).catch(e => message.channel.send(e.message))
mild flower
#

but you have two if statement doing the thing you are trying to do
@tepid gust one sees if the role is n him

#

the other

#

detects if a role is on teh user with that name

blissful coral
#

instead of having 2 if statements, use 1 and do
let rrole = message.mentions.roles.first() || message.guild.roles.cache.get(args[1])
if(!rrole) return message.channel.send(Erole)

mild flower
#

but obviously its not working

blissful coral
#

Then you only need one

carmine summit
#
if (message.member._roles.includes('<role id>'))
#

i think this is what you are trying to do

mild flower
#

eh not working

#

oop theres an underscrore there GWslippyPeepoW

#

message.member.roles.include is not a function

#

uh ok

solemn latch
#

includes or has

#

depending

mild flower
#

ah both of those are not working

carmine summit
#

godamnit can you stop copy pasting codes

#
if (ruser._roles.includes('<role id>'))
#

make sure the role id is a string

#

cuz discord works that way

mild flower
#

not work

carmine summit
#

noone knows why

#

I just got pinged

#

i dunno who it is

earnest phoenix
#

There, the answer

#

Of why it doesnt work

#

Read docs, and you will know why.

carmine summit
earnest phoenix
#

Bruh

#

Is that djs 11

carmine summit
#

12 i think

prisma oriole
#

i havent used d.js in a while but i def dont remember a _roles property on Member

carmine summit
#

lemme check

earnest phoenix
carmine summit
#

"discord.js": "^12.3.1",

#

hmmmmmmm

earnest phoenix
#

Update your fucking libary

prisma oriole
#

lmAO

earnest phoenix
#

do npm update

#

Or npm install

carmine summit
#

"discord.js": "^12.3.1", this considered as v11?????????????

#

im so confused

earnest phoenix
#

You

#

Didnt

#

Update the file

#

The node modules

carmine summit
#

WHAT?

earnest phoenix
#

You only change package.json

prisma oriole
#

^

carmine summit
#
"discord.js": {
      "version": "12.3.1",
      "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-12.3.1.tgz",
      "integrity": "sha512-mSFyV/mbvzH12UXdS4zadmeUf8IMQOo/YdunubG1wWt1xjWvtaJz/s9CGsFD2B5pTw1W/LXxxUbrQjIZ/xlUdw==",
      "requires": {
        "@discordjs/collection": "^0.1.6",
        "@discordjs/form-data": "^3.0.1",
        "abort-controller": "^3.0.0",
        "node-fetch": "^2.6.0",
        "prism-media": "^1.2.2",
        "setimmediate": "^1.0.5",
        "tweetnacl": "^1.0.3",
        "ws": "^7.3.1"
      }
    },
#

hmmm

#

package-lock.json

earnest phoenix
#

just

#

do npm install

#

Bruh

#

How did you know ._

carmine summit
#

just

#

reinstalled it

#

same as before

earnest phoenix
#

use .roles.cache

carmine summit
#

also, i don't change package.json nor don't know what it does

earnest phoenix
#

@carmine summit .has

carmine summit
#

WHY THO

#

ohhhhhhhhhhhhhh

#

.has searches the whole array

solemn latch
#

whole collection