#development

1 messages · Page 506 of 1

earnest phoenix
#
Debugger listening on ws://127.0.0.1:19218/1bf66a6b-7ac4-4b78-8ba7-51bcfdbc7fe7

superagent: Enable experimental feature http2
(node:5928) ExperimentalWarning: The http2 module is an experimental API.
Ready!
TypeError: Cannot read property 'url' of undefined
    at Client.client.on (c:\Users\darkr\Desktop\Fairy Bot\index.js:99:17)
    at emitOne (events.js:116:13)
    at Client.emit (events.js:211:7)
    at MessageCreateHandler.handle (c:\Users\darkr\Desktop\Fairy Bot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (c:\Users\darkr\Desktop\Fairy Bot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
    at WebSocketConnection.onPacket (c:\Users\darkr\Desktop\Fairy Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (c:\Users\darkr\Desktop\Fairy Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
    at WebSocket.onMessage (c:\Users\darkr\Desktop\Fairy Bot\node_modules\ws\lib\event-target.js:120:16)
    at emitOne (events.js:116:13)
    at WebSocket.emit (events.js:211:7)
topaz fjord
#

like I said

#

.get returns a promise

earnest phoenix
#

:/

topaz fjord
#

so you either have to use await or .then

earnest phoenix
#

ok i try

#

oh

#
Debugger listening on ws://127.0.0.1:17040/e2d1af03-afd6-44f8-b83d-39b89659fec1

superagent: Enable experimental feature http2
(node:6912) ExperimentalWarning: The http2 module is an experimental API.
Ready!
TypeError: superagent.then is not a function
    at Client.client.on (c:\Users\darkr\Desktop\Fairy Bot\index.js:94:26)
    at emitOne (events.js:116:13)
    at Client.emit (events.js:211:7)
    at MessageCreateHandler.handle (c:\Users\darkr\Desktop\Fairy Bot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (c:\Users\darkr\Desktop\Fairy Bot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
    at WebSocketConnection.onPacket (c:\Users\darkr\Desktop\Fairy Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (c:\Users\darkr\Desktop\Fairy Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
    at WebSocket.onMessage (c:\Users\darkr\Desktop\Fairy Bot\node_modules\ws\lib\event-target.js:120:16)
    at emitOne (events.js:116:13)
    at WebSocket.emit (events.js:211:7)
topaz fjord
#

thats not what i mean

#

🤦

earnest phoenix
#

:/

#

idk anything about superagent

topaz fjord
#
superagent.get('...').then(body=> {
    body.url  //use url for anything you want
})```
earnest phoenix
#
Debugger listening on ws://127.0.0.1:39482/96239432-e8a5-48aa-baf6-afc842f5c1f9

superagent: Enable experimental feature http2
(node:16976) ExperimentalWarning: The http2 module is an experimental API.
Ready!
TypeError: Cannot read property 'url' of undefined
    at Client.client.on (c:\Users\darkr\Desktop\Fairy Bot\index.js:101:17)
    at emitOne (events.js:116:13)
    at Client.emit (events.js:211:7)
    at MessageCreateHandler.handle (c:\Users\darkr\Desktop\Fairy Bot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (c:\Users\darkr\Desktop\Fairy Bot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
    at WebSocketConnection.onPacket (c:\Users\darkr\Desktop\Fairy Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (c:\Users\darkr\Desktop\Fairy Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
    at WebSocket.onMessage (c:\Users\darkr\Desktop\Fairy Bot\node_modules\ws\lib\event-target.js:120:16)
    at emitOne (events.js:116:13)
    at WebSocket.emit (events.js:211:7)
earnest phoenix
#

make your command an async function

#

await it

#

add try/catch

#

use node-fetch

#

and then it will work

#

can you make the code for me plz im tired

topaz fjord
#

here is how async works

#
async function ducc() {
    const { body } = await superagent.get('...'); //without async this would complain `await is only valid in async function`
    body.url //use this shit for whatever
}
earnest phoenix
#

k

topaz fjord
#

then how about you try const thing = await superagent.get('...'); and log thing to see if it's undefined or not

#

basic debugging

earnest phoenix
#

i try ?

topaz fjord
#

yes

earnest phoenix
#

k

#

why

#

a

#

cons

#

const

#

and not a let

#

🤔

#

nvm

#
Debugger listening on ws://127.0.0.1:35079/f31793cb-ca9e-4376-b9cc-7d02728e8686

Debugger attached.

c:\Users\darkr\Desktop\Fairy Bot\index.js:94

    const {body} = await superagent.get('https://nekos.life/api/v2/img/meow');

                   ^^^^^



SyntaxError: await is only valid in async function

    at createScript (vm.js:80:10)

    at Object.runInThisContext (vm.js:139:10)

    at Module._compile (module.js:616:28)

    at Object.Module._extensions..js (module.js:663:10)

    at Module.load (module.js:565:32)

    at tryModuleLoad (module.js:505:12)

    at Function.Module._load (module.js:497:3)

    at Function.Module.runMain (module.js:693:10)

    at startup (bootstrap_node.js:191:16)

    at bootstrap_node.js:612:3

Waiting for the debugger to disconnect...

SyntaxError: await is only valid in async function
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3
#

your using await outside async

#

ik

#

@earnest phoenix

#

how to make this work :

#
if(message.content.startsWith(`${prefix}dog`)) {
    const {body} = await superagent.get('https://random.dog/woof.json');

    let dogembed = new Discord.RichEmbed()
    .setAuthor('Dog')
    .setColor('RANDOM')
    .setImage(body.url)

    message.channel.send(dogembed)
    message.delete()
}```
#

put it in an async function

#

duh

#

can you repair the code for me plz im tired

#

bruh

#

all you need to do is add async to the beginning of your function

#

💤

#

🤔

#

plz 💤

#

what do you want me to do

#

i dont get it

#

i told you how use it

#

does he want help or not?

#

probs not

#

looks like

#

uh wtf

#

yes i want help but ima tired

#

but want finish today

#

i told where to put it

topaz fjord
#

just because your tired doesn't mean we're gonna spoonfeed you code

earnest phoenix
#

in the beginning of the function

#

also even if wanted to do it for you

#

i couldn't with the code you gave me

#
async function ducc() {
    const { body } = await superagent.get('...'); //without async this would complain `await is only valid in async function`
    body.url //use this shit for whatever
}```
#

like that?

#

yes

#

not work

#

<client>on("message", ---> ***async*** <--- message {})

inner jewel
#

you should learn js before making a bot

earnest phoenix
#

^

#

what am i talking about actually

#

just

#

do

#

like

#

that

#

ye

#

finally

#

work

#

but

#

1 problem

#

?

#

i say f!dog

#

im tired spoonfeed i dont understand what an async function is spoonfeed i dont try/catch spoonfeed

#

and its give me

#

4 dog meme

#

:/

#

i want only 1

#

and now 5

#

:/

#
client.on("message", async message => {

if(message.content.startsWith(`${prefix}cat`)) {
    const {body} = await superagent.get('https://nekos.life/api/v2/img/meow');


    let catembed = new Discord.RichEmbed()
    .setAuthor('Cat')
    .setColor('RANDOM')
    .setImage(body.url)

    message.channel.send(catembed)
    message.delete()
}

if(message.content.startsWith(`${prefix}dog`)) {
    const {body} = await superagent.get('https://random.dog/woof.json');

    let dogembed = new Discord.RichEmbed()
    .setAuthor('Dog')
    .setColor('RANDOM')
    .setImage(body.url)

    message.channel.send(dogembed)
    message.delete()
    }
})```
#

why do you have it in if statements

#

thats bad practice

#

uh

#

what

#

if else chain monkaS
no try catches around async await stuff monkaMega
getting help in dbl monkaOMEGA

#

spooky

inner jewel
#

not even if else chain

#

it's just an if chain

earnest phoenix
#

tru

#

so

#

it is just search for it in Google

#

...

#

i love how when i put the random dog pictures url, the first thing i got was a link to a mp4 file

topaz fjord
#

@earnest phoenix yes

earnest phoenix
#

so

#

what i have to do for don't have more than 1 gif per command ?

#

well that code is not good, but it shouldnt give more than 1 reponse per command

#

ur probably just running multiple instances

west raptor
#

kill all instances

#

then start 1

earnest phoenix
#

how

west raptor
#

does your bot have an eval command

earnest phoenix
#

do u have task manager

#

no

#

(for the eval command)

#

so

#
{"id":677649627,"name":"XNKXCKDBDLPM67817s","online":false,"parent":{"role":{"Name":"Criminal","Rank":2,"ID":19056012},"page":1,"rankIndex":0},"index":0},
{"id":676815749,"name":"ZYCCYTXDOOTN72724s","online":false,"parent":{"role":{"Name":"Criminal","Rank":2,"ID":19056012},"page":1,"rankIndex":0},"index":1},
{"id":675935392,"name":"MTEDCNRZBQYD38564s","online":false,"parent":{"role":{"Name":"Criminal","Rank":2,"ID":19056012},"page":1,"rankIndex":0},"index":2},
{"id":677312765,"name":"MHOMBYLMQZNA5634s","online":false,"parent":{"role":{"Name":"Criminal","Rank":2,"ID":19056012},"page":1,"rankIndex":0},"index":3},
{"id":672058939,"name":"PKXCENBUZZYG48740s","online":false,"parent":{"role":{"Name":"Criminal","Rank":2,"ID":19056012},"page":1,"rankIndex":0},"index":4},
{"id":674156849,"name":"EEZMSBCHJOWY40280s","online":false,"parent":{"role":{"Name":"Criminal","Rank":2,"ID":19056012},"page":1,"rankIndex":0},"index":5}
]```
#

I have this:

#

let json = fs.readFileSync('players.json');  
let players = JSON.parse(json);  
console.log(players["id"]);  ```
#

How can I get it so that i get the info from one person at a time.

inner jewel
#

that's not how json works

earnest phoenix
#

What do you mean?

inner jewel
#

arrays won't have an "id" property

earnest phoenix
#

not simply require()'ing jsion blobsweat

inner jewel
#

require caches

#

also @earnest phoenix you shouldn't save data in json files

#

that's easily corrupted

earnest phoenix
#

ah the classic sync file reading

#

Dude, I get it. That is not my doing.

#

what is nodejs?

#

Well, how can I get it?

#

well its an array

#

...

#

so like you would an array

inner jewel
#

iterate over the entries and check the id property of each one

earnest phoenix
#

I have no idea how to do that.

topaz fjord
#

for loop mmLol

earnest phoenix
#

sigh

inner jewel
#

then you should learn js

topaz fjord
#

we need the check marks

earnest phoenix
#

lmao

#

readfilesync tickYes what is array tickYes not my fault tickYes

topaz fjord
#

there it is

earnest phoenix
#

nah but just use a db to store that stuff

topaz fjord
#

use yaml

earnest phoenix
#

then u can actuqlly query it

topaz fjord
earnest phoenix
#

and sort it

#

sigh

#

again, not my choice

quartz kindle
#

array = []
object = {}

earnest phoenix
#

arrays are objects

quartz kindle
#

array = numerically indexed, each entry has an auto-incremented index number
object = indexed by keys, a key can be a string, number, etc...

topaz fjord
#
{
    []: []
}
#

yes

quartz kindle
#

your file is an array with objects inside it: [{},{},{}]

#

so each object can only be accessed through its array index position, example: array[1] (gets item in position 1)

earnest phoenix
#

e!botinfo

west raptor
rapid citrus
#

guys please help me, I already deleted this repo for the fifth time and I can still visit it. please try visiting this guys I am not advertising or promoting this is a serious problem.
https://github.com/xamantra/rikimaru

#

When I push commits to that repo the cli says it was ok.

#

but github website is not showing the correct latest commit.

#

so I decide to delete and create a new repo.

#

but now I can't delete it and I can't seriously create a new.

#

Just tell me guys if you can still browse the source code for that repo

night imp
#

we can browse it

#

@rapid citrus

rapid citrus
#

and the repo is still there.

#

btw, that was the 6th attempt.

#

I can't also create a new repo.

#

I don't have a repo named: rikimaru-bot

#

but I can't create it, the same goes for anything.

#

I created a new repo named: rikimaru-discord

#

the repo appears on the website and gone after refreshing.

#

I now hate github

bright spear
topaz fjord
#

github died

rapid citrus
#

github? what is that? is that edible?

bright spear
#

...

rapid citrus
#

I don't know what is that.

topaz fjord
#

give github some time

rapid citrus
topaz fjord
#

they survived a massive ddos

#

smh why are you so impatient

rapid citrus
#

I don't know what you are saying.

topaz fjord
#

github has been through a lot. Like they ddos that peaked at 1.2 Tbits a seconds

#

how do you not know what github is

#

yet you use it

rapid citrus
#

The moment a software show a weakness, I'll stop using it, It doesn't deserve my attention.

topaz fjord
#

lmfao

#

than you should've stopped using discord long ago

#

discord kills gcp about twice a month

#

I wonder why you haven't stopped using it

#

clearly that statement is wrong

#

and also every piece of software will go through issues

rapid citrus
#

I'm in love with gitlab now.

topaz fjord
#

@earnest phoenix well

#

I guess my statement stands

#

When gitlab shows weakness you're 100% gonna go back to github and say the same thing

#

Pretty shitty thing to live by because soon you will run out of things to go to

rapid citrus
#

I've got bitbucket

#

sourceforge.

topaz fjord
#

after that

#

you will soon run out

bright spear
#

@rapid citrus no software is perfect

#

everything goes down and has bugs

topaz fjord
#

I'm still wondering

#

why haven't you left discord

rapid citrus
#

but not to the point that it slowsdown my life.

bright spear
#

lol

topaz fjord
#

it fails a couple times a month

#

yet you still stay

rapid citrus
#

when was it

#

?

topaz fjord
#

oh wait you haven't been on discord long enough

rapid citrus
#

I'm new to discord

#

lucky me.

topaz fjord
#

It'll fail

#

you will leave

rapid citrus
#

yeah.

topaz fjord
#

red means severe

bright spear
#

yeah discord likes to die

#

sometimes its cuz gcp breaks

topaz fjord
#

gcp doesn't break on its on

#

discord makes it break

bright spear
#

lol

zealous veldt
#

Anyone here by any chance know how and where the license key for a Studio 3T purchase is delivered? I can't find mine and don't remember how they sent it to me. Ping me if you know please

Edit
I found it 😃 it was an email

night imp
#

Jesus Christ 199/Mon?!?

#

What do you use it for?

zealous veldt
#

@night imp Talking to me?

night imp
#

yeah

zealous veldt
#

It's a mongo browser

night imp
#

They advertise it for so much though, isn't there other options?

zealous veldt
#

I got it for free

#

lol

#

student discount

night imp
#

OHHH

zealous veldt
#

It's far better than mongo compass

night imp
#

ok lmao I thought you were paying 200/Mon for it

zealous veldt
#

yeah no lol

#

it's like reqlpro on meth, and for mongo

glacial kestrel
#

👀

visual surge
#

So I'm looking for some ideas on changes to my existing swear filter.
So right now it removes all spaces, lowercases, changes characters like $ and 5 to S, 0 to O, etc. and then checks for swearing.
The issue with that is "ass".
Okay, assassin. Well, that gets blocked since it doesn't check every word individually for an exact match, it just looks in a long string of letters

#

Without whitelisting words, is there any better way to do that?

coral trellis
#

Are you using match regex?

keen drift
#

Anyone have a solution to djs aggressive caching besides disabling? My ram usage is actually getting out of hand.

smoky spire
#

https://discord.js.org/#/docs/main/stable/typedef/ClientOptions you might be interested in messageCacheMaxSize, messageCacheLifetime, and messageSweepInterval

scenic galleon
#

anyone here use google clouds app engine feature for hosting their discord bot?
im thinking of moving over from the compute engine to reduce costs

keen drift
#

@smoky spire Yeah I'm doing sweep of messages

#

My main concern is the guild member collection size

#

5.4mil atm, ontop of 1mil of channels, 1mil of roles

#

and how many emojis there are

#

@scenic galleon Never, cost is actually insane, I would never need that unless I'm building serious business critical apps

scenic galleon
#

so ill stick with compute engine?

keen drift
#

Does your bot really need all that

scenic galleon
#

need all what

#

im hosting about 3 bots on the one server and was wondering if using the app engine would be cheaper in the long run

#

im currently using an f1 micro compute engine

keen drift
#

yeah no there are better hosts for budget

scenic galleon
#

any cheaper ones to reccomend

keen drift
#

namely ontop of my head

#

OVH, Hetzner

scenic galleon
#

will those be more reliable than google

keen drift
#

It's close, but not the level of redundancy as Google

scenic galleon
#

ill check out the pricing

keen drift
#

Google Clouds & Aws is designed to serve largely scalable applications

#

It's cheaper for large business, as they can shut down instances during minimal loads

#

and can be spun up again on demand

#

The need of instance groups, templates, sole tenant nodes, disks, images, tpus, metadata, zones

#

is so unnecessary for most discord bots

scenic galleon
#

yea

#

i only need a compute engine that i can ssh into

#

which is what i currently use google for

keen drift
#

yeah unnecessary cost

bright spear
#

App engine is probably cheaper than compute engine tho

#

Iirc there's a free version

keen drift
#

yeah free tier

#
28 frontend instance hours per day, 9 backend instance hours.
5 GB Cloud Storage
1 GB of egress per day
Shared memcache
1000 search operations per day, 10 MB search indexing
100 emails per day
#

for app

#
1 f1-micro instance per month (US regions only, excluding Northern Virginia)
30 GB-months HDD, 5 GB-months snapshot
1 GB network egress from North America to all region destinations per month (excluding China and Australia)
#

compute

visual surge
#

@coral trellis hurru
Yeah, I'm using regex matching to find it somewhere in the garble

coral trellis
#

Yeah sometimes it finds words that include it, Try reduce it to specific words

visual surge
#

So just checking each word without removing spaces

#

I really didn't want to do t h a t because of stuff like t h i s but I guess I don't have too much of a choice :p

coral trellis
#

That would be tedious but would work

visual surge
#

What do you mean?

coral trellis
#

Remove the spaces, I thought you meant something else.

visual surge
#

Ah ok

keen drift
#

actually getting nervous how long I can afford to sustain my bot

fluid basin
#

@tacit grail

#

¯_(ツ)_/¯

earnest phoenix
keen drift
#

i'm already taking Patreon

#

but i wonder if it can keep up

fluid basin
#

Also depends if you are paying extra for your host

keen drift
#

nah it's reasonable pricing

fluid basin
#

then I guess it should be fine

keen drift
#

might get a full machine soon

#

i'm at 32 shards atm

fluid basin
#

yeah a dedicated server will perform better in general

#

Mainly CPU gets more important when your bot grows

keen drift
#

mainly ram atm lmao

fluid basin
#

due to message and event handling

#

hmm then maybe its with your process memory usage

keen drift
#

yes

fluid basin
#

shouldn't be too high in most cases

#

unless you cache too much

keen drift
#

I'm caching 5.4mil users, 1.4mil channels, 1.2mil roles

fluid basin
#

hmm well probably

keen drift
#

doing interval database based message sweep

#

fun

#

this on top of supporting idiots

#

even better

fluid basin
#

yeah well can't help it

keen drift
#

i regret having a support server

fluid basin
#

I've seen bots which automatically leave tiny guilds and bot farms

#

to save resources

keen drift
#

eh

#

tiny guilds barely affects me

fluid basin
#

true, its mainly with those bot farms and big guilds

#

where you have events going on every second or so

keen drift
#

with like 100k+

fluid basin
#

yeah

#

the events that come in is just crazy

keen drift
#

cpu is more than capable of handling load, but members count is affecting cache more than I'd like

fluid basin
#

what library though

keen drift
#

djs

fluid basin
#

oof

#

no wonder

keen drift
#

yeah lots of cache

#

it's same in dgo

#

with dgo's state cache

#

cache is pretty unavoidable for performance

fluid basin
#

My 200 server bot went to 1.4gb ram in about a month

#

without restarts

#

and thats really bad

keen drift
#

3 months period

fluid basin
#

tbh just restart the bot frequently

#

Like a few shards at a time

keen drift
#

yeah I do restart them

fluid basin
#

if not caches can go crazy

#

cuz d.js

keen drift
#

eventually that'll become useless PepeRain

fluid basin
#

well I heard eris is better for bigger servers as it has better shard management

keen drift
#

little late now

fluid basin
#

true

#

a rewrite would take some time

keen drift
#

I'm staring those PR in djs right now

#

can't wait for v12

#

had my bot for 4 months now

#

and it took off on July

fluid basin
#

oof that growth rate though

keen drift
#

yeah not slowing down either

fluid basin
#

well I don't expect much from d.js performance wise

keen drift
#

i was expecting like max of 2k servers when I started this

fluid basin
#

Just maybe like improvements on like voice

keen drift
#

they have few PR pending for disabling stores, autofetch uncached data, & external caching

fluid basin
#

yeah those are important

#

Like I think by default d.js caches 200 messages per channel

keen drift
#

hm no idea, I don't have anything on default

#

and messages are sweeped every 10 minutes regardless

fluid basin
#

not really that sure how d.js caching work, but well 200 messages over time that just gets alot

#

main thing is that members and other things like guilds, roles, channels don't get removed

#

and discord requires you to cache them whenever you can

earnest phoenix
#
bot.on('roleUpdate', (oldRole, newRole, role) => {
    const log = role.guild.channels.find(x => x.name === "log")
      if (!log) return;
      let mdembed = new Discord.RichEmbed()
         .setTitle(`**__רול נערך__**`)
         .setAuthor(`עורך הרול: ${oldRole}`)
         .setColor('RANDOM')
          .setDescription(`**שם הרול לפני עריכה:**\n${oldRole}\n
                           **שם הרול אחרי עריכה:**\n${newRole}`)
         .setTimestamp();
       log.send(mdembed)
       })

guild not undefined

austere meadow
#

@earnest phoenix roleUpdate only takes two parameters, oldRole and newRole
you'll need to change it from role to old or newRole

languid dragon
#

NewRole is role tbh

earnest phoenix
#

Who can program a discord bot that gives me free Minecraft and Fortnite alts ???

lament meteor
#

i think thats agaisnt the tos

heady anvil
#

i think his avatar matches what he is saying

hardy sierra
#

guys

#

can someone help

#

how can i make a channel with permissions

shadow barn
#

.addField("Useful Links", "[https://discordapp.com](Website) / [https://discordapp.com](Website) / [https://discordapp.com](Website) / [https://discordapp.com](Website)")
What am i doing wrong?

#

lmao i just noticed

#

fuck i'm so dumb lol

naive condor
hardy sierra
naive condor
#

is not int?

#

hmm

#
message.guild.createChannel('name', 'text', [{
  deny: ['MANAGE_MESSAGES'],
  allow: ['SEND_MESSAGES']
}])
  .then(console.log)
  .catch(console.error)
hardy sierra
#

brb

rotund sierra
#

Ive got a problem.... Ive made a vulgarity filter and it works. the vulgarity filter has a toggle function as well. but the thing is that everytime i toggle the vulgarity filter, other servers get toggled as well.

#

is there a fix for this?

naive condor
#

dunno

rotund sierra
#

welp... :/

hardy sierra
naive condor
#

dunno

#

@hardy sierra wait you use discord.js

#

right?

hardy sierra
#

yes

naive condor
#

or anything else

#

then idk

rotund sierra
#

@naive condor what do you use?

naive condor
#

discord.js

rotund sierra
#

ah

#

:c

#

C# is a bitch

naive condor
#

oof

quartz kindle
#

show code EL

#

@rotund sierra you need a database to store server settings

naive condor
#

i use quick.db

rotund sierra
#

@quartz kindle is it possible to do it without a database or using .txt file?

#

The bot is for final year project and we didnt impliment database in time

hardy sierra
#

Tim

#

please

quartz kindle
#

@rotund sierra yes, you can use text files, but they are less safe, and prone to corruption. plus you're using C# right? i dont know which storage format is better supported, a json file or an xml file

#

you need a textual representation of something that resembles a database

#

then use server IDs as keys, and server settings as values

rotund sierra
#

I have no choice atm because demo is tmrw

#

ill try it out.

#

So two different txt files right?

quartz kindle
#

for example, a list of servers by ID, and each id is associated with a value that tells the function to be enabled or disabled

#

one file is enough, as long as it can contain keys and values

#

even an .ini file should work

#

then you need to make your function check for this value on all messages received

hardy sierra
#

TIM

#

i can dm the whole code

#

if you need

quartz kindle
#

no need

#

try this

#
<...>.createChannel('logs','text',[
    {allowed:"READ_MESSAGES"},
    {denied:"SEND_MESSAGES"}
])```
#

allow and deny are deprecated, and have been replaced by allowed and denied

hardy sierra
quartz kindle
#

ah i forgot the id

#

{allowed:"READ_MESSAGES",ROLE ID HERE}

#

you need to set which user or role should this permission be applied to

hardy sierra
#

how can i do @everyone

#

but no ids

#

fully automated

quartz kindle
#

i dont know, because the everyone role you can get with <guild>.defaultRole(), but in the docs its marked as "read only"

#

theorically it should be {allowed:"READ_MESSAGES",guild.defaultRole()}

#

but that probably wont work

hardy sierra
#

unexpected

#

.

quartz kindle
#

why unexpected .? did you copy and paste without editing the guild part?

#

lul

hardy sierra
#

dont worry about the last one

quartz kindle
#

anyway i found this piece of code, you could try const everyone = message.guild.roles.find("@" + "everyone"); // We seperate it that way if it's run in eval, it won't tag. channel.overwritePermissions(everyone, {"VIEW_CHANNEL": false});

#

and yeah, in your case, you have to either cache guild or get it again from the message

#

so newMessage.guild.defaultRole()

#

anyway i g2g

hardy sierra
#

i dunno where 2 put

#

the channel.overwritePermissions

#

;-;

#

can anyone help me?

#

i will dm whole code

stable tide
#

Yes @hardy sierra

#

What u actually wanna do?

hardy sierra
#

logs

stable tide
#

await channel , then do channel.overwritepermissions

#

Wait that code seems good! Whats the problem? @hardy sierra

hardy sierra
#

brb wait

earnest phoenix
#

I changed my BOT logo

#

@gilded plank

#

<@&304313580025544704>

loud salmon
#

why would you ping all mods

#

also luca isnt a real person

earnest phoenix
#

m-bot

#

I am a Türk

#

I can't Speak English

loud grail
frank rapids
#

why send 2 msg?

quiet bobcat
#

2 instances running possibly?

frank rapids
#

i don´t know

#

and don´t show error in terminal

quiet bobcat
#

try with another command?

frank rapids
#

thanks

#

is this

#

stable tide
#

@frank rapids which editor do u ise

#

Use*

frank rapids
#

Brackets

#

with 1 theme

hardy sierra
#
   if(newMessage.guild.channels.exists('name', "logs")) {
   if(newMessage.content != "efdmkeeosmaoweeunre")
       var channel = bot.guilds.get(newMessage.guild.id)
       .channels.find("name", "logs");
  channel.sendMessage("✏️ " + newMessage.author.tag + " Edited a message " + "`" + oldMessage.content + "`" + " ➡️ " + "`" + newMessage.content + "`");
   } else {
       newMessage.guild.createChannel('logs', 'text', [
  { id: newMessage.guild.id, deny: ["SEND_MESSAGES"], allow: ["READ_MESSAGES"] } 
])
  .then(console.log)
  .catch(console.error);
   }
});```
#

somethings wrong

stable tide
#

Check DM's

frank rapids
#

@hardy sierra is javaScript?

stable tide
#

Yep

frank rapids
#

words is string and numbers is ints

#

123456.. = int

#

abcde... = String

stable tide
#

Yep

frank rapids
#

understood?

#

then change int to string

#

@stable tide your code is for chat off?

hardy sierra
#

hows that possible

#

make [READ_MESSAGES] a string

#

im not asking for spoonfeeding

#

but its just hard

#

for me

#

ohhh

#

how can i convert string to int

earnest phoenix
#

In what language?

topaz fjord
#

parseInt

lofty hamlet
#

How to make a voting order?

barren brook
#

My discord.js package on glitch.com is not working what can I do?

topaz fjord
#

that is very vague

quartz kindle
#

@hardy sierra you're doing it wrong

#

discord.js internally converts "SEND_MESSAGE" to an int representing the permission number

#

but you're not doing "SEND_MESSAGE", you're doing ["SEND_MESSAGE"]

#

you're trying to send an array

#

which causes the internal conversion to fail

#

also, as i said before allow and deny are deprecated

#

use allowed and denied

earnest phoenix
#

does args need to defined in all commands, or just the commands that are using it like args.join(' ') because im cleaning my bot, and i dont want un needed pieces of code

quartz kindle
#

technically, if you're not using it, you dont need to define it

#

but be careful because it also depends on your code structure

#

for example if you're passing variables to a function like function(message,args,client), and you remove args, client will replace it, and will possibly assign the wrong things to the wrong variables

earnest phoenix
#

ok thanks

quartz kindle
#

@barren brook what do you mean "its not working"

barren brook
#

My discord.js package on glitch.com is not working what can I do?

#

It won’t find it

#

In bot.js

quartz kindle
#

what error

barren brook
#

const Discord = require(‘discord.js’)

#

Just won’t work so making an error for no reason.

quartz kindle
#

show the error...

barren brook
#

That’s the error

quartz kindle
#

thats not an error...

barren brook
#

Like I go to console to see the error and I jump to it and

#

There’s no error it’s just not finding it

quartz kindle
#

show the console

barren brook
#

Ok

#

Error: Cannot find module 'discord.js'
3:11 PM
at Function.Module._resolveFilename (module.js:548:15)
3:11 PM
at Function.Module._load (module.js:475:25)
3:11 PM
at Module.require (module.js:597:17)
3:11 PM
at require (internal/module.js:11:18)
3:11 PM
Jump to
at Object.<anonymous> (/app/server.js:1:79)
3:11 PM
at Module._compile (module.js:653:30)
3:11 PM
at Object.Module._extensions..js (module.js:664:10)
3:11 PM
at Module.load (module.js:566:32)

quartz kindle
#

did you install discord?

topaz fjord
#

you need to install discord.js

barren brook
#

I did

quartz kindle
#

npm install discord.js

topaz fjord
#

npm i discord.js?

barren brook
#

Yh

topaz fjord
#

fucking hell tim

quartz kindle
#

lmao

#

did you install it in the same folder as your bot?

barren brook
#

I put it in package.json and put const Discord (‘discord.js’) in bot.js

quartz kindle
#

just putting it in package.json is not installing

#

you have to run the install command

#

in the bots folder

barren brook
#

Ok

#

But I’m on iPad.

#

"discord.js": "^11.4.2", is what is in the package.json

quartz kindle
#

it doesnt matter what is in the package

#

when you run npm install discord.js your package.json will be replaced with the installed version

barren brook
#

In the console?

quartz kindle
#

yes

barren brook
#

I can’t type in it I’m on iPad

earnest phoenix
#

Then don't use an iPad? Lol

loud salmon
#

heydo you know how to make a constructor in java use multiple parameters, but with only one that is written in the code?

#

i forgot what it was exactly

#

but it was like java public class(Object obj..){ //iterate through the objects given as parameters }

#

something that involved periods

topaz fjord
#

google™

earnest phoenix
#

why tf has dis error appeared from nowhere

    cmd.run(client, message, args);
        ^

TypeError: cmd.run is not a function
topaz fjord
#

cmd doesnt have .run()

loud salmon
#

you cant search for periods in google @topaz fjord

topaz fjord
#

yes u can

loud salmon
#

and when i search periods with constructors it gives me some other stuff

topaz fjord
#

wait doesn't ... destruct

#

or is that only in js

loud salmon
#

probably in js

earnest phoenix
#

error

    cmd.run(client, message, args);
        ^

TypeError: cmd.run is not a function

cmd is defined like this

    var args = message.content.slice(config.prefix.length).trim().split(/ +/g);
    const command = args.shift().toLowerCase();
    const cmd = client.commands.get(command);
    if (!cmd) return;

    cmd.run(client, message, args);

stoopid thing
this has worked for ages, why stop working now?

loud salmon
#

but anyway, googling ... in method constructor gives me the same results as in method constructor

#

google ignores special characters when searching

earnest phoenix
#

so, no help...

gilded blaze
#

@loud salmon Object... obj

loud salmon
#

oh thank you

earnest phoenix
#

You were told the issue, @earnest phoenix

#

The module in question does not have a run method

#

but it has always worked

#

The module in question does not have a run method

topaz fjord
#

did you add a new command

earnest phoenix
#

but always worked

#

yes, a giveaway command

topaz fjord
#

and forget to put run in it

earnest phoenix
#

"The module in question does not have a run method."

#

ehm

#

Y'know, an easy way to find out which module it is would be to log cmd

#

when i log it, the bot cant even start

quartz kindle
#

@loud salmon you can also google for "ellipsis"

loud salmon
#

oof

#

thank you

worldly obsidian
#

d

west raptor
#

@callumok2004#8093 code in ur new cmd

#

Fuck

#

@earnest phoenix

earnest phoenix
#

ye, i fixed it, but it dont work like it shud

west raptor
#

Ok so first

#

Please learn Javascript

#

Second those if statements are wrong

earnest phoenix
#

how

#

I agree with Jonny

#

You don't really understand JavaScript, and you need to learn a bit more before jumping into this

west raptor
#

^

topaz fjord
#
if(footer) args[0] != ("``");
#

I wonder where you went wrong

earnest phoenix
#

Us telling you how to fix this isn't going to help you in the long end

#

You need to really understand why it's wrong

topaz fjord
#

first what the fuck is that if statement

#

two I agree with ITexlo

languid dragon
#

@topaz fjord If you're not going to help or provide any solid support, heck off nerd

#

No need to be rude

topaz fjord
#

@languid dragon am not nerd

#

am kool boye

earnest phoenix
#

let json = fs.readFileSync('players.json');  
let players = JSON.parse(json);  
players.forEach(function(value){
    let name = players.map(p => p.name);
    console.log(`${name}`)
});```

Why does that log each name with a "," between them?
inner jewel
#

because that's what printing an array does

earnest phoenix
#

Can I remove it some how?

#

Such as a trim?

knotty steeple
#

you dont have to trim it

#

just join

earnest phoenix
#

Thanks.

knotty steeple
#

what does --save-dev do when you are installing an node package

earnest phoenix
#

--save-dev is used to save the package for development purpose

#

Just use --save unless making a package.

heady zinc
#

^, --save-dev will save the package under the devDependencies field in your package file, the packages under this field won't be installed if you run npm install with the --production flag

night imp
#

@regal pilot so what you need to do is

#

have a database

#

With the guild id key and role id value

#

And when someone joins the server

#

Check the database for the role

#

And add the user

regal pilot
#

Thanks

knotty steeple
#
F:\Bots\Javascript\Cake V2\cake.js:6
cake.loadCommands()
     ^

TypeError: cake.loadCommands is not a function
    at Object.<anonymous> (F:\Bots\Javascript\Cake V2\cake.js:6:6)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Function.Module.runMain (module.js:665:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
``` why am i getting this error
#

posting code wait

#
const Eris = require("eris")
const fs = require("fs")
const loggr = new (require("cat-loggr"))()

class CakeClient extends Eris {
    constructor(token, options) {
        super(token, options)

        this.config = require("../config.json")
        this.botinfo = require("../../data/botinfo.json")
        this.commands = new Map()
        this.aliases = new Map()
    }

    loadCommands() {
    // code
    }
}

module.exports = CakeClient```
#

uhm what

topaz fjord
#

where do you create cake

quartz kindle
#

post contents of cake.js

heady zinc
#

have you forgotten to instantiate it blobmeowsip

earnest phoenix
#
if (!bot.guilds.get("419193162469212160").members.get(msg.author.id).roles.has("419194461126393867")) {embed.setTitle("Woah there, slow down!").setDescription("You're being rate limited!\n\n**Premium cooldown:** 0 seconds\n\n**Donator cooldown:** 5 seconds\n\n**Normal cooldown:** 10 seconds!").setFooter("Use Alexa premium/donate to buy premium or to donate!").setColor("RED")
    if (talkedRecently.has(msg.author.id)) { return msg.channel.send(embed);
    } else {
    talkedRecently.add(msg.author.id);
    setTimeout(() => {
    // Removes the user from the set after a minute
    talkedRecently.delete(msg.author.id);
    }, 0);
  }} else if (!bot.guilds.get("419193162469212160").members.get(msg.author.id).roles.has("419194461126393867")) {embed.setTitle("Woah there, slow down!").setDescription("You're being rate limited!\n\n**Premium cooldown:** 0 seconds\n\n**Donator cooldown:** 5 seconds\n\n**Normal cooldown:** 10 seconds!").setFooter("Use Alexa premium/donate to buy premium or to donate!").setColor("RED")
  if (talkedRecently.has(msg.author.id)) { return msg.channel.send(embed);
  } else {
  talkedRecently.add(msg.author.id);
  setTimeout(() => {
  // Removes the user from the set after a minute
  talkedRecently.delete(msg.author.id);
  }, 5000);} ```
#

is it possible to have 3 elses for premium donator and normal users?

#

You can have as many else-ifs as you want

#

hard to read code cos im on mobile

#

only one else.

#

ut if else yeah

#

u already have some

#

u can add more

#

It says unexpected when I did it

#

bad syntax

#

missing bracket somewhre probably

#

not because of else if

knotty steeple
#

ok wait

#

uhm

#

laptop shut down

#
const Cake = require("./src/Cake")
const cake = new Cake.Client(require("./src/config.json").token, {
    disableEveryone: true
})
const loggr = new (require("cat-loggr"))()
cake.loadCommands()

cake.on("ready", () => {
    loggr.info("Connected to Discord, I am ready!")
})

cake.connect()
#

@quartz kindle

earnest phoenix
#

How can I get the return (as stated in the docs)?

west raptor
#

gyazo

earnest phoenix
#

Observant of you.

gilded blaze
#

Well it returns a promise so you would need to wait for it to resolve by either using .then or async/await. Also it doesn't seem like the arguments are an object and rather just two parameters, but that might be correct.

tepid hedge
#

I'm not sure if its just me, when hosting my discord bot on my raspberry pi (model 2), the bot seems to shut down, but the command prompt is still open. Please @ me if you know anything related to this. Thanks.

earnest phoenix
#

Any errors in the console?

#

@tepid hedge

tepid hedge
#

Im not sure. When running on my computer it was fine.

earnest phoenix
#

Are you hiding errors somehow (using try then neve)-

tepid hedge
earnest phoenix
#

................

tepid hedge
#

is that my ethernet cable?

earnest phoenix
#

npm rebuild I think it is

knotty steeple
#

no

west raptor
#
client.on('err', err => console.err(err))```
#

error

#

my bad

knotty steeple
#

@west raptor thats wrong

west raptor
#

i know

#

i just said

#

error

earnest phoenix
#

also u can be

knotty steeple
#

oh

earnest phoenix
#

like smarter

#

and do this:

knotty steeple
#

<Client>.on("error", console.error) iirc

earnest phoenix
#
client.on('error', console.error)
``` ![awesmart](https://cdn.discordapp.com/emojis/480316442672103429.webp?size=128 "awesmart")
west raptor
#

not really @earnest phoenix

earnest phoenix
#

It was a joke, lmao

west raptor
earnest phoenix
#

👍🏼

#
    function append(){

    let name = value.name;
    let id = value.id
    let rank = value.parent.role.Name;
    var rank1 = rbx.getRankInGroup({
        userId: id,
        group: 2815443
      }).then(console.log(rank1));
      
    };
   


    append();```
#

it returns undefined

west raptor
#

y ping

#

tonkku

earnest phoenix
#

I don't see an issue, do you?

#

He was helping me earlier...

#

yes you are making new function every iteration

#

lmao

knotty steeple
earnest phoenix
#

also foreach dont have a return value does it? lol

#

it just doing somethinf for every element

#

oh shit

#

wrong tonkuu

#

ree

knotty steeple
#

nice

west raptor
earnest phoenix
#

:thinkkin:

quartz kindle
#

@knotty steeple try this.loadCommands = function() {} in your class CakeClient

earnest phoenix
#

OK DISCORD FINE

topaz fjord
#

he could try extended Eris.Client

knotty steeple
#

the eris client is Eris

#

ok it works now

#

🤔

knotty steeple
#

how do you set the name of a variable as a variable

earnest phoenix
#

give example

knotty steeple
#

idk how

earnest phoenix
#

use an object

#

and assign the value to diff name

#

or rethink the problem

gilded blaze
#

Could use eval

knotty steeple
#

what does 'use strict' really do

heady zinc
#

you should read the MDN page for it for in-depth explanations

earnest phoenix
#

use strict prevent many things

#

global vars

heady zinc
#

in short it enforces stricter rules, makes your code better

knotty steeple
#

oh ok

earnest phoenix
#

so has list

#

u should use

heady zinc
#

in nodejs modules always use use strict blobmeowsip

knotty steeple
#

mine dont mmLol

earnest phoenix
bright spear
#

@knotty steeple they mean its forced on

knotty steeple
#

o h

silver fulcrum
#

unuse strict

earnest phoenix
#

'dont use strict'; awesmart

silver fulcrum
#

'use strictn\'t'

native folio
#

how do i make my bot check if a channel is a nsfw channel?

zenith moss
#

Look at the docs

native folio
#

docs?

#

I'm using py

agile lodge
#

oh

#

oof

native folio
#

3.6.5 py4hon

#

python

zenith moss
#

Look at the docs for your lib

knotty steeple
#

@native folio are you using cogs

native folio
#

nope

knotty steeple
#

well

#

idk

#

ik if you are using them you would do @commands.is_nsfw()

west raptor
#

ctx.channel.nsfw?

knotty steeple
#

have you tested mmLol

west raptor
#

Me?

knotty steeple
#

well yes

west raptor
#

I'm not the one asking though

#

I'm just guessing

#

That's the answer

wheat marten
#

When I make my bot post images should I put an image folder in each command group folder?

quartz kindle
#

depends what you want to do

wheat marten
#

embeds

quartz kindle
#

i mean

#

if you want to group images by category or something, then yeah

#

whatever makes it easier to organize and access them

wheat marten
#

would a folder in my bot's folder called images be better?

quartz kindle
#

if it feels more organized for you, sure

#

you can have an images folder, and categories folders inside it

#

like images for command 1, images for command 2, etc

wheat marten
#

ok

quartz kindle
#

also, if your command sends a random image, dont forget to cache the list in memory, so you dont scan entire folders every time a command is used

wheat marten
#

I forgot, how do I make my bot send a DM in discord.js?

quartz kindle
#

you can send a message to the command author

#

message.author.send()

wheat marten
#

ok thanks

quartz kindle
#

or you can define a recipient by user id

#

users.get(id).send()

wheat marten
coral trellis
#

Putting the link in the footer gooseWut

silver fulcrum
#

🥚

wheat marten
#

I added setURL and got rid of the link in the footer

#

I realized putting it in the footer was useless when I could use setURL

earnest phoenix
#

mhmm

earnest phoenix
#

Anyone know if you can create an invite using Discord's developer api?

#

Using a bot token

bright spear
#

yes you can

earnest phoenix
#

Hmm

#

Cant seem to find it

bright spear
earnest phoenix
#

Ahhh thanks 😄

bright spear
#

yw

earnest phoenix
#

What if i dont have a specific channel?

keen drift
#

well Discord invites only works with channel

earnest phoenix
#

Hmm

#

It's for a web platform

#

So it's a bit different than writing it for a bot

keen drift
#

you can't create an invite on Discord without a channel

earnest phoenix
#

Alright I'll see what I can do

#

Thanks guys

#

@keen drift Any idea why it would return null?

#

Nvm got it, thank you!

earnest phoenix
#

Can someone tell me how can I make command cooldowns only work for known commands instead of messages starts with the prefix

sinful lotus
#

make a set or map your choice depends.
configure a setTimeout on those commands.
delete them once setTimeout fires
@earnest phoenix

hardy sierra
#

@quartz kindle i just had to put int istead of string

broken slate
#

Hello,
I would like to delete message with a commande like "!clean" and it will delete all message of my bot, but i don't know how to do, i don't succed to get a good API documention :/ (Discord.js)

hardy sierra
#

Can someone spoonfeed me a !clear <message count>

glacial kestrel
#

do u guys reccomend using WS or UWS (even though ik it's deprecated) for making a custom discord lib

mossy vine
#

whats the rate limit on avatar changes? if i make the bot change its avatar every 5 minutes will it be safe?

glacial kestrel
#

it'll be rate limited

#

i believe quickly

#

but every 5 minutes i think is fine

uncut delta
#

@mossy vine 15min

#

Bye

mossy vine
#

so do i go with 5 or 15 minutes? 🤔

#

couldnt find it in api docs

glacial kestrel
#

5 would work

#

but 15 is safer

uncut delta
#

My bot changes it's pfp randomly just take a look at it's time limit

earnest phoenix
#

Spoon feeders are despised on this server @hardy sierra

hardy sierra
#

;-;

#

Docs are useless atm

earnest phoenix
#

Not really

#

They show examples

#

Go spoon feed off them

hardy sierra
#

Hmmm

earnest phoenix
hardy sierra
#

Promises are my nightmare

#

I cant learn them

#

My brain dabages

#

Damages

earnest phoenix
#

You don’t need all of it all you really need is bulkDelete then just send a messages saying the 2 args

hardy sierra
#

Maybe you can explain whats promise

#

Yea

#

Can you explain promises

earnest phoenix
#

Idk js words I just know how to do it as soon as someone asks me what one of the words mean I freak out

#

All I know is bootlean = true/false

hardy sierra
#

Promises is

#

(Messages =>

#

Bla bla

earnest phoenix
#

Idk how that works

#

All I know is await new promise

#

For waiting

sinful lotus
#

.then .catch are traditional way of promises

#

async await is the new way of promises

#

I suggest that you read more about them on google if you are making a bot

#

or you will just run into a lot of issues

wicked summit
#

Hey

#

Someone can help me in d.js ?

knotty steeple
#

can people just say their problem

wicked summit
knotty steeple
#

use embeds

wicked summit
#

not the embed

coral trellis
#

You would use a webhook

wicked summit
#
then when you check another time, compare lastOutput with lastModified, and only output (and record the new lastModified) if lastModified > lastOutput```
#

My friends say

#

i'm successfully make that but its hard for the setInterval stuff

broken slate
#

Yep a webhook should work

wicked summit
#

Im using webhook

#

Like i want that stuff automatically send if the new content is different than older contwnt

topaz fjord
#

discord has a webhook thing, all you need to do is create it, set it to a channel, and trigger it whenever the webhook says something

earnest phoenix
#

How can I use the DBL webhooks to give vote rewards?

#

And have the guild count post

topaz fjord
#

to post guild count use the api

earnest phoenix
#

I’ve posted the count but idk the vote rewards

topaz fjord
#

for vote rewards set up a webserver and put in the webserver link for the webhook link in the edit page

earnest phoenix
#

idk how to make servers

topaz fjord
#

google

earnest phoenix
#

Does dbl not make a list of the user ids?

topaz fjord
#

You can get the last 1000 votes

earnest phoenix
#

How

topaz fjord
#

And check if a user has voted

#

But the check is for the last 24 hours

#

look at the dbl API docs

earnest phoenix
#

I don’t think my bot will get over 1000 votes

lament meteor
#

its better to use webhook and it isnt hard to setup

earnest phoenix
#

Can someone tell me what code should I type in for the cooldown only works for commands? Because if(!message.content.startsWith(stupidprefix)) return: don’t work

#

yep I literally named the var of the prefix as stupid prefix because I am bored

west raptor
#
if (!cmd) return;
#

?

#

or something like that

earnest phoenix
#

you use ms for your cooldown @earnest phoenix ?

hardy sierra
#
       id: newMessage.guild.id,
       deny: (0x00000400, 0x00000800) }])```
#

im a bit dumb

#

but i cant make 2 denies

#

only the first one applies

#

0x00000400 = SEND_MESSAGES

hollow fulcrum
#

I'm no expert

#

but prehaps you can try deny: (0x00000400), deny: (0x00000800)

hardy sierra
#

unfortunately

#

nope

hollow fulcrum
#

What is 0x0400?

#

@hardy sierra

hardy sierra
#

SEND_MESSAGES

hollow fulcrum
#

and 800? (ik i can check dis docs but i just cant)

hardy sierra
#

VIEW_CHANNEL

hollow fulcrum
#

bruh

#

you cant send messages if you can't view the channel

#

just do deny: (0x00000800)

hardy sierra
#

owner always can send messages

hollow fulcrum
#

because hes the owner?

hardy sierra
#

hes admin

hollow fulcrum
#

with Administrator perms?

hardy sierra
#

nope

quartz kindle
#

i dont think thats how it works lol

hardy sierra
#

how 2 do that

hollow fulcrum
#

So just deny him perms to view the channel

#

and then he can't post messages in the channel

#

because he cant see it

hardy sierra
hollow fulcrum
#

problem solved

hardy sierra
#

how to make that

#

bot can post messages

#

and admins can see channel

#

but normies cant

quartz kindle
#

those permission flags are bitwise operators, not integers

#

you dont separate them by commas or anything, you add them with math

#

example, there is no permission 3. permission 3 means both permissions 1 and 2 are activated

hardy sierra
#

so 8+4

#

0x00001200

#

?

quartz kindle
#

supposedly yes

hardy sierra
#

btw can admins see channels

quartz kindle
#

admins can always see everything

hardy sierra
#

oh

#

ok

#

aint working

#

or

#

u meant like this

quartz kindle
#

0x00000400 = 1024

#

0x00000800 = 2048

hardy sierra
#

ye

quartz kindle
#

0x00001200 = 4608

hardy sierra
#

yeah this number showed up

#

in cmd

quartz kindle
#

0x00000400 + 0x00000800 = 3072

#

400 + 800 is not the same as 1200

hardy sierra
#

@quartz kindle is best

#

quartz kindle
#

so either (0x00000800)+(0x00000400) or simply try 3072

hardy sierra
#

tim4mod

quartz kindle
#

ew no

#

mod = too much work

hardy sierra
#

i suck at math

#

ill just do +

#

everytime i try something

tiny notch
#
  if (message.channel.nsfw)
  if(message.content.startsWith(prefix + "nekopara")) {
    
    var nekopara1 = [
  
        "liens1",
        "liens2
    ];
  
    var gif = nekopara1[Math.floor(Math.random() * nekopara1.length)];

    var nekoparae_embed = new Discord.RichEmbed()
    .setColor('RANDOM')
    .setTitle(':zap: GIF Aléatoire `nekopara` :zap:')
    .setImage(gif)
    .setFooter('GIF - Aléatoire `nekopara`')
    message.channel.send(nekoparae_embed);

  }
});```

How to do? I can not say sorry I'm a beginner 
How to force an nsfw channel for an order?
quartz kindle
#

just put return after the if

#

if message channel is nsfw, return (return stops and exits the function)

#

as i said, increase specificity

#
/*less specific*/
selector2 {
    rule1: rule;
}

/*more specific, overrides the less specific rule*/
selector1 selector2 {
    rule1: rule;
}```
tiny notch
#

Thanks @quartz kindle

quartz kindle
#

...

#

are you aware of how html works? boxes inside of boxes?

#

css follows the same rule

#

more specific means naming all the parent boxes in your css rule

#

you can see how specific the original rule is

#

this is the original rule

#

border-radius 4