#development
1 messages · Page 1516 of 1
use the one from the d.js-guide
*tutorial
Yes.
from multiple years ago
Most likely

furious typing by everyone
use the discordjs.guide
its always up to date
and its the best guide for discord.js
nothing beats it
anidiotsguide is not bad either
yeah
but I think the discordjs.guide is still better
cuz it has github repos which allow you to quickly copy paste the code
I want to jump into a much more intense project (with still little to no previous knowledge) I will check out those sites
And hopefully it wont be 11 years old
Outdated*
also the guide I sent you has a linter section
which you defenitly should check out
cuz a linter can help you make your code more consisent overall
I dont even know whAt linter is 😦
it gets the lint off you, or the cat hair. /s
its like a programmable code checker, a set of rules your code needs to follow.
That actually sounds super helpful
like I said
helps you make ur code consistent
and cleaner
kinda like a formatter
but also a code checker
lol
if you don't wanna bother configuring ur linter
then use the standard
thats the module called
the npm module
its like the linter the discordjs guide uses except you don't need to configure it
I would have no clue how to configure anything so that would be best
you don't really need to know how to config the linter
they show you the configuration they use
in the guide
lol
Sorry, just wanted to show off for a second. I've successfully implemented the Patreon API retrieval of all patrons 😄
congrats on learning to read the documentation
How to check if a user connected to the defined voice channel?
for example, through a voice channel name
what lib
old good djs
member.voice.channel for member's voice channel
is there something like Client#connect?
for what?
that you might use for bot.on('connect', async (channel, member) => {
oh is there
let me read the documentation for it, thanks
is oldState for like a member?
oldState.voice.channel
ok, i will try test it
thanks
and one more question
how to make a bot create a voice channel?
ok, thank you
is there an event that called when a user leave a voice channel?
voice state update
How do I get the administrator of the ban and the reason?
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: module 'discord.ext.commands' has no attribute 'remove_command'
client.remove_command('help')
remove_command is a GroupMixin method, and commands.Bot inherits it.
. H
send code, you must've done something wrong.
intents = discord.Intents.all()
client = commands.Bot(command_prefix=when_mentioned_or('.'), intents=intents)
client.remove_command('help')
the error isn't from that file.
any idea?
import discord
from discord.ext import commands, tasks
class Help(commands.Cog):
def __init__(self, client):
self.client = client
@commands.group(invoke_without_commands=True)
async def help(self, ctx):
commands.remove_command("help")
embed = discord.Embed(color=discord.Colour.teal())
embed.add_field(name="Moderation", value="``Kick, Ban``")
embed.add_field(
name="Fun", value="``whois, hello, whomadeyou, devinfo, die, wassup, good, credits, creditz, ping, pool``", inline=False)
await ctx.send(embed=embed)
def setup(client):
client.add_cog(Help(client))
print("Help cog is loaded")
ctx.author
audit logs ig, though you need to fetch it since the gateway doesn't send the event
what?
do you want to add it like kicked by "the mod"?
no, I want when somebody kicks/ bans a member. It will send banned Meister by Schwitz
How do I fetch the mod?
like this?
by another bot xD
SCHWITZ that's not what they're asking
what error?
and while you are dealing with your problem lemme introduce my djs problem
you have error?
plox look nori
so uh
umm
AttributeError: module 'discord.ext.commands' has no attribute 'remove_command'
how to change voice channel's bitrate?
@fallow dust
see just get rid of that line commands.remove_command("help")
what is that line supposed to do anyway
there shouldnt be anything wrong
bruh
it removes the default help command
how?
?
do you know discord.py?
You don't even know what you're talking about
wtf do you mean?
im not asking you 
what is guild
guildBanadd from the event
what is your djs version
@summer torrent how to set a limit and bitrate to a voice channel?
i just can't find it in the documentation
limit of members on the voice channel?
ye
VoiceChannel.setUserLimit(10) (any number ofc)
np
setUserLimit is used on a channel
let voice = message.member.voice;
let rate = args[0];
if(!rate) return message.channel.send(emb)
if(isNaN(rate) || rate < 0 || rate > 99) return message.channel.send(embed)
voice.setUserLimit(rate)
message.channel.send(embe)
voice.channel.setUserLimit
np
anyone know why this happen?
i think your schema uses the wrong type for a field
did you store the guildid as an int or string?
string obviously
here's the schema```js
const config = new mongoose.Schema({
guildId: String,
prefix: String,
reminder: Boolean,
action: String,
cd: Boolean,
channelId: String,
lastDate: String
})
i'll just delete the doc
hope it'll fixed
wha about jawad tormos bot
wait where did you get _id from? this causes an error
hey
i have recently made a pokemon bot. How do i actually make a trade function?
how would i replace one array in the json file with another?
like i honestly have no clue on how to begin.
generate a uid for each item and set the id for the item of the users who own it. for trading take the id and set it to a different user
hmmm
fuck this cat, sry for the typos
{"1159773":{"id":676,"name":"Furfrou","level":60,"catchChance":0.25,"spawnId":8046692,"owner":"345138133429649408","catchTime":"01/11/2021 11:27 AM","nickname":""}}```this is how my json file looks
but atm i really have no clue on how to even begin
no problem mate, keep ya head up.
@lusty quest
hey so
I am new to API making
Where should I start
I want to use my domain for api's
Where do I start
How can i ask for bot permissions?
client.hasPermission()
client.user.hasPermission()
doesnt work
<guild>.me.hasPermission()
let entry;
guild.fetchAuditLogs()
.then(audit => entry = audit.entries.first())
.catch(console.error);
``` why cant I define entry?
Does custom emojis work with embed footer?
no
how to transfer a user to another voice channel?
For using discord API via REST.
What is the difference between https://discordapp.com/api/v6/users/@me and https://discordapp.com/api/v6/users/userId
I notice I can use an OAuth2 token on @me but when using {userId} and the same Authorization token I get a 401 Unauthorized.
The API documentation doesnt really provide much info on the userId url authorization method.
@me grabs the user information attached to a specific token, the userId grabs information about a specific user identified by their ID
I agree. Although regardless of Authorization I use in the header, I get a 401 Unauthorized when querying the userId
So Im just confused about what to actually use when providing userId.
I assume I wont get all of the same since I don't have a token for that user, but getting any response would be useful to know.
for that you may need your bot token when attached to a discord server which has an user connected to it
not too sure about the userid but yeah
thats all i know so far...
Okay for sure.
I can use @me no problem, I was just curious. Building a website so, don't have any bot api functionality I'd normally have lol
then you can simply use your bot application attached to the website to fetch user data
(as long as the bot user sees the user in any server and has cached data about it)
warnings: [{ moderator: message.author.tag, reason: reason, case: this.warnings.length }] would this work in this context?
or does it reference the object that it's inside of
Yes this is true. For this part of functionality it is not guaranteed the user is exposed to a bot. But they are logged in and I have their Oauth2 token. From bot side Im very familiar with how to do it with a wrapper api.
But yeye. Thanks for chattin 🙂
it references the class instance
so say i was making a mongoose document or whatever, it would reference the document being created?
bot.on('voiceStateUpdate', async (oldState, newState) => {
if(newState.channelID === '798117816242012160'){
newState.guild.channels.create(`${newState.member.user.username} ~ Voice`, {
type: 'voice',
bitrate: 64000,
parent: '736472475625324568',
userLimit: 15,
reason: `Member ${newState.member.user.tag} joined VC`
}).then(c => {
newState.member.user.setChannel(c.id, `Member ${newState.member.user.tag} joined VC`)
})
}
});```
what's wrong with this?
it creates a channel, sets a category, it's cool
but it doesn't move me
It's newState.setChannel()
VoiceState#setChannel
where newState is an instance of VoiceState, not a member
thanks for millionth time today i guess
i have 1 shards?
if you dont have shard, it will just be 1 as it is the bot instance itself
what are shards actually for?
I know of them but idk why they're used
a shard is a connection to discord
each connection can only handle up to 2500 guilds
its a wild tim
if you have more than 2500 guilds, discord will not allow you to connect with a single connection anymore
as we see the wild tim in his natural habitat (the development channel)
you will have to start sharding, which means, splitting your bot into multiple connections
lmao
tldr; dont worry about shards unless you are reaching over 1.5-2k servers
@_@ this is why I dont want over 2.5k servers
just use internal sharding in djs
flashbacks to people showing them sharding with only having 10 guilds
wait is internal sharding multiprocess again
no
nah
but honestly
well yeah, if you have hundreds of thousands of servers
and if you use presences lul
then rip your cpu
and internet
tim what do you think the maximum servers you can run with internal
depends on your intents
like with the conditions above
theres too many variables to consider, but at minimum it should handle 10-20k no problem
ah ok thats great
im currently at 7k
using on average 5% cpu (with zlib, without presences)
if you use zlib stream, then each packet you receive needs to be decompressed
which means more cpu is needed
i'm never gonna need shards then 
you never know :)
Why can't I do super.super.myStuff 😦
you shouldn't need to do that
if you have to then you should rethink the architecture of your code
hmmm, makes sense.
I should move my method to parent class
huh
that trash , use sqlite/json instead
lol json is the worst you can do, and sqlite is annoying to use if you shard
bruh i already try that

but when my host restart all the data is gone
hmmm
ye
no
if u use uptimerobot
yeah lol
isn't that against the tos
is there a good way to talk to lua with js
use flask + uptimerobot
repl.it's team showed that bruh
y would they show something that breaks theyr own rules?
well
🤦♂️
they will probably do the same as glitch
is there a good way to talk to lua with js
is there a good way to communicate between lua and js>
maybe over an api, but i dont know if you can make post and get requests as needed with lua
ok ill just while loop a file then
[ ............]
i want to give a specific user all of the permissions of a voice channel, but some of them don't work. What should I put instead some of them?
const buttons = ['a', 'b', 'up', 'down', 'left', 'right']
let button = message.content.toLowerCase().slice(1)
if(buttons.includes(button)) {
mhm bcs iahsuoiahoifd is in this array
it logged it when that button isnt in the allowed array
this is how many worked
first message lol
plsu se
hi
can someone please help me
i can't get the bot pfp on my bot's top.gg site to hover
This is what i have rn
.entity-header__image {
border-radius: 50% !important;
border: 3px solid gold;
animation: float 5s easein-out infinite;
}
@keyframes float {
0% {
box-shadow: 0 5px 15px 0px rgba(0, 0, 0, 0.6);
-webkit-transform: translatery(0px);
transform: translatery(0px);
}
50% {
box-shadow: 0 25px 15px 0px rgba(0, 0, 0, 0.2);
-webkit-transform: translatery(-30px);
transform: translatery(-30px);
}
100% {
box-shadow: 0 5px 15px 0px rgba(0, 0, 0, 0.6);
-webkit-transform: translatery(0px);
transform: translatery(0px);
}
How can I get a path to a file for os and io on lua
Lua - File I/O - I/O library is used for reading and manipulating files in Lua. There are two kinds of file operations in Lua namely implicit file descriptors and explicit file
like you just type the path
flask?
@fluid basin
lol
or to generate a file path
find a file
With discord.py? Attach an aiohttp.web/Sanic/quart script to your bot
sanic
Yis

wait what are you trying to accomplish
wait I have to cancle out the path
also, if you are putting the path in string, use \\ instead of \


{"4317558":{"id":269,"name":"Dustox","level":36,"catchChance":0.4166666666666667,"spawnId":4181200,"owner":"345138133429649408","catchTime":"01/11/2021 1:31 PM","nickname":""},"9983671": hey this is a json file. I actually want to modify one specific field, "owner". How would i do that?
Load the entire json, then modify the object you get from JSON.parse() , then save the file again using JSON.stringify
open the JSON file, parse it, json["4317558"]["owner"] = xxxxxxx, write to file
do that until your json breaks because you messed up, or it corrupts because you're trying to read and write at the same time. then use a database.
yeah i understand the knowledge, but how would i modify the object...
the object called owner
by... y'know, literally using javascript?
JavaScript is designed on a simple object-based paradigm. An object is a collection of properties, and a property is an association between a name (or key) and a value. A property's value can be a function, in which case the property is known as a method. In addition to objects that are predefined in the browser, you can define your own objects....
(imagine answering without knowing what lang) but ok
I'd be amazed if Awsome didn't use JS in this case
it's js
yeah so read the article on how to use objects then
¯_(ツ)_/¯
or like shiv said... <#development message>
Hey, Usually, I create a schema for the economy commands, and the users use it, when it comes to updating the schema, people will yet be able to use it, but the schema wouldn't be updated to all the users, so if they would want to use the new feature, it would error out or return as undefined.
Any solution anyone can think of?
the problem with this is that i don't know the id
there are thousands of ids
isn't there some sort of replace function
Right so you're opening yourself up to corruption real fast
Ok but not it's literally an object
get the object's key
change it
very basic JS tbh
I have no idea why he said "i don't know the id", you're changing a property's value, not guessing an ID?
its a pokemon id
literally have thousands of ids
ok so figure out how to get that ID
thanks.
¯_(ツ)_/¯
you know that you don't really help right?
Seriously though
don't come crying when your json file disappears and you lost your entire data
It might sound logic to you, but not to others
i have never said that i would come cry to you
No, but it will happen, if you use JSON as a database. JSON is not a proper database.
JSONs are prone to corruption, only meant for read operations, not too many read and write operations, sure they're good for storing data, but not to be used as a database
Any help here please.
The solution is "update the schema for all users" I guess?
storing mostly-persistent and unchanging data you mean
Of course
Yes, for 350 users, great idea.
Anyone can help me with a good solution? Something I can do?
I don't see a problem with it
Ok
Set an interval and update one by one to not make too many database calls in a short amount of time?
updating 350 database entries takes less than a second
updating 200,000 entries might take a few seconds but it's still not problematic. that's what databases are for.
literally their entire point in existing is being able to read and write to them quickly ^_^
Is there a code that does that? Example in my economy system, I do this to register the user's data.
Data.findOne({
userID: message.author.id
}, (err, data) => {
if(err) console.log(err);
if(!data) {
const newData = new Data({
name: message.author.username,
userID: message.author.id,
lb: "all",
money: 0
})
newData.save().catch(err => console.log(err));
const embed = new MessageEmbed()
.setColor(cyan)
.setDescription(`Successfully registered an economy account for **${message.author.username}**!`)
return message.channel.send(embed);
} else {
const economyEmbed = new MessageEmbed()
.setColor(red)
.setDescription(`❌ **${message.author.username}** already has an economy account registered!`)
return message.channel.send(economyEmbed);
};
});
MongoDB
MongoDB?
its mongodb
?
that's the answer you want
I dont see a code that could help my solve my case.
you do'nt see the update() feature?
ok
well, I see it very clearly
I see the update() function with the upsert option, hell, there's even a way to do it in one single line of code
How?
Maybe you should... actually read the answers? I Guess?
who here makes their beta/dev version of their bot public, and how many people invite it?
also is your beta bot up 24/7
im trying that my bot will leave the vc when the song is over
.then (setTimeout(function() {
message.member.voice.channel.leave();
}, `${song.formattedDuration}`))
you're passing a string and not a number
get rid of the `${}`
just do song.formattedDuration
assuming that it's a value in milliseconds
You realize <Promise>.then() expects a callback function right?
setTimeout() doesn't return a function
That is also a horrible way to make the bot leave the voice after the song's over
discord.js has proper mechanisms for that, like dispatcher.on("end"
how to make a bot delete a voice channel once a user disconnects from it?
wait wtf is this server for?
top.gg support
so how to make a bot delete a voice channel once a user disconnects from it?
listen to voice state update, if the state changed from having a voice channel to not, delete that channel
@green kestrel mines in 270 servers and it's up 24/7
o.o hi kyoso
Hi
i tried doing this, it doesn't work
if(oldState.channel || !newState.channel) c.delete()```
uh
oo hi kyoso
yes
or it doesn't work this way?
Use &&
instead of channel
let's test
or means, if old state have voice channel or new state dont have voice channel
might cause issues if the user moves around channels
still doesn't work :(
if(oldState.channelID && !newState.channelID) c.delete()```
Hey i get an error : member.roles.map is not a function
to this:
.addField("Roles:", member.roles.map(roles => `${roles}`).join(', '), true)
Can someone help me how to fix this?
what is c
it's just roles.join(', ')
roles is a manager, it doesn't have map
you might be looking for .cache.map
roles.cache.map?
it's message.guild.channels.create(`Name`, { permissions stuff im lazy to copypaste here }).then(c => {})
hm ok, but how do you know which c belongs to the channel that the user is in?
you should consider something like oldState.channel
and not c
fine fine ill copypaste it all here
newState.guild.channels.create(`${newState.member.user.username} ~ Voice`, {
type: 'voice',
bitrate: 64000,
parent: '736472475625324568',
userLimit: 15,
reason: `Member ${newState.member.user.tag} joined VC`
}).then(c => {
c.updateOverwrite(newState.id, {
VIEW_CHANNEL: true,
MANAGE_CHANNELS: true,
USE_VAD: true,
MUTE_MEMBERS: true,
DEAFEN_MEMBERS: true,
MOVE_MEMBERS: true,
PRIORITY_SPEAKER: true,
CONNECT: true,
SPEAK: true,
STREAM: true,
CREATE_INSTANT_INVITE: true,
MANAGE_ROLES: true
})
newState.setChannel(c.id, `Member ${newState.member.user.tag} joined VC`)
if(oldState.channelID && !newState.channelID) c.delete()
})```
this is how it all works
nonono
you need to check the states in the voiceStateUpdate event
not when you create the channel
so like uuh
if(oldState.channelID && !newState.channelID) newState.channel.delete()
let's try or something
that code needs to be in the voiceStateUpdate event
A completely separate event where you handle checking states
similar to your message event
yes yes it is
the client.on('<event name', () => // blah blah)
@fluid basin Thank you 🙂 . How can i filter the role @everyone? So that it doesnt show this as an role
\u200b entered after @
there is a value for it
yeah but it should be a seperate event
not as 1
it won't work that way
can you describe the process that the bot should take?
with .filter?
e.g.
- user enter cmd to create channel
- user joins channel
- user does stuff
- user leaves channel
- bot deletes channel
yeah the role name I think
hold up lemme check
I also cant ping the roles
ofc you're supposed to ping them via their id
is there even such a property?
but iirc role.toString() give the mention
but for this i have to do <@${role.id}> and im listing them at once
but msg.member.roles.cache.map(role => role.name).join(", ") this is listing ALL roles and not one by one
hard to explain, but i mean i can ping roles, names channels by <@§{user.id}> for example but i cant do this with roles
because there is then <@@everyone role1 role2 role3> and thats not what i want
msg.member.roles.cache.map(role => role.name).join(", ").toSting() so?
how?
role.name.toString()?
filter(role => role name not equals '@ everyone')
How can i ping then every single role?
role.toString is the ping
thats what i have
.setDescription("Roles: " + msg.member.roles.cache.map(role => role.toString()).join(", "))
good
lol
bruh
voltrex just gotta come with the better ways doesn't he
I dont understand it right now
var roles = member.roles.cache.map(role => role.toString()).join(", ")
Can you tell me how to filter everyone?
uh
🗿 You're supposed to filter by guild ID
i dont get it without code
wdym you dont get it without code
!= = not equal
The filter() method creates a new array with all elements that pass the test implemented by the provided function.
same thing (in this case)
shut it twat (jk ly)
woah
shut your facehole you twat (ly2 bro)
. . .
@misty sigil shut it you fucking twat waffle on a break stick
I should link that large para about matt saying "learn js"
that was evie
oh evie
shu' it you big sock hanger
Shut it cock man
inb4 post on devrant: "today I met a big sock hanger"
🗿

mfw you just realised
shu' it you other bri'ish uphill gardener
well quick hint, you need to put the .filter before the .map
Why would you use map instead of casting it to an array and joining it
eh guys
if i have mongodb schema that have a String variable named guildId
then i set it with message.guild.id
will it set the variable to number?
eh or is it string already
it should stay a string
hm
if it is casted with ' ' its a string
const config = new mongoose.Schema({
guildId: String,
prefix: String,
reminder: Boolean,
action: String,
cd: Boolean,
channelId: String,
lastDate: String
})
that the schema
here it say guildId tho
at path "guildId" for model "GuildData"
where did you register the Schema?
umm like saving the document?
no you have to register the Schema so Mongoose knows its there
Does the Mongoose lib have it's own type definitions for what Mongoose offers or do you pass it the global String, Boolean, Number classes
u mean like this?
mongoose.model('GuildData', config);
yes
its already did
and you call the schema with GuildData in your other files right?
what is the error again? if possible the full stack
// author message content = "hi :EmojiName:"
message.reply('`'+message.content+'`') // Bot Message: `@Nawal, hi <:EmojiName:EmojiID>`
I want my bot to only send: hi EmojiName or hi :EmojiName:
How can I do that? I don't know regex 
unicode emoji or custom emoji?
custom
its still not full
you have to send the emoji id with name
no, I don't want to send an emoji
how did you save the data to the model
so you want to remove the name?
to send a animated emojijs <a:emoji_name:emoji_id> for normal custom emojis ```js
<:emoji_name:emoji_id>
it should have iirc
you can define it in the schema/model
Use regex and group the name
i save new document on guildjoin
const newConfig = new Config({
guildId: guild.id,
prefix: PREFIX,
reminder: false,
action: 'raid/upgrade',
cd: false,
channelId: null,
lastDate: null
})
return newConfig.save();
I don't know regex 
for number there shld be int32 int64 decimal
/<a?:([\w\d_]+):\d+>/ // custom emoji rejex with the name as the capture group
use an empty string instead of null
/<?(?:(a):)?(\w{2,32}):(\d{17,19})?>?/
for the channelId?
Don't define number lengths!
mongoose doesnt support bigint
I know, snowflakes can be as long as they would like to, but just for more accurate checks, defining specific lengths would be better at least
its just a wrapper for mongodb
I'm waiting for a DM from Luca from my bot
It's more expensive computationally to limit the range length of something
and how do I use this to replace the escaped emoji to only the emojiname?
It returns 3 groups
Access the second one
But after matching it tho
<String>.match()
Really tho?
@earnest phoenix and if I got more than 1 emote? 
Use the global flag
/g?
Yes and also use <String>.matchAll()
[...found]
Am i able to customise the color that the invite button background changes to on hover with some css ?
whats a regex
Just add it?
via a cmd
"hb_automation": "293060399106883584"
},```
i have this rn
but i want to make it so if i go
;add userhere useridhere
it goes into that format
i mean i dont think its possible because it needs a comma / not a comma depending on its spot
Modify the JSON and save it using <fs>.writeFileSync()
acc nvm it doesnt need a comma
but
how exactly would i save it in that format
"user_name": "id"
JSON.stringify
<JSON>[<property name>] = <value>
↓
JSON.stringify()
↓
<fs>.writeFileSync()
I don't think they're using it as a database
Just adding necessary or temporary properties with values
why not redis then?
uh redis means setting up another server
and not many ppl are willing/have the ability
well then
Ok guys , Galaxy Gate isn't working out for me
Any other good Hosting service which gives good ram at cheap prices
you get what you pay
DigitalOcean
Thats expensive than GG
DigitalOcean is a bit more expensive than Galaxy gate
but you also get other nice stuff
Who can help with discord oauth2? JS
If you want a good hosting service then go for it
API, i think recently they added 3 Free Websites (static)
That's why i suggested it
Oh damn
Thanks
Still any other in your thoughts
Vultur
OVH
Linode
Alr thanks
Virmatch also
wtf are these meme npm packages
Which ones
404
this are just packages for people who are stupid
Oh man wait till tim shows up with all his meme packages
Contabo gang
Git op
the bigger thing is 3 people downloaded a 9 years old NPM package that is still on the first version
and check the target version for the packages

does ```js
client.guilds.cache.keyArray()
return an array of guild id?
yea people are stupid
did your MongoDB work now @sacred aurora
It should return all the guild IDs
nah still guildId error
I was overthinking where perhaps it's over engineered and uses code points to map string characters to a lower case variant
oh okay
Nah, people are looking out for memes instead of actually making something useful 
imagine adding bloat
brain hurt
i want to know how many Newbies to Discord bots used this package until they realise its as useful as a Briefcase for a phone
is there a way for it to only edit the userID section
because it just removed the entire conf.json
and it didnt post like "username" : "id"
it just posted "username"
@earnest phoenix I still can't manage how to replace the escaped emoji to the emoji name, I'm so bad 😕
Use the regex on <String>.replace()
The regex i showed + whatever to replace with
nawal
Good 4 u
const msg = 'hi :Hello: :Hello2:';
const regex = msg.matchAll(/<?(?:(a):)?(\w{2,32}):(\d{17,19})?>?/g);
message.channel.send(msg.replace(...regex[0], ...regex[2])) // response: hi Hello Hello2
like this?
Nope
const args = msg.content.slice(conf.prefix.length).split(' ');
let username = args[1]
let id = args[2]
if(!username) return msg.channel.send("You need to specify the trello user")
if(!id) return msg.channel.send("You need to specify a user ID")
fs.writeFileSync('conf.json', JSON.stringify(username, id))```
JSON.stringify() expects an object
hm
{ [username]: id }
well
the fs.writefile thing
just removes the entire conf.json
and repalces it
thanks 😳
username
replaces*
so if i did .add user1 id
it just removes the entire thing and puts user1
shouldnt it be
what even is the return value of JSON.stringify(string, string)
Modify the json, pass the json
look up how json.stringify works
You need to Object.assign to the old JSON data then write the data back to the json
Or use mixin-deep since Object.assign is quirky
Can't they just <JSON>[property] = value
Is anyone else trying to get their bot verified right now? I've legit just been waiting since like Dec. 26th for this.
The verification form is currently closed for the holidays. We have increased the maximum guild limit for bots to 250 until the form re-opens. The form will re-open on January 11, 2021.
Wasn't a question. I just wanted to share in the frustration of it not being open yet even though it states it will open Jan 11th.
maybe you aren't the first in the queue
I'm not even able to submit the bot's verification.
They've locked the form and greyed out the fields.
ah
Maybe it'll open at 11 EST since their headquarters is in San Franciso, CA (which would mean 8am) 🤷♂️
if its 11 EST then maybe in about 21 minutes
That's just me guessing, lol
Ah, interesting
🗿
Their documentation was extremely lacking, and there's references everywhere regarding how the API isn't being maintained. Nonetheless, after getting an access token, it was fairly simplistic to crawl the list of pledges and get their discord id 👍
slash command question: When a user uses a slash command, does the message with the command gets sent, do other people see it?
No like, for example I do /somecommand, do other people see that I did the command? I haven't seen slash commands in action
Others can see your doing x used command n, but your command message is not visible
My bot has come to approval within only 7 days
Before it was more than 3 months
Thank You Top.gg
Only the notification
they do not show the args?
No
Built-in commands are not affected
And slash-commands notifs are kinda buggy on discord mobile
I don't really get the point of the notification
the bot should decide if there should be a notification or not
Not really a notification
Like, sends a message in the channel notifying that you used a slash-command
For example
I do
/bruh moment
My message becomes invisible and it sends a message saying
Voltrex Master used command bruh
Kinda a system message
/bruh
aha, still I think the bot should decide if there should be a message or not
I can't find any bots that have slash commands
they are a thing tho
Its a thing, I've reviewed a few bots with slash commands already
how do you make them
If you search slash on top.gg there are some listed
Most libs don't support it yet, so you have to do a lot of it yourself.
Ah yeah that's it.
nice
It might be very useful for some people, but imo slash commands are much worse than normal commands.
Maybe it's just change though 🤷♂️
cant wait for there to be billions of people asking for help
nah they're definitely worse
the lack of sheer features you get with normal message commands destroys the enthusiasm about slash commands
Can other people see the arguments? Do only I see the /catch mon: Pikachu?
Ah.
yea everybody sees it
no
first bot I found with slash commands
I think slash commands would be way more useful if people couldn't see that you used the command
cant you just do like
Why is that useful
<slash>#delete()
but people see it for a split second
maybe discord will change it
unrelated to whatever is happening here, helping @ornate otter in VC
<img class="this-is-my-image" src="url" alt="pog"/>
.this-is-my-image {
height: 20px;
}
🤔
LOL
Lmao you can't see that on mobile
.thisisntmyimage
no, because its mine, nerd
Who uses their actual image? Just steal it on google
bruh
Yo
hi
how do you change a user's nickname on djs?
With MariaDB in python, is there a better way to retrieve a single value than this?
cursor.execute("SELECT ? FROM user WHERE user_id=?", (key, user_id))
value = cursor.fetchone()
You could append a "LIMIT 1" to the statement
idk of fetchone does that automatically or if it accepts a list of all entries matching that statement then returns the first in that list
In discord.js How do you get an argument's character length?
string.length
k thanks
"pog".length // 3
i did this but caused sum red underlines
=
=> is for fat arrow functions, >= is "larger or equal to"
also. is nickName a string or is nickName an object with a property string?
my fat arrow functions are only 2 or 3 lines, prob gonna name them thin arrow functions
imagine using anon functions rather than named ones
Calling arrow functions fat 
better than calling them whores 
ok
when I say string.length, the string in this instance is referring to the type of the variable and length is a property of instances of String or primitive strings
uhh okay
just send()
God. How long ago was sendMessage? That's giving me flashbacks to V8
np
im kinda rusty in JS
just trying to learn
and i learn from mistakes
xD

isnt it message.send? as i defined "message" at the start
i finally managed to get my shit together yesterday
Maybe they were migrating from Eris to discord.js 
smash your keyboard until it works
message.channel.send()
how come?
you send() something on a channel
makes perfect sense
you dont send a message on a message
I remember when <Client>#sendMessage() existed in v1
when using .length does it count the spaces as well?
yes
All chars
ok
^^
now on djs, how do you change a user's nickname in a server?
member.setNickname()
np
ik
i assumed they meant user as in a person
well this told me you didn't know
ic
But the <String>.length isn't always accurate, the codepoints mess up, you can use [...<String>].length to get the accurate length
i had it already
const nickUser = message.mentions.members.first()``` see?
thats just a member
or null

Oh no no no
nah
