#development

1 messages · Page 617 of 1

mossy vine
#

do the same thing but with fetch("data.json")

#

same response?

wide ruin
#

yeah

#

@mossy vine

#

what else do i need to do?

copper cradle
#

k

indigo flume
#

can someone copy the index.js code and put it in a pastebin? i can't copy it for some reason. https://repl.it/@DominicBurke/Windows-Bot

#

When someone does it please ping me

amber fractal
#

Even better, a hastebin

potent quarry
#

What do i need to do to give my servercount en status to the site?

#

I already installed the API.

amber fractal
#

the docs

grim aspen
#

that's for when you become a bot developer

amber fractal
#

Oh and that

potent quarry
#

Okay, Thx.

amber fractal
#

you need an api token

potent quarry
#

Yea, I read that 🤦

#

I couldn’t find the docs before this

#

😅

indigo flume
#

Thanks @amber fractal

strange escarp
#

Would someone be interested in doing a preliminary test of my bot?

indigo flume
#

yes

cosmic crypt
#

hi all can someone please look over this code and tell me what i should use instead of await? as i get SyntaxError: await is only valid in async function at Module._compile (internal/modules/cjs/loader.js:703:23) at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10) at Module.load (internal/modules/cjs/loader.js:628:32) at Function.Module._load (internal/modules/cjs/loader.js:555:12) at Function.Module.runMain (internal/modules/cjs/loader.js:822:10) at internal/main/run_main_module.js:17:11

opaque eagle
#

That bot won't work at all

#

Since the if statements are outside the message event

cosmic crypt
#

Thanks , i just noticed i closed the message event early by using }); 😃 thanks for your help your comment helped my realise my mistake even though it looked valid it was not 😄

#

@opaque eagle

copper cradle
#

why don't you make a command handler?

fiery stream
#

ayy i crashed someones api website <br /> <b>Fatal error</b>: Out of memory (allocated 10485760) (tried to allocate 1191936 bytes) in <b>C:\Users\BrightSkyz\Documents\Development\BrightSkyz\MemeLoad\api\v1\random.php</b> on line <b>8</b><br />

#

lmao i sent to many requests to it

grizzled spruce
fiery stream
#

lmao dont u roast me

#

i didnt mean to

grizzled spruce
#

puts in 5 thinking it means minutes not milliseconds

#

gee I wonder why my api crashed

fiery stream
#

lmao i was doing some quick maths

#
    axios({
      method: "get",
      url: "https://api.memeload.us/v1/random"
    })
      .then(function(response) {
        console.log(response.data.image);
      });
  }

  (function loop() {
    var rand = Math.round(Math.random() * (300000 - 500)) + 500;
    setTimeout(function() {
      task();
      loop();  
    }, rand);
  }());```all done by this code
#

not my fault

#

i need the web site its not coming back online rip

grizzled spruce
#

Oof

fiery stream
#

yep big rip to my random meme event

grizzled spruce
#

^^^

fiery stream
#

hopefully the dev of the website comes back and gets it back up n running with some more ram

grizzled spruce
#

gets back up with less ram and bans your access point

pallid zinc
#

Lol

fiery stream
#

u are rude and yea im on glitch they change ip every 24 hours

grizzled spruce
#

I use glitch

#

And I use uptime robot which keeps me bot online 24/7!

fiery stream
#

yea they change ip of the project continuously

grizzled spruce
#

Which gets irritating tbh

#

If you don’t use uptime your bot might go offline every 12 hours

opaque eagle
#

Why would either of you use Glitch anyways...

#

It's not a host

grizzled spruce
#

Free

#

IS FREE

grim aspen
#

i do skysilk vps

grizzled spruce
#

it’s the best my wallet can do

opaque eagle
#

Free isn't really a good reason to use something so terrible

fiery stream
#

i want to get cloud 9 but its confusing and glitch has live editor that i love

grizzled spruce
#

The only other option is self host

grim aspen
#

which is not free but it lasts 24/7

fiery stream
#

i dont really care about FREE part

opaque eagle
#

Use an editor locally...

#

Like VS Code, vim, or WebStorm

grizzled spruce
#

The live editor is nice as well

fiery stream
#

^^^ thats what i love

grizzled spruce
#

Honestly glitch runs pretty well for me

opaque eagle
#

Lmao

grizzled spruce
#

I don’t really have any issues

fiery stream
#

i want to get cloud 9 i got it once but i dont know how payments work on aws

#

so i am scared to get it

opaque eagle
#

Idk I'll switch to Glitch when it can run my Redis stores and kubernetes clusters

shy rose
#

aws is just a credit card

fiery stream
#

^^^ i know that

shy rose
#

@opaque eagle or just any db....

#

not sqlite

opaque eagle
#

Redis is OP

#

Nothing beats it

fiery stream
#

but i dont know how billing works like how they take money on usage or what

opaque eagle
#

And no, you can't change my mind.

fiery stream
#

i wasnt able to figure that out

shy rose
#

hourly billing

grizzled spruce
#

Glitch can use databases

shy rose
#

normally

opaque eagle
#

Not Redis @grizzled spruce

#

SQLite is shit

shy rose
#

ec2 machines are per hour

empty owl
#

ewww glitch

grizzled spruce
#

I use a different database

grim aspen
#

exactly

grizzled spruce
#

Can’t remember which one

opaque eagle
#

Like... json?

#

Lol

grizzled spruce
#

Nono

opaque eagle
#

k

grizzled spruce
#

Json is so bad

opaque eagle
#

Just like Glitch @grizzled spruce

shy rose
#

real pro's use csv databases

fiery stream
#

why do u guys hate glitch they do everything for free without ads

empty owl
#

bro

opaque eagle
#

Dude

empty owl
#

half the time

#

people

shy rose
#

because the hosting is potato

grizzled spruce
#

I’m not a pro lol

empty owl
#

are

#

using it

#

and making it slow

#

for web devs

shy rose
#

also discord blocks its IP every so often lol

fiery stream
#

@shy rose there ping is faster than digital ocean i have tested that myself

grizzled spruce
#

Yep

opaque eagle
#

It can't do anything advanced... it can't run Redis stores, Docker containers, etc... no ssh, no pipelines, no CI, no nothing. It's an editor, not a host. It's an editor, not a host. @fiery stream

grizzled spruce
#

Well it works for what I do so idc

shy rose
#

@fiery stream depends on your neighbours and also server location of that do machine

fiery stream
#

^^^ dont complain about something free

grizzled spruce
#

I’ll move on to a paid service someday

#

But for now glitch is just gimme

#

*fine

shy rose
#

@fiery stream i can get avg of 15ms ping to discord off aws

opaque eagle
#

And you can't scale up your "system" in Glitch

#

You can't allocate more memory to it

shy rose
#

heroku at least has scaling capacity

grim aspen
#

@fiery stream the reason why most people don't use it because free hosting is shit hosting

shy rose
#

as its designed as a service not a hobby thing

opaque eagle
#

When using glitch, you're not in control of the environment in which your bot is run. And I hate that more than anything.

fiery stream
#

i dont think so because they care about there users they add updates regularly

opaque eagle
#

They can solve all of these problems... if they add Docker support

shy rose
#

thats just containerised code thats pretty good tbh

opaque eagle
#

But they won't, becuz Glitch isn't meant for that

grizzled spruce
#

It’s free tho

shy rose
#

glitch is a hobby hosting thing tbh

grizzled spruce
#

What do you expect from a free service?

fiery stream
#

and guess what @shy rose they are using aws in backend

shy rose
#

heroku is free and designed as a service

opaque eagle
#

You need to stop citing it being free as a good thing... that is bad news, not good @grizzled spruce

shy rose
#

@fiery stream yes but you also share it with god knows how many neighbours

#

if the person next to you is downloading the internet then your latency will go through the roof

grizzled spruce
#

@opaque eagle your not the one using it so I don’t give a shit

opaque eagle
#

If you absolutely need a free option, Heroku is much better

shy rose
#

^

opaque eagle
fiery stream
#

umm true rn im just waiting to get my self a domain then i am moving my all important stuff to vultr

shy rose
#

heroku is designed as a service not a hobby system

#

@opaque eagle is now sh free again 😮

grizzled spruce
fiery stream
#

yeppy i got achievement

opaque eagle
#

And when I have this argument with others, they think I'm hating on Glitch. I'm not. No dev who talks shit about Glitch is doing it cuz Glitch is bad. Glitch is good... at what it's supposed to do. Using Glitch as a bot host is misusing it, and that's where it goes terribly wrong.

shy rose
#

wait does zeit just run like aws lambdas? @opaque eagle

opaque eagle
#

Yeah

shy rose
#

thats cool

opaque eagle
#

They dropped Docker support in exchange for AWS lambdas

shy rose
#

can you make long running apps or is it just lambda based?

fiery stream
#

@grizzled spruce how many achievement things you got????

opaque eagle
#

Think they do both

grizzled spruce
#

Infinite

fiery stream
#

lmao really

opaque eagle
#

Lol

shy rose
#

thats cool 😄

grizzled spruce
#

My bot can generate any

fiery stream
#

srsly

grizzled spruce
#

Yep

fiery stream
#

i want to check your bot out now

#

whats its name

grizzled spruce
#

It’s not on the bot list yet

fiery stream
#

ohh can i join the server its in

grizzled spruce
#

I can give you the link in a non advertising way

fiery stream
#

just inv me in your testing server or som if u got one

opaque eagle
#

If someone explicitly asks for a link, there's nothing wrong in sharing it through DMs, or so I believe.

grizzled spruce
#

Ok

shy rose
#

if its in context yeah

opaque eagle
#

^

#

Just posting a link and saying "yo join my server" is... not so good. But I'm assuming it's fine in this case.

grizzled spruce
#

@fiery stream

#

Here you go

shy rose
#

@ mooserators bean for ads

opaque eagle
#

lol

grizzled spruce
#

I checked rules. It’s ok as long as it’s requested

opaque eagle
#

Bet they won't respond even if u pinged @shy rose

shy rose
#

im sure i could get at least 1 ping sock

fiery stream
#

they ill they fast as Freak

grizzled spruce
#

O

empty owl
#

returns undefined

#

uses nekos.life

#

discord.js

#

nvm'

mystic shell
#

so if a server owner decides to kick/remove my bot how can i find out the user who did the kicking/removing

#

i wanna be able to send them an ominous private message

#

i know i can use the guildDelete event listener

buoyant wagon
#

guildDelete could also mean the bot left by itself

novel wolf
#

!ping

grim aspen
#

#commands, common prefix, and ultimate hoisting

amber fractal
#

Bro

#

Sending them an ominous private message will just make them not like the bot more

#

Not to mention idek if that's allowed

mystic shell
#

@amber fractal fair enough
ok so i have a sqlite database that i use to log what someone uses my bot for (commands, server join, server leave, etc.) and the date the bot is used. i have the use date stored as a sequelize date, when i get a date object from the db and try to adjust it for my time zone using the .toLocaleString() method in the javascript docs it only outputs a string with the time set to the UTC time zone

fiery stream
#

can anyone help me test something in my bot

#

ayy whats wrong with this

#
      // This is the name of the role.
      name: "Admin",
      check: (message) => message.channel.type === "text" ? (message.member.hasPermission("ADMINSTRATOR") === message.author.id ? true : false) : false
    },```
#

its saying Invalid permission string or number.

buoyant wagon
#

you spelled administrator wrong

fiery stream
#

Lol did i

#

Administrator lmao

sinful lotus
#

oh

#

"ADMINSTRATOR" lmfao

grizzled spruce
#

Pronounced admin-straight-tor

pallid zinc
#

Lol

fiery stream
#

@sinful lotus is it gonna work if i spell it correctly

sinful lotus
#

wtf is that question lmfao

#

you made me say wtf is that question

delicate zephyr
#

Hang on

#

am gonna check permissions

#

just so you know

#

8 is the admin number

#

@fiery stream ^^

sinful lotus
fiery stream
#

@delicate zephyr nah

sinful lotus
#

check your spelling

fiery stream
#

Ik

#

It did

sinful lotus
#

" a code will not work with misspelled values "

#

unless its your own values

fiery stream
#

If i fix it will it work

sinful lotus
#

facepalm did you read what I said?

fiery stream
#

Okay i fixed the spellin

pallid zinc
#

Nope it will not work

fiery stream
#

Okay?

#

Wasss the reson

pallid zinc
#

Unexpected token it will show

fiery stream
#

Why is that

sinful lotus
#

what is that syntax

#

condition ? if true : if false

#

not ? ? ? ?? ? ? ?? ?

fiery stream
#

Yee

#

It worked

pallid zinc
#

Lol

sinful lotus
#

that ternary isnt needed

#

thats just useless and will make your code unreadable

#

because hasPermissions will already return TRUE or FALSE

pallid zinc
#

Is there any way to make bot fast

#

??

sinful lotus
#

make your code better

pallid zinc
#

??

#

My code

#

It's voting

#

It work but bot show late result

sinful lotus
#

uhmm what?

pallid zinc
#

It's take time to calculate

#

Vote

sinful lotus
#

because you set it to let collector = await message.channel.createMessageCollector(col => !col.bot, { time: 30000 })

#

time: 30000 means it will wait for 30 secs to end

#

read documentation

earnest phoenix
#

Message wont send , no error

sinful lotus
#

console.log if it doesnt send and look on where your code stops

earnest phoenix
#

it stops at setImage

sinful lotus
#

then start debugging from there

earnest phoenix
#

i guess the image im trying to send is undefined ..

#

but i dont know how else to define it

sinful lotus
#

read documentation of the api

earnest phoenix
#

theres no docs...

sinful lotus
#

then parse the outout

#

output

mossy vine
#

.setImage(Page ${page} of ${pages.length})

#

Wtf is this

earnest phoenix
#

wtf are you

#

ugly bich

sinful lotus
#

how do that page thing work

#

I dont see that ommand working tbh

earnest phoenix
#

it works

#

just doesnt send the image i want

sinful lotus
#

define works and not work

#

also if you open that link on browser

#

you will find your answer tbh

earnest phoenix
#

i have it open

sinful lotus
#

what do you see?

earnest phoenix
sinful lotus
#

did you really open the api?

earnest phoenix
#

i think im going to just leave this server breh

sinful lotus
#

what do you see?

#

Its a json response

earnest phoenix
#

i got it

sinful lotus
earnest phoenix
#

i got it

#

i was just putting it in the wrong place

sinful lotus
#

Dont blame us for your lack of knowledge. We are only gonna point you to right direction.
Another thing is code legibly, I even have a hard time reading that code

earnest phoenix
#

i didnt blame you for anything

earnest phoenix
#

How am I supposed to grab different items if the items arnt numbered

sinful lotus
#

Items is an array

#

array has methods

#

use what you see fit

fiery stream
#

@gilded plank prefix @earnest phoenix

gilded plankBOT
#

GuildClean's prefix is -

bright spear
fiery stream
#

So i am checking

#

Im developing

#

1010110 = true

idle basalt
#

🤔

earnest phoenix
#

@gilded plank prefix @mild heart

gilded plankBOT
#

Ayako's prefix is a~ or @Ayako

earnest phoenix
#

Hello, I would like someone who is currently available on computer. And who have nodejs

opaque eagle
#

Sure, what do u need

earnest phoenix
#

I can not install the superagent module and I would like you to give it to me please @opaque eagle

#

Its puts makes mistakes

opaque eagle
#

What kinds of mistakes?

earnest phoenix
#

The operation was denied by your operating system

mossy vine
#

run the cmd as admin

#

or try running the command again

earnest phoenix
#

Already done..

#

There I speak with a phone but I have a computer next to me..

#

who can give it to me the module superagent so ?

mossy vine
#

build it yourself

earnest phoenix
#

thx

#

But there are dependencies

mossy vine
#

yes

opaque eagle
#

Idk why ur getting that error lmao... unless ur installing globally

earnest phoenix
#

I see that expected

#

I put everything in a folder superagent and its puts puts it does not find the module..

#

I was wondering if someone could install it on his computer and send it to me?

mossy vine
#

can you not install anything?

#

btw are you using npm or yarn

earnest phoenix
#

There's just the superagent that lags

#

And I don't know why

#

I do

npm i superagent```
and if its not working I did

npm i superagent --force

its not working even in Admin
mossy vine
#

install yarn and try it with that

earnest phoenix
#

ok

mossy vine
earnest phoenix
#

Thx

#

Seriously, its takes time to install it and puts it like what I can not, you can give it to me directly because I have 20 minutes after I have to go..

spring ember
#

@earnest phoenix what is the error

earnest phoenix
#

@spring ember The operation was rejected by your operating system.

pallid zinc
#

let role = message . guild . roles . find ( r => r . id == ' 547042181223809055 ' ) case " role " : if ( ! role) return message . channel . send ( ` ** $ { Message . author . username } **, role not found ` ) message . guild . members . filter ( m => ! m . user . bot ). forEach ( member => member . addRole (role))message . channel . send ( ` ** $ { Message . author . username } ** ** role $ { role . name } ** Was added to all members ` ) break ;

#

Can you check

#

No err but not working

mossy vine
#

What the actual fuck

pallid zinc
#

What

opaque eagle
#

Get rid of the extra spaces

#

No one can read that

pallid zinc
#

Am on mobile

#

Can't do that

opaque eagle
#

Why did u have those spaces there in the first place then...

#

Use ur bot’s eval command to remove all spaces with regex

pallid zinc
#

Let me send screen shot

#

How can I use eval for it

#

Can you give example

#

Plzz

#

I am new to eval

inner jewel
#

eval("code")

grim aspen
#

@pallid zinc which library are you using

pallid zinc
#

Discord.js master

grim aspen
#

oh ok

#

try this

#

eval message.channel.send ('hi')

spring ember
#

@earnest phoenix can you send the full stack?

#

What operating system as well

copper cradle
#

u should stop leaving that many spaces

earnest phoenix
#

yeet

mossy vine
#

just post your question

#

do you know any programming languages?

ruby dust
#

bots aren't something you can easily "make", they are programmed just like any other software/game

earnest phoenix
#

account's been created recently, a possible troll

ruby dust
#

not that recently

mossy vine
#

thats not too recent

#

leave

ruby dust
#

rude

earnest phoenix
#

@spring ember ok wait

ruby dust
earnest phoenix
#
npm ERR!      errno: -13,
npm ERR!      code: 'EACCES',
npm ERR!      syscall: 'symlink',
npm ERR!      path: '../mime/cli.js',
npm ERR!      dest: '/storage/emulated/0/Bot Discord/bot/node_modules/.bin/mime' },
npm ERR!   stack:
npm ERR!    "Error: EACCES: permission denied, symlink '../mime/cli.js' -> '/storage/emulated/0/Bot Discord/bot/node_modules/.bin/mime'",
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'symlink',
npm ERR!   path: '../mime/cli.js',
npm ERR!   dest: '/storage/emulated/0/Bot Discord/bot/node_modules/.bin/mime',
npm ERR!   parent: 'bot' }
npm ERR!
npm ERR! The operation was rejected by your operating system.

@spring ember

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

@modest remnant You don't know how to create at least one app bot?

#

Have you watched YouTube videos or on the Internet?

ruby dust
#

there are like over 3.5k public bots you can find on the site, why do you need a custom one specifically?

earnest phoenix
#

He's gone..

ruby dust
#

no

earnest phoenix
#

He got banned?

sage bobcat
#

One message removed from a suspended account.

ruby dust
#

🤦

mossy vine
#

he didnt even leave

sage bobcat
#

One message removed from a suspended account.

ruby dust
#

deleting one message
"yep, he's gone"

earnest phoenix
#

I hadn't seen

ruby dust
#

how about scrolling up to see his previous messages? since that's exactly the reason why discord never deletes them

pallid zinc
#

How can I make bot that tell the time

#

I know it's useless (my bot name is also useless)

earnest phoenix
#

thx

spring ember
#

@pallid zinc is the issue the bot or the time

pallid zinc
#

Time

#

I want to add useless command in useless bot

spring ember
#

What programming language?

pallid zinc
#

.js

spring ember
#

Use the Date object

pallid zinc
#

Ok

earnest phoenix
#

@spring ember always the same error

spring ember
#

Weird

#

Try to chown the node_modules in your project's directory

earnest phoenix
#

You can not still give me the superagent module and its dependencies please

#

It already in

spring ember
#

It's a permissions error

earnest phoenix
#

yes

#

I tried in Admin

spring ember
#

Give npm access to this directory

#

Oh it's Windows

earnest phoenix
#

how?

#

How do I give access?

#

!ping

spring ember
#

npm cache clean -f

#

Try this

earnest phoenix
#

on

#

ok

spring ember
#

Deleting the node_modules folder and then running npm install again might work as well

earnest phoenix
#

Its started to settle but its stopped

#

Already done

#

But the error comes only for the superagent module, you can give it to me directly to the worst?

spring ember
#

I have no idea what causes it sorry

#

Try googling this issue and add an issue on the GitHub repository

earnest phoenix
#

Meanwhile, give me the superagent module possible?

#

It's urgent

mossy vine
#

just dont use superagent then

#

it has nothing that other libs cant do

spring ember
#

node-fetch is a better alternative

#

Try it out

earnest phoenix
#

Personally I prefer superagent

spring ember
#

Well I can't help you with that

earnest phoenix
#

I was just asking if someone could give me the module because me it makes me mistakes..

copper cradle
#

wdym

lofty hamlet
#
                            if (event.guild.id != "493025435769372682") return;
                            if (!events.hasOwnProperty(event.t)) return;
                        
                            const { d: data } = event;
                            const userid = bot.users.get(data.user_id);
                        
                            console.log(events[event.t], userid)
                            bot.emit(events[event.t], userid);
                        });```
#

Hi

#

My problem is :

#

This line does not work :

#

if (event.guild.id != "493025435769372682") return;

#

The error is : id of undefined

sage bobcat
#

One message removed from a suspended account.

lofty hamlet
#

Both are verified

#

@sage bobcat

sage bobcat
#

One message removed from a suspended account.

lofty hamlet
#

@sage bobcat you want see all my code ?

sage bobcat
#

One message removed from a suspended account.

lofty hamlet
#

I want get the id of the personn who has add the reaction

#

It's been 3 hours that I can not do it and nobody can find the test with the event

flint trellis
#

why are you using raw meguFace

lofty hamlet
#

🆙

#

I want get the id of the personn who has add the reaction It's been 3 hours that I can not do it and nobody can find the test with the event

earnest phoenix
#

part of codage :
guild.channels.get('578603303085146132').send(nouvserv);

Error :
TypeError: Cannot read property 'send' of undefined

flint trellis
#

@earnest phoenix channel doesn't exist

earnest phoenix
#

Who can help me

#

@flint trellis If it exists

flint trellis
#

then it would work.

earnest phoenix
#

But the ID of the target lounge is the right

sage bobcat
#

One message removed from a suspended account.

lofty hamlet
#

?

lofty hamlet
#

@sage bobcat why ?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

lofty hamlet
#

?

#

#pinmessage

#

@earnest phoenix

#

Look pin message

earnest phoenix
#

But the channel with the ID 578603303085146132 is in my server and not in the one where it is added. How do I make it send to my server?
@flint trellis

lofty hamlet
#

@sage bobcat ?
The server exist dude

#

What dide you say this is hots dude

sage bobcat
#

One message removed from a suspended account.

copper cradle
#

just use messageReactionAdd

sage bobcat
#

One message removed from a suspended account.

flint trellis
sage bobcat
#

One message removed from a suspended account.

lofty hamlet
#

@sage bobcat what ?.??

flint trellis
#

@earnest phoenix just do <client>.channels.get()

earnest phoenix
#

ok

#

@flint trellis
guild.channels.get('578603303085146132').send(nouvserv);

#

it's good

flint trellis
#

is guild defined

earnest phoenix
#

yes

flint trellis
#

as what

earnest phoenix
#

But its not working

flint trellis
#

show code pls

earnest phoenix
#

k

flint trellis
#

codeblock or hastebin

earnest phoenix
#

k

lofty hamlet
earnest phoenix
flint trellis
#

i see no problem with the code

#

the channel doesn't exist

earnest phoenix
#

come

flint trellis
#

i would also suggest adding an error catch to the guild.owner.send because Guild#owner is a nullable object

earnest phoenix
#

sry

flint trellis
#

see if it works with <client>.channels.get()

earnest phoenix
#

k

#

@flint trellis It puts me

Cannot read property send of undefined
flint trellis
#

then the channel doesn't exist

earnest phoenix
#

But if there is

mossy vine
#

you are looking for the channel in the guild the bot gets added to

#

which only exists if its added to the server the channel exists in

#

do client.channels.get instead

earnest phoenix
#

Indeed

#

THX BRO

flint trellis
#

I wonder who said that. Three times. HappyThonk

earnest phoenix
#

@mossy vine same error

mossy vine
#

oh boy

#

are you 100% positive that the channel does indeed exists and that its actually a channel id and not something else

earnest phoenix
#

client.channels.get("578603303085146132").send(nouvserv);

#

I'm sure

flint trellis
#

wrong channel id.

#

re-copy it.

earnest phoenix
#

Ok

flint trellis
earnest phoenix
#

ID : 578603303085146132

west spoke
#

:v

mossy vine
#

or maybe the channel isnt cached

#

@earnest phoenix restart your bot, send a message to the channel, and add the bot to another server

earnest phoenix
#

k

#

Why does my bot shut down after 1-2 weeks with an error?

#

I am very sorry.
I have to change my account under various circumstances. If so, can I change the owner on this list?

unique nimbus
#

@earnest phoenix whats the error?

earnest phoenix
#

@unique nimbus
I can not track this error

unique nimbus
#

Where do you host your bot?

earnest phoenix
#

amazon

unique nimbus
#

I am not sure sorry

earnest phoenix
#

it's alright, thanks

vague chasm
#

Suppose I am creating a webserver with http.createServer() from a js file, now I need that webserver object in another js file, How can I do so?

bright shard
#

export the object

mossy vine
#

^

bright shard
#

from the file you made the webserver

mossy vine
#
const server = http.createServer()
module.exports.server = server```
bright shard
#

well I was kinda not wanting to spoonfeed him..

vague chasm
#

Then I .require() the file where webserver was created to access its module.exports?

#

I think .require() will run that file again

bright shard
#

.require()?

mossy vine
#

^

bright shard
#

it's just require

mossy vine
#

if you need to access it from the file you created it in, its already defined as server

#

so you can do server.listen()

#

ez

vague chasm
#
const webserver = require('./webclient.js').server```?
mossy vine
#

yes

#

that

#

should work

#

ig

earnest phoenix
#

@mossy vine I deleted the salon, I have recreated another and I copied the ID, I even checked with koya the ID and it is the same I copied but its always puts
Cannot read property .send of undefined

mossy vine
#

are you sure the bot is in the server the channel is in

earnest phoenix
#

Yes, it is in the support server

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

mossy vine
#

that code makes no sense

#

you are trying to export.. in an export...?

sage bobcat
#

One message removed from a suspended account.

grim aspen
#

i don't see an if statement

west spoke
#

@sage bobcat I wouldn't be able to eval anything since you use js and I use py

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

mossy vine
#

pingsock

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

mossy vine
#

ok but why is module.exports.help still there

#

when its like

sage bobcat
#

One message removed from a suspended account.

mossy vine
#

you have a client.on in there

sage bobcat
#

One message removed from a suspended account.

mossy vine
#

it should work

#

but please format your code

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

mossy vine
#

and that is why

#

you format your code

#

to realize you have a missing )

#

and that is also why

#

you dont use glitch

#

and use a proper ide

opaque eagle
#

Why doesn't this change the shape of my bot's logo to a circle?css div.bot-img img { border-radius: 50%; }

west spoke
#

You have to edit it

#

With 100% it makes it almost a circle. But I just edit the images. Since it doesnt place the circle always how I want it

opaque eagle
#

oh... why doesn't the css work tho?

earnest phoenix
#

Why it doesn't work

client.on('guildCreate', guild => {
     let addembed = new Discord.RichEmbed()
	.setColor("GREEN")
	.setTitle("**__Merci de m'avoir ajouté dans ton serveur !__**")
	.addField("💼 • Mon prefix :", "`t/` (Changeable)")
	.addField("✨ • Ma page d'aide :", "t/aide")
	.setFooter("Encore merci de m'avoir ajouté dans ton serveur !")
         try{
        guild.owner.send(addembed)
      }catch(e){
        console.log(`Nouveau serveur ! Message privé avec le owner bloqué.`)
    }  
});
mossy vine
#

whats the error

west spoke
#

^

opaque eagle
#

^ not working can mean lots of different things

mossy vine
#

just saying "help pls it dont work" isnt helpful to anyone

west spoke
#

@opaque eagle idk

opaque eagle
#

oh

earnest phoenix
#

No problems appear in the console.

west spoke
#

I work with css and html more than js

opaque eagle
#

lol

west spoke
#

Though to make it where you want you can crop the image

#

I guess

opaque eagle
#

How do u know it doesn't work

west spoke
#

Me?

mossy vine
#

@earnest phoenix there could be many issues with that. instead of not doing anything with the error (e) how about you log it instead of some useless "oh shit problem occured" shit

earnest phoenix
#

because I tested

mossy vine
#

is guild.ownerID your id

opaque eagle
#

Log the error in the catch @earnest phoenix

earnest phoenix
#

But I want that when someone adds my bot, the bot sends a message to the owner of the server in question

opaque eagle
#
try {
   // whatever
} catch(e) {
   throw e;
}```
#

Do the throw part and re-run ur code

mossy vine
#

yes we can read your code, you posted it

opaque eagle
#

so we know what the error is

glass spruce
#

can anyone help me with audio stuff in nodejs

#

am I able to stream an audio instance using discord.js

#

please ping me

sage bobcat
#

One message removed from a suspended account.

glass spruce
#

how do I turn an audio instance into an audio stream

split jungle
#

hello, can anyone help me out understanding an issue with emojies.

west spoke
#

:v

#

Wdym

split jungle
#

I want my bot to have customs emojies, in all servers where he is

mossy vine
#

it already has

buoyant wagon
#

right click + copy link

split jungle
#

does that mean he needs to inject his emojies in each server?

mossy vine
#

no

west spoke
#

No .

buoyant wagon
#

no

west spoke
#

It has nitro

mossy vine
#

it doesnt

west spoke
#

:mmLol:

mossy vine
#

only some nitro features

west spoke
#

Essentially

buoyant wagon
#

bot-version of nitro

west spoke
#

^

split jungle
#

So that means what, i upload custom emojies to 1 server, support server, and he will be able to use that id code on every other server?

west spoke
#

Yeh

split jungle
#

and i can upload emojies like a user, not even needed to do it as a bot?

west spoke
#

I have my emote storage in a private server

#

You can do it yourself

stone perch
#

I need bots

grim aspen
#

unless you're searching for a bot

opaque eagle
#

I get a 400 Bad Request error ```js
fetch(https://discordbots.org/api/bots/${this.client.user.id}/stats, {
method: "POST",
body: { server_count: this.client.guilds.size },
headers: {
"Authorization": this.client.discordBotList
}
});

hushed berry
#

@opaque eagle i believe you need a content type

opaque eagle
#

Oh

#

Nope, still same error

#
fetch(`https://discordbots.org/api/bots/571097569644773455/stats`, {
    method: "POST",
    body: { server_count: 11 },
    headers: {
        "Content-Type": "application/json",
        "Authorization": auth
    }
}).then(console.log);```
amber fractal
#

that's not json tho

#

JSON.stringify

opaque eagle
#

then what would it be

amber fractal
#

That's a js object

opaque eagle
#

ohhh

#

Yay workedd

#

Ty both

amber fractal
#

👍

opaque eagle
#

@west spoke it worked at last (the round image thing)... apparently I didn't enclose my css in <style></style> tags xD

split jungle
#

Anyone knows if it is possible to shorten all this characters in the URL link here:

#

I see one bot has:

#

How can i make it like this?

shy rose
#

[content](https://google.com)

#

if that doesnt work swap the brackets

split jungle
#

just a sec

buoyant wagon
#

no swap

split jungle
#

OMG, thank you 😃 😃 😃 😃

#

It works

#

@shy rose Thank you 😃

earnest phoenix
#

i need "picture input outpu"t codes for javascript

amber fractal
buoyant wagon
shy rose
cunning oxide
#

yo how do i change the theme on my bot page

#

to black

shy rose
#

custom css

buoyant wagon
#

style tag

cunning oxide
#

@shy rose yeah I know that but like I have my site embedded in an iframe blah blah but some of the other bot pages have dark backgrounds

shy rose
#

custom css via a style tag

cunning oxide
#

ah

#

like in the "detailed description of your bot" part?

buoyant wagon
#
<style>
    body {
         background-color: black;
    }
</style>
shy rose
#

yeah i believe so

copper cradle
#
<style>
<!-- You know what goes here-->
</style>
#

bruh

#

use

shy rose
copper cradle
#

#cbf57a

buoyant wagon
#

he/she said black

opaque eagle
#

You didn't include a selector lmao

#

in the example

shy rose
#

#00000

opaque eagle
#

or just black

#

It's one of those CSS color names

shy rose
#

ik....

buoyant wagon
#
<style>
    body {
         background-color: black;
    }
</style>
shy rose
#

but #00000
is same value as black

copper cradle
#

use

#

coral

opaque eagle
#

or even shorten the hex to #000 or rgb(0,0,0)

shy rose
#

css3 has variables for even more options GWeniPopcorn

opaque eagle
#

Yeah

shy rose
#

and functions

opaque eagle
#

Honestly u can do it so many ways

shy rose
#

and all the stuff it should have had long ago

opaque eagle
#

I just wish DBL offered LESS/Stylus support

shy rose
#

also why sass took off so dam much

#

now css3 is just sass almost

opaque eagle
#

i guess

#

But browser support tho...

shy rose
#

sass is a precompile

#

it has everything css should have

#

chrome even supports previewing css in sass view lol

opaque eagle
#

Yeah

cunning oxide
#

I just wish there was a default dark theme

#

so that I could just pop the style tag in there lol

cunning oxide
#

but think it looks good

#

it is indeed done using style tags in ur bot description thingy.

opaque eagle
#
  1. How do I make that circle behind the logo disappear
  2. How can I make the text behind the image go to the right
#

In-case u wanna preview itcss <style> div.bot-img { background-color: #C9B37A } div#bot-img, div.bot-img, div.bot-img img { border-radius: 50% !important; animation: MoveUpDown 2s linear infinite; position: absolute; left: 0; bottom: 0; } @keyframes MoveUpDown { 0%, 100% { bottom: 0; } 50% { bottom: 5px; } } </style>

buoyant wagon
#

you can use display: none for the circle

opaque eagle
#

But idk what element that circle is

#

Can't pinpoint what it is

buoyant wagon
#

did you add box-shadow?

opaque eagle
#

no, that css above is all I have

copper cradle
#

and then click on the box

opaque eagle
#

I did

copper cradle
#

shoot

buoyant wagon
#

if the border-radius is 4px it might go normal

opaque eagle
#

nope still there

#
div#bot-img, div.bot-img, div.bot-img img {
  border-radius: 50% !important;
  border-radius: 4px;
  animation: MoveUpDown 2s linear infinite;
  position: absolute;
  left: 0;
  bottom: 0;
}
@keyframes MoveUpDown {
  0%, 100% {
    bottom: 0;
  }
  50% {
    bottom: 5px;
  }
}```
#

Lmao so much trouble just to get it to bounce up and down

buoyant wagon
#
.columns #bot-img .bot-img {
      box-shadow: 0px 0px 0px 0px #C2C1BE, 4px 4px 8px 0px rgba(0,0,0,0.2) !important
}
```is what i did to remove the white circle
#

||psst you set the border radius to 50% and 4px above||

opaque eagle
#

ohh lol

earnest phoenix
#

I like finding the easy way of things... anyone know of a open-sourced Discord bot w/ an economy/currency system? 😉
Or can anyone point me in the right direction in developing this bot?

grim aspen
buoyant wagon
#

you would need a database to store balance and stuff

earnest phoenix
#

is it cool if I can ask a question on some command development stuff

sinful lotus
#

just ask

split jungle
#

Can a bot edit his own message on DM channel?

buoyant wagon
#

Lepi yes i think

sinful lotus
#

Yes

earnest phoenix
#

I'm trying to work on a command that pulls a random post from a subreddit, and I've been struggling a bit with getting it to work

sinful lotus
#

since its the bot's message

split jungle
#

i receive a FORBIDDEN status code

west spoke
#

@opaque eagle bruh

sinful lotus
#

provide more context

west spoke
#

That's why I put two </style> tags

#

If there isnt one before it it just ignores it

split jungle
#

discord.errors.Forbidden: FORBIDDEN (status code: 403): Cannot execute action on a DM channel

earnest phoenix
#

Is there any way I can pull this off or is more context needed

west spoke
#

Tbh stringing api together is easy

sinful lotus
#

first of all, what is your wrapper?

#

what is your code

buoyant wagon
#

what is the language

sinful lotus
#

if we dont know those we cant help

west spoke
#

Nekos.life(yes eww) just use the image variable :v

sinful lotus
#

Nekoslife is fine because it is a public api and you get what you expect to get

earnest phoenix
#

I'm using discord.js and tried wrapping it using node-fetch

split jungle
#

Can a bot clear reactions on a DM channel ?

sinful lotus
#

any errors?

split jungle
#

His own reactins

#

yes

#

discord.errors.Forbidden: FORBIDDEN (status code: 403): Cannot execute action on a DM channel

sinful lotus
#

then probably you cant

west spoke
#

I dont think it can use reactions

split jungle
#

this line makes an error await client.clear_reactions(message);

west spoke
#

Technically a bot in a dm has the @everyone role with no perms except delete and edit their own messages

#

If you think about it

grizzled spruce
#

:-0

split jungle
#

damm it

#

my help menu doesnt work in DM -,-

west spoke
#

Make it send a separate one that checks if it's in a dm or not

#

And that's why I dont use reactions

#

=help -main
=h profile -profile help

#

Essentially structured like that

earnest phoenix
#

I think I found out why the reddit command might not be working

#

the code is a giant mess and it's just a big blob of commands

grim narwhal
#

how do i can get messages own id which seding by "await channel.send" func.

#

for example, i will send 4 messages using by "await channel.send" func. and user react emoji 2nd message.

#

in this case, how i can do for bot recognized it ( just react only 2nd message. )

buoyant wagon
#

what language

grim narwhal
#

python.

static marsh
#

msg = await channel.send('hello')

#

are you talking about it?

grim narwhal
#

@static marsh Thank you. it's so simple 😃

static marsh
#

👌 😁

grim narwhal
#

i didn't see it's return type...haha..😜

robust acorn
#

Hello, I have a question. What exactly is allowed for discord bots. Is there a policy I can refer to? I know that it is not allowed to punish for not voting, but what other limitations are there? Am I allowed to deny service to anyone? or only if they abuse bot/cheat? I know that some bots deny service for muting their bot etc. I just did not want to violate a policy. For a reply, please ping me! Thank you!

buoyant wagon
#

@robust acorn well you cant change activity more than 5 times a minute

robust acorn
#

what does that mean?

#

I thought it was 5 messages per 4 sec limitations

#

but in terms of blacklisting, what is okay?

buoyant wagon
#

such as @gilded plank is "Watching Discord Bots" that is activity
intervals between editing a message has some limit idk

robust acorn
#

oh

#

so can I blacklist anyone?

#

what if they find a cheat?

buoyant wagon
#

then they find it

stray wasp
#

You are allowed to blacklist anyone after all it's your bot.

errant ocean
#

When you search for client.token on github and you find a page full of results

#

Smh

stray wasp
#

Are you saying you can see all their tokens?

errant ocean
#

Yup

#

Lmao

#

This was a while ago

viral spade
#

how do people make multistep forms in bots? i mean how is it done best to keep track of what question the user has answered to?

Do i create something like a global open_dialogues, as soon as some user start the form, and then always check for each message everywhere if its part of a dialogue. This seems bad somehow.

earnest phoenix
#

wat

#

you mean paginators?

viral spade
#

I mean a user starts a multipart form. get asked one question after the other and has to answer one question after thje other

earnest phoenix
#

that's not a form :what:

earnest phoenix
#

oh you mean web

viral spade
#

so i mean this concept in a bot

mossy vine
#

how do people make multistep forms in bots?

earnest phoenix
#

forms don't even exist in chat

viral spade
#

ok. i understand form as a more general think as you do

earnest phoenix
#

wat

viral spade
#

A form is not 2 white boxes with username and password only on webpages.
A form is something that allows a user to enter data that is sent to a server for processing.

earnest phoenix
#

and there is no such thing on discord

viral spade
#

you do it everytime you send a message

earnest phoenix
#

api side

#

i meant

#

you can't have in-message forms

viral spade
#

bro u really dont understand what i want by now?

earnest phoenix
#

no, you're being vague

viral spade
#

Ok assume two people want to setup their account for my bot. For this they have to write "ar!setup". Then the bot will start the setup process for the user. It then "allows a user to enter data that is sent to a server for processing." But it first asks the first question, then the user answeres the first question. After successfull answer of the first question, the bot should ask the second question, and the user answeres the second question. Then the bot asks the third question. do you get it?

earnest phoenix
#

a listener

#

not a form

viral spade
#

User: ar!setup
Bot: What is your xyz?
User: blablabla
Bot: What do you want to be your whatever?
User: This and that
Bot: To finalize please blabla
User: dumdum
Bot: Everything saved. Setup done. Thnaks

earnest phoenix
#

listen to user responses -> filter out any message that's not by x user -> time out if there's no response, otherwise repeat

viral spade
#

But how do i internally keep track of how far the user is?
Do i create something like a global open_dialogues, as soon as some user start the form, and then always check for each message everywhere if its part of a dialogue.

earnest phoenix
#

which library are you using

viral spade
#

nodejs

earnest phoenix
#

library

viral spade
#

discordjs

earnest phoenix
viral spade
#

Ok nice. So as soon as someone starts the setup, i start a message collector and add it so some global array? This messagecollector listens to that channel only, and the filter assueres that only messages of that user are processed.
Now after the setup command, the bot send the first question and a messagecollectior is created. When the user answeres it will pass the collector's filter (by userid) and i can process that message. correct?

earnest phoenix
#

yes

#

the collector has a collect event which you can use to interact with the message at the time of reply

viral spade
#

ok nice, but this i could have also achieved by simply saving userid,channelid on setupstart, and then filter on every message for those values, right? (Using collectors only reduces workload?)

How can i know in which step the user is within a started dialogue/collector? How do i implement these steps mechanics (moving to next question if first answer is valid, fallback to the last question on false answer, resolving it at the end if everything is correct, remove the dialogue if the user doesnt respond for some time, etc.) ?

Also, it should be assuered that two useres can make their setup process partly simultaniously in the same channel.

earnest phoenix
#
    throw err; // Unhandled 'error' event
    ^

Error [ERR_UNHANDLED_ERROR]: Unhandled error. (ErrorEvent {
  target:
   WebSocket {
     _events:
      [Object: null prototype] {
        message: [Function],
        open: [Function],
        error: [Function],
        close: [Function] },
     _eventsCount: 4,
     _maxListeners: undefined,
     readyState: 2,
     protocol: '',
     _binaryType: 'nodebuffer',
     _closeFrameReceived: false,
     _closeFrameSent: false,
     _closeMessage: '',
     _closeTimer: null,
     _closeCode: 1006,
     _extensions: {},
     _receiver: null,
     _sender: null,
     _socket: null,
     _isServer: false,
     _redirects: 0,
     url: 'wss://gateway.discord.gg/?v=6&encoding=json',
     _req: null },
  type: 'error',
#

My bot crashed and gave me his

#

where are you hosting the bot

#

I had done it on my phone just this morning but its done several times that I lit it for a long time on my phone and it never gave me this error

#

get a proper vps

#

I can't find

#

that's probably the root of the problem

#

i do this

#

Hi,

What you can do is a simple change in node_modules/discord.js/src/client/websocket/WebSocketConnection.js

Line 364, change the whole function onError(err) to:

onError(error) {
    if (error && error.message === 'uWs client connection error') {
      this.reconnect();
      return;
    }

    this.reconnect();
    return;
  }

Which will force a connection instead of crashing on that error.

#

and its stopped from crash

#

that's not, i-

amber fractal
#

Uh

#

Lmao

#

You know they crash for a reason right?

#

If it keeps reconnecting they will just reset your token

sinful lotus
#

you handle the error

#

then make it r econnect ther own

sage bobcat
#

One message removed from a suspended account.

vague chasm
#

hey

sage bobcat
#

One message removed from a suspended account.

vague chasm
#

how can I get info in a js file from a html file's <input> userinput?

#

because I cannot use require() in <script> and I need to

mossy vine
#

why would you need require for getting the value of an input field?

#
document.getElementById('inputid').value```
vague chasm
#

no..

#

I mean

#

I want that .value in a js file

mossy vine
#

you want to write that to a js file or what

vague chasm
#

I will tell what I want to do.

#

I need the user to put their server ID in a <input> then I need to store that info in a variable in my main js file to lookup server and give back server info

mossy vine
#
let userinput = document.getElementById('inputid').value
console.log(userinput) // whatever the value of the input field is```
#

you dont need to store that

vague chasm
#

I need something like index.js.variables.serverID = userinput

#
let webclient = require('./webclient.js').server
const serverID = '';

await webclient() 
.then(document => { 
serverID = document.getElementById("userinput")
})``` is this ok?  @mossy vine
mossy vine
#

Assuming its regular html + js, no

#

As you said yourself, you cant use require() in browser js

vague chasm
#

That code will be in my main file

mossy vine
#

Which you are running on your server, so document wont be valid

vague chasm
#

I am still hosting my site along with my bot app because pm2 won't work with auto-restart

#

It needs sudo perms

#

And my host doesn't give them

mossy vine
#
  1. Buy a vps, assuming you are using a free host
  2. Look up guides on how to safely send data between server and client
earnest phoenix
#

get a host that's not glitch or heroku then

vague chasm
#

Oof k

#

I was here to just know how to transfer info from html file to js file

mossy vine
#

And i told you how

vague chasm
#

Whether I implement it in my code or not

mossy vine
#

But that isnt what youre looking for

vague chasm
#

I was curious

earnest phoenix
#

you probably shouldnt mix and match frontend and backend code

#

especially not backend code into frontend

mossy vine
#

Despite your original question asking exactly what i asked

#

^^^^^^

slow elk
#

This might be a simple question for certain people. I've been using a MessageCollector for my discord.js bot. It collects a message, inserts it into a database and then goes on to the MessageCollector.next property. However, when it gets to that property, it will stop the collector and only 1 value is inserted into the database. I dont know what I'm doing wrong. I know the issue lays with the MessageCollector, as it doesn't show a error in any syntax.

#

Please tag me when someone replies. I have the server muted and I'm on my way to a appointment.

scarlet phoenix
#

Idk discord.js so I may be reading what that means wrong, but if you are storing messages from users in a persistent db, I hope that you have a privacy policy stating that, or some other way to make that clear. The database should also be encrypted, if not that breaks TOS.

fiery stream
#

-help

pliant gorgeBOT
#

Hello </Jazz>!
Need help? Get more help and information here: https://discord.gg/pFPrbyq

Some FAQ:

+ Does this bot/website have a bump function?
No, Discord Server List does not support any bumping functions.
``````diff
+ My image|member count|emojis|name wont update?
Try updating your server on the website.

Go here (https://discordbots.org/servers/264445053596991498/edit) to edit Discord Bot List.
This bot does not have any other commands yet!

slow elk
#

I can assure you, I'm not storing messages themselves. This is for a project that I'm part of. I can also happily say that no ToS will ever be broken.

#

The user executes a command and that starts a process that adds the values from that user to the database.

earnest phoenix
#

how would i create a webhook in js?
i looked at docs and they aren't super helpful

opaque eagle
#

What library

earnest phoenix
#

discord.js?

mossy vine
earnest phoenix
#

it seems like you need an already made webhook

opaque eagle
#

Look at the second link

earnest phoenix
#

how else would you get the token and id

mossy vine
#

of course you do

#

you create it in your server

opaque eagle
mossy vine
#

alternatively, that ^

earnest phoenix
#

ohhhhh alright

#

ok so i was doing it right originally

#

nice

#

ty

scarlet phoenix
#

@slow elk Sorry, Im not familiar with discord.js, but messageCollector sounded like user messages, sorry for the confusion.

slow elk
#

It's fine.

#

@scarlet phoenix
A MessageCollector is a temporary collector of messages in a channel. They're usually used for voting systems. There's also a sister of the MessageCollector, which is the ReactionCollector, which is usually used for menus with multiple pages on, for example, a music queue.

mossy vine
#

or you can be like me and completely disregard those collectors and build your own

slow elk
#

Hmmm

#

I would prefer the MessageCollector, but how did you build your own?

mossy vine
#

its not really public, but i can send you the code if you want

slow elk
#

Please do. I'll be able to study it and, with credit, edit it in my own little way.

earnest phoenix
#

Hi i nned help with discord.js bot script

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

  var con = mysql.createConnection({
    host: "localhost",
    user: "****",
    password: "*********",
    database: "******"
  });
  con.query("SELECT user FROM Staff", function (err, result, fields) {
    const users = JSON.stringify(result)
    console.log(JSON.stringify(result))


    let userr = message.guild.member(message.mentions.users.first()) || message.guild.members.get(args[0]);

      if(!message.author === (`${users}`)) {
        if (err) throw err;
        console.log(err);
      if (!userr) return message.channel.send("Usage: -givepremium <server id>")

CODE

  } else {

    message.channel.send(`Sorry but you are not staff!`);
  }
  })
}

Error:
I got Sorry but you are not staff! as reply but i am added in db

strange escarp
#

The indentation makes the code hard to read

#

But I can see the error

earnest phoenix
#

you can't compare an object to a collection

strange escarp
#

Author is an object, not a string.

#

Wait, a collection you say?

earnest phoenix
#

nevermind i see what they're doing

#

putting the collection into a string

#

thinking it joins it

#

@strange escarp or @earnest phoenix

#

You mean i did wrong some its not db error or some

#

it's not a database error, it's a user error

#

you mean collecting my id or users?

strange escarp
#

Checking if the user is the author

#

Author is an object in discord.js

#

Depending on what you have stored in your database, it's going to require a certain type of value from the author object.

#

Probably the ID

earnest phoenix
#

id

#

yes

strange escarp
#

Also what's the value of users returned by the database?

#

Is it a list?

earnest phoenix
#

will check

ruby dust
#

question for canary users, when you copy the message url it's then canary.discordapp.com for you, but is this also the case for webhook urls?

strange escarp
#

I think so?

#

I haven't used Canary in a while

earnest phoenix
#

@strange escarp its varchar

strange escarp
#

But you're parsing it as JSON

#

So it's obviously a JSON object right?

earnest phoenix
#

yes

strange escarp
#

What does the object look like?

earnest phoenix
#
[{"id":1,"user":"572527691949932556","type":1,"date":1556908550,"administrator":"572527691949932556"},{"id":2,"user":"559041831569063936","type":1,"date":1556908550,"administrator":"572527691949932556"},{"id":3,"user":"572527691949932556","type":1,"date":1556908550,"administrator":"572527691949932556"}]
#

that is the output i think you mean this

strange escarp
#

Okay

#

So user and administrator look like snowflakes

#

Which one are you checking?

earnest phoenix
#

user

strange escarp
#

Okay

#

This should be interesting

#
function checkUsers(users, id) {
    for(const user : users) {
        if(user.user == id) {
            return true;
        }
    }
    return false;
}
#

Then your if statement can be: ```Javascript
if(checkUsers(users, message.author.id)) {

#

It's not a pretty solution, but it's a working one.

earnest phoenix
#

wait 1 code where should i paste it

#

under connection or nope

strange escarp
#

Why are you pasting code?

earnest phoenix
#

idk i mean like where should i write/paste it

strange escarp
#

Replace your current if statement with the one I wrote

#

As for the function, put it somewhere outside of the function you currently have.

earnest phoenix
#

okay

ruby dust
#

I need to know for sure, does anyone with canary know the actual answer?

earnest phoenix
#

webhooks are part of the api, not the client

#

if you look at their url, they have the /api endpoint

#

meaning no

ruby dust
#

well I had to ask, cause of the canary message urls and stuff

earnest phoenix
#

message urls are still part of the client

ruby dust
#

mk then

ancient prawn
#

guys help when i try to start my bot this message comes

#

i dont understand anything it says

earnest phoenix
#

go recheck your commands and validate that all groups are lowercase, as the error states

ancient prawn
ruby dust
#

for the first time someone finally blurs out the token

#

👏

ancient prawn
#

yeah xd

#

i dont want my HAVOC to be controlled

#

i litterly have tried EVERYTHING there is but i can't get it to work

ruby dust
#

btw, I was installing the requests module, and is now stuck at this for over 10 minutes now thonkku

ancient prawn
sage bobcat
#

One message removed from a suspended account.