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)
#development
1 messages · Page 506 of 1
:/
so you either have to use await or .then
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)
superagent.get('...').then(body=> {
body.url //use url for anything you want
})```
for more about promises https://medium.com/dev-bits/writing-neat-asynchronous-node-js-code-with-promises-32ed3a4fd098
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)
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
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
}
then how about you try const thing = await superagent.get('...'); and log thing to see if it's undefined or not
basic debugging
i try ?
yes
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
just because your tired doesn't mean we're gonna spoonfeed you code
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 {})
you should learn js before making a bot
^
what am i talking about actually
just
do
like
that
ye
finally
work
but
1 problem
?
i say f!dog
im tired
i dont understand what an async function is
i dont try/catch 
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 
no try catches around async await stuff 
getting help in dbl 
spooky
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
@earnest phoenix yes
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
how
does your bot have an eval command
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.
that's not how json works
What do you mean?
arrays won't have an "id" property
not simply require()'ing jsion 
require caches
also @earnest phoenix you shouldn't save data in json files
that's easily corrupted
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
iterate over the entries and check the id property of each one
I have no idea how to do that.
for loop 
sigh
then you should learn js
we need the check marks
there it is
nah but just use a db to store that stuff
use yaml
then u can actuqlly query it

array = []
object = {}
arrays are objects
array = numerically indexed, each entry has an auto-incremented index number
object = indexed by keys, a key can be a string, number, etc...
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)
e!botinfo
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
after pressing delete it always leads me to this:
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
@rapid citrus https://status.github.com
github died
github? what is that? is that edible?
...
I don't know what is that.
give github some time
I don't know what you are saying.
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
The moment a software show a weakness, I'll stop using it, It doesn't deserve my attention.
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
I'm in love with gitlab now.
@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
but not to the point that it slowsdown my life.
lol
oh wait you haven't been on discord long enough
yeah.
lol
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 Talking to me?
yeah
It's a mongo browser
They advertise it for so much though, isn't there other options?
https://youtube.is-down.party/s1HYjYv0.png it's really nice
I got it for free
lol
student discount
OHHH
It's far better than mongo compass
ok lmao I thought you were paying 200/Mon for it
👀
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?
Are you using match regex?
Anyone have a solution to djs aggressive caching besides disabling? My ram usage is actually getting out of hand.
https://discord.js.org/#/docs/main/stable/typedef/ClientOptions you might be interested in messageCacheMaxSize, messageCacheLifetime, and messageSweepInterval
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
@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
so ill stick with compute engine?
Does your bot really need all that
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
yeah no there are better hosts for budget
any cheaper ones to reccomend
will those be more reliable than google
It's close, but not the level of redundancy as Google
ill check out the pricing
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
yea
i only need a compute engine that i can ssh into
which is what i currently use google for
yeah unnecessary cost
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
@coral trellis hurru
Yeah, I'm using regex matching to find it somewhere in the garble
Yeah sometimes it finds words that include it, Try reduce it to specific words
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
That would be tedious but would work
What do you mean?
Remove the spaces, I thought you meant something else.
Ah ok

Also depends if you are paying extra for your host
nah it's reasonable pricing
then I guess it should be fine
yeah a dedicated server will perform better in general
Mainly CPU gets more important when your bot grows
yes
hmm well probably
doing interval database based message sweep
fun
this on top of supporting idiots
even better

yeah well can't help it
i regret having a support server
I've seen bots which automatically leave tiny guilds and bot farms
to save resources
true, its mainly with those bot farms and big guilds
where you have events going on every second or so
cpu is more than capable of handling load, but members count is affecting cache more than I'd like
what library though
yeah lots of cache
it's same in dgo
with dgo's state cache
cache is pretty unavoidable for performance
My 200 server bot went to 1.4gb ram in about a month
without restarts
and thats really bad
yeah I do restart them
eventually that'll become useless 
well I heard eris is better for bigger servers as it has better shard management
little late now
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
oof that growth rate though
well I don't expect much from d.js performance wise
i was expecting like max of 2k servers when I started this
Just maybe like improvements on like voice
they have few PR pending for disabling stores, autofetch uncached data, & external caching
yeah those are important
Like I think by default d.js caches 200 messages per channel
hm no idea, I don't have anything on default
and messages are sweeped every 10 minutes regardless
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
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
@earnest phoenix roleUpdate only takes two parameters, oldRole and newRole
you'll need to change it from role to old or newRole
NewRole is role tbh
Who can program a discord bot that gives me free Minecraft and Fortnite alts ???
i think thats agaisnt the tos
i think his avatar matches what he is saying
.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

is not int?
hmm
message.guild.createChannel('name', 'text', [{
deny: ['MANAGE_MESSAGES'],
allow: ['SEND_MESSAGES']
}])
.then(console.log)
.catch(console.error)
brb
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?
dunno
welp... :/
yes
@naive condor what do you use?
discord.js
oof
i use quick.db
@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
@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
I have no choice atm because demo is tmrw
ill try it out.
So two different txt files right?
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
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
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
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
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
i dunno where 2 put
the channel.overwritePermissions
;-;
can anyone help me?
i will dm whole code
logs
await channel , then do channel.overwritepermissions
Wait that code seems good! Whats the problem? @hardy sierra
brb wait
#memes-and-media @earnest phoenix
2 instances running possibly?
try with another command?
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
Check DM's
@hardy sierra is javaScript?
Yep
Yep
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
In what language?
parseInt
How to make a voting order?
My discord.js package on glitch.com is not working what can I do?
that is very vague
@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
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
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
ok thanks
@barren brook what do you mean "its not working"
My discord.js package on glitch.com is not working what can I do?
It won’t find it
In bot.js
what error
const Discord = require(‘discord.js’)
Just won’t work so making an error for no reason.
show the error...
That’s the error
thats not an error...
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
show the console
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)
did you install discord?
you need to install discord.js
I did
npm install discord.js
npm i discord.js?
Yh
fucking hell tim
I put it in package.json and put const Discord (‘discord.js’) in bot.js
just putting it in package.json is not installing
you have to run the install command
in the bots folder
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
In the console?
yes
I can’t type in it I’m on iPad
Then don't use an iPad? Lol
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
google™
why tf has dis error appeared from nowhere
cmd.run(client, message, args);
^
TypeError: cmd.run is not a function
cmd doesnt have .run()
you cant search for periods in google @topaz fjord
yes u can
and when i search periods with constructors it gives me some other stuff
probably in js
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?
but anyway, googling ... in method constructor gives me the same results as in method constructor
google ignores special characters when searching
so, no help...
@loud salmon Object... obj
oh thank you
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
did you add a new command
and forget to put run in it
"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
d
ye, i fixed it, but it dont work like it shud
why is this not working, prob obvious reason
how
I agree with Jonny
You don't really understand JavaScript, and you need to learn a bit more before jumping into this
^
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 If you're not going to help or provide any solid support, heck off nerd
No need to be rude
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?
because that's what printing an array does
Thanks.
what does --save-dev do when you are installing an node package
--save-dev is used to save the package for development purpose
Just use --save unless making a package.

^, --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
@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
Thanks
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
where do you create cake
post contents of cake.js
have you forgotten to instantiate it 
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
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

https://gyazo.com/340f4d9421ea372c5790f4d378effc6f
function append(){
let name = value.name;
let id = value.id
let rank = value.parent.role.Name;
var rank1 = rbx.getRankInGroup({
group: 2815443,
userId: id
});
};
append();```
How can I get the return (as stated in the docs)?
gyazo
Observant of you.
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.
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.
Im not sure. When running on my computer it was fine.
Are you hiding errors somehow (using try then neve)-
................
is that my ethernet cable?
npm rebuild I think it is
no
@west raptor thats wrong
also u can be
oh
<Client>.on("error", console.error) iirc
client.on('error', console.error)
``` 

not really @earnest phoenix
It was a joke, lmao


👍🏼


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
I don't see an issue, do you?
He was helping me earlier...
yes you are making new function every iteration
lmao
also foreach dont have a return value does it? lol
it just doing somethinf for every element
@knotty steeple https://gyazo.com/5758dfb00ead165fc129967c6f52ef45
oh shit
wrong tonkuu
ree
nice

:thinkkin:
@knotty steeple try this.loadCommands = function() {} in your class CakeClient
OK DISCORD FINE
he could try extended Eris.Client
how do you set the name of a variable as a variable
give example
idk how
Could use eval
what does 'use strict' really do
you should read the MDN page for it for in-depth explanations
in short it enforces stricter rules, makes your code better
oh ok
in nodejs modules always use use strict 
mine dont 

@knotty steeple they mean its forced on
o h
unuse strict
'dont use strict'; 
'use strictn\'t'
Look at the docs
Look at the docs for your lib
@native folio are you using cogs
nope
ctx.channel.nsfw?
have you tested 
Me?
well yes
When I make my bot post images should I put an image folder in each command group folder?
depends what you want to do
embeds
i mean
if you want to group images by category or something, then yeah
whatever makes it easier to organize and access them
would a folder in my bot's folder called images be better?
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
ok
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
I forgot, how do I make my bot send a DM in discord.js?
ok thanks
I just forgot
Putting the link in the footer 
🥚
finally perfected my bot's command
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
mhmm
Anyone know if you can create an invite using Discord's developer api?
Using a bot token
yes you can
Discord
Step up your game with a modern voice & text chat app. Crystal clear voice, multiple server and channel support, mobile apps, and more. Get your free server now!
Ahhh thanks 😄
yw
What if i dont have a specific channel?
well Discord invites only works with channel
you can't create an invite on Discord without a channel
Alright I'll see what I can do
Thanks guys
@keen drift Any idea why it would return null?
Nvm got it, thank you!
Can someone tell me how can I make command cooldowns only work for known commands instead of messages starts with the prefix
make a set or map your choice depends.
configure a setTimeout on those commands.
delete them once setTimeout fires
@earnest phoenix
@quartz kindle i just had to put int istead of string
Check discord.com developer guide
Not discord.js.org
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)
do u guys reccomend using WS or UWS (even though ik it's deprecated) for making a custom discord lib
whats the rate limit on avatar changes? if i make the bot change its avatar every 5 minutes will it be safe?
My bot changes it's pfp randomly just take a look at it's time limit
Spoon feeders are despised on this server @hardy sierra

https://discord.js.org/#/docs/main/stable/class/TextChannel?scrollTo=bulkDelete @hardy sierra @broken slate
Hmmm
They give examples which you can build off
You don’t need all of it all you really need is bulkDelete then just send a messages saying the 2 args
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

.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
can people just say their problem
Like that how i can make it ?
use embeds
not the embed
You would use a webhook
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
Yep a webhook should work
Im using webhook
Like i want that stuff automatically send if the new content is different than older contwnt
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
How can I use the DBL webhooks to give vote rewards?
And have the guild count post
to post guild count use the api
I’ve posted the count but idk the vote rewards
for vote rewards set up a webserver and put in the webserver link for the webhook link in the edit page
Does dbl not make a list of the user ids?
You can get the last 1000 votes
How
And check if a user has voted
But the check is for the last 24 hours
look at the dbl API docs
I don’t think my bot will get over 1000 votes
its better to use webhook and it isnt hard to setup
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
you use ms for your cooldown @earnest phoenix ?
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
SEND_MESSAGES
and 800? (ik i can check dis docs but i just cant)
VIEW_CHANNEL
bruh
you cant send messages if you can't view the channel
just do deny: (0x00000800)
owner always can send messages
because hes the owner?
hes admin
with Administrator perms?
nope
i dont think thats how it works lol
how 2 do that
So just deny him perms to view the channel
and then he can't post messages in the channel
because he cant see it


problem solved
how to make that
bot can post messages
and admins can see channel
but normies cant
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
supposedly yes
btw can admins see channels
admins can always see everything
ye
0x00001200 = 4608
so either (0x00000800)+(0x00000400) or simply try 3072
tim4mod
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?
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;
}```
Thanks @quartz kindle
what is array

