#development
1 messages ยท Page 549 of 1
well, have fun
Its 2:19 am
what
ok
don't you think people should at least know how to use the computer before attempting to code
lmao
So ill trust him
how's that going for ya
kek
i cant find it
@amber fractal lmao, good night
WHATS THE COMMAND
cmd

OK
was w8 that long ago, jeez time flies
yes
Are you in command prompt atleast
yes
type node -v
hue
it just closes
windows key and r opens run
it opens
Now type node -v
Yes
can i dm you the picture
Sure


my api generates a buffer, how do i turn that into an image?
right now i get this lol
Set the proper content type
so on vsc, ive got all the code sorted,
but it keeps turning off
how can i stop that?
I didn't see this as an issue on the GitHub, but is it a known issue that the "Remind me to Vote for this bot" button does nothing?
Doesn't seem to be a support channel for the webpage itself; this seems to be the closest thing
@trail dew it works
Myself and at least one other person on our server were discussing how we've never received a single reminder
How is the notification supposed to be sent? Over discord, or via browser?
browser ofc
Ohhh. Then yeah, it's a browser issue. It didn't say at all how the reminder was going to be sent; we were all assuming some bot would message us
I mostly discord on ios mobile, so I guess the feature just won't work for me
safari?
Yeah, I haven't had that pop up on Safari. I don't think mobile safari supports browser notifications.
iOS entirely sucks though so we expect it 
Weird that a discord service doesn't notify via discord, but such is life. At least it's not a bug
they can't reliably use discord
not everyone is in this server, and not everyone has DMs open
Well, thank you for clarifying how they're supposed to work
yeah safari has no support for that
I am using discord.js and why dont this work? let botembed = new Discord.RichEmbed(); .setDescription("Bot Information"); .setColor("#cc1212"); .addField("Bot Name", bot.user.username);
ping me
Cause you terminated RichEmbed() with semi colon
You don't need semicolons in js
If you're gonna use them then only put them where they should be
It doesn't enforce it
ok
How to make the bot was online in monitoring?
can anyone help with es6?
vsc reccommended me to import modules this way, but this happens
even if i ignore the {} it still happens with a different error message
as SyntaxError: Unexpected identifier
wats ur node -v
v10.14.2
wouldn't it be { Client }
according to https://developer.mozilla.org/hu/docs/Web/JavaScript/Reference/Statements/import it should be correct
no im importing Discord
and tried with {}
idk why i linked the hungarian site
so even when you do ```JS
import Discord from 'discord.js';
yup, SyntaxError: Unexpected identifier
yes, i just sent the node -v output
it is not
docs say otherwise
what else is in your environment
wdym
defining the client, logging in, and the ready event logging "im online lmao"
send pic
yes the issue is that its not working D:
no 1 sec
okay
rename your file to index.mjs
and run it with node --experimental-modules index.mjs
:^)
as far as I know, import only natively works for code that's going to compile
but then everyone else using the code will need to do that, no?
so like, React for example, compiles into code that is then read by the browser
(not really "compiled" just converted into legible and organised code that a computer can understand but we can not)
yes
mk so i guess i will stay with require() lmao
I'm trying to get the hang of es6 imports in node and am trying to use the syntax provided in this example:
Cheatsheet Link: https://hackernoon.com/import-export-default-require-commandjs-javascript-
@mossy vine use coffeescript :^)
yes
ew no
oh that syntax is hot
hm
Hello everyone, I need your help. I have a .json file in which the level of participants is recorded.
"guild.id": {
"user": {
"user.id": {
"level": 8
}
}
}
}```
How can I get the list of participants with the highest level?
are you using JSON as a database?
or forEach since its an object
But it is possible in more detail how to do this. is there an example?
@languid dragon something is wrong?
is that a yes to my question?
you shouldnt use json files as a database
just other formats fail to use ๐
wow @mossy vine you leveled up XDDDD /s
what
although it's on topic, memes belong in #memes-and-media 

I'm still too stupid. If you offer another way, I will try to do
I use json, want to switch to enmap or sqlite or something but its just so much revamping :(
lmao steven
it seems to me that everything is not bad with json. I just do not know other options for storing information
I want to do it sooner rather than later because theres already a lot of data I'd need to transfer
what's best for frequent writing and reading
@languid dragon ok coffeescript seems pretty fucking hot lol

more people using coffeescript 

I'm too stupid to use anything else
well be less stupid
the answer is still valid, loop through the members
I understand, I do not understand how to do it
are u using fs
what
well
load the file with require()
and with a for loop or forEach() you look thourgh all of the data
pls use for
and if its higher than the previous highest encountered level, make it the new highest encountered level
forEach is slow af
complicated 
what is
Anyone knows how I make a setInterval promise I used to know but forgot
if loops are complicated you have to learn more js
go away
Guys ,how do I get a user's creation date? I've looked at the docs and all that but it still doesn't seem to be working. (nodejs)
Discord.JS?
yes
or you can change message.author to anyone
boi message.user is not a property
oh right thanks

sh
stop spoonfeeding
How do you make a leveing system, I need help plz
Theres no such thing
Wut
ranking system
what is a mee6
@earnest phoenix please stop being a nuisance
...
You'll need to calculate an amount of xp to give a user per message and add it to their total xp count. If that xp reaches a certain number add 1 to their level
ez
yeah but how, i am noob
I'm not gonna give you code
i hjave
view these PDF files for best practices and common sense with javascript coding
Thanks, got it to work 
okay so in js there are these things that look like
client.on('something', callback)
client is a class right? and what is .on() and how would implementing one go?
sorry if this is spoonfeeding, if anyone can direct me to some resources i would be thankful
yes and i meant that Client is an class
right?
and lowercase client is the thing
the whatsitcalled
once you create a new one and make it login, you get all the properties that are available here https://discord.js.org/#/docs/main/stable/class/Client
it's a created instance of Client
yes thats what i meant
yes
then what is .on() and how would it be implemented?
class documentations dont tell aynthing

.on is an event handler
essentially its like this
client.on("message", function () {
// because a callback is a function
});
// translate to
on a "message" event from client, do function
does that make sense?
const EventEmitter = require('events');
class MyEmitter extends EventEmitter {}
const myEmitter = new MyEmitter();
myEmitter.on('event', () => {
console.log('an event occurred!');
});
myEmitter.emit('event');
ok so i need to require the events module/package/idontevencare to make it work and then i just .on() and .emit()?
its a part of node.js so you don't need to install it
and for MyEmitter class i can add more things right?
yes
so it behaves like a normal class with those features?
an example usage of this would be
const EventEmitter = require('events');
class Game extends EventEmitter {
constructor() {
// do stuff
this.ready();
}
ready() {
this.emit("ready");
}
start() {
// do more stuff
}
}
const game = new Game();
game.on("ready", () => {
console.log("the game is ready!");
game.start();
});
its untested so i dont know if it will actually work
alright thank you for helping
hey everyone, would there be a way to create a command that responds with how many people are in a certain call?
What lib?
yes, read the docs
const args = message.content.slice((`<@${client.user.id}> `).length).trim().split(/ +/g);
const command = args.shift().toLowerCase();```
is there something wrong with this? because every now and then when i say a normal sentence it'll response as if i said the <@clientid>
anyone?
can you send your full message event?
its a one file bot so idk
yes thats what im saying
yes, only send the part in the message event
all 800 lines?
okay then only the first few lines of it lmao
xD
client.on('message', async (message) => {
if(message.guild && !message.guild.me.hasPermission("SEND_MESSAGES")) return;
if(message.author.bot) return;
const args = message.content.slice((`<@${client.user.id}> `).length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
yeah, you need to check if the message starts with your bots prefix
its ok lol
I have a problem with my startscript (Debian 8)
nodejs /root/DiscordBot/LSGangwars/bot.js
but how can I create a screen
I want who I Putty out that he does not go with
is it necessary to put a catch for every send() method?
can someone help me with my screen problem?
@vagrant flare not really
@earnest phoenix have you tried using an amazing thing called google
yeah. i know but i doesent find it
๐ฆ
its literally the first result what
i search and search
but nothing
-.-
pls say
how do you make an eval command
Example Me: ?eval (code)
Bot: Running eval...
Also bot: js Code
what library
d.js
const code = args.join(' '); // assuming you have args, which you should
const result = eval(code);
msg.channel.send(`\`\`\`js\n${result}\`\`\``);
change it as needed and add owner only protection
thats kinda what you gotta do
ok thanks
I have a problem with my startscript (Debian 8)
nodejs /root/DiscordBot/LSGangwars/bot.js
but how can I create a screen
how i can overwrite permissions and create channel
what language and library?
@dense ocean what d.js version
"discord.js": "^11.4.2",
Okey, thx โค
yw
@deep drift
Would any of you recommend Heroku?
I know about the list in the pins
But I feel Heroku is the best option for me to go with rn. ANyone have any input?
heroku/glitch aren't suited for discord bots
both kill your process after a time of inactivity
Im just looking for a cheap reliable host
glitch is free
this doesn't look like supporting discord bots
which require a constant ws connection to discord
Im hosting off of my PC right now
have your bot like send stuff to the console every 4 minutes or something
keep it live
ew
but that's just a loophole
So what host would you guys recommend from the pinned list
I was thinking maybe Digital OCean
I mean
I know a host that has really cheap hosting
compared to those
if you want info dm me. I use their services
I recommend GalaxyGate over digital ocean
cheaper
and they have a support server on discord which they're very active in
also very transparent, and you get really low ping to the discord api
lately I have been deciding to whether or not to go with digitalocean for their kubernetes
Weren't able to host it yourself?
able, yes, easily, no
@vocal meteor what lib and version
(implements TextBasedChannel)
Represents a member of a guild on Discord.
Properties: client guild user joinedTimestamp lastMessageID lastMessage deleted serverDeaf serverMute `selfMu...
no bot property
hmm ok let me check
oh it's member.user.bot
client.on('guildMemberAdd', async member => {
let autoRole = await db.fetch(`autorole_${member.guild.id}`).catch(err => console.log(err));
if(!autoRole) return;
if (!member.guild.roles.get(autoRole)) return;
let botRole = member.guild.roles.find(r => r.name === 'Bots');
if(!botRole) return;
if(!member.guild.roles.get(botRole.id)) return;
if (member.user.bot) {
member.user.addRole(botRole);
} else {
member.addRole(autoRole);
}
});
is my code correct now @bright spear
ok
OK so I have a problem that I can't fix and I need some help
I can't send the file because I'm not home but the problem is that there is an error in line 29
the program only has 28 lines
Help
we cant help if we can't see it
I see 3 { and 4 }
no worries.. I didnt learn to count that high until kindergarten
๐ jk.. happens to the best of us
lol
wrong channel
Not sure if I can ask here, but I have a var that looks like this
{
"pic":"https://cdn.astrobin.com/thumbs/gGoN6WUmE0Km_1824x0_wmhqkGbg.jpg",
"source":"Adam Jesionkiewicz"
},
{
"pic":"https://cdn.astrobin.com/thumbs/v8e_ybM2kUN9_1824x0_wmhqkGbg.jpg",
"source":"Rafael Schmall"
},
{
"pic":"https://cdn.astrobin.com/thumbs/4f1dGIOHdGt1_16536x16536_u7lfpV8j.png",
"source":"Ola Skarpen"
},
{
"pic":"https://cdn.astrobin.com/thumbs/k8RFxxn2duuh_1824x0_E5OUiQ7u.jpg",
"source":"Kevin Morefield"
},
{
"pic":"https://cdn.astrobin.com/thumbs/jtUTwFWuU0S1_1824x0_wmhqkGbg.jpg",
"source":"sydney"
}
]```
and I wanted to just console.log all the sources so they look like this: ``Adam Jesionkiewicz Rafael Schmall Ola Skarpen`` etc. Would anyone know how to do this in js? ๐จ
loop over pics (for or for of or .forEach) and console.log the item source
example ```js
var array1 = ['a', 'b', 'c'];
array1.forEach(function(element) {
console.log(element);
});```
AAAA thank you soooo much!!!
Hi
pls unmute my bot
414440610418786314 (id because when you mention my bot it shows help msg)
I fixed problem where it responds to other bots
the censor thing
welp @queen sentinel pls help
Done
@loud salmon thx - 3 minutes ago
@next scaffold 
?
eh so I tried to ask you to unmute my bot, but you went offline after I pinged
soz m8
If I have right this code should kick the mention person right?```
if (cmd === ${prefix}Kick || ${prefix}kick) {
let kUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
if (!kUser) return message.channel.send("Can't find user!");
let kReason = args.join(" ").slice(22);
if(!message.member.hasPermission("MANAGE_MESSAGES")) return message.channel.send("No can do pal!");
if(kUser.hasPermission("MANAGE_MESSAGES")) return message.channel.send("That person can't be kicked");
let kickEmbed = new Discord.RichEmbed()
.setDescription("~Kick~")
.setColor("#e56b00")
.addField("Kicked User", `${kUser} with ID: ${kUser.id}`)
.addField("Kicked By", `<@${message.author.id}> with ID: ${message.author.id}`)
.addField("Kicked In", message.channel)
.addField("Time", message.createdAt)
.addField("Reason", kReason);
let kickChannel = message.guild.channels.find(`name`, "logs");
if(!kickChannel) return message.channel.send("Can't find logs")
message.guild.member(kUser).kick(kReason);
kickChannel.send(kickEmbed);
return;
}```
Please use ```
Get rid of the other `s so that it makes it a block
Replace them with a normal quote or something
are you talking to me?
Yes
Thatโs not the answer
I just canโt look at that without dying inside
Is there an error message also?
Its a block for me
This is the respond I get in cmd: (node:16216) DeprecationWarning: Collection#find: pass a function instead (node:16216) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions at item.request.gen.end (D:\Users\Mads Fredrik Thaulow\Desktop\MyBots\discord.js\testing\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:79:15) at then (D:\Users\Mads Fredrik Thaulow\Desktop\MyBots\discord.js\testing\node_modules\snekfetch\src\index.js:215:21) at process.internalTickCallback (internal/process/next_tick.js:77:7) (node:16216) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) (node:16216) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
The bot doesnโt have permission to kick
Be sure to check at the beginning
By doing something like
if(!message.guild.me.hasPermission(โpermโ)) return
But what i think is happening as well is the bot canโt kick that user
Because itโs role still has to be higher
.find is also screaming
at new Script (vm.js:84:7)
at createScript (vm.js:264:10)
at Object.runInThisContext (vm.js:312:10)
at Module._compile (internal/modules/cjs/loader.js:684:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:774:12)
at executeUserCode (internal/bootstrap/node.js:342:17)
why
what is your code
So what you should do is check the .kickable property of the member object and it gives a Boolean of whether the bot can kick the user or not so use that property to decide whether to continue and also whether to say the bot canโt kick the user @rocky dagger
Find the missing )
what line
either you need to add or remove a )
nice token leak
lmfao
Exposed token
uh fuck
Yea
better reset it
yes
lmao
u should remove that switch
xD
Just regenerate it quickly

Sorry oof
Donโt fuckin send it idiot
and now like 30 bots logged it nice
๐คก
So what you should do is check the .kickable property of the member object and it gives a Boolean of whether the bot can kick the user or not so use that property to decide whether to continue and also whether to say the bot canโt kick the user @rocky dagger. by copy pasting this in my test server i got this message That person can't be kicked idk why
Hh
stop getting annoyed at people and reset the token quickly @earnest phoenix
idk sorry
Just before u kick check if .kickable is true
so instead of client.login("token") it would be client.login(config.token)
No what
Weโre not gonna look through the whole thing to find it
Put it in a code editor and let it debug it for you and find the missing parenthesis
what are you using to code
if itโs notepad then iโll be sad
Thonny is best for python
atom is a meme
vs code is best

I didnโt even know that existed as I rely on vscode to find syntax errors for me 
Yeah I just said that cuz Iโm assuming it exists I donโt even know if thereโs any good one
NTMw
Oof I can't type
There is nothing missing
And this time without tokens xD
Did you reset it yet
reset?
Yes
Go to the dev panel and hit regenerate
and please use a config
I did
Ok
the worst thing is is that i copy from youtube and my code doesn't work
na
Then donโt copy
its my fist bot
ahh o
fuck xD
^
ReferenceError: client is not defined
at Object.<anonymous> (C:\Users\NOEL-TPC\Desktop\DiscordLSwars\bot.js:17:1)
at Module._compile (internal/modules/cjs/loader.js:721:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:774:12)
at executeUserCode (internal/bootstrap/node.js:342:17)
at startExecution (internal/bootstrap/node.js:276:5)
at startup (internal/bootstrap/node.js:227:5)```
client.on('message', msg => { if(!msg.author.bot) { if(msg.content.startsWith(".")) { var command = msg.content.toLowerCase().split(" "); console.log(command); switch(command[0]) {
what is wrong?
@fresh pewter yes
ok so
i made a custom scroll bar
should look like that
then i added a new class
and it broke
and if i do overflow scroll
it comes with the div
but when i add 2 div
i don't know wat to do
<div class="holder">
<div class="center">
<img src="conco3.jpg" alt="404">
<h1>Conco</h1>
</div>
</div>```
html
.holder{
overflow: scroll;
background-image: linear-gradient(230deg, #e7733a, #f16046, #f74b57, #f9346b, #f51a82);
height: 100%;
width: 100%;
display: flex;
}
.center{
margin: auto;
}
.center img{
box-shadow: 0 0 14px 1px black;
border-radius: 100%;
transform: translateY(-20px);
}
.center h1{
color: white;
text-align: center;
font-size: 40px;
transform: translateY(-40px);
}```
css
the canvas is in js
if u want
i can give but its really long
Hello, i declared my variable in top of my code and when i want reuse this variable, he is not defined, i don't know why, Someone know why my variable is not defined ? Here is my code:
if (message.content.startsWith(config.prefix + "championship"))
{
var seconds = 0:
//mon code
if (splitMessage[4] === "d")
{
seconds = 16 * 15;
}
}
And when i try this:
if (message.content.startsWith(config.prefix + "championship"))
{
let seconds = 0:
//mon code
if (splitMessage[4] === "d")
{
seconds = 16 * 15;
message.channel.send(seconds)
}
}
It is work but the other not:
if (message.content.startsWith(config.prefix + "championship"))
{
let seconds = 0:
//mon code
if (splitMessage[4] === "d")
{
seconds = 16 * 15;
}
message.channel.send(seconds)
}
let seconds = 0:
Why is it : it needs to be ;
Idk if thatโs the problem
But what you should also do is just
var seconds;
You donโt have to define it as something
But (if itโs giving no error) the only explanation i have is that somethings wrong with splitMessage meaning itโs always false etc.
i think that's personal preference and really doesn't matter
defining it as something and using let is generally better practice
Using semi colons isnt even required 
I wasnโt really talking about var/let but yea
Ik its not but he still put : but idk
im talking about defining it as something is better practice since you can't send undefined using the send method
Idk if u can use : instead of ; (or nothing)
you can't
Var allows it in all scopes of the function let allows it only in that scope iirc
if you don't know why are you explaining 
Well I said that itโs wrong but I just wanted to make sure
And heโs just gonna not respond
if i just type anything my bot activates with this four line of codes if (cmd === `${prefix}Kick` || `${prefix}kick`) { let kUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0])); if (!kUser) return message.channel.send("Can't find user!");``````` if(cmd === `${prefix}Ban` || `${prefix}ban`) { let bUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0])); if (!bUser) return message.channel.send("Can't find user!"); does any1 know?
What do you mean activates?
if i type hello it writs "Can't find user!" back
yeah
if there isn't a mention or an id it does that
you should only run inside the command its needed for
nvm
why are you checking to see if the command is ban or ban?
not even
checking if cmd = a string || a string is true
lol
its if(1 equals 1 || 2 equals 2)
not if(1 equals 1 || 2)
yyes
https://gist.github.com/Madmadz16/dd83fbb33f767e634304d11decbff082 this is the whole code if you want
if you spott an error please ping me
@rocky dagger for one
your if statements are wrong
@bitter sundial pls ban
should be js if(cmd === (`${prefix}command`||`${prefix}Command`)) {...}
@real quiver #memes-and-media
@modern sable Cleanup on isle #development
not if(cmd === ...)
english only here pls, #memes-and-media for other languages
or dm
yeah, edited
thats maby the best
?
isn't it if(cmd === ...)
javascript has an order of operations
i think you need to learn about javascript operations
prob
what you're doing with this js if (cmd === `${prefix}Report` || `${prefix}report`) {
is checking if cmd is ${prefix}report or if ${prefix}Report is true
by surrounding the strings with parens you'll make it check if it's either one of the strings instead of checking for one of them or if the other is true
adding () around the strings won't do what they want
around both
natan is invisible 
they want a == b || a == c, not a == (b || c)
the latter will still work
so then it'scss if (cmd === ${prefix}Report || ${prefix}report) {
no
no

add ` around the strings
this is not a real solution either
what you should be doing
is converting your command to lowercase
change this js let cmd = messageArray[0];
to this
let cmd = messageArray[0].toLowerCase()```
then you only have to check for the lower case version
if(cmd === ("<prefix>command"||"<prefix>Command")) {...} won't handle the case of cmd = "<prefix>Command"
i have herd of that function
then use it
then your if's can just be js if(cmd == `${prefix}command`) {...}
also why do you have commands in 1 file
yea I shold do that
or at least use a switch instead of if-else chains
yes this
I am doing that
a switch is O(1) vs O(n) for if-else chains
do you not know switch exists
when you were using switch and people were like "thats bad practice" but all the time it was more performant and I didnt even know gg
a switch and an object/map lookup are both O(1) for any proper map implementation
switch(a) {
case "wew":
return "hi"
break;
case "hi":
return "no bye"
break;
}```
hecc, might need to look at the assembly when I have time for how this magic works
although O(1) doesn't necessarily mean it's faster, just that execution time is constant regardless of size
string switches usually generate an integer from the string then use an integer switch
inside the integer switch it does if-else for string equality
because there may be collisions
it's pretty much an inlined hashtable
now i'm really curious what the asm behind this is
lol
probably a jump table
taking treehouse right now
js course 
york best
i just copy and paste until it works 
My computer science class didnt introduce tables, objects and arrays until the end
It was a shit class
well ur class is shit
yes i know
Same fishy
But how the crap a mi supposed to use to.lowerCase() in this?cs if(cmd === `${prefix}command`) {...}
The ctrl and c and v keys will be the first to die on my keyboard 
a question: what is the "best" or the "standard" permission to look for, when a user wants to change the servers prefix. manage server?
put .toLowerCase() at the end of the declaration
are what would you guys use
I check for MANAGE_SERVER
I check for manage_server, or my ID lol
let messageArray = message.content.split(" ");
let cmd = messageArray[0];
let args = messageArray.slice(1);```
i can already tell thats from some tutorial 
add .toLowerCase after messageArray[0] @rocky dagger
yeah manage server makes sense๐
for the cmd declaration
Using json for database is the future
let prefix = botconfig.prefix;let messageArray = message.content.split(" ");
let cmd = messageArray[0] .toLowerCase();
let args = messageArray.slice(1);
woops
I use rethink
I watch a tut

It's my first bot
Docs are better for learning
and courses
^
and copy and paste
if u want to make a bot, learn js or another programming language
yes
fishy and i learn the same way lol
soon u will die like all goldfish
theft and googling the best way to learn
yes docs are muuch better. i also started with some basic tutorials but after looking in some docs...never gonna watch a tut again xD
i learned when i was 9
dumbass me at 9 still knew how to make programs work
most of the time 
pls
i learned exactly nothing since then
yes
except making discord bots will be my fulltime job
oof sad job

wew
I got toLowerCase(); to work thx
Making discord bots fulltime on fiverr
fulltime? ive gotten a couple gigs, but not enough to quit my job
where do you put PERMISSIONS INTEGER into this link https://discordapp.com/oauth2/authorize?client_id=487618682986430484&scope=bot
at the end?
yeah
ok thx
With code


Hey Guys! Iโve got a question. Can I make a Music Bot with the app Discord Bot Maker on Steam?

Don't use DBM
Ok. Wich is the best I can use?
Well
Coding it yourself
Makin your own bot XD
Ok
can someone help me understand .slice in js
what dont you get?
Yes
so , is also considered string
res will be string, yes
oh its one variable
, cofused me lol
"Apple, Banana, Kiwi".slice(4, 7);
0123|--|
|56|
4 7
Result: "e, "
4 = the point at which it should *start* slicing
7 = the point in which it should *stop* slicing
]]ev "Apple, Banana, Kiwi".slice(4, 7);
e,
tnx โค
works the same with arrays, same deal
just imagine the string is split up into an array and every entry is a single char
so "A" would be the beginning of the array starting at 0
]]ev ["Apple", "Banana", "Kiwi"].slice(0,1);
[ 'Apple' ]
yeah i get it now, im pretty new to js
Hi, how can I add the whole page into long description? I tried this: <iframe src="http://example.com/"></iframe> but this doesn't work 
Does anyone know any reason for my bot's forever instance to be randomly shutting off?
I don't get any errors it literally just shuts down
@gritty bolt where are you hosting?
AWS Ubuntu t2.micro Linux
is the instance itself shutting off or just the bot program?
Welp i cant help you then
It doesn't show any signs of shutting down
It's being monitored 24/7
And it hasn't shut down once according to the logs
you can still ssh into it?
does it auto restart or do you need to do something to get it online again?
I need to do forever start again
in aws? or in linux?
and ssh stops working when it shuts down?
No it still works
somebody plz?
check the browser console for errors
Ok
@waxen blaze it has to be https
is there a limit on how many messages can be deleted at once? as bot
100 iirc
100 per request
and message deletion ratelimits get high very quickly
no
if you do 1000 requests then probably
im worried what if users abuse bot or some command
ยฏ_(ใ)_/ยฏ
you could ratelimit the command or just have the bot leave the spam guild
they're not as common as you'd think
theres cooldown thing, ill try it
bless stackoverflow
is 10 second cooldown too much ? 
discord should have a list of rate limits.. it will be way less than 10 seconds, but 10 seconds is probably fine
i guess you could check if x users on x guild use x commands within a span of x seconds
or make it into a formula, and have it leave when it is above a certain threshold
there are some known ones, and most don't really change (eg 5/5s for sending)
but deleting is an exception
there use to be a list of rate limits
there was never an official list
and even the ones that exist shouldn't be used to ratelimit discord api calls
as ratelimits are dynamic and can change at any moment without prior notice
you can use those to get an idea on what the ratelimit was the last time they were updated
There was a list according to a "staff software engineer @discordapp" on github 
I had some server owners came complaining to me that their reactions disappeared
Turns out it got rate limited
Nice
Large guild problems
Wait Library Developer? I didnt even realize that it was that role that gave you a neat color 

Anyone know anything about json files?
Lol ok so i have a few json files that keep deleting while using commamds. Why would this happen?
Are you reading/writing them with these commands?
No
then its not your bot
Hmmm ok.. I wonder what it is
Specific
Do they reset to {} or fully delete the file
It deletes everything out of the file including the brackets
Which part of the code? I'd rather not send it here though
are you using json files as data storage?
more often than not, you will end up corrupting your files by trying to read/write while the file is open
Coins, XP,Autoroles and Server Prefixes
yeah, thats just a bad idea, using a database will be your best bet
I use json for all those things, going to move to a database asap I just need to learn one and transfer data
I havent had it corrupt yet
thats a ticking timebomb
I know a little about mysql just not enough to do that
if you do it correctly steven, its possible
emphasis on yet
Mike, what language?
Js
Is there any db thats as simple as json cuz json is so easy to get stuff out of.
json is not a db
i use mongodb
I know
not with JS though, im sure there is a library
Mongo is bson
I use MySQL for most of my data
yeah, its pretty easy to implement tho
Transferring my current data will be the hardest part
MySQL is my recommendation.
you should be able to automate it all
Mongo over charged me once
They charged me $453 one month out of no where
rethink is nice
Is it easy @zealous veldt
yeah
well
set up can be a pain in the ass
but I can help y ou
but using it is easy
rethink can be a bitch
You can transfer json file to MySQL if you absolutely needed
i've had it do stupid shit more than enough times to want to rm -rf it asap
Lol
Alright Ill install mongodb and try that
make sure to properly secure it
No idea what that means
mongodb doesn't come with security pre installed i believe
configure iptables to drop outside traffic to the mongodb port
there's this https://www.infoworld.com/article/3164504/security/the-essential-guide-to-mongodb-security.html
to access my db will I need to MongoClient.connect in every seperate file or once connected it will just stay connected?
use mongoose
Hey can I have some help
client.on('message', message => {
if (!message.guild) return;
if (message.content === prefix + 'test')
channel.send('Testy mc test') //I know that there needs to be a message before channel but I did that so I can have an error to display
}).catch(err => console.log(err) message.channel.send('**Error** ' + err + ' This has been sent to our developers') client.users.get("335227605777121281").send("There has been an error " + err))
It gives an error stating .catch(...) is not a function
Any help (d.js)
my guess is that you need to await it
can you explain plz
client.on('message', message => {
if (!message.guild) return;
if (message.content === prefix + 'test')
channel.send('Testy mc test') //I know that there needs to be a message before channel but I did that so I can have an error to display
})```
you're doing client.on(...).catch
yeah
ok
Ok this database stuff is actually confusing the hell out of me
how would I change the timestamp of a pre-built embed in discord.py?
what did you go with Steven
I swithced to rethinkdb
Or just use a platform that hosts the db for u and takes care of security
For mongo you can use Atlas or mlab
Mlab has a sandbox plan
Which is free
Yet still reliable
If you're using js and want to use mongo, as moose said, mongoose is helpful
If you read their docs you should be able to figure it out.
This error is literally my life rn
I have no idea what to do about that error, same thing happened with the dblapi I always got connection refused
Idk how it started working.
If you have any ideas of how i could fix this, please dm me or @me here thx
do you have the server running?
nothing is running on that port
Its the port the db connects to
or tries
But it says connection refused when it tries to connect
because there's nothing running



pls no ban



