#development

1 messages · Page 1123 of 1

digital ibex
#

oh im retarded

strange trout
#

Convert it before it is sent

digital ibex
#

yeah, i just realised i can use .toString

#

im literally 💩

solemn latch
#

toString is kinda a weird thing in js

#

i feel like it should be called something else

sudden geyser
#

like what

pure lion
#

translateToString()

solemn latch
#

message.delete()

sudden geyser
#

it more seems like the string representation of said object, like how python has __str__

digital ibex
#

well this is fucking shit

pure lion
#

Lmao

pale vessel
#

sex me daddy

solemn latch
#

no color will give you 0

pure lion
#

S e X m e D a D D y

pale vessel
#

that's why i said padStart

digital ibex
#

oh

#

well

pure lion
#

OMG

digital ibex
#

idk what to do wid dat

solemn latch
#

class of message

#

not litterally var message

pure lion
#

Fetch message by ID => delete

strange trout
#

I don't think you should color it like that. You'll end up with some bad contrast between the text and the background color

pure lion
#

If the colour is above/below X amount of brightness set the text colour to Y

solemn latch
#

css can auto adjust for dark backgrounds cant it?

digital ibex
#

yeah. im gonna try and make the background colour the inverse of the role colour but look nice somehow

solemn latch
#

woopi role

#

🤔

digital ibex
#

yeah the servers just cancer its all good

pale vessel
#

check if the color is light. if so use, black as text

digital ibex
#

how would i do this?

pale vessel
#

can't you somehow measure the hex and check? dunno

pure lion
#

If thingy to string sex me daddy > number

strange trout
#

Then you just end up with inconsistent text coloring which is just as bad in my opinion

digital ibex
#

probably yeah

#

well, time to delete that idea from my brain

solemn latch
#

you could put a box next to each one with the color

strange trout
#

Kind of how discord does roles

digital ibex
#

the idea was to try and make it look like the way mee6 has it with sumthing but in an option select thingy but ofc it flopped

solemn latch
#

then dont

#

store the bots sent message in a variable

#

and then do .delete on that variable

earnest phoenix
#

asks how

dire obsidian
#

WHAT

pure lion
#

Woooooooot

solemn latch
#

message.author.bot would be a bool of if the author is a bot

strange trout
pure lion
#

Lmao

#

H a h a e p i c p o o p y

#

WOO TF WAS THAT LMAOO

digital ibex
#

alexis u 2 gud with ui

solemn latch
#

let botsMessage = await message.send()

strange trout
#

Bulma hype_smile

digital ibex
#

i use bulma along with materializecss still shit

#

most in bulma

slender thistle
#

botmsg.delete

digital ibex
#

more u go into the website, the more u see the level of effort go ⬇️

sonic lodge
#

@earnest phoenix did you open a dm channel to yourself

solemn latch
#

when im(or the docs are) refering to message, i mean a class message, not the variable message

strange trout
#

Same Lost. I'm not very happy with my website right now

sonic lodge
#

<User>.createDM()

strange trout
#

Considering commissioning someone to make some mockups because frontend development isn't my thing

solemn latch
#

you can only use await in async functions

#

you can use .then if you dont want to use async, or you can use async await. really up to you

digital ibex
#

you're really good with frontend stuff imo

#

ur canvas is 💯

solemn latch
#

no ones good at frontend ;p

sonic lodge
#

what's the error, missing permissions?

pure lion
#

I'm the worst at front end

#

My sites literaly look like shit

digital ibex
#

i know a guy who im making a smol project with is really good at frontend

strange trout
#

Thanks haha

dire obsidian
digital ibex
#

2 people but one im working with

solemn latch
#

is he like the tim, but with frontend

sonic lodge
#

their dms are probably closed

solemn latch
#

front end tim

pure lion
#

O h

#

Omg

digital ibex
#

better™️

strange trout
#

Which one are you using @dire obsidian

pure lion
#

Frontend tim

dire obsidian
#

well none of these

sonic lodge
#

hm

dire obsidian
#

nah

strange trout
#

Then put None of these

digital ibex
#

if tim got into frontend, they'd be on the same level for sure

earnest phoenix
strange trout
#

Google it

sonic lodge
#

you add async before function

solemn latch
#

having a decent grip on async and promises is probably a good idea

#

especially when working with bots

digital ibex
#

discord.js is promised based so f

solemn latch
#

^

strange trout
#

It doesn't take any params

earnest phoenix
#

tf

solemn latch
#

you named your function async

strange trout
#

You're using the incorrect method @earnest phoenix

solemn latch
#

not made it async

sonic lodge
#

oohhh, @earnest phoenix the bot is trying to dm itself

#

i think you mean client.users.fetch('id')

#

client.user is your bot

solemn latch
#

????

#

your naming your function async

#

not making it async

earnest phoenix
sonic lodge
#
async function functionName() {}
earnest phoenix
#

@earnest phoenix didn't I tell you to learn JS?

pure lion
earnest phoenix
#

huh

solemn latch
#

never used peer.js

#

🤷‍♂️

#

peer-to-peer data, video, and audio calls.

#

wait

#

video calls

#

pog

digital ibex
#

ur text editor is maybe fooked

pure lion
#

video calls
Yes

digital ibex
#

or what is botmsg ?

earnest phoenix
#

to this point idk what you're doing

solemn latch
#

delete will always be any right?

digital ibex
#

what is botmsg ?

pure lion
#

Wd72j8ejirnfiejedjrie272828282727272u2

strange trout
#

What is botmsg defined as

solemn latch
earnest phoenix
#

@pure lion it would be nice if you didn't write some next bs.

pure lion
#

Where

earnest phoenix
pure lion
#

Oh there

#

I thought you meant my code

#

x)

earnest phoenix
#

Also people will help you on stackoverflow when they can.

solemn latch
#

im not sure what your doing lord

#

every time, you do things more wrong

digital ibex
#

its ur text editor, even if it doesn't have jsdoc, it should say promise void or some shit

solemn latch
#

any type is normal for delete()

earnest phoenix
#

where are you sending the message?

digital ibex
#

i mean, it shouldn't

earnest phoenix
#

and what message are you sending?

digital ibex
#

it must have jsdoc, and it takes parameters

solemn latch
#

your calling .delete on the function

strange trout
#

Did you just copy shivaco's code

solemn latch
#

not the message

sonic lodge
#

@earnest phoenix

#

please learn js

#

just basic js so that you can troubleshoot your issues

earnest phoenix
#

i asked him like yesterday or the day before

#

to learn js

pure lion
#

@earnest phoenix no

#

Learn now

#

We refuse to help

solemn latch
#

<Message>.delete()

pure lion
#

Woo istg

solemn latch
#

yeah, im out. we tried

dire obsidian
#

i find my command handler: discord.js-commando

pure lion
#

Omh

dire obsidian
#

i only disable some things and ya

strange trout
#

Is that even supported anymore

pure lion
#

4 lines to make a proper handler

#

4

dire obsidian
#

no separated files

#

separated files in separated files

solemn latch
#

you know, the first result on google for fs getting all folders in directory is what you want?

strange trout
#

Klasa and Akairo are the two frameworks I recommend

dire obsidian
#

nah

#

discord.js-commando is easier

solemn latch
#

i told you to look it up without specifying djs because its more of an fs issue than a djs issue.

gusty patrol
#

Its like a movie, I’m having fun while watching. Is it always likr that?

placid iron
#

so bascially how you code is that you save the code as strings in a script then you write the strings to files and then you execute the file names with exec

#

bascic multi file scripting

misty sigil
#

Its like a movie, I’m having fun while watching. Is it always likr that?
@gusty patrol yes, development is more hellhole than #memes-and-media

solemn latch
#

lol

pure lion
#

m

solemn latch
#

no

pure lion
#

@earnest phoenix go

#

Js

#

Learn

#

Now

solemn latch
#

doing random things doesnt work

pure lion
#

:(

#

Now

#

We aren't helping

#

So learn so we can help

#

Then sleep

solemn latch
#

your just adding random things one by one asking if its right

marsh sapphire
#

Well i lost all my codeGWhighpolyAjitPai

pure lion
#

I'm out

solemn latch
#

feels bad boon

#

git is a wonderful thing

gusty patrol
#

my bot is done
@earnest phoenix I don’t think so

marsh sapphire
#

Imma have to restart

#

Ugh

solemn latch
#

@pure lion so, are you going to actually have p2p video calls?

pure lion
#

Yeah

solemn latch
#

pretty cool

pure lion
#

That's kinda the entire idea of my site

digital ibex
#

anyone know what a nonce is? i've read the discord docs but still confusion

pure lion
#

But fml it's hard

#

@digital ibex a nonce is a pedophile

digital ibex
#

i know

#

thats why im confused

misty sigil
pure lion
sonic lodge
#

but you're right

placid iron
#

XD

digital ibex
#

help?

solemn latch
#

ooo nonce

pure lion
#

npm i pedophile

placid iron
#

do you even need to deal with them?

sonic lodge
#

a nonce is a integer / string used to validate if a message was sent

pure lion
#

@earnest phoenix g o

#

L e a r n

solemn latch
#

your calling .delete on a function

pure lion
#

J a v a s c r I p t

solemn latch
#

not Message class

digital ibex
#

time to let my uncle know he's not a nonce thanks m8

sonic lodge
#

lmao

gusty patrol
#

@earnest phoenix Dice is gonna kill you, I prefer you to go. Really

solemn latch
#

🤔

pure lion
#

I am heavy weapons guy

#

And this is my weapon

solemn latch
#

the nonce lib

pure lion
#

Lmaoo

misty sigil
#

me as a brit

earnest phoenix
#

Ahh yes, iptables

#

LUL

#

Best of luck

digital ibex
#

most people here are i think

pure lion
#

me as a brit
Same tho

solemn latch
#

ay

pure lion
#

Brit squad?

#

@earnest phoenix IM GOING TO EAT YOU

solemn latch
#

gettem dice

gusty patrol
#

so no?
@earnest phoenix are you asking lol

digital ibex
#

confirmed retard 101

strange trout
#
// Send the message (returns a promise);
<Channel>.send('your message');

// resolve the promise and then
<Message>.delete(); 
pure lion
#

spoonfeed mmm I love me some @earnest phoenix soup

gusty patrol
#

@pure lion I CAN LEARN JS TOMORROW
@earnest phoenix When you learn, plz tag me too.

pure lion
#

Btw woo

#

If you wanted to see me make something else cool what would it be?

solemn latch
#

web related?

pure lion
#

Yeah

digital ibex
#

make me look ugly cuz ha lol impossibel

pure lion
#

Okay I'm done

solemn latch
#

video calls is pretty cool, if it could support screensharing that would be amazing.

pure lion
#

@earnest phoenix eat sosig

faint prism
#

Anyone know how to do a truth table in a k map?

vernal rivet
#

Have you looked in the docs of d.js yet?

solemn latch
#

probably would have to be an app at that point

gusty patrol
#

Okay I'm done
@pure lion hey hey hey calm down easy man

pure lion
#

video calls is pretty cool, if it could support screensharing that would be amazing
I'll look into that

solemn latch
#

this started by pointing him at djs docs. the exact page that explains how to do it @vernal rivet

vernal rivet
#

Oofers

pure lion
#

Ngl I could go all out with this app

sonic lodge
#

we did

pure lion
#

I could rewrite it in a compiled lang

#

And make it sexy

solemn latch
#

everyone knows how to, we just cant spoonfeed you the answer

vernal rivet
#

Yea

pure lion
#

@earnest phoenix do you want to explode?

#

Fuck me

#

Bye

strange trout
#

You have to learn beginner to intermediate level JavaScript concepts

vernal rivet
#

^^^^^^

strange trout
#

And tomorrow you'll get the same answers

pure lion
#

No

queen moss
#

I should have a basic bot tutorial with code setup by tomorrow then

#

And ill give you free codes

pure lion
#

@queen moss no

solemn latch
#

inb4 just copy pastes code

strange trout
#

If you're not willing to learn how to code then go look for an open source project online and use that

misty sigil
#

don't try submitting it though

#

as the moderation team will deny it

sonic lodge
#

there's always
d i s c o r d b o t m a k e r

vernal rivet
#

If you really need to check d.js guides. They will explain a lot of things, but it is best you learn J's first before jumping in

pure lion
#

*cries in how the fuck do I fix my issue*

solemn latch
pure lion
#

Woo gib hug

#

;-;

strange trout
#

Not gonna lie I earned how to code by making a Discord bot

snow urchin
#

I have this command handler (https://hastebin.com/opigasatez.js)
Whenever I update one of the commands, it logs perfectly fine "Updated command: balance", but it does not actually use the new changes when I use the command, something between lines 22 and 30 is not right. Anyone know?

solemn latch
#

reloading commands has to be done in kind of a specific way

strange trout
#

God what is that name

digital ibex
rapid heath
#

I need music bot in my discord server how can invite any discord Music bot

faint prism
#

People with unicode symbols in their name give my db hell

snow urchin
pure lion
#

Lmaoooo

solemn latch
placid iron
#

@faint prism you save names??

#

just save the id of the user

snow urchin
#

reloading commands has to be done in kind of a specific way
@solemn latch how so

rapid heath
#

I need music bot in my discord server how can invite any discord Music bot

solemn latch
#

the command has to be deleted from the require cache first

faint prism
#

@placid iron ID and username#discrim

misty sigil
#

People with unicode symbols in their name give my db hell
@faint prism thats why i use id mmulu

placid iron
#

then if you need the name you can fetch it using the client and the id

faint prism
#

oof, fuck what am I doing then lmao

strange trout
#

@digital ibex dunno about forms but I know that you can use is-arrowless for the nav bar. Try that maybe?

earnest phoenix
#

I need music bot in my discord server how can invite any discord Music bot
@rapid heath SOMEONE ANSWERED FOR GOD SAKE

rapid heath
#

Please help I need music bot in my discord server how can invite any discord Music bot

solemn latch
#

delete require.cache[key];

placid iron
#

you 2Head moment there @faint prism lmao

earnest phoenix
#

bruh im done

vernal rivet
#

When you run your code, you run an instance of the code. If you try changing it, you have to create a new instance of the code. Idk what the method is for reloading commands, but that is why it doesn't use changes

rapid heath
#

Ok

earnest phoenix
strange trout
#

No way that name is allowed here

faint prism
#

you :2Head: moment there @faint prism lmao
@placid iron I had a :2Head: moment since the beginning of the project

placid iron
#

XD

solemn latch
#

its not, a mod just hasnt seen it yet

digital ibex
#

edah, i tried it but it didn't change anything :(

rapid heath
#

@earnest phoenix thank you

#

@solemn latch prefix

earnest phoenix
#

???

digital ibex
#

oh i put dropless instead of appleless

solemn latch
#

prefix indeed

digital ibex
#

1 sec

earnest phoenix
#

u have a prefix

#

damn

digital ibex
#

both dont work :/

strange trout
#

Just remove it yourself then

digital ibex
#

dis what i put html <select class="select-role is-arrowless" name="role"> <% roles.forEach((role) => { %> <option value="<%- role.id %>"><%- role.name %></option> <% }) %> </select>

faint prism
#

@placid iron Well I store it because I return a list of available users on a command. Wouldn't it be slower to use getUsername or whatever instead of IO?

digital ibex
#

how?

strange trout
#

Your own css

digital ibex
#

replicate the bulma one but without arrow?

snow urchin
pure lion
#

Anyone know how to fix my issue? It's been 4 days and fuck it's awful

placid iron
#

@faint prism it would be slower by like, not much. but you save the disk space and you have to do less IO which i think is better

digital ibex
#

oh im retarded

solemn latch
#

im not sure then

placid iron
#

oh and what if someone changes their name

#

then your command is kinda stuffed

digital ibex
#

well same thing:/

rapid heath
#

Give me link music bot

graceful quarry
#

!help

earnest phoenix
#

oh im retarded
@digital ibex lovely announcement

pure lion
#

@graceful quarry no on 2 counts

faint prism
#

I'm all for less data. I'll look into it

digital ibex
#

yeah

earnest phoenix
#

Give me link music bot
@rapid heath no i literally sent you a link to look for yourself

pure lion
#

oh im retarded
Same

strange trout
#

Just ignore him

earnest phoenix
#

kl

placid iron
#

if the member is cached in your client then the get_member should be faster than io i assume

rapid heath
#

@earnest phoenix Where there haven't any music bot

placid iron
#

chip??/

solemn latch
#

take your pick

digital ibex
placid iron
#

its good music bot

earnest phoenix
#

i don't get how he didn't find music bots although top.gg is littered with them

solemn latch
#

whos this timo guy

placid iron
#

idk

#

seems kinda weird tbh

marsh sapphire
rapid heath
#

@solemn latch thank you love you bro

solemn latch
#

😻

#

stole all the glory guys

pure lion
#

O w O

marsh sapphire
#

Can some one dm me every type of https, http, www. Pls

#

Like the start of links

slender thistle
#

I mean, that's about it

earnest phoenix
#

Or you could Google it pepowot

marsh sapphire
#

Oh yeah

earnest phoenix
#

Theres that, & redirects, such as nekos.club goes to --> www.nekos.club or whatever you want really

gleaming steeple
#

how would i make a randomised response section in the code

#

i stoopid

coral lichen
#

@zealous widget define guild by member.guild

#

@gleaming steeple learn javascript?

gleaming steeple
#

i am

misty sigil
#

how would i make a randomised response section in the code
@gleaming steeple an array

gleaming steeple
#

thx

coral lichen
#

loop through it and bam

misty sigil
#

array[randomNum]

zealous widget
#

@coral lichen so

bot.on("guildMemberAdd", (member, message, member.guild) => {
let gradenew = JSON.parse(fs.readFileSync("./gradenew.json", "utf8"));
let grade = gradenew[message.guild.id].grade;
member.roles.add(grade);
})
??

coral lichen
#

or that

#

@zealous widget no

zealous widget
#

Oh 😐

misty sigil
#

is that a json database

coral lichen
#
bot.on("guildMemberAdd", (member) => {
  let gradenew = JSON.parse(fs.readFileSync("./gradenew.json", "utf8"));
  let grade = gradenew[member.guild.id].grade;
  member.roles.add(grade);
})
#

there you go

#

when a guild member is created/joins

misty sigil
#

rool 4

coral lichen
#

it doesnt supply a message or a guild

earnest phoenix
#

I see nothing wrong with having a json file containing four million lines of settings & data

coral lichen
misty sigil
#

I see nothing wrong with having a json file containing four million lines of settings & data
@earnest phoenix acc yea same

earnest phoenix
misty sigil
#

apart from its ballsack and ultra prone to corruption

#

like just learn quickdb lmao

coral lichen
#

or mongodb

marsh sapphire
#

Well i cant find what i want

misty sigil
#

mongo's cool too ye

coral lichen
#

@marsh sapphire what are you looking for

earnest phoenix
marsh sapphire
#

Start of links like https, http, www.

#

Stuff like that

zealous widget
#

Thx @coral lichen ! 🙂

coral lichen
#

your welcome

#

@marsh sapphire what are you trying to do

marsh sapphire
#

Anti links

coral lichen
#

there's websockets then that's wss://

zealous widget
#

So

solemn latch
#

www. is a subdomain
there can be any number of subdomains

marsh sapphire
#

Ok

#

Oh

solemn latch
#

there are a ton of example regex's online for getting links

digital ibex
#

mongo's cool too ye
remove the "too" because quick.db is not cool

vernal rivet
#

For people starting out, it's a good db to use

pure lion
#

mongoose is sexy

split hazel
#

being able to reference other documents in one is tasty

pure lion
#

and everyone else is wrong

split hazel
#

something sql databases lack sadly

misty sigil
#

no mongodb is best driver

tame anvil
#

Hey

#

I need help

pure lion
#

Hi

#

omg bye

misty sigil
vernal rivet
#

^^^

tame anvil
#
bot.on('message', (message) => {
    if (message.content === `@echo shale`) {
        const verification = new MessageEmbed()
            .setColor("GREEN")
            .setAuthor("This verification becomes invaid after 30s")
            .setDescription(`Do you want to kick ${toKick}?`);
        
    message.channel.send(verification).then(msg => {
        msg.react(":white_check_mark:")
        msg.react(":x:")
    });
        const filter = (reaction, user) => reaction.emoji.name === ':white_check_mark:' message.delete();
        message.channel.send(`@versed oracle`);
        } else if const filter = (reaction, user) => reaction.emoji.name === ':white_check_mark:' msg.delete();
        message.reply("Alert canceled..."); 
        }
    }
});``` Code ^^
```js
/home/container/Draits-Utilities/index.js:51
const filter = (reaction, user) => reaction.emoji.name === '✅' message.delete();
^^^^^^^
SyntaxError: Unexpected identifier
at wrapSafe (internal/modules/cjs/loader.js:1054:16)
at Module._compile (internal/modules/cjs/loader.js:1102:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
``` My error ^^
misty sigil
#

you aren't supposed to delete that in the filter

tame anvil
#

hmm?

quartz kindle
#

else if const filter is not valid

tame anvil
#

wdym

#

how do I fix it

quartz kindle
#

its not valid code

pure lion
#

you cant reassign consts btw

#

just a heads up

tame anvil
#

ok

quartz kindle
#

an if expects a condition inside parens

#

like this

#

else if(something) { do something else }

tame anvil
#

nvm

#

bye

quartz kindle
#

you cannot do else if something

tame anvil
#

bye

earnest phoenix
pure lion
#

dont bye thats rood

#

btw anyone know my issue

#

its literally been 4 days

earnest phoenix
#

pls halp
y no w0rk
ok no thank u 4 halp nvm bye

tame anvil
#

BYE

solemn latch
#

👋

misty sigil
#

i sometimes wonder if any of the people in here know the lang they're developing in lmao

solemn latch
#

i dont

misty sigil
#

ok goodbye

vernal rivet
#

Lol

pure lion
#

i know js

#

js = juicy stems

#

right?

sudden geyser
#

"I'm a master in C++" big lie

earnest phoenix
#

js = just shit

pure lion
#

py = poopy yeah

sudden geyser
#

py = programming yeah

full widget
#

sa

pure lion
#

C = cock

earnest phoenix
#

py = phuck yeah

#

C = Cockandballtorture

pure lion
#

java = ()
{

}

earnest phoenix
#

vsfd= fuck the administration give me adm 😎

marsh sapphire
#

GWslippyPeepoH GWslippyPeepoH im bad at coding using javascript

#

Ughgg

#

cri

earnest phoenix
#

you need some help?

marsh sapphire
#

Ye

earnest phoenix
#

what with

marsh sapphire
#

Making a bot

#

Lol

earnest phoenix
#

alrighty lets go from the start

#

make a folder

marsh sapphire
#

Wait

solemn latch
#

how do i make a folder

vernal rivet
#

Where do I make folder?

marsh sapphire
#

Lemme check its javascript bcs im not sure

earnest phoenix
#

desktop

marsh sapphire
#

Ye it is

earnest phoenix
#

join general vc and i'll show you how to make a folder ig

#

lol

solemn latch
#

im so lost, how do you start programming and not know what language it is

marsh sapphire
#

I cant

#

Its to late

#

1:07

#

Am

misty sigil
#

im so lost, how do you start programming and not know what language it is
@solemn latch whitename. thats how

#

i've seen some people say "english"

vernal rivet
#

Oof

misty sigil
#

like do you just hello bot, i want you to listen for messages, if the message is the ban command, make sure the member has the ban permission, check the roles too, and if that all clears, ban them, then try sending a message, saying they were banned, in a channel called mod-log

earnest phoenix
#

lol

vernal rivet
#

Lol

#

Logic

woven sundial
#

Hi everyone, I'm searching how to get a role ID by mentioning it but I don't find how... can someone help me ?

earnest phoenix
#

how are you using it

vernal rivet
#

What language?

earnest phoenix
#

that too

vernal rivet
#

Big question

earnest phoenix
#

lol

marsh sapphire
#

Do @role

pure lion
#

sorry

woven sundial
#

discord.js

vernal rivet
#

Have you check the docs?

sonic lodge
#

it's in message.mentions.roles

sudden geyser
#

i've seen some people say "english"
@misty sigil I've heard that a lot

woven sundial
#

Yes I did@vernal rivet

misty sigil
#

thats how they code in english

woven sundial
#

it's in message.mentions.roles
Ty I'll check

misty sigil
#

message.mentions.roles.first()

#

as its a collection

sudden geyser
#

coding is technically english

sonic lodge
#

yes

earnest phoenix
#

yes

sudden geyser
#

messge mentions users first ban

#

all

earnest phoenix
#

igg

misty sigil
#

yea

#

but you need a way of scripting that

woven sundial
#

Ty very much Ruchurd

earnest phoenix
#

ima sleep its 11:30 pm gn

vernal rivet
#

English is an actual programming language. It's a esolang tho

misty sigil
#

you don't just say oi computer do that and do that

sudden geyser
#

applescript™️

pure lion
#

you don't just say oi computer do that and do that
oi mate write 'hello world' ya lazy fuck
^^^^^1 ^^^^2 ^^^^^^^^^3 ^^^^^^^^^^4
1: process.stdout
2: .write
3: string
4: async

marsh sapphire
sonic lodge
#

aren't there meme-like languages like that

marsh sapphire
#

Uh

sonic lodge
#

lolcode

stable grail
#

Python: how do i let my bot send + instead of space?

earnest phoenix
#

?

pure lion
#

what

slender thistle
#

.replace?

digital ibex
#

use strings lul

queen moss
#

Ah yes

honest perch
#

Don't work

#

Fix for me

stable grail
#

how?

pure lion
#

Fix for me
we dont do that here

digital ibex
#

how r u sending it?

pure lion
#

*yeet into websocket*

honest perch
#

@earnest phoenix your code is a mess

digital ibex
#

its not even that bad

solemn latch
#

is this because copy paste

#

🤔

digital ibex
#

the only questionable thing is just js const args = message.content.slice(prefix.length + arg[0].length).split(" ").join(" "); if(message.author.bot) { return; } if(message.content.startsWith(prefix)){ return; }

misty sigil
#

wait

#

thats if it starts with prefix

#

so thats exactly the opposite of what you want

#

lmfao

solemn latch
#

lol

stable grail
#

Python: how do i let my bot send + instead of space??

digital ibex
#

how are u sending the message with the + ?

tight plinth
#

learn python

slender thistle
#

What do you mean by "sending + instead of spaces"

stable grail
#

so i send a text with a lot of spaces it should put instead of the spaces, +

#

it should repeat what i write

slender thistle
#

Can you physically replace them?

digital ibex
#

<string>.replace(' ', '+') ?

stable grail
#

no its random

slender thistle
#

well yeah then Lost's way

stable grail
#

it repeats my text

#

its js

#

lol

digital ibex
#

its a thing in python too

#

one of the first things i learnt when learning python :yike:

stable grail
#

k didnt know

static oxide
#

pls dank

sudden geyser
#

but you'd need regex to make it go for every space though

digital ibex
#

???

#

you don't

slender thistle
#

regex is unnecessary in this case though

digital ibex
#

the 3rd parameter is optional

sudden geyser
#

Try running "this is the string".replace(" ", "+")

#

ah

slender thistle
#

😄

#

It replaces all occurrences unless told not to

placid iron
#

learn python
@tight plinth YES

digital ibex
#

O_O

zealous widget
#

Hey !

module.exports.run = async (bot, message, args) => {

  let gradenew = JSON.parse(fs.readFileSync("./gradenew.json", "utf8"));

  let roles = message.mentions.roles.first() || bot.roles.get(args[0]);

  if(!message.member.hasPermission("MANAGE_GUILD")) return message.reply("Désoler, vous n'avez pas la permission de faire cela.");

  if(!args[0]) return message.reply("Merci de mettre mettre un grade.");

  gradenew[message.guild.id] = {
    grade: args[0]
  }
  fs.writeFile("./gradenew.json", JSON.stringify(gradenew), (err) => {
    if (err) console.log(err)
  });

  let grade = gradenew[message.guild.id].grade;

  let embed = new Discord.MessageEmbed()
  embed.setColor(colors.green);
  embed.setTitle("Succes");
  embed.setDescription(`Nouveau Grade: ${args[0]}`);

  message.channel.send(embed);

}

The ID of my roles have symbol, how I can dont have that ?

vernal rivet
#

ummmm String.replace();

digital ibex
#

replace 😛

#

lol

zealous widget
#

Euh I dont understand

digital ibex
#

what exactly are u trying to do?

vernal rivet
#

are you talking about <@id>

zealous widget
#

Yes @vernal rivet

vernal rivet
#

String.replace() will work then

slender thistle
#

But why

vernal rivet
#

wait why are you needing to remove the symbols? message.mentions.roles.first() searches for mentioned roles in the message

slender thistle
#

A proper role mention is <@&ID>

slender wagon
#

Is there any way i can make my bot create a role and make overwrittes for the role in all the channels (muted role)

vernal rivet
#

yes

slender wagon
#

Oh okay

#

Ill have to check the docs then

slender thistle
#

Iterate over channels and apply overwrites for the muted role

zealous widget
#

@vernal rivet for a autorole, I cant give a role with <@&id>

digital ibex
#

you just need the id

#

not <@&id>

vernal rivet
#

are you using an id that was passed as an argument?

zealous widget
#

I just need id, not <@&id> and I dont know how I can just have the id

vernal rivet
#

you don't need to do extra steps if you are using one that was passed in as an argument, then the Role object already has a property called id. it will give you the id. There is no reason to do anything complicated

zealous widget
#

Because member.roles.add(); dont work with symbol

vernal rivet
#

yes

zealous widget
#

No

#

My error
Supplied roles is not an Role, Snowflake or Array or Collection of Roles or Snowflakes

blazing portal
#

Well you've already been given the answer. string.replace

vernal rivet
solemn latch
#

that error is pretty descriptive

opaque eagle
#

dumb regex question... how can I make it get the code and not the first part

solemn latch
#

look behinds right?

#

or... maybe not?

#

\K ?

amber fractal
#

Post that regex real quick

pure lion
#

Regex in a nutshell is just /(ahifnsjfens)+700\/[big, balls]/+g\

opaque eagle
#

/(https?:\/\/)?(www\.)?(discord\.(gg|io|me|li)|discordapp\.com\/invite)\/.+[a-z]/g

amber fractal
solemn latch
#

maybe not . but \S

amber fractal
#

oh yeah true, didn't even think about that lmao

solemn latch
#

or is there a regex thingy for urlencoded

#

no, there isnt, as far as google says

#

would be a good thing like a \U
for any non urlencoded char

zealous widget
#

  let gradenew = JSON.parse(fs.readFileSync("./gradenew.json", "utf8"));

  let roles = message.mentions.roles.first() || bot.roles.get(args[0]);

  if(!message.member.hasPermission("MANAGE_GUILD")) return message.reply("Désoler, vous n'avez pas la permission de faire cela.");

  if(!args[0]) return message.reply("Merci de mettre mettre un grade.");

  gradenew[message.guild.id] = {
    grade: args[0]
  }
  fs.writeFile("./gradenew.json", JSON.stringify(gradenew), (err) => {
    if (err) console.log(err)
  });

  let grade = gradenew[message.guild.id].grade;

  let embed = new Discord.MessageEmbed()
  embed.setColor(colors.green);
  embed.setTitle("Succes");
  embed.setDescription(`Nouveau Grade: ${args[0]}`);

  message.channel.send(embed);

}

Where I need put String.replqce(); ??? 😭

dire obsidian
solemn latch
#

you can put String.replace() anywhere you want to replace something

amber fractal
#

May even want to use (?:https?:\/\/)?(?:www\.)?(?:discord\.(?:gg|io|me|li)|discordapp\.com\/invite)\/((?:[0-9]|\w|-)+) so you dont get people trying to use things like ? query params to mess with the code

vernal rivet
#

String.replace() is just method for strings.

#

you can only use it for string variables.

zealous widget
#

I dont know where I need put 😭

solemn latch
#

im not sure what your trying to replace

zealous widget
#

The <@&> of the id

vernal rivet
#

but like i said, you have a Role object. You don't need to use String.replace. The Role object literary has a property called id, that is a Snowflake, which is what is need to add a role to a user

zealous widget
#

I dont wqnt <@&> when I take

solemn latch
#

then where ever your id with <@&> is used, you should replace it.

#

or store it in a variable

vernal rivet
#

he is trying to replace something that doesnt exist woo. he is having the command to search for a mentioned role. That makes the variable into a Role object

zealous widget
#

Yes but Im fatiguer and I dont know how I can work de autorole 😭

#

I work this of 3 hours

solemn latch
digital ibex
#

when a user joins, give them a role

vernal rivet
#

thats kind of unnecessary to do woo. he has a variable called roles that is type of Role.

/**
 * @type {Role}
 */
let roles = message.mentions.roles.first() || bot.roles.get(args[0]);
//<@&id>
roles.id; // id
dire obsidian
#

any form to disable the defaut commands of discord.js-commando?

#

or the discord.js server

digital ibex
#

wot

solemn latch
#

i didnt even look at the code ngl

halcyon ember
#

im using the nodejs mysql thingy, but i cant seem to be able to use ? to define the rows i want to change

vernal rivet
#

oofers

halcyon ember
#

it adds ' before the items and mysql rejects the syntax

#

await connection.query("UPDATE balances SET ?=?+? WHERE id=?", [coin.ticker,coin.ticker,amount,message.author.id])

#
  errno: 1064,
  sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''doge'='doge'+873 WHERE id='430117093573394442'' at line 1",
  sqlState: '42000',
  index: 0,
  sql: "UPDATE balances SET 'doge'='doge'+873 WHERE id='430117093573394442'"
}
vernal rivet
#

he was trying to do

/**
 * @typedef {Role} roles
 */
roles.replace("<@$", "").replace(">", "");
halcyon ember
#

how can I make it not add the '

sonic lodge
#

that's what it will always do if the items in the array are strings

halcyon ember
#

ah

stable grail
#

it also doesnt work

slender thistle
#

uhhhhh

stable grail
#

xD

slender thistle
#

not literally the str type itself

sonic lodge
#

@halcyon ember it seems that doge in your case is a column name?

#

you can use two question marks ?? and mysql recognizes it as an identifier instead

#

@stable grail str.replace() does not modify the original string

coral lichen
#

hello, in the description of my bot on top.gg i have done one styling to test this out but it doesnt change the button color, anyone know why?

<style>
.votebutton btn btn-orange btn-2x {
    color: #004ecc;
}
</style>
tight plinth
#

it doesnt seem that your code is correct

coral lichen
#

something wrong with it?

faint prism
#
[08/06/2020 00:04:59] - (WARNING) Unknown Guild (GUILD_MEMBER_REMOVE Guild=GUILDID).```
I need to add handling for this, so it will delete user records that no longer exist in any guilds
But I don't store guild Ids with user records currently
tight plinth
#

yes

coral lichen
#

what's wrong with it i dont get it

#

oh

tight plinth
#
        .votebutton {
        background-color: #0f0f0a !important;
          color: #1abc9c !important;
        border-radius: 3px !important;
        color: #3955c6 !important;
    }```
#

heres my code

#

fuck you discord formatting

coral lichen
#

oh well thank you

#

LOL

solemn latch
#

.votebutton btn btn-orange btn-2x
would look for the class votebutton thats a <btn btn-orange btn-2x></btn btn-orange btn-2x> right?

coral lichen
#

um.

#

no

#

elements and classes are different

solemn latch
#

btn btn-orange btn-2x
those are all elements to css syntax

#

since you didnt prefix them

#

with a selector

coral lichen
#

well its solved now :D

#

works like charm

tight plinth
#

e

opaque seal
#

How can I put a custom emoji in a embed title?

sudden geyser
#

If you're using the title field, you can insert an emoji like normal. Emojis are like <:name:id>, but will be <a:name:id> for animated emojis.

#

Keep in mind you can't use emojis in the author name field, footer, and some other places.

opaque seal
#

I did

#

And it didn't work

sudden geyser
#

can you show?

opaque seal
#

I put that :pepeOK:

#

Uhm

#

wait

#

why discord

sudden geyser
#

just as :pepeOK:?

opaque seal
#

< :pepeOK:7406311010265530307 >

#

without spaces

sudden geyser
#

does your bot have access to the server it came from?

opaque seal
#

yeah it's a discord bot just for my server

#

and in the embed it says :pepeOK:

#

nothing else

faint prism
#

I think this should clean up any user records left over if my bot is removed from a guild :)

        private Task LeftGuildHandler(SocketGuild arg)
        {
            IUserRecordsRepository userRecordsRepository = _userRecordsContext.GetUserRecordsRepository();

            userRecordsRepository.UserRecords.ForEach(user =>
            {
                if(arg.GetUser(user.UserId).MutualGuilds.Count == 0)
                    _userRecordsContext.RemoveRecord(user.UserId);
            });

            return Task.CompletedTask;
        }
opaque seal
#

does your bot have access to the server it came from?
@sudden geyser what should I do?

pale vessel
#

is the emoji animated? just in case

opaque seal
#

No

pale vessel
#

can you show your embed code?

opaque seal
#
let voteEmbed = new Discord.MessageEmbed()
        .setColor(guild.me.displayHexColor)
        .setTitle(':pepeOK: New Vote!')
        .setDescription(`<@${voter.id}> is amazing!\nYou can vote for Astro too [here](https://discord.boats/bot/715621848489918495/vote)`)
        .setFooter('Thank you for supporting Astro!');```
pale vessel
#

why does it show as :pepeOk: inside the codeblock

opaque seal
#

Idk discord I guess

#

i can try fetching it like that

const emoji = guild.emojis.resolve('7406311010265530307');
gilded vigil
#

How do i put a text with a gif

#

-3-

#

Rawr

#

Op

opaque seal
#

and then use emoji.toString() right?

gilded vigil
#

Wrong chat I think .

midnight blaze
#

I am trying a new way to delete channels. This looks good. I dont get any errors( I will include the console.log). Yet, it doesnt delete my channel.
The count is 0 in my log. What am I missing?

client.on('voiceStateUpdate',(newMember) => {

const voiceChannels = client.channels.cache.filter(c =>(c.parentID=="731406241665908776")?c.type === 'voice': null)

let count = 0;

for (const [id, voiceChannel] of voiceChannels) count += voiceChannel.members.size;

     (count!=0)?console.log("connected"):voiceChannels.delete({ timeout: 10000, reason: 'It had to be done.' })
          

console.log(voiceChannels)
console.log(count) })
opaque seal
#

why are you using !count==0

midnight blaze
#

same result for (count>0)

#

it doesnt delete the channel

tight plinth
#

no

#

count != 0 is NOT the same as !count == 0

midnight blaze
#

yeah, but it doesnt matter (count>0)

#

also doesnt delete it

#

that should work

slender thistle
#

connect_error() takes 0 positional arguments but 1 was given

@socket.event
def connect_error():
    print("The connection failed!")
sudden geyser
#

maybe it's @socket.event

tight plinth
#

-caching issue
-youre using it with one argument somewhere
-you probably missed smth

sudden geyser
#

I assume @socket.event is trying to call it

slender thistle
#

It happens on connection, actually

tight plinth
#

knowing how smart you are, its probably not you. what even is socket.event

slender thistle
#

socket = socketio.Client()

it's a decorator I got from the example for python-socketio

#

Well, scrapping that event until further notice

faint prism
#

Tfw forgot to add logging for a new update that purged half my db (as intended, but I would have liked to know who)

slender thistle
#

rip

midnight blaze
#

yes, very rip

#

nobody can help xD

jaunty peak
#

Hello!

solemn latch
#

Hey

vivid vault
#

Is this expensive Minecraft discord

#

Ecpe

slender thistle
jaunty peak
#

How to get Bot developer?

vivid vault
#

K thanks

thick gull
#

that shouldn’t be your goal but you do you, make a bot and develop it

#

there are many resources online

slender thistle
#

That's a question for #support for future reference

You'll need to have an approved bot on top.gg for the role

#

as for the badge...

#

-verifybot

gilded plankBOT
#

Hi! It seems like you are looking for information on how to get your bot verified.

Once your bot reaches 75 servers or more, you are eligible for bot verification. On October 7, 2020, bots with 100 servers or more that are not verified will not be able to be invited to any more servers. You verify your bot on your bot's application page, under the "Bot" section in the sidebar.

If you need more information, check out this article written by Discord about The Future of Bots on Discord and you can ask questions in the Discord Developer Server.

We cannot provide support on how to get your bot verified.

earnest phoenix
#

Hey. I'm getting a fields.flat error on my VPS

#

can anyone help me

tight plinth
#

upgrade node

solemn latch
#

^

earnest phoenix
#

I did so many times

sudden geyser
#

what version

earnest phoenix
#

it's at version 10.21 rn

tight plinth
#

youre using a version of node lower than 12

solemn latch
#

Discordjs v12 requires node v12

tight plinth
#

use node 13

#

its better

sudden geyser
#

no odd numbers!

tight plinth
#

also you should use node version manager

solemn latch
#

Use 14, its not an odd number

tight plinth
#

i cant use 14 with sqlite

solemn latch
#

Wait really

tight plinth
#

yep npm refuses to download it

sudden geyser
#

I mean I can

tight plinth
#

iirc

quartz kindle
#

why cant you?

#

i just installed it no prob

faint prism
#

Oh god, I wiped my db. Rip

quick pulsar
slender thistle
#

Nope, Discord verification is completely unrelated to top.gg

faint prism
#

Turns out the GetUser() docs state that it will return null if any user is offline on a large server.

midnight blaze
#

@quartz kindle as u are here, sry for the ping, but maybe you are able to help me^^ I have already asked people, but nobody answered me.(some tried to help me, thanks for that, but it didn work.)

So. I am using the event:VoiceStateUpdate.
My goal is: my bot should delete the voice channels, that have 0 users.

I think it is pretty clear, what I am trying to do, when you see the code.

client.on('voiceStateUpdate',(newMember) => {

const voiceChannels = client.channels.cache.filter(c =>(c.parentID=="731406241665908776")?c.type === 'voice': null)

let count = 0;

for (const [id, voiceChannel] of voiceChannels) count += voiceChannel.members.size;

     (count!=0)?console.log("connected"):voiceChannels.delete({ timeout: 10000, reason: 'It had to be done.' })
          

console.log(voiceChannels)
console.log(count) })

My console log shows me the count of people when they join/leave the channels, but it doesnt react to the condition when there are 0 users.

Sry ,for ping, but I am a little bit overworked^^ I am working on it since hours now, but I dont see what I am doing wrong.

quartz kindle
#

your code makes no sense

earnest phoenix
#

the voice state update gives 2 voice states

#

one before, one after

#

you're exclusively working with the one before

quartz kindle
#

you're getting a collection of voice channels under the same category, then sum up all their members, then try to delete the collection?

earnest phoenix
#

nevermind reading through the code you aren't working with it at all

#

why?

midnight blaze
#

That is they key part. I am trying to delete the channels, when their sum is zero. If I join a channel and log out in that category, I get this log. I am only trying to find a way to delete those channels, as soon as the sum is 0. So, I guess, I am simply deleting the wrong thing and not the "channels". That is the problem I am facing. What I am not understand.
Cry, I think you are right, I guess, I have to work with 2 voice states. Wont work otherwise.

#

when I join and leave a channel in a category

#

but ok

quartz kindle
#

so you want to delete the entire category with all channels included?

midnight blaze
#

yep

#

except the category itself

quartz kindle
#

oh so just the channels

midnight blaze
#

yeees

quartz kindle
#

then you need to loop over them and delete one by one

dire obsidian
#

Well my bot is going like 2m to turn on, is that a problem?

midnight blaze
#

ok, but as I said, only if the count is 0

#

hmm

misty sigil
#

seems like a problem with your internet speed lad

dire obsidian
#

Huh, no, i allready load more heavy bots

#

And is like on 5 seconds

misty sigil
#

god how inefficient is your code kekwot

dire obsidian
#

Ah im stupid

misty sigil
#

why

dire obsidian
#

I dont add a ready event

misty sigil
#

you dummkopf

dire obsidian
#

No wait

quartz kindle
#
let count = voiceChannels.reduce((a,b) => a + b.members.size, 0)
if(!count) {
  for(let channel of voiceChannels.values()) {
    await channel.delete()
  }
}
dire obsidian
#

Yes i add it

misty sigil
#

hackerpepe add

dire obsidian
#

I allready add it

#

Is not loading

midnight blaze
#

Looks quite good. Hopefully this will work in the event. Thanks TIM for your help

dire obsidian
#

I was like 10m here and dont do anything

fluid basin
#

which library btw, sqlite or sqlite3 @tight plinth

quartz kindle
#

or better-sqlite3

midnight blaze
#

it worked

fluid basin
#

yeah

midnight blaze
#

thanks

dire obsidian
#

My bot isnt get online help

midnight blaze
#

a lot

dire obsidian
#

I was here 12m and console dont show ready!

misty sigil
#

are you sure there isn't a problem in your ready code

opaque seal
#

I have an array of objects, every object is like identifier: score
identifier is the user identifier and can always change instead score is a number

Every time a user scores I need to add 1 to the score, would this code work?
array[identifier]++;

Probably not, what is the correct way of doing this?

dire obsidian
#

are you sure there isn't a problem in your ready code
@misty sigil no there isnt

misty sigil
#

show it

fluid basin
#

@opaque seal it should

opaque seal
#

@fluid basin a guy said that array[index][identifier] ++;

#

But I don't know the index

fluid basin
#

show us some examples of your code that uses that line

opaque seal
#

me?

fluid basin
#

ye

dire obsidian
#

client.once('ready', () => {
console.log('ready!');
});

#

Thats it

#

But nothing on console

opaque seal
#
await client.guildSchema.findOne({ guildID: guild.id }, async (err, res) => {
        if (!res) {
            const newGuildSchema = new client.guildSchema({
                guildID: guild.id,
                bans: [],
                kicks: [],
                mutes: [],
                votes: [{ voterID: 1 }],
            });
            await newGuildSchema.save().catch(err => console.log(err));
        }
        else {
            let votes = res.votes;
            votes[voter.id]++;
        }
    });```
fluid basin
dire obsidian
#

No, my code is ok, dont show any error

#

The console is clear

fluid basin
#

yes, you're not logging in to discord

dire obsidian
#

Nothing

fluid basin
#

from your bot

#

thats why its offline

#

bruh

faint prism
#

That's some confident logging lol

misty sigil
#

do you have client.login?

#

you need client.login("token")

dire obsidian
#

yes

opaque seal
dire obsidian
#

I have it

#

But nothing on console

fluid basin
#

@opaque seal where is the definition for votes?

#

the line where the variable is created

remote reef
#

alguien español que me ayude

solemn latch
#

You have it not in another event right?

faint prism
opaque seal
#

@opaque seal where is the definition for votes?
@fluid basin it's created when if(!res) ...

solemn latch
#

The number of times I've seen people do client.login in an event that cannot happen until the clients logged in already is scary

opaque seal
#

It get's it from the database if it's created

#

votes = res.votes

fluid basin
#

owh

#

I found your problem

dire obsidian
#

You have it not in another event right?
@solemn latch well i have a command handler but in the same bot.js i have it, the ready event and client.login

fluid basin
#

you've changed the variable value locally

#

but its not yet saved to the database

opaque seal
#

I just want to get a list of all the users who vote for my bot and how many times they do

#

is an array of objects good for that

fluid basin
#

after you update the value, save it to the database

opaque seal
#

or is there a better way?

dire obsidian
#

Ufff

#

15m and finaly load

opaque seal
#

after you update the value, save it to the database
@fluid basin Ik, I just miss the part where I add 1 to the user

dire obsidian
#

Ufff

misty sigil
#

wtf it takes that long

opaque seal
#

@fluid basin Ik, I just miss the part where I add 1 to the user
Idk how to do that part

faint prism
#

Someone recommend me a type of database

dire obsidian
#

Sql

fluid basin
#

there isn't a problem there, if you console log votes[id] it should show the correct value

faint prism
#

sqlite or SQL?

misty sigil
#

either

#

quick.db works if you're starting

fluid basin
#

@opaque seal I would need to know what is running that part of the code, is it in a loop?

dire obsidian
#

Now idk if wait anothers 15m to turn bot on

misty sigil
#

and mongo is good

solemn latch
#

Maybe its just me, but I'd avoid quick.db.
It seems to be the db with the most issues that no one seems to know how to solve

summer torrent
#

try votes.save()

opaque seal
#

Ik that

#

But I don't know if an array of objects is the right solution

summer torrent
#

use updateOne

strange trout
#

Yeah I wouldn't use quick.db

shy turret
#

^ i reccomend sqlite using enmap or keyv

fluid basin
#

mongodb is fairly easy to use as well

#

though you will need a running database server, either hosted on your server or using something like mongodb cloud

strange trout
#

Dunno about keyv but I'm pretty sure enmap is a sqlite wrapper too so I'd also advice against using it

solemn latch
#

Keyv works with a handful of databases

#

Or in memory

spice pier
strange trout
#

I'd just use PostgreSQL with an ORM like TypeORM or Sequelize

#

Or MongoDB if you want NoSQL

#

@spice pier What API are you making a request to?

spice pier
#

discord?

strange trout
#

Do you know which part of your code is causing the error?

spice pier
#

its all in the screenshot

#

this is the body {"content":"Pong!","tts":false}

fluid basin
#
  1. are you using a library?
  2. is this a bot or a user?
spice pier
#
  1. Why does it matter?
  2. A bot.
fluid basin
#

a library makes things easier

#

well in that case you should scrutinise the docs carefully

spice pier
#

Theres no discord api wrapper for V

#

hard to use one :)

fluid basin
#

have you considered using a webhook then if it is possible for your use case

spice pier
#

A bot using webhooks? hmmm

fluid basin
#

you need to have a websocket connection established

#

for a bot to work

#

and send messages

spice pier
#

It is

strange trout
#

Did you connect to the gateway

spice pier
#

How do you think im triggering my code

fluid basin
#

alright

spice pier
fluid basin
#

have you added the required headers

#

for the http request

spice pier
fluid basin
#

interesting then

upper acorn
#

can someone help me set a time to use the command again in js?

fluid basin
#

does the http library you are using have a default user-agent, or does it not have one? @spice pier

spice pier
#

The default one is v.http

fluid basin
#

well.. this issue seems weird, might need to do some debugging

earnest phoenix
#

@spice pier what is the response code

#

you're getting

summer torrent
#

400

earnest phoenix
#

it shouldn't be returning html

#

at all

spice pier
#

And who decided that?

earnest phoenix
#

REST api spec

#

it's supposed to be returning a json response

#

anyways

#

the headers might be case sensitive

#

try using Content-Type instead of lowercase

spice pier
#

funfact: you dont need to be connected to the ws to send messages

#

and it isnt case sensitive

earnest phoenix
#

yes welcome to REST

#

are you sure you're making a request to discord

strange trout
#

I found the response weird

earnest phoenix
#

the response is from google

summer torrent
earnest phoenix
#

it's a response from google

spice pier
#

thats in the response

#

I copied the code and ran it, worked as expected

earnest phoenix
#

the entire response is from google, you can see that from the hrefs referencing google resources

spice pier
#

was able to post and send a message

earnest phoenix
#

something fishy is going on here lol

strange trout
#

Yeah

spice pier
#

found out what was the problem, unsure how it happened in the first place tho

strange trout
#

What was it?

spice pier
#

using post instead of POST as the method

#

I didn't make the code base, so that'd be from the other people who contributed

karmic compass
#

how do i check bot permissions?

I have a command that edits channel permissions, but i can't figure out how to make it so the bot doesn't shut down if it is missing perms

#

discord.js btw

sudden geyser
#

You can use <GuildChannel>.permissionsFor(...) with ... being GuildMemberResolvable. For example, you could use <Guild>.me and pass that.

#

Then you can just do .has("MANAGE_CHANNELS") to see if it has permission to edit said channel

karmic compass
#

would this work: ```javascript
const theGuild = message.guild
if(!theGuild.me.has("MANAGE_CHANNELS")) {
message.reply("I can't use this!")
} else {
// do the code
}

sudden geyser
#

No, it should look like channel.permissionsFor(guild.me).has("MANAGE_CHANNELS")

karmic compass
#

so:

const theGuild = message.guild
if(channel.permissionsFor(theGuild.me).has("MANAGE_CHANNELS")) {
message.reply("I can't use this!")
} else {
// do the code
}

would work? i'm just putting two and two toghet here

opal plank
#

theGuild?

karmic compass
#

i can't find any better names for variables

sudden geyser
#

Still wouldn't (assuming channel isn't defined), but you can always trial and error.