#development
1 messages ยท Page 827 of 1
are you running the bot on your own pc or some vps
hm, ive seen this error once before and it was a problem with building the native module on one platform and then using those compiled modules on another platform
ex. copying the bots files straight from say, a windows machine, to a linux machine
Ye.
That's what I'm doing.
I need to upload the node_modules from my PC to the Machine as the npm doesn't work on the machine.
ah, yeah you cant do that
Is there anyway i can do to fix it?
npm probably has some rebuild command
I'll send the error.
try npm rb
Unhandled rejection Error: EROFS: read-only file system, mkdir '/root/.npm'512ff
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://npm.community>
root@85741d70-ac7f-4be4-96eb-90cc39857676:/app/data/DiscordBot# npm rb
> canvas@2.6.1 install /app/data/DiscordBot/node_modules/canvas
> node-pre-gyp install --fallback-to-build
sh: 1: node-pre-gyp: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! canvas@2.6.1 install: `node-pre-gyp install --fallback-to-build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the canvas@2.6.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I got same error when I trying to install canvas ๐ก
could i ask what version of npm and node youre runnin
node v10.x
hm
im reading online that you might wanna try appending --no-bin-links to the install command. overall however, this sounds like a permissions issue in that your user account doesnt have write access to that directory. i dont have confident working knowledge of linux however to help much further with that. maybe try googling about linux permissions and how to change them
> node-pre-gyp install --fallback-to-build
sh: node-pre-gyp: command not found
npm WARN discord.js@11.5.1 requires a peer of @discordjs/uws@^10.149.0 but none is installed. You must install peer dependencies yourself.
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! canvas@2.6.1 install: `node-pre-gyp install --fallback-to-build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the canvas@2.6.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
How'd i do to install back versions of djs?
k
npm WARN discord.js@11.6.2 requires a peer of @discordjs/uws@^10.149.0 but none is installed. You must install peer dependencies yourself.
o
just a warning
yeah
Please help me
I want to add pic to my bot page
How can i do that
I just have link of pic
I want to put my pic in full size
Pic link https://cdn.discordapp.com/attachments/688681667631906840/688685259545772042/20200315_151902.jpg
bot.on('guildMemberAdd', async member => {
const welcomechannel = await con.prepare('SELECT welcomeid FROM config WHERE guildid = ?').get(member.guild.id);
if (!welcomechannel) return;
const canvas = Canvas.createCanvas(700, 250);
const ctx = canvas.getContext('2d');
const background = await Canvas.loadImage('./wallpaper.jpg');
ctx.drawImage(background, 0, 0, canvas.width, canvas.height);
ctx.strokeStyle = '#74037b';
ctx.strokeRect(0, 0, canvas.width, canvas.height);
// Assign the decided font to the canvas
ctx.font = applyText(canvas, member.displayName);
ctx.fillStyle = '#ffffff';
ctx.fillText(member.displayName, canvas.width / 2.5, canvas.height / 1.8);
ctx.beginPath();
ctx.arc(125, 125, 100, 0, Math.PI * 2, true);
ctx.closePath();
ctx.clip();
const avatar = await Canvas.loadImage(member.user.displayAvatarURL);
ctx.drawImage(avatar, 25, 25, 200, 200);
const attachment = new Discord.MessageAttachment(canvas.toBuffer(), 'welcome-image.png');
welcomechannel.send(`Welcome to the server, ${member}!`, attachment);
});
``` Error welcomechannel.send() isnt a function...
ion. This error originated either b
y throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id:1)
When it clearly is.
@pine aspen, you need to fetch the channel
const wCh = client.channels.get(channel ID);
any ideas what i could code?
not really
Not really
Anybody here have experience with the Electron module? Receiving the following error even when running the Project as "Root Admin"
[142:0317/121723.928276:FATAL:setuid_sandbox_host.cc(157)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /rbd/pnpm-volume/c187cd94-66ca-4b81-ba61-33382c33ef97/node_modules/.registry.npmjs.org/electron/7.1.14/node_modules/electron/dist/chrome-sandbox is owned by root and has mode 4755
Does anyone ever have an issue where there bot isn't able to connect?
I just restarted my bot, without changing anything, and it isn't connecting to Discord at all
Are you getting a "Something took to long to do" error?
No errors, not connecting for what is 5 minutes now
discord is laggy
Yeah they are very laggy lately
in how many servers your bot is?
300~
What lang?
Discord.js
If it's JS you can scroll and find Tims force ready method that he posted earlier
Oh interesting
I restarted it a few more times, and it finally connected after a few minutes
But still it's odd that it would sit in limbo
Not connecting or timing out
Yeah discord has been having that bug lately if I have to restart my bot for any reason sometimes it hangs
But eventually it connects
Np
@stoic gate https://discordapp.com/channels/264445053596991498/272764566411149314/689186559886360597 here's the link to that method I was talking about
Oh awesome thanks!
Np again lol
I got a question
what you to make your bot run
?
wot
how do you bulk delete messages in v12.0.2
channel.bulkDelete()
could anyone maybe give me tips on how to optimize the discord.js caching
as wel all know discord.js caches a lot
the easy way is regular sweeping
the hard way is modifying it
for sweeping check this https://discordapp.com/channels/264445053596991498/272764566411149314/685609266488410112
I guess you can use intents to block certain events, which results in those things never being cached
ยฏ_(ใ)_/ยฏ
Intents sure lower CPU and RAM usage if that's what you're looking for
I just want to lower ram usage
eh
"use .open FILENAME"
Hey
https://minecraftskinstealer.com/achievement/20/New+Poll+by+Syn/Guys+poll
I'm trying to make a command to create this.
how could i do to replace the spaces in the args to +
(" " => "+")
not mozilla TRIGGERED
What is the uptime of bot ?
No just what is it xD
yes
Thanks xD
@modest maple
corrupted :o
to see if a value (ie, result of a function) is a promise: if(typeof result.then === "function")
to see if function is async: if(function.toString().startsWith("async"))
another way: if(function.constructor.name === "AsyncFunction")

open discord developer page
ok
there should be an oauth link generator
ok
Isn't constructor.name kind of unreliable?
give screenie
Because it's the name instead of something like the instance. Like doing (async () => {}).constructor === (async () => {}).constructor was true (and AsyncFunction is not taken). It's more one of those situations that'll never happen, but not bullet-proof
anyone know how I would use node-ffmpeg like ytdl?
@quartz kindle tks)
Is anything in js bullet proof? Lmao
Hey, how could i fetch a member agian from args?
v11 or v12?
JS is wack
v11
https://nmw03.wheres-my-ta.co/Lo2sVZ.png
is there any way to get this size
I need help on something discord.js version 11
Each time my bots logs it does this ....
My code is this ...
//Leaves A Guild
client.on("guildDelete", async(guild) => {
client.channels.get(`688812916639924286`).send(` Left guild **${guild.name} [ ${guild.id} ]** \`[ Now connected to ${client.guilds.size} servers ]\``);
console.log(`[ Guild Leave ] ${guild.name} (${guild.id})`);
});
are you sure its not djs v12?
Looks weird
Yes i have version 11
can ss package.json
and then do console.log(guild.toArray()) on the guild leave event
commando?
I have some unwanted things installed
and then do console.log(guild.toArray()) on the guild leave event
@heavy marsh
hold on doing it
@restive furnace Welll nothing now ... it just logged in fine ๐
What??
kick it from ur guild and then add it back
https://cdn.danbot.xyz/cq1s22cM
@heavy marsh 11.4.2 ??
yep
@restive furnace ```js
[18/03/20 14:27:49] [ERROR] (node:14) UnhandledPromiseRejectionWarning: TypeError: guild.toArray is not a function
at Client.<anonymous> (/home/container/tutorialBot.js:88:19)
what would be the best javascript lib for a bot thats the size of 2,000 guilds? (and sharded) I'm currently using discord.js and not sure if I should change libs for performance
eris doesn't use as much memory as discord.js
^
okay thanks
hey so
this is a part of my command handler:
client.commands = new Map();
fs.readdirSync("./commands").forEach(file => {
client.commands.set(file.split(".")[],require("./commands / file"))
});```
it says
An element access expression should take an argument.ts(1011)
on the brackets
by the require
and
just check admin
@hidden spindle the permission the bot will have when it joins the guild
๐ฅณ
But if i click the checkbox i will automatically have it?
not u
Because it has a permission integer field below
cool
i was wondering because since it gave me a integer, i thought i had to use some command with that integer to actually make the bot have admin privileges
thanks shiemi
np
it was a value which determines which permissions should the bot role have when it's invited
you shouldn't check admin and instead check perms which your bot needs
having those values in the invite url however does not guarantee that your bot will actually have the perms on invite
What if discord decides to force their api version up, would eris be affected?
all libs would be affected and a lot would migrate
though discord gives a few months notice when they update their gateway versioning
^
before the old gateway versions go down
imagine using the 1st discord version to every exist
help
const client = new Discord.Client();
client.commands = new Map();
fs.readdirSync("./commands").forEach(file => {
client.commands.set(file.split("."),require("./commands / file"))
});
let prefix = ";";
client.on("message", message => {
if(message.author.bot) return;
if(message.content.startsWith(prefix)) {
let command = message.content.split(" ")[0].slice(prefix.length);
if(client.commands.has(command)) {
client.commands.get(command)(message).catch(error => {
})
}
}
});
client.on("guildCreate", guild => {
});
client.on("memberAdd", member => {
});```
i have that
and getting api banned
you need to define fs
LOL
@naive mantle u need the fs module
what is it
did you know that early discord gateway and api didn't have ratelimits at all
npm init fs?
add const fs = require('fs') to the top
Object.values(require("mongoose").models).forEach(model => model.collection.stats(function(err, results) {
console.log(results.totalSize);
}))```
this is my code
result is a 20480. what is 20480? byte?
consult with the docs
@finite bough do you say npm i fs to download
they exist for a reason
yes
k ty
and then define it
fs is there by default, right
kk
what
not u
consult with the docs
@earnest phoenix ty i found it
imagine using an outdated lib
like u? nah
anyhow
oke
you're not giving enough info of what the error is
^
oke
at validateString (internal/validators.js:120:11)
at Module.require (internal/modules/cjs/loader.js:1029:3)
at require (internal/modules/cjs/helpers.js:72:18)
at C:\Users\littl\Downloads\Bot Storage\index.js:9:39
at Array.forEach (<anonymous>)
at Object.<anonymous> (C:\Users\littl\Downloads\Bot Storage\index.js:7:30)
at Module._compile (internal/modules/cjs/loader.js:1147:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
at Module.load (internal/modules/cjs/loader.js:996:32)
at Function.Module._load (internal/modules/cjs/loader.js:896:14) {
code: 'ERR_INVALID_ARG_TYPE'
}```
@earnest phoenix so you could send more than 5 messages a second if you wanted to?
pie what did u do
not recommended @grizzled raven
ratelimit lol
nothing
bruh
i just installed fs
bruh
its already installed
did you know that early discord gateway and api didn't have ratelimits at all
cry#2046
you just need to define it to your code
client.commands.set(file.split("."),require("./commands" / file)) has something to do with it
try adding const fs = require('fs') on the top
yeah @grizzled raven
i have that
what
can you like
what
stop acting like a 9 year old
is that the full code?
define file
const client = new Discord.Client();
const fs = require('fs')
client.commands = new Map();
fs.readdirSync("./commands").forEach(file => {
client.commands.set(file.split("."),require("./commands" / file))
});
let prefix = ";";
client.on("message", message => {
if(message.author.bot) return;
if(message.content.startsWith(prefix)) {
let command = message.content.split(" ")[0].slice(prefix.length);
if(client.commands.has(command)) {
client.commands.get(command)(message).catch(error => {
})
}
}
});
client.on("guildCreate", guild => {
});
client.on("memberAdd", member => {
});```
thats the code
wait
something is wrong
also paste your code in https://paste.mod.gg or any other service you're cluttering the chat
whats the error
C:\Users\littl\Downloads\Bot Storage>node .
internal/validators.js:120
throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
^
TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received type number (NaN)
at validateString (internal/validators.js:120:11)
at Module.require (internal/modules/cjs/loader.js:1029:3)
at require (internal/modules/cjs/helpers.js:72:18)
at C:\Users\littl\Downloads\Bot Storage\index.js:9:39
at Array.forEach (<anonymous>)
at Object.<anonymous> (C:\Users\littl\Downloads\Bot Storage\index.js:7:30)
at Module._compile (internal/modules/cjs/loader.js:1147:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
at Module.load (internal/modules/cjs/loader.js:996:32)
at Function.Module._load (internal/modules/cjs/loader.js:896:14) {
code: 'ERR_INVALID_ARG_TYPE'
}```
oh somethings wrong with validators.js
index.js line 7
learn how to read your own errors
what
you cant divide strings
bro tim taught me how to do this
+
he lies
he dies
did he teach you or did you copypaste without knowing what you're actually doing
because i'm betting it's the latter
me too
he taught me how to act like u understood everything but in reality i did nothing
oh ok
._.
๐
oki
hold the darn dang up
i defined client but it said its not def-
oh i didnt save
lmao
@finite bough how do i define bot
client is defined as the user
i need a const for bot
that is the bot
:/
Guys, im finding different answers online on how i can select a channel to send a message,
const general = channels.find(channel => channel.id === '689470905612632079');
and tried this
const const general = channels.get(channelId)
thats the bot
both didnt work
gives me an error
fuck am i doing wrong xD
ok
const const is not a thing
@hidden spindle 1st
const channels = client.channels;
nope
never defined a guild
add guild
module.exports = async function(message) {
message.reply("Pong!");
}```
try message.guild
depends upon ur command handler
client.commands = new Map();
fs.readdirSync("./commands").forEach(file => {
client.commands.set(file.split("."),require("./commands/"+file))
});
let prefix = ";";
client.on("message", message => {
if(message.author.client) return;
if(message.content.startsWith(prefix)) {
let command = message.content.split(" ")[0].slice(prefix.length);
if(client.commands.has(command)) {
client.commands.get(command)(message).catch(error => {
})
}
}
});```
what do u think u r doing wrong
everything is right
i just need to know how
i can execute my commands
with a certain message
new Discord.Guild(client, data);
thats what i found, on data i just pass the id of the server i want?
try ;ping
i guess i didnt really understood what a guild is
a server
since my bot is already on my server
guild is a server
why does it also need a guild?
define the server
๐ค
Maybe you're looking for channels.cache.find
you can do everything with guild
._.
Like, i already have the bot on my server
its kinda confusing, since i also need to code it into a guild
what discord.js version?
newest
are you using the guildCreate event
nope
12v?
i just invited him
what are you using
yea
try this
lemme post my code, is very small
so far i have this
const Discord = require("discord.js");
const { timezone, generalId } = require('./config.json');
const CronJob = require('cron').CronJob;
const client = new Discord.Client();
client.login(process.env.BOT_TOKEN);
client.on('ready', () => {
console.log('The bot is up!');
const channels = client.channels;
console.log('channels', { channels })
const general = channels.find(channel => channel.id === 'x');
console.log('general', { general })
console.log('config.js', { timezone, generalId });
});
https://prnt.sc/rigyyy why doing this
lmao your login is last
it doesn't matter where it's put
^
^
oh
As far as i know it doesnt matter
my immersion tho
i am looking for the objects methods @tight plinth
did you get any error?
@finite bough can u help me now
i thought since it was a map it would have a .get method
but i didnt
since maps on js have the get method
try adding .cache
yea
imma try that
the error was that the .find method doesnt exist on channels flazepe
yeah add a .cache
JUST DO IT
shh
shiemi help me pls
@naive mantle did u make the command handler
no
tim did
then he forced me
to understand what it did
can you just like,,, tell me how my commands can actually do the work
You mean find an emoji by it's ID?
message.guild.emojis.cache.get(emoji => emoji.name === 'angeryBOYE')``` gives me undefined. Anyone knows why?
does it exist in the guild
no
someone pls help
it's emojis
nvm
is get same as find?
true
like var, const, let have differences
var & let are different?
can like someone actually do my command handler help
lol
๐
yes
oh
idk from where did u get that command handler
get it done
because
@naive mantle no one here will "do a bot for you"
my brain doesnt work like that
are you trying to make your own command handler? What exactly are you trying to do (as in explain)?
i need someone to explain
use thos
my command handler works
First 500 people will get 2 months of Skillshare free: https://skl.sh/polymatter4
Patreon: https://patreon.com/polymatter
Twitter: https://twitter.com/polymatters
Reddit: https://reddit.com/r/PolyMatter
Discord: https://discord.gg/polymatter
Itโs become popular to encourage ...
but when i use the prefix
cry
then say the command name
pls
the command doesnt run
@earnest phoenix xD
@earnest phoenix yes
2 days ago
your issue is that you're depending on other people without having a clue about what you're actually doing
2 days ago
exactly
sry caps
kappa
ys
What is the preferred way of starting specific id shards with a shardingmanager (possibly even less ids, than there are totalShards, because the other ids will be started on another machine)?
My approach from old to new:
coz u need to do it
Try to debug it and see what variables you set are incorrectly being parsed
https://canary.discordapp.com/channels/264445053596991498/272764566411149314/689854042645594188
https://prnt.sc/rih4ln
no
developing doesn't work like that. you can't faceplant into making a discord bot without knowing the fundamentals first; it isn't how it works. you need to learn and familiarize yourself with the language you're working with
im not giving out names because i dont wanna be rude
logic says it works
Linck I think there's a options.shardList option.
js says no
Where the fuck do i find that on the docs tho?
but I don't know if it's preferred or not
https://discord.js.org , @hidden spindle
the fucking docs
please dude
read
there's literally a property called cache that returns a collection
in the channelsmanager
ima just not do a command handler
edit : .find works
i was looking at the channels class
not even slightly confusing i guess
back to using event commands
@earnest phoenix animated emoji and normal emoji have no difference when u r trying to find htem
them
๐ฟ
you know what's even a better idea? learning the language first instead of complaining how you don't understand a single thing you're doing
@sudden geyser oh so shardlist i can set before spawning? i thought thats just the post getter of the shards
@earnest phoenix thats not helping
it very much is
but ig because i have a friend
I don't know if it's preferred or not, but it's in the docs: https://discord.js.org/#/docs/main/stable/class/ShardingManager
:/
and what events are even
a think
thing
and he also told me how to do javascript
not properly
wdym alessandro
i can do this out of the top of my head
bot.on("message", (message) => {
if (message.content === ";ping") {
message.reply("Pong!");
};
});```
what r u trying to do
yes you do
bruh
and you just saw that here
moron
yes, they are, because theyre the ones
that made them
๐
the docs dont help me understand
and that is EXACTLY WHY you need to learn the concepts themselves, the docs are going off by the knowledge they assume you already have (which YOU ARE SUPPOSED TO HAVE)
and which
you do not
saying that discourages me because i dont have any docs that tell me how
pie
hey you know what's encouraging? learning the damn language
cry is right but sadly these arguments shouldn't be continued here but DMs
if u tell me the purpose of every line in ur command handler
ez
i will make a better command handler myself
i already deleted my command handler along with all my code
letting them learn themselves is better than screaming to learn the language imo
wt
that's your choice
._.
yall just discouraged me and now i dont wanna do it
that's actually
because apparently ill never know the language
it starts with a p
pure negativity
that's wrong, you said you don't want to learn the language and that you do not need to learn it.
and now he give up
pls stop fighting
because i never learned how to understand it
BRO CAN SOMEONE JUST GIVE ME A DARN INTRO
ummm that's why you learn
give intro
w3schools xD
xD
just give me an intro
even that works
actually
w3schools is a bad source for learning JS. Use a site like Codecademy, but learn to browser docs like Mozilla. Find out how to learn it your way, it's not a straight line and will take a while.
i like how when i ask for the docs you dont give me then anymore
there are a ton, and i mean millions, of courses online which are able to help you understand the language better. we aren't here to help you learn it, we're here to help you with a problem which is expected of you that you had already diagnosed it
In this #Discordjs video we show you how to:
- NodeJS Setup
- Ready Event Setup
- dotenv stuff
Discord.js #Github:
https://github.com/The-SourceCode/Discord.js-Bot-Development
Series Playlist:
https://www.youtube.com/playlist?list=PLdnyVeMcpY78Hz8fFD1vqhYliBmZKaa7N __...
not docs
no
an intro
thank you
even worse
stop using youtube tutorials
shh
help yourself
better than fighting ww3 here
do not watch YouTube tutorials.
oopsie
what happened to that thing
a youtube tutorial taught me how events work
yikes
so i just forget that knowledge
bad idea
then i started reading the docs
yeah but whenever i do everyone gets mad at me because i shouldnt
Hello how can i make simple chatbot? Ping me with answer
@shadow shale depends wdym by chat bot
watch them outdated information
@pale vessel shhhhhhhhhhhhhhhh
really
@shadow shale depends wdym by chat bot
@finite bough i mean like it will sort off chat with you
docs is the most reliable and up to date source
youre trying to make me learn outdated
the whole point of programming is that you're free to logically resolve problem in your own way. using youtube tutorials does not help you think nor develop skills for yourself, you're just being a sheep, like you are in school, doing what you're being told to do without any explanation as to why and any concepts.
if you cannot resolve logical problems yourself and think logically, in steps, programming isn't for you.
someone just give me the docs already
to what
what
@shadow shale do u have basic discord.js knowledge?
JavaScript lol
@naive mantle https://discordjs.guide/
no
bad
bro
ah yes
which one do i use
@shadow shale do u have basic discord.js knowledge?
@finite bough um no if its javascript yee and i mqinly developing in python
ok
@shadow shale its ok try searching for some chat bot modules in python
mozilla has amazingly written documentation which goes over almost every aspect in javascript
tldr
reading comprehension; read with understanding
think about what you're reading
yes
i need eye bleach everytime i enter this channel
i've never used it pie, but you're free to look up reviews
i use codecademy for a lot of programming courses i take
since my school covers the membership
they said use this
courses != documentation
</p>
<p>text</p>
wait wtf
^
JavaScript is arguably more difficult to learn than related technologies such as HTML and CSS. Before attempting to learn JavaScript, you are strongly advised to get familiar with at least these two technologies first, and perhaps others as well. Start by working through the following modules:
Getting started with the Web
Introduction to HTML
Introduction to CSS
skip css and html
ok
you can skip over html and css
nope
now im actually getting into something i need to know
JavaScript contains a standard library of objects, such as Array, Date, and Math, and a core set of language elements such as operators, control structures, and statements. Core JavaScript can be extended for a variety of purposes by supplementing it with additional objects; for example:
yes, learning about data types is the single most important thing in any language
if you know what kind of data you're dealing with, you know what you can do with it
client side is a browser
server side is what gives information for a browser to connect to
ie: the server that contains the website
so client side cannot run without server side?
ok
if you make a client, that does not connect to anything, it doesnt need a server
This means that in the browser, JavaScript can change the way the webpage (DOM) looks. And, likewise, Node.js JavaScript on the server can respond to custom requests from code written in the browser.
node.js can be both
no
javascript is a language that requires an "interpreter", which is a program that executes the code. node.js is an interpreter, browsers are an interpreter, everything that you use javascript on, is a javascript interpreter.
A server means it receives requests and returns information, a client means it requests information and receives it.
visual studio code is a code editor / IDE (integrated development environment), it is not a server. visual studio code saves your code and tests it using an interpreter like node.js to show you the result. it doesnt give or receive information from anywhere, it just takes the code and tests it using an interpreter
so node.js is the server side
when you see artices and tutorials about clients and servers, they are talking about one of the possible uses of javascript, browsers and node.js, but a lot more can be done, node.js is not strictly for servers although many use it as a server
in the case of discord bots, node.js becomes both a client and a server
its a client for the discord API, but also a server that can receive and return requests if you want to
the library "discord.js" is a discord client
this is what its teaching me rn
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions```
the console is the primary output of any javascript program, whatever interpreter you're using to run it, will show the results using the console
in your case, youre using the browser as the interpreter, and the browser's console as the output
if you use node.js, you will be using node.js as the interpreter, and the terminal where node is running as the output
sorry to interrupt you Tim, but when will this course end?
who knows
js is a lot
that's mostly for websites
its teaching me html. instead of. javascript.
alert only exists in browsers, it does not exist in node.js
which is what js is intended to
yea
So I reported a bot on another server, how long does a review take.
SPA as your bot page ๐ฉ
it says saying use strict does this
``1. Massively improve performance.
-
Prevent stupid semantics in JavaScript that trip up beginners.
-
Prevent code snippets executed in the console from interacting with one-another (e.g., having something created in one console execution being used for a different console execution).``
so like
if you have big code chunks
they dont interact in a different way
than intended?
Ohh I was reporting a bot, the report said to join this server and a moderator would message me if more information was needed.
@pale vessel am i right or wrong
Just didn't know how long that process took
strict mode basically doesn't allow you to use poor features
hello! Can somebody may help me with the bot? OAO
OK
so its like, ew no. here, do the harder version
When bot cannot send embeds, they error. What is a way to check if a bot can embed links? if you check guild-wide, it does not apply for specific channels
What do you need help with (Akaya)?
do the harder and safer version, yes
ok
i just got this bot a few minutes ago for my server, but is it able to "lock" a command for users?
yeah as long as it's not locking a large portion for something like vote-locking
so variables have to start with a letter, _ or $
how do i do that?
this ain't php
no, i just wanna lock the ".xpadd"
it starts with var
so its not abused in the server.
yea
that's just variable
and then the identifier
constant uses const
must start with a letter, _ or $
there's no such thing
``You use variables as symbolic names for values in your application. The names of variables, called identifiers, conform to certain rules.
A JavaScript identifier must start with a letter, underscore (_), or dollar sign ($). Subsequent characters can also be digits (0โ9).``
how you lock it is how you set up the restriction. We don't know how your commands work or how you're setting them up
i use the basic commands from here so far: https://nadeko.bot/commands
I don't use variables.
yes
IM ACTUALLY LEARNING OMG
Semi colons are required at all in JS.
@floral salmon wrong server
What should I call a command that finds you a teammate in any game?
i still use them because I'm used to coding php
Semi colons are required at all in JS.
@warm marsh they don't, but they're recommended
and PHP is quite strict with their semicolons
omg, i am retarded.... ๐คฆโโ๏ธ thank you tho!
Meh, Developer preference.
PHP is semicolons
Variables are code smell. Just use registers.
php and semicolons is fucking stupid
but yeah, most of my js has semicolons because of php
Most strong typed languages are strict on their semi-colons.
semicolons make your code more readable
that's due to machine-code generation
yes
same. i just felt like putting them because it wouldn't feel completed without them
just me
Don't use compilers they get in the way.
what?
Just write some boot sector code & edit ram in hex.
you're declaring it
pft, imagine programming, what peasants.
for THE most optimal performance i send voltage signals to my cpu
you didn't assign anything to it yet
yes
Also read into var, let, const. Usually using let and const is better due to it being scoped and not in global.
wowowowwowowowo
no
compilers are one of your best friends
that's a comparison
assigning is done with a single equals sign
concatenation would be += IIRC
Anyway everyone knows prolog is the best for writing bots.
prolog?
Imagine not writing your bots in prolog lol
prologue in games?
will const input; not work because a const's value cannot be changed?
bro. im learning
const in JS is vey weak
what
Pretty sure JS const is only const for primitives
like, you might have gotten corona.
WHO ME
we don't need your rambling here
yea
constants are more performance-friendly depending on where you use them
I just like having a bit of fun
Fun is for #memes-and-media
const input; will be undefined no matter what because a constant's value cannot be changed right
Not writing code is more performance-friendly.
they also work a lot better when defining values that'll be used in the whole code
const input;will be undefined no matter what because a constant's value cannot be changed right
@naive mantle yes
Pie it will throw an error.
I can write no code in O(0)
Due to not being initialised.



