#development
1 messages · Page 785 of 1
What version of Discord.js and Node.js are you on?
the latest version of Node and 11.5.1 of discord.js
node version is 12.13.1
oh my bad, that is not the latest
do you create the channel in your code as well? do you await the channel creation?
yes.... i mean the code to get the ID is after the channel creation code
but do you await it?
channel creation involves sending a rest request, which takes time to return a response
no.....
then thats your problem, its basically trying to find it before its finished creating
show your channel creation code
message.guild.createChannel('logs', {
type: 'text',
permissionOverwrites: [{
id: message.guild.id,
deny: ['VIEW_CHANNEL'],
}]
})
.catch(console.error);
// option 1
let created = await message.guild.createChannel(...)
let logsChannel = created;
// option 2
message.guild.createChannel(...).then(created => {
let logsChannel = created;
}).catch()
cant i just let logsChannel = await message.guild........?
yes you can
Fun fact this also means that the bot won't be able to see the newly created channel 😔 unless it has admin
acutally this is my first time ever coding outside of an IDE, so i didnt really know the concept of waiting for the request to be completed
Yea that's the thing
my bot has admin, so it should be able to see
You should never give bots admin anyway
look into Promises in javascript, thats basically how async code works
Dont ask for admin rights if it is a public bot
hey im really new at bot api
and im trying to make a bot that adds m to every sentence
const client = new Discord.Client();
client.on('message', msg => {
msg.content = msg.conted += "m";
});
I tried that code but it doesnt seem to work
well msg.content = msg.conted += "m"; should be msg.content = msg.content + "m";
and what are you gonna do with the new message? log it? send it?
all good
and when i change to i have to go back into my cmd and load the code again?
yup
ok
but that code wont actually do anything, you cant edit other peoples messages either im pretty sure
oh
you could delete their message then send the new one with your bot
well below the line that i changed you would do msg.channel.send(msg.content)
but that will trigger for every message
even the ones that the bot it self sends
and to delete a message you do msg.delete()
ok thanks
is there a way to mark the messages the bots send to make it so the bot doesnt resend its own messages
when do i put msg.delete()
you can check if the author of the message is equal to the author id of the message
anywhere really
and how do i check for author id?
do i use the 3 stars?
where do I put that?
also thats gonna run on every single message
uh make an if statement at the start
you should probably go watch a discord bot tutorial
thatll help you alot
so if msg.author.id = my bot's msg.author.id
yea pretty much
or if msg.author.it != my bot's msg.author.id?
yea i meant that my bad
right click your bot and copy id
then paste it into your code
if(msg.author.id !== 'your-bots-id')
ok thanks
and i use {} brackets around it?
i made the bot
and re ran the cmd this
and tried to do
node bot.js
but it didnt work and m bot is still offline
My code looks like this
and my terminal keeps saying invalid or unexpected token
i dont know what im doing wrong
please help
my code looks like this now
const client=new Discord.client();
if(msg.author.id !== 675506964876230657){
client.on(message,msg =>{
msg.content = msg.content += m;
msg.channel.send(msg.content);
msg.delete();
}
);}
this is the only thing i wrote in my code
Ay every1 how do I ban every word in the world in a discord bot except for 1. Then give roles to people who say that word a certain number of times
I have a reference bot on another server
It's not mine
Check if the message does not contain that one word you want to exclude, then save a collection or object counting how many times the user has said whatever.
if word in lowered message content
But I want it so they can ONLY say that word
Do u mind if I dm u what I'm talking about so u get a better understanding
you could replace the message with that word
have your bot delete the message and just send that word
No @high wind lemme dm u a sec
ok
how would i get the platform of a user?
I dont think you can for sure
@high wind that code
yes?
what about it
@copper cradle
my error log looks like this
SyntaxError: Invalid or unexpected token
at Module._compile (internal/modules/cjs/loader.js:891:18)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
at internal/main/run_main_module.js:17:11
Can i invite my bot here ?
Im newbie developer bot
I need to change name of my bot first
Because another bot has same nick
xD
Ok
Hello
i need help
in index.js
it says } is an error can not be specified
'}' expected.ts(1005)
Please ping me
nvm found it
Is that good enough for logo?
My logo sucks 😢😢
when I try to start my bot it says ReferenceError: guildMemberAdd is not defined
at Object.<anonymous>
I dont know what's the problem
:/
can you show some code where you are doing the guildMemberAdd thing
@high wind ofc
There are 2 things wrong in your code
First
There'a a semicolon that looks like this
);}
Remove that semicolon
Also
You can't do this
const client=new Discord.client();
if(msg.author.id !== 675506964876230657){
client.on(message,msg =>{
You're using the msg variable before even defining it, and the variable is inside the arrow function you're using to get the message object which means you can only use it inside of that scope
Ph and
IDs are strings
So wrap that id inside a string
4|xxx | at Object.<anonymous> (/root/xxx/Modules/GAwesomeClient.js:8:15)
4|xxx | at Module._compile (internal/modules/cjs/loader.js:1144:30)
4|xxx | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1164:10)
4|xxx | at Module.load (internal/modules/cjs/loader.js:993:32)
4|xxx | at Function.Module._load (internal/modules/cjs/loader.js:892:14)
4|xxx | at Module.require (internal/modules/cjs/loader.js:1033:19)
4|xxx | at Module.Hook._require.Module.require (/usr/local/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:70:39) {
4|xxx | code: 'MODULE_NOT_FOUND',
4|xxx | requireStack: [
4|xxx | '/root/xxx/Modules/GAwesomeClient.js',
4|xxx | '/root/xxx/Modules/index.js',
4|xxx | '/root/xxx/master.js'
4|xxx | ]
4|xxx | }```
How to fix it
show code first
can someone here can help me with the python cmds of a bot
i am newcommer plz
can anyone
wht
ohh noice
waht i go and vote for u if i like it
can someone here can help me with the python cmds of a bot
i am newcommer plz
can anyone
can u help me then
wait i confused
Ok
I add bot
Ok
@earnest phoenix there's a queue, it can take up to 2 weeks for your bot to get approved
what a braindead chat
Ikr
2week so a long time
@marble juniper ikr, guess they are 11 y/o or something
maybe not in age but in brain age yes
@earnest phoenix I would suggest you take change the Prefix from . to something like si!
maybe the first two letters of your bot and then !
because every other bot uses . and it will cause problems
Wht problem ?
because then if 2 bots have the same prefix for example both will react to commands
and maybe the person wants to use only 1 bot
Ow
this is why you need a prefix which is not common
Else your bot gets muted
and no there are thousands of bots who use .
the best option would be using the bot mention as your prefix
Already used
or the first 2 letters of your bot followed by an + or . or whatever character
like sa! or sa+
Hm ok
My bots prefix is customizable for each server so I have no problem with the prefix thing
phone
What language do u use?
What coding language do you use?
Oww
lmao just trought about it myself
kms
All coding with pc ?
reeee
Oww
BDscript
Finnally a valid answer
Im sorry xD

Wait is BDscript not DBM?
Im not really can speak english
Yep
well i do
well I don't
of cause u don't have strg z or something but idc about that
Lol
I guess tho that the "jeff" person uses a dbm
i think so
Wht is dbm ?
@earnest phoenix do u use discord bot maker as app?
Yep lols
@spare goblet you can decline @earnest phoenix Bot, it's made in BDscript so in Discord Bot maker

sorry but DBM is not allowed Here
discord bot maker is allowed
Shimano
Ow see
yes
what r u talking about
Dbm is coding too :v
no its not
But it has displayed code
but you are not the one writing it
it is coding just like scratch is coding
:v
nobody's stopping you from using a common prefix if you want, we just have to block its read access in this server because there's too many bots with those prefixes
if you went and wrote !help in a testing channel like thousand bots would respond
Yep lol
Im sorry
now you know
Hmm did you have idea for new prefix @link.
its just a thing in this server
if you dont care about #commands here the prefix doesnt matter
unless you want to test your bot in this server
3 would be even better
mention prefixes are the best bet
^true
@earnest phoenix just a small question, I've seen you use ":v" a lot, do you speak spanish?
Im from asia/indonesia
jeffsay#6430
Mm
can anyone tell me why my guild ids last 3-4 digit change
its showing correct id at out of script aria and
its changing ids last 3-4 digit inside <script>
You from asia ?
Yes
Why you talking here
Its not #general
Plz remove your all message
ill ask $. Prefix is good or not ?
no
@twin pendant I don't think dbm has a db
@earnest phoenix use strings to store snowflakes in js, js supports numbers up to 53 bits but snowflakes are 64 bits
Let me check @earnest phoenix
@uneven wyvern oh yeah true
$. Prefix is good :v
Ok ill change
@earnest phoenix same problem bro
...
you're still not storing them as strings
Like how?
...
you know your code, go wherever you store ids in tbe the database and use strings instead
oh wait
is this a db
in the first place
also why are there "" in toString()
@earnest phoenix got it thanks anyway.
I still use prefix . And idc if bot will invite here
just pls in website
hi
is eris faster than djs?
Both are different libs written in different ways
ones caching is better than the other but it generally comes down to preference at the end of the day
use whatever lib you see fit
i thunk eris is faster
im going for the speed
my bot is a newgrounds crawler
i almost disabled all caching in djs
if you want pure speed (speed is the wrong term here, because performance will be limited by network more than anything, so im assuming you mean resource usage and efficiency), you will need to modify the library (either of them)
because both of them are primarily centered around avoiding hitting the API as much as possible
which means tons of caching and processing all packets in one way or another
how can I detect in node.js if a file has been renamed and then get the old and new name of the file
so ive updated yesterday node on my pc and fryed my entire enviroment. ```internal/modules/cjs/loader.js:1021
return process.dlopen(module, path.toNamespacedPath(filename));
^
Error: Access is denied.
\?\W:\Discord Bots\Captain-Vor-Production\node_modules\better-sqlite3\build\better_sqlite3.node
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1021:18)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)
at Module.require (internal/modules/cjs/loader.js:848:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (W:\Discord Bots\Captain-Vor-Production\node_modules\better-sqlite3\lib\database.js:5:21)
at Module._compile (internal/modules/cjs/loader.js:955:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)```any suggestions?
@lusty quest uninstall node and re install your version :)
Lol
gzip or deflate?
@lusty quest did you run npm rebuild?
or delete node_modules and run npm install
@glacial anchor brotli > gzip > deflate
ok im gonna rephase it - which method compresses best? gzip or deflate?
@quartz kindle brotli is br, right?
yes
you can include it yes, if the server supports it
the server should send an accept-encoding header
i tried but the fetch speed was worse than gzip or deflate, so methinks its not supported
i send requests to https://api.newgrounds.app
might ask newage to add brotli support
make a request and log their response headers
(async () => { const i = require ("node-fetch"); await i ("https://api.newgrounds.app/").headers})```?
i dont use node-fetch so idk the correct syntax for it, but should be soething like that yes
@quartz kindle done both with the same result
how do i modify discordjs and use in my project? do i clone the git repo into one folder in my bot project and just recall it locally? if i delete some files and pieces of code, will it break?
I has issues. So I'm using the following code where userID is being passed message.author.id
let registered = false;
var contents = fs.readFileSync('users/' + userID + '.json').catch(err);
if (!contents) { registered = false; }else{ registered = true; }
return registered;
}```
When the file exists it works no problem.
When it doesn't, I get an error that it can't throw an error.
tf, why are you using json for database
especially when each file is an element of it
because I have issues using database
@glacial anchor what i do is build on top of it, by extending some classes and intercepting packets with the raw event
im afraid that im gonna break something without the ability to recover
@inner slate your directory seems to be wrong
most likely, i did break many things during my experiments
How is my directory wrong?
i can share what i learned so you dont break it
let contents = fs.readFileSync(`./users/${userID}.json`);```
try ./users
k
@quartz kindle nah i dont think im gonna do such huge step
@inner slate you cant catch fs.readFileSync like that, since its not a promise
you need to use a try catch block
yeah
try {
let contents = fs.readFileSync(`./users/${userID}.json`);
} catch {
// code
}```
let user;
try {
user = fs.readFileSync(...)
} catch(e) {
// failed to load user
}```
ok
thanks guys
const checkRegistered = (userID) => {
let user = "";
try {
user = fs.readFileSync(`./users/${userID}.json`);
} catch (err) {
console.log(err);
}
return user ? true : false;
}```
idk if its gonna work
goddamned lifesavers
np, have fun coding
contents is undefined xD
took whatcha said and actually simplified it, seeing as I don't need to know the contents in that context
function checkRegistered(userID){
try {
fs.readFileSync('./users/' + userID + '.json');
} catch(e){
return false;
}
return true;
}```
produced expected results both times
and try to use streams whenever possible
no need to bother with streams if the files are like 1kb
@inner slate return is 0 as default
so instead of return false you can do return ig
yeah, they're small, biggest ones are the user files
return is undefined
and they're max 2kb
but its better to explicitly use true/false for the sake of consistency
I hate databases, not to mention none of the free options are up to snuff
enmap is a package
hmm?
it makes an object once you initialize it
it can be accessed globally, and you can push data to it
its kinda fast if your db is small
and it's permanent?
sqlite ftw
I'll look into it, but I already have a crap ton of functions and such
hi, i have a db with 100 values, i tried to use a while and make a list, but the bot "lag"
I had a friend who started out with enmap and now he is like, dependent on it
well, my bot is on 2200 servers and still running on json
much the way I'm already dependent on file databases ;P
bruh what
but im rewriting it to sqlite as we speak
I mean, I run my bot locally on my laptop
just that my bot so so complex i've been rewriting it for over a month and still nowhere near ready
btw quick side question how do you make something like enums in c++?
show us what you did @earnest phoenix
and json is not slow, nor a problem, if you use it efficiently
efficiently... >.>
are enums like a kind of validation-enforced array/object? which only accepts predefined values?
Hello
yeah
Why we cant use !thelp
i think so
On BetterAntiSpam
then you need to use a Proxy
It’s bug
using a ternary operator for x ? true : false could just be replaced with !!x
@meager mulch this is not the suport server for any bot, this is the official server for the top.gg website
but then again i
saves space, sort of
enums are a list of constants basically
this is what i got from google Enums are used only when we expect the variable to have one of the possible set of values, for example, we have a dir variable that holds the direction. Since we have four directions, this variable can take any one of the four values, if we try to assign a another random value to this variable, it will throw a compilation error. This increases compile-time checking and avoid errors that occurs by passing in invalid constants.
this behavior is only achievable in js by using the Proxy class
a Proxy is essentially a middleware for ANYTHING in js
you can use it for validation for example
identity is no compression
it only exists if for some reason someone wants to forbid uncompressed access
@quartz kindle
wait can i put these three as a header
and will it make it any faster
or it will take more time to compress than get data itself
yeah ive seen it on mdn
put the three in the header, and the server will send you what they prefer
if you send br,gzip,deflate the server will send br if they suport it and prefer it, else they will send whatever best match they have set up
br should be the best option at the moment, but if you feel like its slower, it could be their server is not good at encoding br, or node is not good at decoding it
if you feel gzip is faster, then use gzip
gzip will be about 10% bigger in size, other than that its no biggie
well gzip is at least something
no compression is slow af
god praise whoever invented gzip
is the data you're receiving very large?
5 seconds? wtf
my bot's ping averages on 200ms, which is far less than 5 seconds
see for yourself in #commands
my API can send several MB in less than 1 second
okay, so question, would these two work the same:
Old: javascript if (command == "register" || command == "reg"){ fs.readFile('users/' + message.author.id + '.json', (err, data) => { if (err){ let userdata = newUser(message); let newdata = JSON.stringify(userdata, null, 4); fs.writeFileSync('users/' + message.author.id + '.json', newdata); botlog.send(message.author + " has just registered!"); }else{ message.reply("you're already registered!"); } }); }
New:javascript if (command == "register" || command == "reg"){ try { fs.readFileSync('./users/' + message.author.id + '.json'); } catch(e){ message.reply("you're already registered!"); return; } let userdata = newUser(message); let newdata = JSON.stringify(userdata, null, 4); fs.writeFileSync('users/' + message.author.id + '.json', newdata); botlog.send(message.author + " has just registered!"); }
probably, but sync ops are blocking
so i doubt you wanna do that at any point but initialization
not when running a command
@inner slate make a command handler bruh
dont tell me that you have all bots code in just one file
thought you were gonna try the db thing again
it's only 1681 lines of code, I usually don't compartmentalize till after 2000 lines
14
make a command handler
plus 15 functions
and split all those ugly if's into files
move all these functions into their own folder like i did
ive made an util folder with useful functions
and i just call those in each command file
that code follows every bad practice you can possibly do lol
using json as a database, shoving all of your code into one file
^^^
I've had bad results using databases, specially when running my bots locally
it's the only option I have atm
and other people didn't, so it's rather a you problem
that's even worse
it's a spare laptop I don't use for anything
let them experiment, no need to criticize that much
@earnest phoenix at least better than paying for electricity
and be extremely limited with uptime and resources?
they will learn from experience
Thank you Tim
heroku doesn't even allow discord bot hosting
like we all did
1 hour of downtime in 1 month
if thats too much for you then dont make a bot
and heroku does allow hosting for everything
I moved from glitch, because glitch I had loads of downtime
selfhosting is fine
discord.py, discord.js
using free hosts however, isn't because again, very limited resources and uptime
all those are libs/packages which you can install and use from the console
i did self hosting for several months in a slow af third world country internet
all my commands took randomly 1-10s+ to respond
my commands respond almost immediately
good internet is a blessing
@quartz kindle and a curse
just did a ping of the bot and it came back in 0.873 seconds
873ms is huge
that is a tad slow
but better than what i had to work with at the time
also i have 1ms to discord if we're already flexing ping
wtf
back when i started my bot i selfhosted and my internet was ass slow cause it was always under stress, i borrowed a 4G module from a friend for an rpi and just used mobile data instead
23ms roundtrip including latency & discords worker delay
nasa pc
the api servers are hosted in NY i think
so if you're close, you're going to have god latency
b1tt, I'll humor you on the command handler bit, how exactly would I start that?
I'm near Baltimore, MD so... I'm close
there are many different ways of setting up a command handler
you can be very creative with them
the simplest one is using commando
but if you dont want to clutter your code
you can write your own
yeah... already cluttered enough, lol
mine fits in like 6-7 lines of code
I'd rather code my own
right now you have to move all your commands into some folder
am I going to have to pass the message variable to them?

a dead simple example of a command handler would be to ```js
const commands = {
command: require(commandfile),
command2: require(commandFile2)
}
client.on("message", msg => {
if(msg.content.startsWith(prefix)) {
let command = commands[msg.content.slice(prefix.length)]
if(command) {
// call command
}
}
})```
@inner slate yeah how would you otherwise interact with the message
just making sure
["commands", "aliases"].forEach(x => <Client>[x] = new Collection());
const load = async (dir = "DIRECTORY") => {
const commands = await readdirSync(dir).filter(files => files.endsWith(".js"));
for (const file of commands) {
let pull = await require (`${dir}${file}`);
if (pull.help) {
await bot.commands.set(pull.help.name, pull);
pull.help.aliases.forEach(async alias => {
await bot.aliases.set(alias, pull.help.name);
});
console.log(`Loaded "${pull.help.name}"!`);
}
}
};```
so I'd run commands like I'd run functions
no
just making sure I'm understanding
yes
lmao
so you just check what the command inputted by user is, then check for that command in <Client>.aliases and then run that command
do module.exports for that
okay, hold up so you guys can get my start bit here:
client.on("message", message => {
const chnManage = message.guild.me.hasPermission("MANAGE_CHANNELS");
const msgManage = message.guild.me.hasPermission("MANAGE_MESSAGES");
if (message.author.bot) return;
if (!message.content.startsWith(config.prefix)) return;
const withoutPrefix = message.content.slice(config.prefix.length);
const split = withoutPrefix.split(/ +/);
const temp = split[0];
const command = temp.toLowerCase();
const args = split.slice(1);```
ignore the toLowerCase bit, I was having issues doing it directly
yes
good enough but needs optimization
client.on("message", message => {
const chnManage = message.guild.me.hasPermission("MANAGE_CHANNELS");
const msgManage = message.guild.me.hasPermission("MANAGE_MESSAGES");
if (!message.content.startsWith(config.prefix)) return;
if (message.author.bot) return;
const withoutPrefix = message.content.slice(config.prefix.length).split(/ +/g);
const command = withoutPrefix[0].toLowerCase();
const args = withoutPrefix.slice(1);```
stop that variable fetish
an even easier way would be js client.on("message", msg => { if(msg.content.startsWith(prefix)) { let cmd = msg.content.slice(prefix.length).split(" ")[0]; try { let command = require("directory/"+cmd); command(msg); } catch(e) {} } })
xD
@quartz kindle gross
hahaha
sure why not
b1tt... where are you getting split? you removed it from the code example everywhere but the args bit
const args = split.slice(1);
its there (well now it is)
fixed
put the checks that lead to a return all the way on top
no point in declaring those variables if you'll return anyway
op command handler
i have an entire service dedicated to registering command and parsing parameters
and somewhere with your code ping was reacted to by a different command
@inner slate wdym
I replaced just the command portion with yours and when I did SD!ping, it ran a completely different command
one that started with p
but wasn't ping
lmao
do you have the whole discord.js required?
replaced
const temp = split[0];
const command = temp.toLowerCase();```
with
`const command = withoutPrefix[0].toLowerCase();`
yes
BRUH
thats inefficient af
instead of importing it all you can import needed functions or classes
at least I get the right command
ohhhh
that seems well above my paygrade, I don't understand discord.js, I'm not gonna rip out pieces at a time
for example, if you only need collection, you can change js const Discord = require ("discord.js"); const Collection = Discord.Collection;
with js const { Collection } = require ("discord.js");
that doesnt really matter much lol
it does
it will improve startup time by a few nano seconds and reduce memory usage by a few kb
imagine that - you require some 10mb lib while you only need one function from it
djs is not 10mb lol
lol
yeah but it doesnt matter much in djs's case, nor with most libs
99% of libs are smart enough not to preload all files anyway
microoptimization doesn't matter in a poor performance language anyways
grabs pitchfork
js is not poor performance
people write bad code that works like bullcrap
nodejs uses v8 engine, which speed is something similar to c++
anyways, microoptimization is not a dealbreaker for a small discord bot
as i said it just results in less and cleaner code
if you need that kind of microoptimization, you should not even be using discord.js in the first place
speaking of microoptimization, move your author.bot return to the top, and the prefix checking to right after
lul
oh and dont forget
const client = new Discord.Client({
disabledEvents: ["TYPING_START"]
});```
that doesnt do anything
disabling typing_start
if you geniunely think it wont do anything
try with and without it
that doesn't do anything
it doesnt disable typing packets from being received, which is 99% of the problem
the event still gets parsed
which takes the most cpu
emitting it is minimal work in js
no, they are always sent, unless you disable guild subscriptions in the discord identify
yeah im waiting for them
processing events is not about speed, its about cpu usage
intents will require most libs to switch to stateless design
in djs you can just pass them to clientops#ws
ah, i'll look into it
sec
im already using guild_subscriptions = false, didnt know intents were already accessible through djs
what are intents
when you connect to discord and open the websocket connection, you can specify an intents field
which tells discord what type of events do you want to receive
hey, please tell the api where there are similar photos
(nip)
they are part of WS options, and not officially supported by djs
because disabling events from being received breaks any things in djs
are they working on it tho
do you need to run this every single time you update your code?
npm install discord.io winston –save
im new to this and im just getting it off the internet
@high wind you are following a bad and outdated tutorial
oh
discord.io is an old discord library that nobody uses
do you suggest any new ones?
discord.js
eew dude
look for anidiotsguide
use djs or eris
thanks
also jotaro best jojo
at least hamon isnt the same type of stand as the protagonist of part 2
@high wind get to part 7 and you'll see balls
I just got to part sever
seven*
Im following "anidiotsguide" on mac and its telling me to use the code apm install linter-eslint and terminal just outputs -bash -apm not found
where did ou see this?
Yeah, moved those two things under bot and prefix checks. Don't remember why I did that in the first place.
Why I placed them there instead of after I mean
@quartz kindle wdym
which website and page did you see that instruction?
you dont need a linter for now
/eval message.guild.createChannel("OP",{ "text"}) does it correct cuz i am getting error
@quartz kindle
https://git.farfrom.earth/aero/aero/tree/develop
config/discord and lib/util/constants
for intents
:)
help nenplzz
@earnest phoenix i sent you the link that explains how to use createChannel
@tight heath thanks, im checking the discord api github as well
yw 😊
Please someone know how to install node.js to computer with Lubuntu 32 bit . ?
I updating OS but I can't install nodejs
i think node.js just supports ubuntu, not lubuntu ( i know its lightweight ubuntu)
no it's still ubuntu but it's using the LXQt DE, yes it's a very lightweight de but lubuntu is lxqt ubuntu
anyway you can just do these
curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -
sudo apt-get install -y nodejs```
that's for nodejs 13, if you want to install the 12 (lts) version do these:
sudo apt-get install -y nodejs```
you could also use nvm
Why would you use 32Bit
Traceback
Feb 08 08:47:42 chipthewolf python[7004]: Traceback (most recent call last):
Feb 08 08:47:42 chipthewolf python[7004]: File "/usr/local/lib/python3.6/dist-packages/discord/ext/commands/bot.py", line 863, in invoke
Feb 08 08:47:42 chipthewolf python[7004]: await ctx.command.invoke(ctx)
Feb 08 08:47:42 chipthewolf python[7004]: File "/usr/local/lib/python3.6/dist-packages/discord/ext/commands/core.py", line 728, in invoke
Feb 08 08:47:42 chipthewolf python[7004]: await injected(*ctx.args, **ctx.kwargs)
Feb 08 08:47:42 chipthewolf python[7004]: File "/usr/local/lib/python3.6/dist-packages/discord/ext/commands/core.py", line 88, in wrapped
Feb 08 08:47:42 chipthewolf python[7004]: raise CommandInvokeError(exc) from exc
Feb 08 08:47:42 chipthewolf python[7004]: discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: code() missing 2 required keyword-only arguments: 'start' and 'end'
Code
@commands.command()
async def code(self, ctx, start: int, end: int, file):
os.chdir('~/usr/botv2/cogs/')
read = open(f"{file}.py", "r").readlines()[int(start)-1:int(end)]
read = ' '.join(read)
read = read
await ctx.send(f"py\n {read}\n ")
What's causing that exactly?
So, I'd use *,?
Just because you write in the params that the function wants this and that parsing doesn't mean the command handlers gonna do that for u
How are you using the command
py code 39 45 owner
b.updateOverwrite(role, {
SEND_MESSAGES: false,
VIEW_CHANNEL: false
});
Why i can'y update channel permissions?
Note: b is channel
Discord.js v12
any error?
Nope
v12 has no method named "defaultRole"
imagine if someone makes a brainfuck discord library
I try it for role ex: guild.roles.find(a => a.name == "@everyone")
i can't write permission
@earnest phoenix U forgot type tho
@glacial anchor BRUH LMAO
this is not gonna be funny
his brain would get fucked after that
can anyone help me with setting a variable to a specific channel
like if I have a number guessing game, you cant play the same game in two different channels
Why sending rate limit warn? on use this code:
await as.react("675604486659637259")
await as.react("675604314718208001")
Js
Every time someone ask a question here the answer should be "Read the docs"
I try it to, done.
How would i make my bot detect when someone joins a different server?
So when someone joins it sends a message to my server saying
User: abc123
Joined: Python
Current user count: 12345
@zenith orchid use === not ==
?
When you're doing an expression
Don't use ==
Use ===
I'm not gonna explain why
should say, Im using py
lmaoo
what?
does python even have ===
bruh
@copper cradle use b instead of a i wont explain why is horrible advice
my last message still stands 
anyways
there should be a guild member add event
or something like that
listen to that, and deal with the member object you get
Ok fine
ya, on_member_join but that only counts to my server
can someone help me with python?
The difference between == and === is that:== converts the variable values to the same type before performing comparison. This is called type coercion. === does not do any type conversion (coercion) and returns true only if both values and types are identical for the two variables being compared.
what dose that means?
And I was talking to the guy using js
Alex,
@copper cradle ok im blind
yes
how can i run a python file?
ok
learn python properly before attempting to make a bot with it
python bot.py
it will save you a lot of headaches and might even get you somewhere in bot development
FILE <stdin>
what is stdin?
standard input
Standard input
In computer programming, standard streams are preconnected input and output communication channels between a computer program and its environment when it begins execution. The three input/output (I/O) connections are called standard input (stdin), standard output (stdout) and...
where can i get my standard input?
python bot.py
ok
import logging
import sys
from discord.ext import commands
from cogs import music, error, meta, tips
import config
cfg = config.load_config()
bot = commands.Bot(command_prefix=cfg["prefix"])
@bot.event
async def on_ready():
logging.info(f"Logged in as {bot.user.name}")
COGS = [music.Music, error.CommandErrorHandler, meta.Meta, tips.Tips]
def add_cogs(bot):
for cog in COGS:
bot.add_cog(cog(bot, cfg)) # Initialize the cog and add it to the bot
def run():
add_cogs(bot)
if cfg["token"] == "":
raise ValueError(
"No token has been provided. Please ensure that config.toml contains the bot token."
)
sys.exit(1)
bot.run(cfg["token"])```
smh
oh lord
DONT COPY PASTE
as its very clear u have fuck all idea what ur doing
but what is wrong in my code?
😦
This is the 0.16.4 version of discord.py
i tried to make a music bot
Alex.
wha
Making music bots are difficult.
even in python?
any language
Definitely not something you want to do for your first project/bot.
^
ok
My first project was to make a calculator
My first was just a password generator,
i made a moderation bot as my first project, in js
then with what
Make a calculator in python
ok
don't take code
read the documents
look at how things are done
what the errors mean
Ok

is there a way to have unlimeted time in setTimeout
^
hmmm
Wait why do you want to set a timeout in the first place if you don't want it?
Yeah.
Unlimited timeout, runs right after the universe ends
lol ye
My first proyect was a brainfuck interpreter
my first project was a discord bot 😳
i made it because i was in some discord server with a community made bit and the owner made the bot bad so i learnt js so i could try and replace it
didnt work, but now im good at js
how is it formed
anyone wanna make discord bot usig discord.js web build
why would you
yes and publish your bot token and entire source code
you wont
well i can
lmao, anyways why cant you just use node express to render the website?
i made dashboard with custom commands like this
pretty seamless and painless exchange of data between bot and website
how would u shard then?
well i never imagined sharding would break this in anyway
the bot file could be imported as module tho? no?
wdym
Is there a way to find/fetch a webhook by name in a guild for Discord.js?
well never did it but, just in the index.js (express app) make a require('./bot.js') which would be the bot
bot.js does whatever the fk it wants, shards or not
but can access parent module anytime, which would be the express app
like i said i never did it before, never even had a bot that required sharding
but just like my commands are modules i require in main bot file, i would make the bot file be required in the express file
let expressApp = module.parent.exports```
in the bot.js file
i get what u are trying to say
i never tried that
i tried importing web app to my bot and that used to crash it
ignore that last message, its confusing mess lol what i wrote
i get what u tring to say
Thank you
...host your token on the web and make it so only the whitelisted IP can see it (the IP of your webbuild), and request token from webbuild to the place where you have your token lmao
idk if it even works like that
ohh just hasing it
im imagining you can make an API call from webbuild to anywhere
right
maybe?
dunno
but anyways
make a place in your web somewhere with token.txt
and just make the permissions so its visible only to localhost
127.0.0.1
IDK if it works, ive barely touched html
you will not be able to hide your token in web build
or trust that guy since he probably knows what hes doing
i can do something
how does web build work again? can you run it like on your local machine?

