#development
1 messages · Page 1259 of 1
prettier FTW
well, maybe start splitting this into modules then
the events are
my index is 99 lines
and most of that is a thing I could definitely throw outside if I wanted
yeah I gathered it wasn't d.js
though i should clean my other indexes as wel tbh
and i forgot to add second parameter on the process event too now that i look at it
though luckily its only organization, in matter of performance shit is working perfectly good
client.on(eventName, event.bind(null, client)); is an awesome little line of code 😛
like, ```js
const evtFiles = await readdir("./events/");
client.log("log", Loading a ${evtFiles.length} events.);
evtFiles.forEach(file => {
const eventName = file.split(".")[0];
const event = require(./events/${file});
client.on(eventName, event.bind(null, client));
});
6 lines to load all my events is not too shabby
lot more cooler too
pass it the binder, the event name and client and you good to go
not only for client events
there are multiple processes i need to bind listeners on
specially when i start doing clustering
i'll attempt sharding/clustering on twitch
So happy that yesterday all this shit ive been doing paid off good time
i was testing nightbot and moobot vs my bot regarding response times
my cache beat them every single time when it comes to responsiveness
cutting down on api calls does make a huge difference in performance
for(let file of fs.readdirSync("./events")) {
client.on(file.slice(0,-3),require(`./events/${file}`))
}
one line it :^)
technically you dont need to bind client because all djs classes have .client
too bad this isnt d.js lul
this shit bare bones
it does handling for you, but just gives you the message
thats about it
anything over that is on you
i dont like one-lining for loops, but sure you can js for(let file of fs.readdirSync("./events")) client.on(file.slice(0,-3),require(`./events/${file}`))
and you have a bunch of hidden lines there :^)
its only 4 lines doe
even the function calls for outside scripts
tried to make it as clean as i could
chat is the IRC connection/connector
Twitch still hasnt replied to my request to verify my bot
if (command === 'purge') {
const args = message.content.split(' ').slice(1);
const amount = args.join(' ');
if (!amount) return msg.reply('You haven\'t given an amount of messages which should be deleted!');
if (isNaN(amount)) return msg.reply('The amount parameter isn`t a number!');
if (amount > 100) return msg.reply('You can`t delete more than 100 messages at once!');
if (amount < 1) return msg.reply('You have to delete at least 1 message!');
async function asyncCall() { await msg.channel.messages.fetch({ limit: amount }).then(messages => {
msg.channel.bulkDelete(messages)
)});```
Debugger attached.
Waiting for the debugger to disconnect...
c:\Users\linds\Downloads\MyBot\MyBot.js:86
if (!amount) return msg.reply('You haven't given an amount of messages which should be deleted!'); // Checks if the amount parameter is given
^
ReferenceError: msg is not defined
at Client.<anonymous> (c:\Users\linds\Downloads\MyBot\MyBot.js:86:16)
at Client.emit (events.js:326:22)
at MessageCreateAction.handle (c:\Users\linds\Downloads\MyBot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (c:\Users\linds\Downloads\MyBot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (c:\Users\linds\Downloads\MyBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (c:\Users\linds\Downloads\MyBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (c:\Users\linds\Downloads\MyBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (c:\Users\linds\Downloads\MyBot\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:314:20)
at Receiver.receiverOnMessage (c:\Users\linds\Downloads\MyBot\node_modules\ws\lib\websocket.js:797:20)
Process exited with code 1
Uncaught ReferenceError: msg is not defined
it’s message
why are you using message then msg
you have to use whichever one you declared in the listener
message and msg are not the same thing. They're obviously different.
whitenames i fucking swear
guys what are you talking about did you not see see the new ESNext version? They introduced msg === message
dude that's roleist
yeah
oh man javascript has conditions now? I've been waiting for this forever
parseInt(amount) as Hindsight suggested
ok
string - 0 😤
by the way you can just specify the amount in bulkDelete(), no need to fetch the messages
async function asyncCall() { await msg.channel.messages.fetch({ limit: amount }).then(messages => { // Fetches the messages
msg.channel.bulkDelete(messages)```
is this command correct
only if amount is a number, and only if it's between 2 and 100
ok
though you don't actually need to fetch the messages.
so why wont it do anything when i type the command
bulkDelete can directly take an integer and removes those messages directly
just message.channel.bulkDelete(NUMBER)
you also defined a function but you never called it
let around = parseInt(args[0]) or something
Your code is a mess
where did you copy paste it from
ignored 😔
you would benefit greatly from actually learning javascript before trying to make a bot. you need to get the basics down before doing something as advanced as a bot.
because anyone with a sip of js knowledge would like know how to fix it
and that 101 > 100 will always return tru
only real js programmers know that the secret to any comparison is
if(!truthy !== false)
you also defined a function but you never called it
fUCk
god, please go learn javascript. seriously.
Before you make a Discord Bot, you should have a good understanding of JavaScript. This means you should have a basic understanding of the following topics:
- proper syntax
- debuging code
- basic features (vars, arrays, objects, functions)
- read and understand docs
- nodejs module system
As much as we'd like to assist everyone with making their bots, we rarely have the time and/or patience to handhold beginners through learning javascript. We highly recommend understanding the basics before trying to make bots, which use advanced programming concepts.
Here are good resources to learn both Javascript and NodeJS:
Javascriptinfo: https://javascript.info/
Codecademy: https://www.codecademy.com/learn/javascript
FreeCodeCamp: https://www.freecodecamp.org/
Udemy: https://www.udemy.com/javascript-essentials/
Eloquent JavaScript, free book: http://eloquentjavascript.net/
You-Dont-Know-JS: https://github.com/getify/You-Dont-Know-JS
NodeSchool: https://nodeschool.io/
CodeSchool: https://www.codeschool.com/courses/real-time-web-with-node-js
Please take a couple of weeks/months to get acquainted with the language before trying to make bots!
never used it
you are too good for it flazepe
who the hell starred that
ok :>
i died at
if(1 < 2) {
msg.reply("")
}
I wont nxt time
maybe it's false in another universe
that if (1<2) is kinda cute tho
👀
if (true) console.log("true worked")
if (1 < 2) console.log("1 < 2 worked")
Console:
true worked
1 < 2 worked
Next level coding
if(input === 1) console.log(1)
if(input === 2) console.log(2)
if(input === 3) console.log(3)
if(input === 4) console.log(4)
if(input === 5) console.log(5)
if(input === 6) console.log(6)
maybe it's false in another universe
Lmao
MessageEmbed field values may not be empty???
let myObject = {
myFunction: function (){
message.channel.send(this === myObject)
message.channel.send(this === myOtherObject)
}
}
let myOtherObject = {};
myObject.myFunction.call(myOtherObject);
this and truthy.. 
whats the outcome? false true?
yeah O: it shows how this can be different in js
different from what?
other languages
@solemn leaf addfields takes an array
the problem is the addfleid
console.log the embed before sending, and you'll see which field is missing
It shouldnt be it thou
you gotta choose between pretty or fuck up mobile users
fuck up mobile = inline
not like non-inline will help them much either way
not like non-inline will help them much either way
inline truly shits out mobile embeds
(without FOooOOoOOoOOOoter)
just make an or
?
v.desc || "no value"
ah ok
or show off and use nullish coalescing
anyone know why im getting dis? ```js
MongoError: not authorized on lost-bot to execute command { find: "guilds", filter: { id: "446067825673633794" }, projection: {}, limit: 1, singleBatch: true, batchSize: 1, returnKey: false, showRecordId: false, lsid: { id: UUID("ab15804b-774b-4ef0-b616-a9be75e6a230") }, $db: "lost-bot"
works on my pc, but i move it to the vm and it errors
any ideas? this is the connection uri
did you try it with an account with admin perms?
null coalescing will let "" pass, which will error anyway
what perms does the account have?
does empty string not pass on fields?
mongodb://lost:da5dcd14c27c6c3cc69f81542b605a05a0df8524e@localhost:27017/lost-bot?authSource=lost-bot slightly modified, not the exact thing
i cant
why?
and that account was made by the admins
ooOh
nope, afaik empty string still throws the empty field error
no i mean same db on pc and vm
no, my pc: mongodb://localhost:27017/lost
vm: mongodb://lost:da5dcd14c27c6c3cc69f81542b605a05a0df8524e@localhost:27017/lost-bot?authSource=lost-bot
hmmmm
Is it possible to make all linked images at a fixed height and length?
what do you add after the image link?
not sure what u mean by perms, its just local host
when you make the account
account has perms
like "adminAnyDb" or something which is practically root
the admins made it, they're not responding rn so for now im just assuming so
can you compass in to see what you can do?
Hey guys
I am not using Java annotations, but am getting an error when importing a JVM package
I literally copy/pasted these files from the previous version of my bot, so they should work?
Hover over the red text. What does it say?
I'm wondering, should I go for TS or JS for a discord bot?
do you want type safety
do you wanna write more and make safer code?
ts
you a lazy cuck who assumes & believes unshakably in your ability to use js without bugs? go js
ts you type way more
but it makes up in production with way lesser bugs
you put more commitment into development and less into debugging/patching
your code WILL likely be 40% girthier btw
so expect to be typing and struggling quite a bit
that's true, I have experienced both, and when using JS, it was 90% of the time debugging.
creating interfaces, types, avoiding compiler errors/catching shit that would work on js, stuff like that
you'll have a great time typing twice as much in ts
How do I make a command which changes the bot's language in a guild? I don't really know how to translate stuff like that... Is there a lang feature I can use?
imma learn python with this https://codewithmosh.com/p/python-programming-course-beginners
any opinions?
ts also transpiles down to "proper" js, there's a good chance that you're going to get faster code from the transpiler making smart decisions a human otherwise wouldn't in js
^^
hmm i'll go for TS
Well, I know python, but how do I change the entire bot's language? Is there a database that I need to use?
unless you already pre-compiled
@leaden rover wdym
ts has types
but in the end it gets transpiled into js
strong typed, i should say
lol
yeah, it transpiles to js first, and then you can run the project
As in when someone uses the command, it changes the bot's language in the guild
ooooh
everybody ignored my message cuz of war btw ts and js
meaning your objects need to have their types set, string, number, etc
the typescript type checking is only at compile time
ok
tbh
the typescript type checking is only at compile time
@topaz fjord + PROPER js
since it gets compiled into js which doesn't have explicit types
but does that make it better than js it self?
I'd highly encourage you guys to at least watch this
https://www.youtube.com/watch?v=ahCwqrYpIuM&t=1s
TypeScript has forever altered the lives of JavaScript developers. Learn why TS is so awesome and the basic concepts required to be successful using it https://angularfirebase.com/typescript-the-basics/
Deep Dive https://github.com/basarat/typescript-book
TypeScript Docs http...
check video, it shows a lot of the perks ts has to offer
also can i use this js if(user.presence.status === ("dnd")) { ctx.drawImage(dnd, 20, 20, 35, 35); }
in the middle of canvas? i tried doing that but it doesn't draw anything
Why doesn't it give me the same size?
Why is he zooming in?
const DIG = require("discord-image-generation");
client.on("message", async (message) => {
if (message.content === "-change") {
let avatar = message.attachments.find(attachments=>attachments.url);
if(!avatar) return message.channel.send("> **قم بإرفاق الصورة مع الامر**");
let img = await new DIG.Greyscale().getImage(avatar)
let attach = new Discord.MessageAttachment(img, "William.png");
message.channel.send(attach)
}
});```
@misty sigil who are the lib developers ?
we don't know.
-.-
https://www.npmjs.com/package/discord-image-generation go there and see what u can find
@slender wagon I have a month I want to contact them and there is no response
can't help
switch to canvas or something
¯_(ツ)_/¯
generate your own images rather than relying on a 1-click lib that seems to be unmaintained
^
const prefix = "-"
client.on('message',message=>{
let command = message.content.toLowerCase()
if(command.startsWith(`${prefix}change`)){
if(!message.channel.guild) return message.reply(`**This Command For Servers Only**`).then(messages => messages.delete(2000))
if(!message.guild) return;
let args = message.attachments.find(file=>file.url)
if(!args) return message.channel.send("**Please send the picture.**");
message.channel.send(`https://some-random-api.ml/canvas/greyscale?avatar=${args.url}`);
}
});```
Even this is the same thing
I want it to convert the image to the same size and not bigger or smaller
client.on('message', (message) => {
let command = message.content.toLowerCase();
if (command.startsWith(`${prefix}change`)) {
if (!message.channel.guild)
return message
.reply(`**This Command For Servers Only**`)
.then((messages) => messages.delete(2000));
if (!message.guild) return;
let args = message.attachments.find((file) => file.url);
if (!args) return message.channel.send('**Please send the picture.**');
message.channel.send(
`https://some-random-api.ml/canvas/greyscale?avatar=${args.url}`
);
}
});```
here, much cleaner
Same thing, it enlarges the image
The embed image don't want to upload on my command, but before (when I installed this command to my bot) it sends it with no problem, can anyone help me ?
embed = discord.Embed(title = "Stats Command",
description = "They are the stats of my bot",
colour = discord.Colour.purple()
)
embed.set_footer(icon_url = "https://cdn.discordapp.com/avatars/341257685901246466/83a72d7485fe313cd0f0141f0b221943.png?size=4096",
text = "JeSuisUnBonWhisky#1688")
embed.set_author (name = "Unconnected Bot#8157",
icon_url = 'https://cdn.discordapp.com/avatars/543924044110626826/1341bf81b2289bf25bd0e5de2aafbad2.png?size=4096')
embed.add_field(name = "TopGG Page",
value = "[You can click on this link to see the bot page](https://top.gg/bot/543924044110626826)",
inline = False)
embed.set_image(url = "https://top.gg/api/widget/543924044110626826.png")
await message.channel.send(embed = embed)```
also why u checking for channel.guild AND message.guild?
i didnt change your code william, i simply formatted it
cuz you seem to not have a linter or a shit one at that
Well can you help me
can you tell me whats the issue?
I want to convert the image to black and white, when he converts it he converts it to a larger scale and not the same size as the image that you sent
also im pretty sure avatar is suppose to get a 1:1 ratio pic
likely cuz its stretching to fit
you are providing a non 1:1 pic
also i think you can use arguments for format
And when I convert a large picture, it zooms out
did you bother reading what i sent or you just throwing random info in chat?
It resizes all images to a fixed size
Save the file to disk, or open the URL in the browser, and see if it does the same.
If it does, it's the API's/module's fault.
did EITHER of you read what i sent?
yes
clearly not
1:1 image
look at the ratio of the image sent
avatars are suppose to be 1:1
I did, and I'm offering an alternative to try to see if it's the apis that do it or not.
What do you mean non 1:1 pic
¯_(ツ)_/¯
100x100
larger than it is taller
How do I get the information of an emoji?
example: /emoji 
1:1
It converts all images into 500 x 500
@earnest phoenix regex and throw its id into the api
@crisp meteor yeah, cuz thats whats its suppose to do
feed it a 1:1 ratio file
and like i said
you can use arguments
@crisp meteor right, so, that's your problem. Give it a square image, it gives you a square image in return. Give it a rectangle image, it gives you a square image anyway.
How do I fix this, I want it to convert it black and white at the same size that I sent
use a different API that doesn't resize.
add the params on the url
im fairly certain you can do ?width=YOUWIDTH%height=YOURHEIGHT
in the end of the url
usually if it only returns the image, i should say
message.channel.send(`https://some-random-api.ml/canvas/greyscale?avatar=${args.url}```
that ?
but you need to add extra queries
I finally made some working code
Such as ?
@sudden geyser it says "the import javax.annotation.Nonnull cannot be resolved"
you really dont read what i send do you?
im fairly certain you can do ?width=YOUWIDTH%height=YOURHEIGHT
I read, but I am not very experienced and did not understand you clearly
https://docs.some-random-api.ml/canvas/filters does not have width and height options.
so clearly, it's expecting a square image, and that's that.
you can pull from source
i think its doable
holdup
im assuming its a get request
either way, gimma a sec
i knew it
@umbral zealot
you can
its unrelated to their api
@slate oyster are you possibly missing it because it's supposed to be specified as a dependency?
actaully
OH I see what you mean. you meant the discord URL not the api one.
I did not understand anything 😭
@sudden geyser I'm not using Java modules, so I don't need to specify the packages I depend on
And it should be part of the JVM, not something I need to import through Gradle
It's just a Nonnull, so I might just remove it and move on with life
alternatively you could use a resizing api for it
though im fairly certain you can add params to most images
Can you give me a site api ?
you gotta look for one
shouldnt be that hard to find
i gotta say though, thats one sketchy domain name right there

It has rights, they put rights on the image
generate👏 your 👏 own👏 image👏 rather 👏 than👏 relying 👏 on 👏 sketchy 👏 api👏
How do I check if a time stamp is more than 3 days old
It was significant different last time I asked
you have the timestamp, yes?
Yeah I have the time stamps stored
divide by 1000(seconds), then 60(minutes), then 60(hours) then 24(days)
you can do that too
not days though
Yes how do I do that method?
wdym?
It was like date.now + 3 days > or < date.now
your method is exactly the same as mine but you adding time
see this?
divide by 1000(seconds), then 60(minutes), then 60(hours) then 24(days)
rather than dividing, you multiplying this and adding onto your timestamp
Except for the Blurple bot, I'd say image generation isn't even useful imo
urs => timestamp + (3 days worth in miliseconds) > date.now
mine => date.now - timestamp (then convert into 3 days worth from miliseconds)
both you'll have to convert 3 days from/to milliseconds either way
yeah google time conversion is pretty cool
What is the problem?
@earnest phoenix screenshot dont take pics wqith cellphone
Ok
what google is doing is the same what i said lol
divide by 1000(seconds), then 60(minutes), then 60(hours) then 24(days)
though multiplying
Should I make warns based on servers the user is in or based on users in the servers? Which take on the subject is the better one? Like either storing warns in serverData as of each user, or inside each userData store servers and warns in them
Actually not a screenshot. Copy/paste your code on https://hasteb.in/ but remove the token from the client.login!! @earnest phoenix
store warns by server per user
^
Store warns per server back if not then other servers can see their warns
mmmm token, tasty
^^
@earnest phoenix delete that picture and reset your bot token, you just 300IQ leaked your bot token
done
also makes it easier to remove a users data from your db's if needed
@umbral zealot done
ok so give us the URL you get from hastebin 😉
lmfao this man finna just leaked his token
but can anyone help me here, my bot is not registering a command that is clearly in its files, no matter if i remove a command, restart it, do whatever, it simply just wont register it
client.on=('message' , message => { <--- this is not valid javascript
ive removed another unrelated command that was working fine and the bot removed it and when i added it back it registered it just fine
if(!message.content.startwith(prefix) || message.outhor.bot) return; <--- this is not valid either, learn to spell author
lul
@earnest phoenix message.author.bot
code hardly misbehaves, its likely you doing some bad filter @left lake
startwith(prefix) isn't valid, it's startsWith
then the problem is your code
mfw copying extremely badly from a youtube video. someone needs new glasses.
wtf man thats so hard
even though its in its command folder, it isnt the command handler
startwith(prefix)isn't valid, it'sstartsWith
@umbral zealot won’t it not work either because it’ll be pretixcommand not prefix command
it isnt how im filtering the commands,
it simply just wont recognize the file itself for no apparent reason
So it wouldn’t start with the prefix if it’s !lol it would if it’s ! lol
show me ur file, your folder and the code that requires the file @left lake
@obtuse jolt uhhh... no... I'm pretty sure you're 100% wrong there my friend.

In fact I'm 100% sure you're wrong
I’m gonna test it
because that's args parsing I literally wrote myself, so...
this photo is from the server, and you can see the file (the one that isnt covered) within the commands folder (which yes i am currently in)
okay, good
i even tried to just put in a test file with nothing really in it but nothing still
next up, code requiring it
extension seems fine
js is case sensitive
by code requiring it are you referring to what is executing the command or the help command which is filtering them
aVariable is different than avariable
done
startsWith is a function that requires an argument, startwith is exactly nothing.
what language wouldn't be case sensetive?
done
can you even run the command(not the help, the actual file) ?
Pascal
no
SQL
ok.. nice
and it shouldn't be an issue with the way im filtering it since its in the same category of commands as some of my others
and those are showing up just fine
@left lake lemme check nonetheless
its clearly something there
if it was an oversight i might be able to catch it
2 heads > 1
the bot is online but he dont write
let funcat = commands.filter(c=> c.file.category === 'fun').map(c=> c.name).join(', ') this is whats filtering the commands by category
@earnest phoenix you should consider learning javascript before making bots. Please read:
https://discordapp.com/channels/264445053596991498/272764566411149314/757640324406313073
do this in your code rudy
ok thx
const tweettrump = require(./goosie/commands/trumptweet.js);
console.log(tweettrump)
fix the path and the name
cuz idk how your directory is handled
but i assume its root/commands/categories
Oi
i wanna see if it requires the file just fine
if it does, its your importer thats blurping
fun part with that is from the vps theres no way for me to log anything to the console 😐
send in chat a check then
i'd do the same thing on my machine where im self-hosting the testing version, but that bot isnt encountering any issues with that
if(message.channel.id === 'MY TESTING CHANNEL') message.channel.send(if(tweettrump))```
@left lake
zero response from the bot
the next time you send a message in that channel it'll send you true or false
needless to say, replace MY TESTING CHANNEL with some channel id you want to be testing in
just a quick patch to walk around the console issue
Hi, I'm trying to update an existing message with an other one that already exist too.
let changelog = new Discord.MessageEmbed()
.setTitle(":bookmark_tabs: **__Dernier changelog de NetBot__** :bookmark_tabs:")
setInterval(async () => {
client.channels.cache.get("757658326459744267").messages.fetch("757664985815056394").then(patch =>
client.channels.cache.get("757661526848176158").messages.fetch("757662070845079602").then(toChange =>
changelog.setDescription(patch.content)
.setFooter("Dernière recherche de changelog ")
.setTimestamp(),
toChange.edit(changelog)
)
)
}, temps)```
error : ``` ReferenceError: toChange is not defined```
I think I'm doing it wrong, can someone help me ?
i put the snippet you gave me inside of a command (since im too lazy to deal with my headache of the message client event)
:/
let me try requiring a command that works and see if its not my code
fam you gotta put commitment
no one ones how to cache users in djs?
fetch them and cache them?

users are cached automatically
😐
but if they're not you can fetch them
if its not a large guild
how to
client.users.fetch("id") for users. guild.members.fetch("id") for guild members (which does both)
okay
why async if you chaining .then()'s ?
@opal plank That's not really my question xd
how do you add the servers bot is in part in top.gg
how do you add the servers bot is in part in top.gg
after all of that still no response from the bot
needless to say that should be right under your message
dont know what else to do, the file is there, it has nothing to do with how im filtering the commands, my command handler isnt fucked up, the file exists and is there (with code that actually works)
if i add any other commands it wont show up on the bots help message (i.e doesnt exist)
i never said i was giving up i literally just told you the bot isnt responding
which means you are putting it in the wrong place
the MESSAGe
chief the message is being put in the right spot what
client.on('message' => if(message.channel.id === 'MY TESTING CHANNEL') message.channel.send(if(tweettrump))
yes
it is infact inside of a client message event
since i just put it in there 30 seconds ago
there has to be a response in that channel
if channel id match it sends it
thats about it
i just put it in there and the bot wouldn't respond to any command
within that channel
if its not sending you either put it in the wrong spot(or before a check) or you didnt put the right id
im just doing guess work, your best bet is to dump your index into https://paste.awoo.rocks/ and sending me the link so i can take a look at it
welp, anyway, im off to code now
gotta add some resolvers for my client cache
did i do this right?
is there a mysql tutorial in node.js?
are u coding in ur lessons xd
Ok that's code. Cool code 
Mmkay. tell me, what's your prefix?
const serverQueue = message.client.queue.get(message.guild.id);
(node:7844) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'get' of undefined
const serverQueue = message.client.queue.get(message.guild.id);
(node:7844) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'get' of undefined
@slender wagon message.client.queue is undefined
are u coding in ur lessons xd
@gentle lynx nope ELA
what is a prefix -_-------------------
client.on('message' => if(message.channel.id === 'MY TESTING CHANNEL') message.channel.send(if(tweettrump))
@opal plank THAT'S FUCKING WRONG
:c
https://hasteb.in/olegulah.php can someone tell me what is wrong
I'll repeat again: you need to learn javascript before you try to make bots
it is
no it aint
if you can't even understand what the prefix variable is doing, you do'nt know enough to make a bot
ik but i want do this than i learn
Learn javascript first, then make a bot.
like i said, my code, my compiler, my rules
@earnest phoenix you will most likely go nuts trying to make a bot without knowing js
wdym go nuts?
yes why not xD
manager.broadcastEval(`console.log(this.guilds.cache.get('${guilds[i].id}'));`) // this works
manager.broadcastEval(`this.guilds.cache.get('${guilds[i].id}');`) // this does not works (im trying to just get the result of this)
EJS + sharding... um
I keep getting (node:6204) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [ChildProcess]. Use emitter.setMaxListeners() to increase limit if i do the second one using ejs
its pretty easy to make a bot without knowing js
wait nvm
like i said, my code, my compiler, my rules
@opal plank you shouldn't give pseudocode to someone who's asking for help (which you did)
i think i know what i did wrong
Step 1: Watch and outdated video tutorial on youtube
Step 2: Get Errors
Step 3: Copy shit from stack overflow
Step 4: Ask around in #development servers for people to fix your code
Bot making in 2020
wait nvm
@shy turret node version manager?
im pretty sure v12 let me check
@earnest phoenix they did understand the gist of what i said
that was probably the fastest starboard I've ever seen in my life @opal plank , congrats.
@shy turret node version manager?
@earnest phoenix dont fucking tell me you dont know what nvm means
lmao ty
did u do node -v?
then thats the node.js version you are currently running
yes i do know
fetchClientValues seems very useful
i love watching all those undefineds coming on my console
<% for (var i = 0, len = guilds.length; i < len; i++) { %>
<% manager.fetchClientValues(`guilds.cache.get('${guilds[i].id}');`).then(check => { %>
<%= check %>
<% }) %>
<% } %>
i hate using sharding :))
you hate using sharding, imagine me who will likely scream and cry attemtping to cluster my twitch bot
f
oauth2 is ez
making a bot is ea--.. sharding FRICK
Gonna stream coding a bit
whats ur stream
[object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise] [object Promise]
funny
<%= manager.broadcastEval(`this.guilds.cache.get('${guilds[i].id}');`) %>
and i cant even use await
because ejs
r u OK?
@modest smelt no i can clearly not fine rn
with a website dashboard "no"
Why are you using ejs?
@cinder patio because it sucks
idk why but i spent 2 months making a model or something i was gonna make
["f","f","f","f","f","f","f","f","f","f","f","f","f","f","f","f","f","f","f","f","f","f","f","f","f","f","f","f","f","f","f","yay","f","f","f","f","f","f","f","f","f","f"]
ive been playing and this happened
XDD
f = cannot find server
yay = can find server
I am a beginner :c
oof
Fuck that was annoying
typeof NaN === 'number'
welp, the resolver is done at least
i can now call the streams directly via the method rather than searching for id on cache
is discord-canvas faster than canvas?
judging by the name, no, since its likely canvas but with extra code on top
i have to learn python for school now and also kotlin for a project that i'm developing with my friend
have u learned it?
i have no clue
but it is really slow
it takes up to 10 seconds to send a userinfo card
cof cof shit code cof cof
then you're doing something seriously wrong
Tim
my bot generates complex images with resolutions up to 4k x 4k in less than 1 second
then you're doing something seriously wrong
@quartz kindle damn u think so?
image generation anywhere should run smoothly if your cpu isnt a celeron
]]vps
it's a i5
I don't think there's anything like node-canvas for Rust
type n.tag host in #265156322012561408 @iron raven if you looking for vps's
are you sure its canvas that is slow?
alright.
yeah
thank you
have you measured individual components of it?
i smell shit host/pc
not really
console.time('canvas')
//do ur canvas thing here
console.timeEnd('canvas')
``` @slender wagon
aight
see how long its taking for the ACTUAL canvas
give me a sec
i wanna see the canvas alone timer without any other extra stuff in ur code
oh
it might not even be canvas whats slowing down your command
there's always native image generation with something like imagemagick
so u want me to test it in a clean file?
either work
aight
that'll just add a timer
does anyone know an vps hosting service that has paying method Paysafecard?
even if its in production it wont affect the command itself
wdym never eneded?
like log the time end?
if it logged it means it ended
oh my bad lmfao
0.134 MS?
ye
i was reading canvas docs
i had a feeling it wasnt canvas slowing down your command
canvas isnt that resource intensive
you can recycle my snippet
attach some random timers in your coed
see whats taking that big ass chunk of time
oh
api aboose
I think so xd
no
can what?
bad
very bad
xd
shoo we dont condone api spam/abuse
replace is an operation on a string
location is a string
you aren't doing anything
set the window.location with a setter
redirection like that is supposed to be done serverside though
as long as your bot shares the guild with the emoji, it can use it anywhere
I once ran some custom code on my bot to help a user ban users from a raid
They all had the same username, so I was able to just compare usernames for each user
I hope that wasn't considered API abuse...
I mean, the library I use automatically handles rate limits
Moobot: [1006, 869, 1011, 769, 799, 789, 961] = mean:886ms
Nightbot: [950, 876, 1002, 1008, 788, 766, 789] = mean:882ms
StreamLabsBot: [1131, 1004, 1102, 894, 751, 799, 978] = mean:951ms
Leviathan: [681, 412, 512, 551, 671, 413, 409] = mean:521ms
All hail aggressive caching. 300ms avarage difference in command response time on Twitch
Error: Traceback (most recent call last): File "main.py", line 85, in <module> main() File "main.py", line 44, in main 'Discord': roaming + '\\Discord', TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
if u are good in python pls DM me
i will give u nitro xbox if u help me fix
if you encounter a raid, the prune feature is there for a reason, also set your server to tableflip security level or whatever it's called
Oh, never heard of prune
(JS) Hi guys,
I have a question.
I tried to get Role using this:
let role = message.guild.roles.get("757697634050900029");
But Idk why it don't work, any help will be great thx 😄
@balmy anchor if it helps here's how i did smth with a verification to get a role :
client.on('message', async message => {
if(message.author.bot) return;
if(message.channel.id === '727664831381110834')
await message.delete();
if(message.content.toLowerCase() === '.f verify' && message.channel.id === '727664831381110834')
{
await message.delete().catch(err => console.log(err));
const role = message.guild.roles.cache.get('719164888337088552');
if(role) {
try {
await message.member.roles.add(role);
console.log("Role added!");
}
catch(err) {
console.log(err);
}
}
}
});
Oh, ok I'll try thx 😄
can someone help me with why isn't this getting sent in the channel as an Embed message?
if (command === config.folder[i] || command === "aesthetic") {
if (command === "aesthetic")
{ i = Math.floor(Math.random() * config.folder.length); }
folder = i;
fs.readdir('./' + config.folder[i], (err, files) => {
number = files.length;
if (!args.length || command === "aesthetic")
{ imageNumber = Math.floor(Math.random() * number) + 1; }
else
{
imageNumber = args[0] * 1;
if (imageNumber > number)
{ return message.channel.send(embed)("Possible arguments: " + config.prefix + command + " [1-" + number + "]."); }
}
console.log(imageNumber);
message.channel.send(embed)({files: ["./" + config.folder[folder] + "\\" + imageNumber + ".jpg" ]} )
message.channel.send(embed)({files: ["./" + config.folder[folder] + "\\" + imageNumber + ".png" ]} )
message.channel.send(embed)({files: ["./" + config.folder[folder] + "\\" + imageNumber + ".jpeg" ]} )
message.channel.send(embed)({files: ["./" + config.folder[folder] + "\\" + imageNumber + ".gif" ]} )
});
return;
}
}
});
don't spoonfed code
sorry
@balmy anchor if it helps here's how i did smth with a verification to get a role :
client.on('message', async message => {
if(message.author.bot) return;
if(message.channel.id === '727664831381110834')
await message.delete();
if(message.content.toLowerCase() === '.f verify' && message.channel.id === '727664831381110834')
{
await message.delete().catch(err => console.log(err));
const role = message.guild.roles.cache.get('719164888337088552');
if(role) {
try {
await message.member.roles.add(role);
console.log("Role added!");
}
catch(err) {
console.log(err);
}
}
}
});
@shy token I tried it and It showed this :
(node:10696) UnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied roles is not a Role, Snowflake or Array or Collection of Roles or Snowflakes.
at GuildMemberRoleManager.add (C:\Users\Amitai\Desktop\Development Folder\JS\Discord Bots\Icy Discord Bot\node_modules\discord.js\src\managers\GuildMemberRoleManager.js:93:15)
at Client.<anonymous> (C:\Users\Amitai\Desktop\Development Folder\JS\Discord Bots\Icy Discord Bot\index.js:34:30)
at WebSocket.onMessage (C:\Users\Amitai\Desktop\Development Folder\JS\Discord Bots\Icy Discord Bot\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
(node:10696) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:10696) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated.
no sorry
hey, is there anyone who knows java?
@torpid forge I do know Java but I don't use JDA if this is the question
@balmy anchor wanna get in a call and try to solve it?
@balmy anchor wanna get in a call and try to solve it?
@shy token I just tried it again and it worked sorry I forgot to say thanks haha lull 😄
wdym "manipulator"?
I dont even know this myself, probaby doesnt matter
idk 🙂
i guess not
i dont even use those things
i started from using SpigotAPI for minecraft as I started with java
np
@shy token
do you how do I add a role to multiple people and not only one?
I mean they have to add it to themselves
by reacting to something
that's the most legal way
oh, I want to add it to 10 people lol
O K
lazy boi
Turns out the canvas problem was just my internet lmao
Learn it then
Turns out the canvas problem was just my internet lmao
@slender wagon KEK
What does kek means and why are u screaming it
@balmy anchor good luck with it buddy <3
tyty <3
so could anyone help me figure out why isn't my math.random not sending the files as an embed message? : ```js
if (command === config.folder[i] || command === "aesthetic") {
if (command === "aesthetic")
{ i = Math.floor(Math.random() * config.folder.length); }
folder = i;
fs.readdir('./' + config.folder[i], (err, files) => {
number = files.length;
if (!args.length || command === "aesthetic")
{ imageNumber = Math.floor(Math.random() * number) + 1; }
else
{
imageNumber = args[0] * 1;
if (imageNumber > number)
{ return message.channel.send(embed)("Possible arguments: " + config.prefix + command + " [1-" + number + "]."); }
}
console.log(imageNumber);
message.channel.send(embed)({files: ["./" + config.folder[folder] + "\\" + imageNumber + ".jpg" ]} )
message.channel.send(embed)({files: ["./" + config.folder[folder] + "\\" + imageNumber + ".png" ]} )
message.channel.send(embed)({files: ["./" + config.folder[folder] + "\\" + imageNumber + ".jpeg" ]} )
message.channel.send(embed)({files: ["./" + config.folder[folder] + "\\" + imageNumber + ".gif" ]} )
});
return;
}
}
});
it just sends it as a normal image
-_-
been stuck the whole day
It's working! Thank you so much @torpid forge 😄
@torpid forge do u know how do I server mute ppl?
I mean, for example: the bot has adminstrator so he can use Server Mute on people no?
it checks boolean
@torpid forge ik
oh ok thx
ill check how to server mute ppl now
;(
wai
tbbruh
burh
@torpid forge welp i dont understand
{ i = Math.floor(Math.random() * config.folder.length) --> config.folder[Math.floor(Math.random() * config.folder.length)] }
^
ReferenceError: Invalid left-hand side expression in postfix operation
Does anyone know how to server mute everyone on the command's author voice channel?
@balmy anchor u down to code and lofi and chill and help each other?
im talking w/ my friend who i didnt talk to him alot,
ill talk with ya later ok?
?
client.on('message', (message) => {
if (message.content == '/muteAll') {
let channel = message.member.voiceChannel;
for (let member of channel.members) {
member[1].setMute(true)
}
}
});
this should work
i know its the same thing i saw
he's using a library or something i guess
cuz i tried it and it didnt worked
ummm
from?
How can i fix that
ok
@astral matrix u put :exerin: as description and not as .setTitle('Some title')
i think
Emotes cannot be in a title
oh yeah u can't use emotes
1/10 ?
What are u trying to do?
@balmy anchor the thing we both saw is from 2018/06
ik
@balmy anchor i love it
ty 😄
that should work i guess?
Yay!!!!!!!
It workedddddd
@digital meadow i cant use emoji in description too
@balmy anchor defo not hahah
<:name:id>
<3
nice
You need to be in the server the emote is
Lol
Lol
...
this does not look related to development in any way 
guild.users.cache.size is not accurate (discord.js)
that returns only cached users
Thats the cached size
Mmmhm
@errant perch guild.memberCount
ah yes
why does my code automatically jump to this even when my args[0] is something else
@worthy glacier you should use a switch
Because that's not how you do or/and operating
what did i mess up on
args[0] == "..." could be false, then you're defaulting to a string which has content in it, which is considered truthly.
What you should do instead is also check if that string is equal to that arg
For example: args[0] === "..." || args[0] === "..."
so args[0].toLowerCase
no
quick question
when port forwarding, it only allows 192.168.0.x ips
can i set address with 192.168.1.x
can i set address with 192.168.1.x
@exotic zephyr well if that's on your router's config. It probably means it's only using a certain subnet 192.168.0.* and not 192.168.1.*
So, no you can't. Unless you tell your router you want everyone to use that subnet
Why do you want to change it?
You'd have to change the whole subnet and gateway address
i tried changing ipv4 and wifi settings, but it stays the same
nvm, ill figure something out
its not
Then there is a device mismatch
Do you have a modem and a router as two separate devices?
lul
when i enter router LAN users
it shows different addresses.. they all start with 0
And cmd shows .1.x?
xd
Oi alguém aqui fala português?
Sim, porém neste canal não é permitido falar outros idiomas além de inglês

freecodecamp for example




= !