#development
1 messages · Page 1152 of 1
im trying to learn maybe a bit too fast, but i will be very satisfied if i finish
i should have looked there first
yeah, he is
the amount of money he is making, probably pretty sweet.
do absolutely nothing, if someone has an issue, so what.
i mean the amount he is making compared to the effort and investment*
i mean probably
Two things you need to learn when getting into development:
- Google is ur soul mate for now on
- The docs are never wrong, you are
Unless its PHP, then fuck that, what are you even doing with ur life
haha
no its python
i know the docs arent wrong, i am just using a weird version
im using v1.4.0
https://i.imgur.com/Jqjx9YC.png
https://i.imgur.com/vervBEu.png
any reason for that?
can i have some help?
I don't really know python
From what the log said
Str (the id) doesnt have attribute id, idk how attribute work in python so yeh
Am i the only one who could spend hours looking at all the things aws and google compute provides and sells
Attributes are just properties.
so many things
how do i post an image to a channel with discordpy
The documentation asks for a VoiceChannel instance https://discordpy.readthedocs.io/en/latest/api.html#discord.Member.move_to
copy pasting from the docs: @info.error async def info_error(ctx, error): if isinstance(error, commands.BadArgument): await ctx.send('I could not find that member...') gives me a name error name is not defined
IS THAT
YANDEV
Fucking
someone help
Just add an attachment
Easy
wdym
this shit doesn't work
@client.command()
async def clip(ctx):
await ctx.send(file=discord.File('fed.PNG'))
:KEKW:
i program in C++
but i do think that py and js are the best for bots
FUCK
i put import random;
with a semicolon?
yes.
why not try aegiscpp if you like c++
because c++ would make things more complicated than they need to be
fair
and it has no community for the discord bot dev
async def info_error(ctx, error):
if isinstance(error, commands.BadArgument):
await ctx.send('I could not find that member...')```
gives me a name error
name 'info' not defined
class discord.File(fp, filename=None, *, spoiler=False)@earnest phoenix
Check file path
what is the root path
does anyone remember where the fs docs are?
found thank you
yes
You know it works.
It was discussed in length earlier
bot.guilds
process.crash() in the end of the code
don't forget to shut down the os for maximum efficiency
actually i think thats electron
make sure to cut the power supply cord with a scissor while its on too
@stuck crest we making jokes cuz :
a. you i did not provide a language
b. you did not provide a library
c. we cant read minds
ask stupid questions get stupid answers 🤷♂️
^^
^^
How do I require a file in py? like in javascript: const file = require("./filename.json");

isnt import the syntax in py?
oh yeah 😂 sorry I just started py :D
shh they don't know json isn't native to python yet
🤐
with open to the rescue
i shouldnt even be talking about py tbh, not my area
Introduction
In this article, we'll be parsing, reading and writing JSON data to a file in
Python.
Over the last 5-10 years, the JSON [https://en.wikipedia.org/wiki/JSON] format
has been one of, if not the most, popular ways to serialize data. Especially in
the web developme...
ty :)
anyone know any good rona npm's
Also not listed on the site, but the 2nd argument for open in this codeblock determines how it'll interact with the file contents
with open('data.txt', 'w') as outfile:
json.dump(data, outfile)
@gray zealot
The argument mode points to a string beginning with one of the following
sequences (Additional characters may follow these sequences.):
``r'' Open text file for reading. The stream is positioned at the
beginning of the file.
``r+'' Open for reading and writing. The stream is positioned at the
beginning of the file.
``w'' Truncate file to zero length or create text file for writing.
The stream is positioned at the beginning of the file.
``w+'' Open for reading and writing. The file is created if it does not
exist, otherwise it is truncated. The stream is positioned at
the beginning of the file.
``a'' Open for writing. The file is created if it does not exist. The
stream is positioned at the end of the file. Subsequent writes
to the file will always end up at the then current end of file,
irrespective of any intervening fseek(3) or similar.
``a+'' Open for reading and writing. The file is created if it does not
exist. The stream is positioned at the end of the file. Subse-
quent writes to the file will always end up at the then current
end of file, irrespective of any intervening fseek(3) or similar.
Also not listed on the site, but the 2nd argument for
openin this codeblock determines how it'll interact with the file contentswith open('data.txt', 'w') as outfile: json.dump(data, outfile)@gray zealot
@earnest phoenix ty!
How do I like make a turn off module per server?
I’m using a mongo py
Should I just make like a on/off line? If so how
Store a bool for each module for each server.
If a command is in a module check if that server has it enabled.
If its enabled, run the command
Do it’ll be like if enabled, else say module not enabled
Yeah
Generally speaking youd cache that data.
Since its such a small amount of data, you'd cache it all
How would I cache it?
I'd personally rather put it in a DB, so its persistent between bot restarts, etc.
Yea

that is what you're going to be doing. just caching it as well can make it faster
Your database is remote
But I mean should like welcome messages, levels and that stuff be like in the main help menu or be in mod
Yes
Remote
So you'll definitely want to cache it
How tho?
#.cases
i did and it just returned undefined
ok
api.all() returns a promise it seems
you need to await it or access cases in .then
api.all().then((result) => {
console.log(result.cases);
});```
Oh
no one here is stupid
Except me
indeed
you aren't stupid unless if you want to be lol
Can i be stupid Thursday to Sunday
I meant Wednesday but typed weekend
Ah we have been get got
darn
Is transferring shit to cogs hard?
Also how can I set aliases for ellif?
Like to cut down on code?
No, transferring & using cogs isn't hard @drifting wedge
Don't work on reinventing the wheel, learn to optimize ur code instead
Don't work on reinventing the wheel, learn to optimize ur code instead
@earnest phoenix yea that’s why adding cogs
But can I set alisases to ellifs?
Or no
You mean for Pythons syntax, as in an elif statement?
I mean, why would you want to do such a thing?
Bc like for mod
And moderation
They send the same message
But have different names
@earnest phoenix
That can be triggered with a mod and moderation command?
But it’s .help moderation or .help mod
I don't really remember how to do that, but its 100% possible @drifting wedge
Just check the docs
You need help?
@drifting wedge
For groups like help mod
Are you using @client/bot.command?
If you are
Let me pull up code
Sure
Hello!
Wassup
how do i make my bot able to add reactions and then detect if you react
something like reactiontime
Python?
discordjs
Can’t help
oh
i used youtube but they are only reaction role tutorials
Rip
if you have the message object, message.react(emoji);
im mainly into lua
to listen for reactions, watch for the messageReactionAdd event
https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=e-messageReactionAdd
Or you can create a reaction collector on a message
how do i make a message go to one particular channel
like for logging
if a member is added
i want a message to go to a particular channel
What's the command only for admins?
are u using commando?
Hi,
the bot invitemanger is offline.
why?
@oak cliff do the commandz
-wrongserver @faint ice
@faint ice
Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Support Server" button on the bot's page, not the "Join Discord" button at the top of our website. If there isn't a button that says Join Support Server, then we can't help you. Sorry :(
ask the server admins
ok
qt
const g = require('../../models/guilds'); g.updateOne({ id: message.channel.guild.id }, { $pull: { autoRole: '739887331796058162' } });
MongoError: '$set' is empty. You must specify a field like so: {$set: {<field>: ...}}
hey does anyone know how to do sharding for python. I cant seem to figure it out and i've looked everywhere.
I am the worst with RegExp, how can I include everything BUT #Room.
https://i.callumdev.pw/m4e31.png
I am the worst with RegExp, how can I include everything BUT #Room.
https://i.callumdev.pw/m4e31.png
@snow urchin Uhh, WHat do you want?
I am the worst with RegExp, how can I include everything BUT #Room.
Like everything other than #room?
ya
Alright, Lemme think
and the dot
/[^#Room].*/ I can't think of anything else..
iirc, the exclusing thing is only with square brackets and hat
that excludes each individual character, #, R, etc.
something like
\b(?!#Room\.\b)
@sonic lodge nope 😦
lemme do some googling
const g = require('../../models/guilds'); g.updateOne({ id: message.channel.guild.id }, { $pull: { autoRole: '739887331796058162' } }); MongoError: '$set' is empty. You must specify a field like so: {$set: {<field>: ...}}
Why isn't this working?
(?!#Room)([a-z0-9]+)
I'd just used [a-z0-9|Room]
how do i make a message go to one particular channel
like for logging
if a member is added
i want a message to go to a particular channel
@ivory seal fetch the channel
how do i make a message go to one particular channel
like for logging
if a member is added
i want a message to go to a particular channel
@ivory seal Which library?
send a message to the channel
@pallid igloo discord.js
client.channels.cache.get('channelid').send('logs')
@ivory seal just use a cache.get on client.channels
you could do .cache.find(c => c.name === 'Name').send('LOGS!')
note : Name is case sensitive...
you beat me
@snow urchin you could also use something like #Room\.(.+) and extract the result of the capturing group
kk thanks guys
@sonic lodge It doesnt work, as far as I say
anyone do mongoose?
it does?
does the input always include #Room.
dirtiest solution lol
;p
xD
dont make me type im lazy xd
let m = #RoomLOL
m = m.replace('#Room', "")
console.log(m)
m output
LOL
I am so fucking done
example my bot creates a channel
@ivory seal Resolve the promise
@ivory seal .then
My VPS deleted themselves leaving me with nothing
All my code was there no backup
i am done
@ivory seal You need basics of js to make a discord bot
.then(c => console.log(c.id)
We wont spoon feed you
i do know basics of js
@pine aspen Can you stop spoonfeeding?
ok
there are many types of js
The promise of guild.channels.create returns the newly made channel.
no
i am fluent in dew
can anyone suggest me some free vps pls
js is vast
for 1 day
yogavpn
my VPS got deleted
no jk
dirtiest solution lol
@sonic lodge https://i.callumdev.pw/b67yg.png
there is none
I just need a backup for one day or so
no such thing as a free vps
is replit a good option
why not run it from ur computer
@delicate shore heroku
Ping
I just need a backup for one day or so
@delicate shore You can try using Github to backup, It cannot host ofc.
Heroku doesnt support quick.db
it does
rip
then get the capturing groups
ad you're gonna have a backup
and no, Repl isn't neccesarily free when it comes to hosting and performance.
@snow urchin why do you want to use regex for something that doesn't need regex?
I have no idea
:(
How to use a command only for admins?
repl.it's code will stick if you have an account, but the runtime will only operate for 30mins to 1 hour if there is no activity
How to use a command only for admins?
@sacred pewter Which library?
Lagu
is Dan hosting good?
Not for security
I was trying to use fs earlier to make a dynamic help command command
my commands are maps originally
my commands are maps
By map I mean .map
yea
why would you need .map even
yeah but thats not very flexible
im trying to publish an npm package, but each time im trying to do npm publish this occurs and idfk what to put here
You have 2fa?
erm idk
I think that means 2fa
wot
still same thing
eh have you checked this? https://docs.npmjs.com/requiring-2fa-for-package-publishing-and-settings-modification
Oh that's new?
i guess i have to do that
I guess I need to enable 2fa
Lumap it's an Auth token I think
@tight plinth
Oop
I meant to ping you in the message
Np
I think slappey has my commands setup so stupidly
I'm tryna do it on mobile but I can't because I have to scan a qr code 😔
hi im trying to make a function sendTyping() so that when a command takes time to process it uses .startTyping() and .stopTyping() to show a "bot is typing" status in the chat bar. How would I get the function to start once a command is sent and then stop once the bot is done sending all messages?
Do it at the end of the command
so that i dont have to use .startTyping() and .stopTyping() every time
just simplifying intoa single function
You could start typing in the message event if it's a valid command
How do you even get your bot to type/stop typing in discord.js?
message.channel.startTyping()
yeah
Can I compile an electron app to an apk?
how would i compile all of args into one string
.join
thx
Args is an array for future notice
ite thx
When I do message.guild.owner in this server I get 'null' but in other small servers it works fine.
try message.guild.cache.owner
try message.guild.cache.owner
@earnest phoenix Not working
#commands message
await message.guild.members.fetch(message.guild.ownerID)```
It won't work because that's not a thing
Put that at the top of the command
Yes...
How do you make a bot is it hard or easy I don't know about these things but I add bots and try to edit on them in a server
is dan vps good?
@bitter bison small simple bots? should be able to do it in a couple hours if you know the language. Simple bot + no/little knownledge? prob a week or two if you focus.
Complex bot + little knowledge ? 2 months ish. Complex bot and know your shit? 2 or 3 weeks
@opal plank
oh thanks It takes time to make a bot.
Can I compile an electron app to an apk?
@pure lion Sadly not, electron is only for desktop devices and is very unlikely to ever get support for mobile devices
How to resolve a promise?
message.channel.send(m.user.tag))```
It gives me promise object
everything in google goes over my head
Okay new question
How do I make my ts compiler output "async" and not >massive block of code<
@pure lion wdym
use native supporting es +
and set your compiler options too
@pure lion use a tsconfig
A very high-level overview of the compiler options in TypeScript
tl;dr
tsconfig.json ```js
{
"compilerOptions" : {
"target": "es6",
}
}```
What Lang is that
oh
we code
what I do now
idk
I need to now how to mention
we code
@earnest phoenix bot designer is allowed as long as you have custom commands
oh india


¯_(ツ)_/¯
bot designer no fun
@earnest phoenix bot designer is allowed as long as you have custom commands
yeah ik but most of us don’t
I‘m BDFD supporter ;-;
And there is a big info in the app where you can get support xD
its js react
Uhh, Upon doing return inside a javascript function, does it return that value whenever it's called for that specific space or is called as it is?
Helo
Anyone know what is the problem in here.
at Function.normalizeField (C:\Users\hajji\OneDrive\Desktop\Attitude\node_modules\discord.js\src\structures\MessageEmbed.js:418:23)
at C:\Users\hajji\OneDrive\Desktop\Attitude\node_modules\discord.js\src\structures\MessageEmbed.js:438:14
at Array.map (<anonymous>)
at Function.normalizeFields (C:\Users\hajji\OneDrive\Desktop\Attitude\node_modules\discord.js\src\structures\MessageEmbed.js:437:8)
at MessageEmbed.addFields (C:\Users\hajji\OneDrive\Desktop\Attitude\node_modules\discord.js\src\structures\MessageEmbed.js:252:42)
at MessageEmbed.addField (C:\Users\hajji\OneDrive\Desktop\Attitude\node_modules\discord.js\src\structures\MessageEmbed.js:243:17)
at C:\Users\hajji\OneDrive\Desktop\Attitude\commands\general\newhelp.js:24:23
at Array.forEach (<anonymous>)
at Object.module.exports.run (C:\Users\hajji\OneDrive\Desktop\Attitude\commands\general\newhelp.js:20:20)
at module.exports (C:\Users\hajji\OneDrive\Desktop\Attitude\events\guild\message.js:11:33) {
[Symbol(code)]: 'EMBED_FIELD_VALUE'
}```
This is my code..
const dir = bot.commands.filter(c => c.config.category === category)
const capitalise = category.slice(0, 1).toUpperCase() + category.slice(1)
try {
embed.addField(`> ${capitalise} [${dir.size}]:`, dir.map(c => `\`${c.config.name}\``).join(" "))
} catch(e) {
console.log(e)
}
})```
Anyone know what is the problem in here.
@feral aspen https://dontasktoask.com
ik
This is my code..
const dir = bot.commands.filter(c => c.config.category === category) const capitalise = category.slice(0, 1).toUpperCase() + category.slice(1) try { embed.addField(`> ${capitalise} [${dir.size}]:`, dir.map(c => `\`${c.config.name}\``).join(" ")) } catch(e) { console.log(e) } })```
@feral aspen lmao there is a blank string in a part of a field
embed.addField
wdym..
please teach me to make music bot
see a tutorial
please teach me to make music bot
@stuck crest we cant spoond feed sorry
ok
@earnest phoenix wdym by the thing you said above.
wdym..
@feral aspen in a field there MUST be two strings with data and one of them in your code is empty
how :\ ?

when using the embed command it outputs an error when checking the role perms
could anyone tell me what im doing wrong?
maybe roles.cache.has
ty
any help on my command please.
This is my code..
const dir = bot.commands.filter(c => c.config.category === category) const capitalise = category.slice(0, 1).toUpperCase() + category.slice(1) try { embed.addField(`> ${capitalise} [${dir.size}]:`, dir.map(c => `\`${c.config.name}\``).join(" ")) } catch(e) { console.log(e) } })```
@feral aspen ...
There is an error in the embed.addField(`> ${capitalise} [${dir.size}]:`, dir.map(c => `\`${c.config.name}\``).join(" ")) section
what should I do to fix?
What is the exact error
This
at Function.normalizeField (C:\Users\hajji\OneDrive\Desktop\Attitude\node_modules\discord.js\src\structures\MessageEmbed.js:418:23)
at C:\Users\hajji\OneDrive\Desktop\Attitude\node_modules\discord.js\src\structures\MessageEmbed.js:438:14
at Array.map (<anonymous>)
at Function.normalizeFields (C:\Users\hajji\OneDrive\Desktop\Attitude\node_modules\discord.js\src\structures\MessageEmbed.js:437:8)
at MessageEmbed.addFields (C:\Users\hajji\OneDrive\Desktop\Attitude\node_modules\discord.js\src\structures\MessageEmbed.js:252:42)
at MessageEmbed.addField (C:\Users\hajji\OneDrive\Desktop\Attitude\node_modules\discord.js\src\structures\MessageEmbed.js:243:17)
at C:\Users\hajji\OneDrive\Desktop\Attitude\commands\general\newhelp.js:24:23
at Array.forEach (<anonymous>)
at Object.module.exports.run (C:\Users\hajji\OneDrive\Desktop\Attitude\commands\general\newhelp.js:20:20)
at module.exports (C:\Users\hajji\OneDrive\Desktop\Attitude\events\guild\message.js:11:33) {
[Symbol(code)]: 'EMBED_FIELD_VALUE'
}```
😐
what may be happening is dir is an empty array
have you tried checking it
how to fix this
?
npm.load()
where?
no* is not empty
@viral iris I got the error.
can you show us your commands/info/img.js file at line 3
can you show us your
commands/info/img.jsfile at line 3
@sudden geyser 1sec
const { prefix } = require("npm");
It's basically newhelp.js:20-24
why are you requring npm
could anyone help me correct this line?
.cache is not a property of type GuildMember. Plus I think Administrator should be in full caps (and hasPermissions should have the last S removed).
ite thx
Use 8 instead of ADMINISTRATOR
ew
Oof
its faster :^)
It's also useful for attracting people who asked "Who pinged" without checking the Inbox button first
I always use the inbox button, But thats basically my style of saying, Why did a person ping me?
how to fix this
WHAT IS THE ENAME EVENT?
what is evt
probably a property, likely the name of a file or something
??
Oh alright.
I'm working on a tictactoe command, Testing it after 3 ddays of hardwork
Hope that it doesn't goes down the drain.
You have defined it, Thats exactly what I was asking
const { readdirSync } = require("fs");
module.exports = bot => {
// const load = dirs =>{
const events = readdirSync(`./events/`).filter(d => d.endsWith(".js"));
for (let file of events) {
const evt = require(`../events/${file}`);
let ename = file.split(".")[0];
bot.on(ename, evt.bind(null, bot));
}
};
what's event.js file
@pallid igloo
Can you show one of your files?
How do i blcok my bot pinging me when i text a command
which 1 ? @pallid igloo
Idk
@steel pelican dont use .reply
I'm just lurking and observing your code, idfk the error
@quartz kindle ok
use .channel.send
@viral iris add a console.log(ename,evt) line in between the ename and the bind lines
so you can see which event is failing
kek
that means the problem is your message.js event
its not returning a valid function
show your message.js
your event loader expects all events to return a valid function
if you want to disable the message event, remove it, or make it return a function that does nothing
like this
module.exports = () => {}
ok thx
Is tic tac toe worth on a discord bot?
I mean, It's almost day 4 of working on tic tac toe.
depends on what your bot is about
m
RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values may not be empty.
embed.addField(`> ${capitalise} [${dir.size}]:`, dir.map(c => `\`${c.config.name}\``).join(" "))
what can I do to fix.
hi i have a problem my bot keeps crashing every day with this :
error: read ECONNRESET
where is general chat
thanx
ok so my bot is now hosted 24/24 on my raspberry pi
and for now reason
some hours after it is launched
it crashes with this error
(it's also why it was off when it had to be tested)
are you emitting any events?
nope
what is dir?
the bot doesn't do anything when it crashes
no i mean
??
what does it return?
I dont know
this is the code
const dir = bot.commands.filter(c => c.config.category === category)
const capitalise = category.slice(0, 1).toUpperCase() + category.slice(1)
try {
embed.addField(`> ${capitalise} [${dir.size}]:`, dir.map(c => `\`${c.config.name}\``).join(" "))
console.log(dir.map(c => `\`${c.config.name}\``))
} catch(e) {
console.log(e)
}
})```
whats the error stack, @cobalt eagle
that is the code.
events.js:292
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at TCP.onStreamRead (internal/stream_base_commons.js:205:27)
Emitted 'error' event on Connection instance at:
at Connection._handleProtocolError (/home/pi/node_modules/mysql/lib/Connection.js:423:8)
at Protocol.emit (events.js:315:20)
at Protocol._delegateError (/home/pi/node_modules/mysql/lib/protocol/Protocol.js:398:10)
at Protocol.handleNetworkError (/home/pi/node_modules/mysql/lib/protocol/Protocol.js:371:10)
at Connection._handleNetworkError (/home/pi/node_modules/mysql/lib/Connection.js:418:18)
at Socket.emit (events.js:315:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ECONNRESET',
code: 'ECONNRESET',
syscall: 'read',
fatal: true
}
pi@raspberrypi:~/Desktop/bots $ node GrapeBotV3.js
events.js:292
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at TCP.onStreamRead (internal/stream_base_commons.js:205:27)
Emitted 'error' event on Connection instance at:
at Connection._handleProtocolError (/home/pi/node_modules/mysql/lib/Connection.js:423:8)
at Protocol.emit (events.js:315:20)
at Protocol._delegateError (/home/pi/node_modules/mysql/lib/protocol/Protocol.js:398:10)
at Protocol.handleNetworkError (/home/pi/node_modules/mysql/lib/protocol/Protocol.js:371:10)
at Connection._handleNetworkError (/home/pi/node_modules/mysql/lib/Connection.js:418:18)
at Socket.emit (events.js:315:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ECONNRESET',
code: 'ECONNRESET',
syscall: 'read',
fatal: true
}
idk what exactly is the error stack
In a tutorial, it said to use that.
@digital ibex
This is the full code
embed.setDescription(`These are the available commands for ${message.guild.me.displayName}\nThe bot's prefix is: **${PREFIX}**`)
embed.setFooter(`${message.guild.me.displayName} | Total Commandds: ${bot.commands.size}`, bot.user.displayAvatarURL())
categories.forEach(category => {
const dir = bot.commands.filter(c => c.config.category === category)
const capitalise = category.slice(0, 1).toUpperCase() + category.slice(1)
try {
embed.addField(`> ${capitalise} [${dir.size}]:`, dir.map(c => `\`${c.config.name}\``).join(" "))
console.log(dir.map(c => `\`${c.config.name}\``))
} catch(e) {
console.log(e)
}
})
return message.channel.send(embed)```
const g = require('../../models/guilds');
g.updateOne({ id: message.channel.guild.id }, { $pull: { autoRole: '739887331796058162' } });
MongoError: '$set' is empty. You must specify a field like so: {$set: {<field>: ...}}
Does anyone know how to do this?
The docs just list this no more.
you are updating one what i see.
then you need to pass { $set: { field }}, is what the error says
then theres ur answer
What do I do
I still dont know how to fix the issue.
embed.addField(`> ${capitalise} [${dir.size}]:`, dir.map(c => `\`${c.config.name}\``).join(" "))```
so any idea ?
@digital ibex what should I do to fix the problem?
@feral aspen dir is empty, so you cannot have empty objects being joined
Even if you console.log dir.size, it should be undefined iirc.
embed.setDescription(`These are the available commands for ${message.guild.me.displayName}\nThe bot's prefix is: **${PREFIX}**`)
embed.setFooter(`${message.guild.me.displayName} | Total Commandds: ${bot.commands.size}`, bot.user.displayAvatarURL())
categories.forEach(category => {
const dir = bot.commands.filter(c => c.config.category === category)
const capitalise = category.slice(0, 1).toUpperCase() + category.slice(1)
try {
embed.addField(`> ${capitalise} [${dir.size}]:`, dir.map(c => `\`${c.config.name}\``).join(" "))
} catch(e) {
console.log(e)
}
})
return message.channel.send(embed)``` this is my code, what can I do
you can think more into javascript and use more reasonable filters.
Idc, I have been strugling for 4 days.
It happens
You gotta understand.
ANyways
What can I do?
What is c.config btw?
const dir = bot.commands.filter(c => c.config.category === category)
Use a different filter.
one that actually matches something.
client.on('guildBanAdd' , (guild,user) => {
let genel = guild.channels.find('name', 'genel');
if (!genel) return;
genel.send('https://i.pinimg.com/originals/a3/60/d6/a360d66140dee7e295949f4eef489aa8.gif' Kek tarafından yargıya uğradın ab cupcake' );
});
What did i do wring
Wrong
Is the main prefix ~ because I might change if it is as I cant make it changeable
??
@steel pelican guild.channels.cache.find(ch => ch.name == 'genel');
Is the main prefix ~ because I might change if it is as I cant make it changeable
@fresh matrix For what?
@pallid igloo thx
[
[ '', 'A', 'B', 'C' ],
[ '1', '🔵', '❌', '⬜' ],
[ '2', '🔵', '❌', '🔵' ],
[ '3', '❌', '🔵', '❌' ]
]
This is my "data".
if(data[1][3] != ⬜) return m10.reply('That cell isn\'t empty!');
Why is this giving me this error?
TypeError: Cannot read property '3' of undefined
try to remove the third cell and see what happens
helo, i have a little problem with json, javascript
so im trying to add values to json without overwriting it
example:
{
"hello": "yes",
"hello_two": "yes"
}
i need to change only "hello" value
why have u got to make two values when they do the same thing
you're using filesystem?
ye fs
Yea.
[
[ '', 'A', 'B', 'C' ],
[ '1', '🔵', '❌', '⬜' ],
[ '2', '🔵', '❌', '🔵' ],
[ '3', '❌', '🔵', '❌' ]
]
This is my "data".
if(data[1][3] != ⬜) return m10.reply('That cell isn\'t empty!');
Why is this giving me this error?
TypeError: Cannot read property '3' of undefined
readJson
writeJson
bcs [3] doesnt exist
@pallid igloo I wanna make it so I can have a prefix so that no other bot has it.
the white block.
How do iget the server.link
@pallid igloo I wanna make it so I can have a prefix so that no other bot has it.
@fresh matrix Think of a unique prefix then.
I dunno lol
const fs = require('fs-extra')
// With a callback:
fs.writeJson('./package.json', {name: 'fs-extra'}, err => {
if (err) return console.error(err)
console.log('success!')
})
// With Promises:
fs.writeJson('./package.json', {name: 'fs-extra'})
.then(() => {
console.log('success!')
})
.catch(err => {
console.error(err)
})
// With async/await:
async function example () {
try {
await fs.writeJson('./package.json', {name: 'fs-extra'})
console.log('success!')
} catch (err) {
console.error(err)
}
}
example()
thats the example
of how to use writeJson
[
[ '', 'A', 'B', 'C' ],
[ '1', '🔵', '❌', '⬜' ],
[ '2', '🔵', '❌', '🔵' ],
[ '3', '❌', '🔵', '❌' ]
]
This is my "data".
if(data[1][3] != ⬜) return m10.reply('That cell isn\'t empty!');
Why is this giving me this error?
TypeError: Cannot read property '3' of undefined
Somebody? Anybody?
i think my error is caused by the mariadb database automatically closing the connection after a while?
god knows
god sucks
god is dead
Lol god. sucks
[
[ '', 'A', 'B', 'C' ],
[ '1', '🔵', '❌', '⬜' ],
[ '2', '🔵', '❌', '🔵' ],
[ '3', '❌', '🔵', '❌' ]
]
This is my "data".
if(data[1][3] != ⬜) return m10.reply('That cell isn\'t empty!');
Why is this giving me this error?
TypeError: Cannot read property '3' of undefined
Somebody? Anybody?
I NEED SOLUTION TO THIS. JAVASCRIPT CAN GO GAY ALOT
hey guys can anyone tell me what does relationships.read scope do in oauth2
I NEED SOLUTION TO THIS. JAVASCRIPT CAN GO GAY ALOT
@pallid igloo just wait for someone to respond lol
me too dumb for javascript
also
did you put the unicode character
in the if Operator
in a string
if (data[1][3] != ⬜) return m10.reply('That cell isn't empty!');
this part
Wait, Lemme try.
if(data[1][3] != '⬜') return m10.reply('That cell isn\'t empty!');
Lemme try that
hey guys can anyone tell me what does relationships.read scope do in oauth2
we told u to ask in discord api @wanton anvil
@cobalt eagle use clearTimeout
we told u to ask in discord api @wanton anvil
@marble juniper and where is that??
i'm talking about mariadb's timeout
there a way to fetch a user and see if theyre a verified bot?
@cobalt eagle show some code
e r r o r ?
after some research i've found that it's caused by mariadb
that has a timeout that closes the connection
is that nosql or sql
sql
ah
events.js:292
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at TCP.onStreamRead (internal/stream_base_commons.js:205:27)
Emitted 'error' event on Connection instance at:
at Connection._handleProtocolError (/home/pi/node_modules/mysql/lib/Connection.js:423:8)
at Protocol.emit (events.js:315:20)
at Protocol._delegateError (/home/pi/node_modules/mysql/lib/protocol/Protocol.js:398:10)
at Protocol.handleNetworkError (/home/pi/node_modules/mysql/lib/protocol/Protocol.js:371:10)
at Connection._handleNetworkError (/home/pi/node_modules/mysql/lib/Connection.js:418:18)
at Socket.emit (events.js:315:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ECONNRESET',
code: 'ECONNRESET',
syscall: 'read',
fatal: true
}
pi@raspberrypi:~/Desktop/bots $ node GrapeBotV3.js
events.js:292
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at TCP.onStreamRead (internal/stream_base_commons.js:205:27)
Emitted 'error' event on Connection instance at:
at Connection._handleProtocolError (/home/pi/node_modules/mysql/lib/Connection.js:423:8)
at Protocol.emit (events.js:315:20)
at Protocol._delegateError (/home/pi/node_modules/mysql/lib/protocol/Protocol.js:398:10)
at Protocol.handleNetworkError (/home/pi/node_modules/mysql/lib/protocol/Protocol.js:371:10)
at Connection._handleNetworkError (/home/pi/node_modules/mysql/lib/Connection.js:418:18)
at Socket.emit (events.js:315:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ECONNRESET',
code: 'ECONNRESET',
syscall: 'read',
fatal: true
}
you have shit internet
the error wasn't occuring when i used mysql
ECONNRESET
thats ur internet
you have shit internet
.
your connection goes idle and mariadb closes it
yes
there a way to fetch a user and see if theyre a verified bot?
that's why i need to not close it
yes thats what i was doing
the bot
thx
there a way to fetch a user and see if theyre a verified bot?
so a verified self bot
im just joking
how do i restart the mariadb server ?
read the docs
just close and reopen the terminal ?
ok
so now it should be working fine
and won't crash when the bot get tested 😠
var log=client.channels.cache.find(channel => channel.name == 'log-channel');
if(log !=null)
const updatedembed=new MessageEmbed()
.setTitle("**Message Updated**")
.addField("Author: ",NewMessage.author.username)
.addField("Old Message: ",oldMessage.cleanContent)
.addField("Updated Message: ",NewMessage.cleanContent)
log.send(updatedembed);
});```
this is my code
it says Unexpected token 'const'
pls help
use brackets
is there a way to make a collector only reactive to people who are in a certain vocal channel?
const collector = new Discord.MessageCollector(/*message.channel, m => m.author.id === message.author.id,*/ { max: 1, time: 30000 });
what do u mean
{}
@midnight blaze filter = msg => msg.channel //shit
{} for what
can bots use custom emojis?
ye
how?
@ivory seal your condition?
if (log != null) {
const updatedembed = new MessageEmbed()
.setTitle('**Message Updated**')
.addField('Author: ', NewMessage.author.username)
.addField('Old Message: ', oldMessage.cleanContent)
.addField('Updated Message: ', NewMessage.cleanContent);
log.send(updatedembed);
}
didnt work
@midnight blaze const filter = message => voiceChannel.members.has(message.author.id);
something like that, i guess
Yo @pure lion did u make a support ticket?
like the first time i edit it it works
after that i edit any message
it doesn't get logged
@delicate shore yeah, should be soon
nice
so.. what should i do?
eval m.guild.channels.cache.get("265156286406983680").send("yes"); --silent
ok
oof
thanks flazepe^^
how do i see the total users in servers that have the bot?
for each server?
No spoonfeed @dense vessel
do a foreach and keep an int count
Rule 7, yes.
is the pre rewrite?

guide people to the right answer please :)
sorry my bad
python?
it is client.users.cache.size
depends on the library and language
python
discord.py then
you already said that

or len(client.users) :p
or len(client.users) :p
@digital ibex for every server?
what's len
length in python
google it
^
it gets all the members which ur bot is in
terrible explanation
nvm me, it gets all the users which is in the cache
len(clinet.users)?
then yeah

var log=client.channels.cache.find(channel => channel.name == 'log-channel');
if(log !=null){
const updatedembed=new MessageEmbed()
.setTitle("**Message Updated**")
.addField("Author: ",NewMessage.author.username)
.addField("Old Message: ",oldMessage.cleanContent)
.addField("Updated Message: ",NewMessage.cleanContent)
log.send(updatedembed);```This code works for the first time , when i try it again it doesn't work
k
what do u mean “it doesnt work” ?
Not sure how I feel about the indention after that if conditional
as in it doesn't log
indentation is not strictly enforced in JS
so?
ik, only python really does that
nobody wants to see shit
^
the error is MessageEmbed fields values may not be empty
Hard to tell without the error msg though
log both <Message>.cleanContent
one of the values is empty
or more
at Function.normalizeField (C:\Code Projects\Discord Bots\Master-Bot2\node_modules\discord.js\src\structures\MessageEmbed.js:425:23)
at C:\Code Projects\Discord Bots\Master-Bot2\node_modules\discord.js\src\structures\MessageEmbed.js:445:14
at Array.map (<anonymous>)
at Function.normalizeFields (C:\Code Projects\Discord Bots\Master-Bot2\node_modules\discord.js\src\structures\MessageEmbed.js:444:8)
at MessageEmbed.addFields (C:\Code Projects\Discord Bots\Master-Bot2\node_modules\discord.js\src\structures\MessageEmbed.js:259:42)
at MessageEmbed.addField (C:\Code Projects\Discord Bots\Master-Bot2\node_modules\discord.js\src\structures\MessageEmbed.js:250:17)
at CommandoClient.<anonymous> (C:\Code Projects\Discord Bots\Master-Bot2\index.js:110:6)
at CommandoClient.emit (events.js:327:22)
at Object.module.exports [as MESSAGE_UPDATE] (C:\Code Projects\Discord Bots\Master-Bot2\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_UPDATE.js:14:12)
at WebSocketManager.handlePacket (C:\Code Projects\Discord Bots\Master-Bot2\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31) {
[Symbol(code)]: 'EMBED_FIELD_VALUE'```
error msg ⬆️
how do i fix it?
try this
client.on("messageUpdate",function(oldMessage,NewMessage){
var log=client.channels.cache.find(channel => channel.name == 'log-channel');
if(log !=null){
const updatedembed=new MessageEmbed()
.setTitle("**Message Updated**")
.addField("Author: ",NewMessage.author.username || 'empty')
.addField("Old Message: ",oldMessage.cleanContent || 'empty')
.addField("Updated Message: ",NewMessage.cleanContent || 'empty')
log.send(updatedembed);
it'll show empty if the value is empty
obv
Neat how JS can use variables like that
instead of giving 1 msg
my bot is giving 5
same message
the first one says the actuall message
the others say empty
send a screenshot pls
one sec
What is this NewMessage
(i no understand)
messageUpdates are sent when embeds are added to a message
these updates will likely have a system:true field
so you have to ignore them
how do i do tht
my homies still don't know what a screenshot is
@summer torrent can you pls show more code
you cannot async map
oki
it will give you an array or promises
well, you can, but you'll have to use Promise.all on it
getHook is
const getHook = async (id) => {
let hooks = await message.guild.fetchWebhooks()
return hooks.get(id)
}```
wha-
k lemme try
that will execute all promises concurrently, if you want them sequentially instead to not hit the api too hard, you have to use a for loop
@drifting wedge To count the users yourself, just iterate over each user in a guild and increment an integer
int totalUsers = 0;
foreach Guild g in Guilds
foreach User u in g
totalUsers++
Don't think you need some library/pluguin for that
you want all users or only online users?
you want all users or only online users?
@quartz kindle ah, forgot about the caching
@ivory seal you should also ignore bots
Right, would want to include that
if(newMessage.author.bot) return
yep it works
thanks @quartz kindle
also can someone give me a link for the color codes i can use for Embeds in Discord
k thanks
does rgb work?
Refer to the docs
a random color?
yes
oof, yeah not the case
Blurple
Can anyone tell me what this error is, is limiting the api, but I already changed token and api.
https://cdn.discordapp.com/attachments/110373943822540800/743803883863932938/unknown.png
How can I solve?




