#development
1 messages Β· Page 1836 of 1
damn
A help command is pointless if all your commands are slash commands, but I'm not sure if top.gg allows bots without a help command if all their commands are slash commands
thanks. Oh that's a good point, didn't think of that
I think slash commands are messy when you have 100+
Everything thrown out of category
yes that's absolutely true
You can say that we lost control over our commands
I add the help command even if I have all my command as slash command, since maybe like server with 10+ bot using slash, it doesn't show up all and scrolling through the slash command is not very intuitive as now
but then you're just doing a commands list?
only listing main command
oh that's requiring a lot of effort
I mean, you can't simply use interaction instead of message inside your commands
this is what I mean: message.channel.send vs client.api.interactions(interaction ...
oh nice, I did that too. But I can't call it a help command if I'm just giving a commands list I think
So it's 1 code for both types
oh that's nice. So you added a lot of properties to them?
Well...no bcuz it's java
ohh
I use annotations to process the commands
Simple one, I can add like selectmenu for details, that an options
Those annotated with @SlashCommand are slash-compatible
And those annotated with @Command are normap commands
If the command has both then the handler will call the proper type
wow that's a smart idea! Thanks for sharing
ohh so not every command can do both slash and messages?
Since each type comes from different events I can just filter what type I should proccess
Not yet
I have too many commands, it takes some time
Also, simple detail, but might be helpful for the user who want to know the bot's command
oh understandable lol
lmao competing refers to many bots using the /help slash command?
For sure it is
nice one
if you have simple commands, you dont need a help command
but if like me, your commands require 90 pages of docs....
lmao
hey, my bot wants to send a embed, he can speak in the channel but he has missing permissions :/
lmao Tim
check for embed links permission
the bot needs to have this?
yes, for embeds it does
okay
if it's sending an embed using a normal message
Found another "great" change in djs v13
Assigning an integer to an embed value will cause an error (RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values must be non-empty strings.)
djs doesn't converter the value to a string anymore, v12 did
yes awesome π€£
coincidentally I saw that already
I've made mine now. Also thought about select menus for that, but I think I will wait for the autocomplete option so users can do /help or /help <command_name>.
But then I want to automatically have my client.commands as options for that argument of course
hello
how can setup
image like this
in html
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<title>KIRA</title>
<meta name="description" content="BEST MUSIC AND MEME BOT FOR DISCORD">
<meta name="theme-color" content="#ffc107">
<link rel="icon" type="image/png" sizes="300x250" href="https://images-ext-1.discordapp.net/external/Ww48p9i_BhGad7v3H6vEXgIhoE1DIrRMjDAv8im8w-Q/%3Fwidth%3D613%26height%3D613/https/media.discordapp.net/attachments/843830735940878336/854619748155523132/20210616_124308.png">
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Alfa+Slab+One">
<link rel="stylesheet" href="assets/fonts/font-awesome.min.css">
<link rel="stylesheet" href="assets/fonts/ionicons.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">
<link rel="stylesheet" href="assets/css/styles.css">
</head>```
my website codes head
It uses the Open Graph Protocol https://ogp.me
Not really sure when autocomplete will arrive, so I made help while waiting for it
oh I've got time enough I think, and else I can update my bot without that command help feature
const Discord = require('discord.js');
/**
* @param {Discord.Client} client
*/
module.exports = (client) => {
client.on('interactionCreate', async (interaction) => {
if (interaction.isCommand()) {
let cmd = client.slash_commands.get(interaction.commandName);
if (!cmd) return;
await interaction.defer().catch(e => {});
let options = interaction.options._hoistedOptions;
cmd.run(client, interaction, options);
}
})
}```
error:
await interaction.defer().catch(e => {});
^
TypeError: interaction.defer is not a function```
because .defer() already been changed, take a look at the documentation
https://stackoverflow.com/a/17269591/16294208 if anyone has a clue of how this works and could walk me through it lmk pls
i need to edit it so that I can get transparency btw
discord.js
const client = new Discord.Client({ ws: { intents: ["GUILDS", "GUILD_MEMBERS", "GUILD_INTEGRATIONS", "GUILD_WEBHOOKS", "GUILD_MESSAGES", "GUILD_MESSAGE_REACTIONS", "GUILD_VOICE_STATES"] } });
returns CLIENT_MISSING_INTENTS, and my bot is under 75 and is not verified.
did you turn it on in the dev panel
Big up tom scott
yessirrr
@twilit geode rip, saying same thing lmao
Me neither
shit my bad didnt look at other answers https://stackoverflow.com/a/18425922/16294208 solution here (assuming not tested)
that's java tho
module.exports = {
usage: 'whatever',
run () => {
how do I put the value of "usage" here?
}
}```
what does guildOnly mean
what usage?
that whatever it refers to only applies to guilds
run() { this.usage }
run.away
Away?
it's a joke
Mine is
run: async (message) => {}```
So what should I do?
its just this.usage
run: async (message) => { this.usage }
Returns undefined
run() { this.usage } works however
π then what are you asking for?
asap unrelated question - is there a way for bot to set up variables for users and not having all the database? for example me normally can have notes on users. how can bot achieve the same thing (i use python btw)
Json file? Google spreadsheet?
no. only using discord. nothing outside...
i can make you a notes cause i have a place under ur profile. bot doesnt see normally profile as user so i think a variable should be here.... or not?
Seems like a really bad way to do things, is there a reason having such a weird requirement?
then you should be using a database for that, especially anything which uses a "password"
i dont want to take data of all users on discord =p
then dont make it imo
bruh
if you dont want to do the work, dont make it
good alternatives for replit.it so i can code my discord bot on v13 and host it with uptime robot
i just dont want to mess up with international laws =p
idk
international laws? π what laws?
privacy, etc...
nope cause then discord handle it =p
not how that works π
youll want a privacy policy for something like that, passwords are PII, and your storing them on a service in a way not meant for storing PII.
Very much a big concern
so youll need to disclose that to all users in a legal fashion(privacy policy)
yeah, cause of that i wanted to store data in discord guilds so i dont have acces and then its correct and i dont need to messup with laws =p
your doing it in a more legal nightmare fashion though π
means?
Pretty sure using discord channels as storage is against tos no?
your making it worse on yourself legally
Someone told me that once
yes, and its insecure, which password security laws are very huge
thinking its somehow discords responsibility because you misuse their stuff makes no sense.
use a database, or dont do it at all
ill just say it again, what you are planning to do is possibly illegal, and will get you banned from discord.
use a database.
bro. i dont wanna mess up with tons of paper =p
discord requires you to secure and encrypt all of their data you store
and the law required encrypting it and securing passwords. which isnt possible by using discord as a database
yeah, but if roles have a variables then i can store it there, so all privacy issues go to discord, not me =p
no, its on you
its on their servers, but its still 100% on you
Help me please i have error 
module.exports = {
name: "lewd",
category: "NSFW",
execute(message, args, client) {
message.delete({timeout: 5000})
var superagent = require('superagent');
if (!message.channel.nsfw) {
message.react('π’');
return message.channel.send(new Discord.MessageEmbed()
.setColor('#ff0000')
.setTitle(errMessage)).then(msg => {
msg.delete({ timeout: 5000 })
})
}
var lo = new Discord.MessageEmbed()
.setDescription(`Por favor, espere...`)
.setTimestamp()
message.channel.send(lo).then(m => {
superagent.get('https://nekobot.xyz/api/image').query({ type: 'lewd'}).end((err, response) => {
var embed_nsfw = new Discord.MessageEmbed()
.setTimestamp()
.setFooter(message.author.username)
.setTitle('Aqui estΓ‘ sua imagem...π')
.setColor('#FF1493')
.setDescription(`**[A imagem nΓ£o estΓ‘ carregando? Clique aqui](${response.body.message})**`)
.setImage(response.body.message)
m.edit(embed_nsfw);
});
});
}
}```
They require you to encrypt?
i dont have acces to that then
"i killed a person inside of mcdonalds, so it's actually mcdonalds' fault, not mine!"
?
yeah, they've been very vocal about it for the past few months
in the ddevs guild
@nova basin response.body.image is an empty string
oh
you're fine then
things implied are message contents, roles, owner information etc.
but intermediate data like ids alone are fine
passwords to give someone a role =p
its still a password
it needs to be treated like one
theres nothing that will change about this. You are required to use a database here.
so u say - i need to invest real money to give some pepol a command? yes?
Arent you also legzlly required to encrypt passwords?
yes
What? Just use mysql or sqlite or something
or well, you are legally responsible for the security of stored passwords
i use replit
Kekw
Honestly, in this case, yes
only external database if cant be opensource =p
so ok. i make bot as abandonware =p
writing a custom discord websocket with 0 dependencies be like:
socket.on("data", data => {
...
onFrame(data);
})
function onFrame(frame) {
...
onMessage(frame);
}
function onMessage(message) {
...
onPacket(message)
}
function onPacket(packet) {
...
uncompress(packet)
}
function uncompress(packet) {
...
unpack(packet)
}
function unpack(packet) {
...
emit(packet)
}

btw - i dont spend money in any pc thing, so u know. i dont even have nitro lmao =p (the only online thing i paid was m$office and it even was a fault cause i dont touch it now =p)
hashing passwords? phew its easy just use some secure algo and ur fine
Then. Dont. Do. It.
unless u wanna pay a fine or end up n jail when u get caught
it was fyi only =p
what? you can litetally just store the passwords (as HASHED) in the same database
as rest of your stuff
to other pepol to see? i use replit as handle for bot =p
He uses replit
+1
just use mongodb cluster or smth
hi sorry for ping.. what app is that?
it's free to use and enough for most purposes
Yeah
read the message below
(π³ too late - i type using one hand now =p)
most. will it handle all discord users?
hi who know what app abey using?
depends hiw big your bot is
but for a bot like with under 1000 servers it'll be fine
for the now smol. but will grow up i think =p
kk im ghost again π»
and when ur at the point of 1000 servers, u should open some patreon or something and get money there to pay for server and database
I don't get it, what's the issue with public source code again?
repl.it, not app it's an website
i dont use any reallife money online cause money is for food and paying real bills not virtual non-existing things
:-|
...that's...man why do you make bots then?
^
then dont make it public if u dont want to worry about this kind of stuff?
then why are you even complaining?
like, you can't expect to stay free for the whole life of your bot
and even if - this mine bot have other purpose than getting cash. its just to show m$ that they arent alone =p
m$?
microsoft
micro$hit
bots go a loooooong way before they become self-sustaining money-wise
you need to input cash at the start tho
like any real life business
nope. i just made it for showing pepol opensource =p
showing what?
and for me it isnt business =p
and im not gonna take part in business when project is against giant business =p
against who?
m$
im a WOMEN u dumb?
if anything you're competing against other bots
im not competing with bots. i compete with m$ cause i heard that m$ gonna buy discord for giant money
ye, they refused
just to change pepol minds and to switch pepol to safer opensource =p
and they bought github, and just good things happened for it ever since then
nothing to worry about
Can you please just stop arguing about this
GOOD ?! COPILOT IS GOOD ?! THEY HAVE NOW PROBLEMS WITH INTERNATIONAL LAWS !!!
and you expect to be the flag-holder to make everyone move to opensource?
maybe not everyone but maybe som pepol ...
also currently best discord alternatives are propiertary anyways, so...
idk yet. i just pushed to topgg
that "hacker" topic not again
if u know code then u know whats inside and when itll be a virus pepol will know it =p
errr...no
Opensource allow for finding vulnerabilities to exploit
^ there might be some nasty backdoors too
I can for sure write an opensource code that WILL have a virus and you'll have no way of knowing
Look at how people in 2b2t exploited a bug in paperspiggot
?
All because they had access to the source code
it's like being a doctor and giving poison to your patients
will they know it? no
even if they have the name
the full compound of the drug
knowing the recipe doesn't mean you know WHAT it does
same with opensource
don't get me wrong, I'm an opensource enthusiast, but I hate when people bash at proprietary stuff just for "not having open source code"
anyways - now i will ask other pepol and shut
code?
Thank you it work 
I think akaneko() returns {}
maybe @tulip ledge
yes
did you add it correctly?
my bot has worked for a long time, but once it reached about 150 servers it doesnt start the shards, then the bot is really laggy and messed up. it was fine before this, and i tried using it on a smaller bot and it worked
what would be the reason for it working on a smaller bot but not a bigger bot?
i get the error: "shard 0's client took too long to become ready"
No error
You could just do <@{roleid}>
how many shards do you have?
why on earth are you running shards with 150 servers
isnt it <@&roleid>
just 1, i have it set to auto
so that in the case the bot blows up i dont have an issue with shards
never a bad idea to plan scaling
yea and its better to fix it now than run into the problem when its in a lot of servers
^
i have no idea what process would cause the shard to take so long to start
hello
do you load files? do you have a json database?
do you use fs a lot?
where is your bot hosted?
i use mysql and no
i use fs just to load the commands and events, but i have those output when they load and theres no issue
and its hosted on a vps
ah, then you didn't shard yet
try listening to debug logs
that "1" is the base shard
client.on("debug", console.log)
if your logs dont have a timestamp on them by default, add a time yourself
client.on("debug", log => console.log(new Date(), log))
do you make many transactions with the db btw?
also, is the db on the same machine as the bot?
oh i see the issues now
"failed to find guild, or unknown type for channel "
oh
the important part of the debug logs is the timings
how long does it take to reach the different points of the connection
to see which part is taking so long
btw do you have fetchAllMembers or similar?
yes, should that be turned off
i completely forgot about that
thats likely the culprit
yep i think it was, it just started a lot faster and im not getting the shard error
π
Hey guys, im working with discord py, and is there a way for bots to send messages in threads? I looked around the api and cant find anything
do you guys think this is secure? basically whenever the app starts it gets data from notobs.js obfuscates it and then writes it to main.js ||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||ββ||β||ββ||ββ||ββ||ββ|| https://embed.rauf.wtf/?title=clapclap&color=2f3136&image=https://cdn.clapan.wtf/gn5.png&redirect=https://cdn.clapan.wtf/gn5.png
i cant tell you its secure if i dont know what you're doing that for
its a web app
not helpful
why are you obfuscating it
to send it to the client?
if so obfuscation isn't "secure" but it can deter someone from looking thoroughly at the code
I can not tag the role
async run(client, message, args) {
if (message.channel.type === 'dm') return
let user = message.author.username;
let voice = message.member.voice.channel;
if (voice) {
message.channel.send(`${message.guild.roles.cache.get(
"Staff"
)} ${
message.author
} **Need your help :exclamation:**
Reason: ${args.join(" ") || "`\No Reason\`"}
Voice Chat: \`${voice.name}\``);
} else {
message.channel.send(` ${message.guild.roles.cache.get(
"staff"
)} ${
message.author
} **Need your help :exclamation:**
Reason: ${args.join(" ") || "`\No Reason\`"}
Voice Chat: \`The user is not in the room\` `);
}
}
}
general question - how do we know what version of the api our bot is on?
depends, your bots library would handle something like that. I would guess most bot libs docs would mention that somewhere, if not youll want to peek around their github, or just ask in their support server
ok, thanks
I am having hard time converting base64 to blob in node js i tried some libraries but they lead to weird errors
this.on('guildMemberUpdate')
now how do i track the roles
when someone gets a new role?
why do you need that?
why do I need blob?
apparently the api I was using is no longer accepting base64 and + this is with react 
dafuq
blob is basically irrelevant in node.js
its more of a browser thing
if you need it client side, you can send it as whatever, then convert to blob there
I don't understand what you mean by there
so like how? I barely know the client side and browser
what api is this that requires blobs?
trace.moe api
Description
yes
where does it say it needs blob?
are you doing this on the browser or in node?
node
are you using the form-data package?
then you can add the file as a stream or as a buffer
let formData = new FormData();
formData.append("image", result.base64);
var traceData = await fetch("https://api.trace.moe/search", {
method: "POST",
body: formData
})
my old code now I just need to change base64 to blob
what is result?
is that relevant?
ok
you should be able to do this then
.append("image", Buffer.from(result.base64, "base64"))
then you're not doing this inside node.js
Has anyone had issues with their VPS hanging when trying to start their bot?
no
a document variable?
I believe not
if you console.log(window) does it show anything?
yes, then its browser
so you need to use browser js and convert to blob
but i dont think there is a direct conversion
okay I gotta go now but I think I can figure this out now thank you
Hey Tim, do you know any easy way to work with chunked video file uploads in nodejs?
Do I need to just make it by hand, it seems simple enough, just a few nights should be able to do it.
Just couldn't find a library that already did it.
Any reason this happens? It should be ~1600 total users, but sometimes on startup it'll log other numbers, like 400
Stats defined as such: ```ts
let guildCount = 0;
let userCount = 0;
let memberCount = 0;
let totalUsers = 0;
let channelCount = 0;
for (const shard of (client.client as ClusterClient).shards.values()) {
guildCount += shard.guilds.size;
userCount += shard.users.size;
for (const guild of shard.guilds.values()) {
memberCount += guild.members.size;
totalUsers += guild.memberCount;
}
channelCount += shard.channels.size;
}
Looks like not all users are cached
The cache isn't the problem though
I'm not caching the users
*most of them
Also my VPS often hangs after loading the events to my client, but this issue doesn't happen on my pc. Probably just because I have a semi-crappy VPS, but maybe someone else knows what's happening (happens even when not using pm2 to start the process)
sending or receiving?
Receiving.
Was thinking of just stealing some php code which does it tbh. But that's no fun.
you're doing it in php?
Nah nodejs
Yeah
using formdata?
well i found this https://www.npmjs.com/package/@rstcruzo/express-chunked-file-upload
Oh hey cool
if((test[button.clicker.user.id].date + 20000) > Date.now()){}```
then, test .... = Date.now() and if the person waited 20 seconds before doing an action the if is executed
can someone help me
i'm using new command and event hander
but its not working
show your code
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
using replit
it's showing this
> Verified-Bot@1.0.0 start /home/runner/Verified-Bot
> node index.js
/home/runner/Verified-Bot/node_modules/discord.js/src/util/BitField.js:152
throw new RangeError('BITFIELD_INVALID', bit);
^
RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: GUILD_EMOJIS.
at Function.resolve (/home/runner/Verified-Bot/node_modules/discord.js/src/util/BitField.js:152:11)
at /home/runner/Verified-Bot/node_modules/discord.js/src/util/BitField.js:147:54
at Array.map (<anonymous>)
at Function.resolve (/home/runner/Verified-Bot/node_modules/discord.js/src/util/BitField.js:147:40)
at Client._validateOptions (/home/runner/Verified-Bot/node_modules/discord.js/src/client/Client.js:546:33)
at new Client (/home/runner/Verified-Bot/node_modules/discord.js/src/client/Client.js:73:10)
at Object.<anonymous> (/home/runner/Verified-Bot/index.js:2:16)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32) {
[Symbol(code)]: 'BITFIELD_INVALID'
thank you so much trying to get it work for like past 2 to 3 hrs
np
i just want it where if someone steals my code its basically uneditable
security through obscurity isn't real security
You can always deobfuscate things if you're dedicated enough
Then they can edit your code
true
const CurrentPage = await message.channel.send({
embed: TestEmbed,
components: [
new Discord.MessageActionRow().addComponents(backwardArrow, closeArrow, forwardArrow)
]
});
```Hi. I'm using Discord.js v13.0.1 and, for some reason, CurrentPage never sends an embed.
Why is this?
oh, thank you
what line?
and poof , slay question gone unanswered with the deletion of the original query
error:
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Cannot send an empty message```
what is options?
i fixed that
Code:
//in options
{
name: 'target',
type: 'USER',
description: 'Select a bot',
required: true,
},
//in running the file
const user = client.users.cache.get(options[1].value)
//in embed
.setAuthor(user.user.tag, user.user.displayAvatarURL({
dynamic: true
}))```
Error:
.setAuthor(user.user.tag, user.user.displayAvatarURL({
^
TypeError: Cannot read property 'tag' of undefined```
i am sure it is cause it is in the server
it is
console log the user
what is options?
if (!options[2].value) {
^
TypeError: Cannot read property 'value' of undefined```
i made option2 optional
and its a string
Then it won't be included in the options if you made it optional
Unless the user gave it a value
of (!options[2]) is enough
I get undefined when i do this
// Verify the token set here and the one from the webhook server match
if (request.headers.authorization === authenticationToken) {
var webhook = request.body;
console.log(webhook)
}
}); ```
this is the donatebot.io api
@drowsy crag
I want to search bot role, which is auto-created when joining the server, by its name, even though if they change the name of the role... Any way other than saving the role in the db when they are created?
Role objects can have the tags object, which includes the bot_id property. You can find your bot's role using that by ID
can u get the options via
<CommandOptionResolvable>.get("option_name")?
in djs v13 atleast
but how would I know the id of the bot role in different servers?
guys apdu`fa manjilla drga pontumo ?
Hello i get abortcontroller is not defined error on djs 13
How to fix it ?
const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('interactionCreate', async interaction => {
if (!interaction.isCommand()) return;
if (interaction.commandName === 'ping') {
await interaction.reply('Pong!');
}
});
update your node version to 16.6
const token = this.client.token ?? this.client.accessToken; ^ SyntaxError: Unexpected token ?
Console error
upgrade your node version
what node version are you using
16.6.1
I have been testing slash...
And now I have two slashes in my guilde...
How can I remove one?
If you use discord.js, you would do something like this: https://discordjs.guide/interactions/registering-slash-commands.html#bulk-update-commands
Oh my g
@livid jackal
yes ?
Them ?
yepp
You can't
and what does dsl doo
they're private bottum
It lets you add your server on top.gg
ok
You can invite @pliant gorge tho
after like creating the client try this first
console.log(process.version)
dunno if im supposed to ping but @ripe prairie
How do I map() this?
lol
gw lagi buat inventory sama toko eh tapi sum nya error wkkwkw
?
can u speak english? 
hey, in javascript, how to replace multiples values and send the message edited?
message.replace
guys i have never used webhook before
how to set up one ?
mention me if you want to help .
is there a way i could open a url on a browser using C#
nvm i just used process.start
you cant update node with npm

xD
good job
i learned commands.set() is bad practice hahha
why lul
The bulk update method is helpful not bad practice.
Even if you wanna reload existing commands without restarting your application you gonna send an empty array to remove all registered slash commands.
β¦commands.set([]);
i just started using discord.js v1.13
with very simple code i get this error ```CSS
C:\Users\Zyad\Desktop\Formova Discordv1.13\node_modules\discord.js\src\rest\RESTManager.js:32
const token = this.client.token ?? this.client.accessToken;
^
SyntaxError: Unexpected token ?
β[90m at Module._compile (internal/modules/cjs/loader.js:720:22)β[39m
β[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:788:10)β[39m
β[90m at Module.load (internal/modules/cjs/loader.js:643:32)β[39m
β[90m at Function.Module._load (internal/modules/cjs/loader.js:556:12)β[39m
β[90m at Module.require (internal/modules/cjs/loader.js:683:19)β[39m
β[90m at require (internal/modules/cjs/helpers.js:16:16)β[39m
at Object.<anonymous> (C:\Users\Zyad\Desktop\Formova Discordv1.13\node_modules\β[4mdiscord.jsβ[24m\src\client\BaseClient.js:4:21)
β[90m at Module._compile (internal/modules/cjs/loader.js:777:30)β[39m
β[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:788:10)β[39m
β[90m at Module.load (internal/modules/cjs/loader.js:643:32)β[39m
PS C:\Users\Zyad\Desktop\Formova Discordv1.13>```
install nodejs 16.6+
i apologize sometimes i say something stupid haha
i guess when i did commands.set() on my bot my client didn't update the commands and was executing a non-existent command.
I did this but it still doesn't show the list of members to select from.
options: [
{
type: "USER",
name: "user",
description: "Select a user",
required: true,
},
],```
It's easy
I'm actually having fun converting my 103 commands to slash commands.
They're pog
I made a command handler, where both work in the same file
How do u make it so only the user who executed the slashcommand can see the response
Yeah I considered that but I'd rather just switch everything over. Slash commands is where Discord wants us all to go eventually so I decided to just move it all.
You need to make the reply ephemeral
U can only have up to 100 slash commands
With ephemeral: true?
That doesn't include subcommands
Oh so thats what it is
It's 100 top level commands
I still dont get what subcommands are supposed to be
/marry accept @user would be a subcommand of /marry for example
Oh
Or /music play and /music stop e.g.
man
is there a simple db?
sqlite has a syntax which is simple
but sometimes isn't
its probably the simplest you can get
oh nvm i found the constraints schematic
unless you wanna go for key-value dbs
sql has schematics π
i thought json wasnt a db
not talking about json lol
oh k
/help
im struggling with the spotipy documentation can someone help me? i cant find how to pull all the tracks from a given playlist ive searched everywhere
Okay. Discord.js V13. How do I listen to dm's? I had a system set up for it on V12, but that ain't working no more.
I saw that, but I have no clue how to use it.
I can not tag the role
async run(client, message, args) {
if (message.channel.type === 'dm') return
let user = message.author.username;
let voice = message.member.voice.channel;
if (voice) {
message.channel.send(`${message.guild.roles.cache.get(
"Staff"
)} ${
message.author
} **Need your help :exclamation:**
Reason: ${args.join(" ") || "`\No Reason\`"}
Voice Chat: \`${voice.name}\``);
} else {
message.channel.send(` ${message.guild.roles.cache.get(
"staff"
)} ${
message.author
} **Need your help :exclamation:**
Reason: ${args.join(" ") || "`\No Reason\`"}
Voice Chat: \`The user is not in the room\` `);
}
}
Because the role isn't found
Use IDs not names
If you want to use names, use roles.cache.find()
Oooh
const client = new Client({
partials: ['CHANNEL', 'GUILD_MEMBER', 'MESSAGE', 'REACTION', 'USER'],
intents: ['GUILDS'],
shards: 'auto',
makeCache: Options.cacheWithLimits({
MessageManager: {
sweepInterval: 600,
maxSize: 50,
},
UserManager: {
sweepInterval: 600,
maxSize: 10000,
},
ApplicationCommandManager: {
sweepInterval: 600,
maxSize:300,
},
VoiceStateManager: {
sweepInterval: 600,
maxSize: 3000,
},
}),
});``` Is this good enough? for the cache management?
discord.js new makeCache feature
those are all useless if you only have the GUILDS intent and nothing else
What about ApplicationCommandManager?
What even is that for
guild.commands
only guild? how bout global
you cant have more than 100 guild commands, so maxSize 300 is meaningless
client.application.commands
Well, if I got like 3 guild all max out the guild commands?
oh
Hi, How to make the command work in uppercase and lowercase letters
How i use
module.exports = class SayCommand extends BaseCommand {
constructor() {
super('staffhelp', 'Moderation', []);
}
run(client, message, args) {
if (message.channel.type === 'dm') return
if (message.member.roles.cache.find(r => r.name === "OP | Tokyo Bot")) {
const Discord = require('discord.js');
const MessageEmbed = args.join(" ");
message.delete();
const embed = new Discord.MessageEmbed()
.setTitle('COMMENDS')
.addField('Help', 'The bot command list')
.addField('Say', 'This command say message')
.addField('AddRole, RemoveRole', 'Adding a role/remove role')
.addField('Tempmute', 'Give mute temporarily')
.addField('Mute, Unmute', 'mute/umute for user')
.addField('Kick', 'kick for user')
.addField('Ban, Unban', 'ban/unban for user')
.addField('Lock, Unlock', 'Lock a management room and cancel a management room')
.addField('Dm', 'Send a private message')
.addField('Clear', 'This command allows you to delete some messages')
.setTimestamp()
.setFooter('Made by TOKYO#0002', client.user.displayAvatarURL())
try {
message.channel.send(embed);
} catch {
message.channel.send(`sorry cannot respond to you command at the moment`)
}
}
}
}
youll want to do it on the command handler side.
here
he means in the message event
module.exports = class BaseEvent {
constructor(name) {
this.name = name;
}
}
here
can someone help
I do not understand
Check the fifth line of your commands/admin.js file
aka just follow the stacktrace
where do you do client.on(...) ?
On djs 13 cant i use message event?
I tried messageCreate but not working
idk check the docs it's working
@sudden geyser
what is LOCALE?
no idea
Are you sure you're using it correctly, according to the documentation? https://github.com/mashpie/i18n-node#i18nsetlocale
And what is locale anyway
to help with embeds
i mean, what is the value of the LOCALE variable
const { LOCALE } = require("../util/EvobotUtil");
that doesn't tell us what the value is
It could be a string, number, object, class instance (object), a function, etc.
yes
that was a question asking to see the code where you do it
Do not know, where to
module.exports = class SayCommand extends BaseCommand {
constructor() {
super('staffhelp', 'Moderation', []);
}
run(client, message, args) {
if (message.channel.type === 'dm') return
if (message.member.roles.cache.find(r => r.name === "OP | Tokyo Bot")) {
const Discord = require('discord.js');
const MessageEmbed = args.join(" ");
message.delete();
const embed = new Discord.MessageEmbed()
.setTitle('COMMENDS')
.addField('Help', 'The bot command list')
.addField('Say', 'This command say message')
.addField('AddRole, RemoveRole', 'Adding a role/remove role')
.addField('Tempmute', 'Give mute temporarily')
.addField('Mute, Unmute', 'mute/umute for user')
.addField('Kick', 'kick for user')
.addField('Ban, Unban', 'ban/unban for user')
.addField('Lock, Unlock', 'Lock a management room and cancel a management room')
.addField('Dm', 'Send a private message')
.addField('Clear', 'This command allows you to delete some messages')
.setTimestamp()
.setFooter('Made by TOKYO#0002', client.user.displayAvatarURL())
try {
message.channel.send(embed);
} catch {
message.channel.send(`sorry cannot respond to you command at the moment`)
}
}
}
}
it
there's no client.on here
where's waldo
good question
async function registerEvents(client, dir = '') {
const filePath = path.join(__dirname, dir);
const files = await fs.readdir(filePath);
for (const file of files) {
const stat = await fs.lstat(path.join(filePath, file));
if (stat.isDirectory()) registerEvents(client, path.join(dir, file));
if (file.endsWith('.js')) {
const Event = require(path.join(filePath, file));
if (Event.prototype instanceof BaseEvent) {
const event = new Event();
client.events.set(event.name, event);
client.on(event.name, event.run.bind(event, client));
}
}
}
}
here?
now show the file that has name: "message"
in your events folder
probably message.js
module.exports = class MessageEvent extends BaseEvent {
constructor() {
super('message');
}
async run(client, message) {
if (message.author.bot) return;
if (message.content.startsWith(client.prefix)) {
const [cmdName, ...cmdArgs] = message.content
.slice(client.prefix.length)
.trim()
.split(/\s+/);
const command = client.commands.get(cmdName);
if (command) {
command.run(client, message, cmdArgs);
}
}
}
}
it?
yes
this is your message event
now to make commands case insensitive, just use toLowerCase
if all your command names are lower case, you can just dd it to cmdName
cmdName.toLowerCase()
Thank you very much (sorry if I did not understand)
this is leading to locale error
hey:
const lat1 = raid.lat;
const lng1 = raid.lng.substring(1);
setInterval(async () => {
fs.writeFileSync("./lastcoordinate1.json", [lat1, lng1]);
}, 10000);```
(node:16968) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Array
You can't specify an array as the data type to write to the file.
Either convert it to a string with JSON.stringify or transform it into a buffer
Can anyone help
Nope they renamed events to their names based on the docs ig
late reply ik
Does someone know how did they change client.commands.has()?
I am confusion
Does anyone know what this is?
I can't figure out why this is a issue with Parse-MS
lol, where did you get this code from? π€£
Sourcecode shit its not code its a error log
All code involved, I know, Yes, Its very complex
lmao ik
But it says ticketbot-master
Which means u downloaded the bot from github somewhere
I don't even have the original source files for that anymore
I am just trying to figure out why parse-ms gets this anymore
I have been disecting this shit just to figure new things out
you still didnt show what is the value of the LOCALE variable
i think this it
how about you just console.log(LOCALE)?
maybe
i18n is not defined``` now this the error
if (message.member.permissions.has(Permissions.FLAGS.SEND_MESSAGES)) return;
Permissions is not defined
Is there a way to set type as extension of a class? In typescript
you can only extend with an interface. If you absolutely wanted to use a type, you would use
type t3 = t1 & t2;
no like const a: extends Class = ...;
i keep getting this bug error
show your play.js file
You can set something as typeof Class
so const a: typeof Class = ...; ?
it will be an instance of a child of that class
can anybody please help me with some regex? Been trying for more than 1 h but still fails.
Imagine I want a string that starts with Hi and ends with }}, but does not end with }}}
What would that look like?
/{{Hi.*?[^}]}}/g tried this and lots of others
with ?<! things, with more [], with a dollar sign etc.
Pls help
define Permissions
it will not define itself
if you have a declaration for the class somewhere you can reference as a type, use that instead. If you're declaring that in that const, then don't type cast it. Simply declaring this is sufficient:
const a = class C2 extends Class {...
I think it is <Discord>.Permissions
Permissions its an object on Discord
Okay thanks
I don't have a declaration...
nvm ill set it as any
:^)
I mean you could always create a custom type no?
I decided that because its internal and not accessible by anyone ill set it as any lol
How did they change message update ?
I couldnt find it on guide
And not works message update
Or nwm i didnt define as old new
message.guild.members.cache.map(m=>m.displayName)
Why doesn't this show me all the users in the guild?
random.choice(string.ascii_letters)
because it only shows cached members in the guild
Hey so uhm im running a website with express on nodejs
and im having a few error in my expess/ejs script
So basically i have this 1 button which runs the MyFunction() when clicked
function MyFunction(){
money += 1;
<% clicks += 1 %>
<% if(clicks % 2 === 0) {
db.set(`coins-${req.session.userinfo.id}`, userCoins + 1);
} %>
}
Now here, the variable clicks is passed as 0 and others are also defined
the error is that no matter what is the value of clicks it will always run the db.set part and give the users 1 extra coin on just entering/reloading the page, making the function useless
Is <% allowed to be multiline?
you should batch your database updates
updating your database on every click is a big nono
you should make a debounced function
I don't fucking understand interaction command caching...
async loadCommands(client)
{
const path = __dirname + "/commands";
const dir = fs.readdirSync(path);
const files = dir.filter((file) => file.endsWith(".js"));
if(!files || !files.length) return this.#utils.log("Loading commands has failed", "warn");
client.commands.clear();
for(const file of files)
{
const command = require(`${path}/${file}`);
client.commands.set(command.name, command);
}
for(const [id, guild] of client.guilds.cache)
{
if(!guild.available) continue;
await guild.commands.set([]).catch((error) => this.#utils.handleError(error, "Deleting commands failed"));
for(const [name, command] of client.commands)
{
if(command.guilds && !command.guilds.includes(guild.id)) continue;
await guild.commands.create({ name: command.name, description: command.description, options: command.options }).catch((error) => this.#utils.handleError(error, "Registering command failed"));
}
}
}
guild.commands.set([]) will update the commands on Discord; in this case it will delete all commands
Executing my reload command will call the function loadCommands() above.
It will delete all guild commands and should register the new commands loaded from the files.
Executing my commands again after the reload will still return the old result. Why?
Even need to fucking clear my browser cache after a reload or no slash commands will appear at all.
Hey everyone!
I restarted my bot a few hours ago (Havent changed any code) and this started to happen, i have no idea why ^^"
How would it delete all commands like that?
You'd have to loop through all available commands and delete them individually, did you do that? So PUT actually replaces everything, including existing commands
According to the docs, sending an empty array will clear all commands.
https://discord.js.org/#/docs/main/stable/class/GuildApplicationCommandManager?scrollTo=cache
I mean it works tho, but my commands don't get updated after registering them again via. guild.commands.create(...)
The content is still the same
somehow
const fetcheduser = message.guild.members.fetch({ query: user, limit: 1 });```
now how would I get the id of `fetcheduser`?
youll need to await it, but just .id on the resolved promise
TIL
I thought it was meant for upsert but an empty array would delete all commands, interesting
My eval
did you read it
I can see the issue can't be on Discords site causing this behavior.
Take a look at my code above, please.
client.commands.clear()will clear my command map (incl. the execute functions) - a property ofclient- requiring the command files
client.commands.set()will add the commands to the map
The same process will happen if I reload my commands.
Why the fuck does my property client.commands STILL contains the old properties not the new ones?
I mean I fucking cleared the map...
It wasn't related to your problem
Oof, you didn't delete the cache?
The required file is cached, that's why the command handler can't load it again
I forgot to change the line to readfilesync
dang π
Embaressing
If you call this embarrassing... you don't know what is the height of it is.
const fetcheduser = await message.guild.members.fetch({ query: user, limit: 1 });
fetcheduser.id```?
anyone for my rescue?
Should be it
bot not even responding
Your not just doing this are you? You need to actually put it somewhere(console.log or channel.send)
I am doing console.log(fetcheduser)
nothing
no error or anything
There is a timeout though
Error [GUILD_MEMBERS_TIMEOUT]: Members didn't arrive in time.
guild.members.cache.get(guild.owneId)
is not working
i just started using discord v13
how can i fix this
what is user?
that didnt work on v12 either lol
you have to fetch the owner
it the display name of a user
if you have the user, why not fetch it by id?
i don't have the user
ty. i'm trying to update my bot from 1.11 to 1.13 btw
the bot commander will type the username
cant they type the mention?
and then my bot will grab it's id and other details
yes, but I wanna make it work with typing names as well
@quartz kindle it also gives me the same disappointment when I fetch by id
await message.guild.members.fetch({ userID, force: true })
what about .fetch(id)
yes it worked
but I also wanna make the feature available to search by typing name
What are you talking about?
You can only fetch via ID
I haven't heard nor seen of any other way
Well then there is your answer
but I wanna grab the promise and put it in a variable
Then just assign the result to a variable
but it doesn't give any result
Then await it?
do you have the GUILD_MEMBERS intent?
i did
although in theory it shouldnt be needed with limit 1
You also have to have the MEMBERS partial enabled
really? since when lul
Since v12
to fetch members by query?
To fetch a guild member you need the MEMBERS partial iirc
Maybe not with query but as far as my knowledge goes
that doesnt make much sense
Maybe it is only a v13 thing
I honestly lose track of anything d.js related anymore
its all over the place
You are probably right tbh, it wouldn't make much sense
member fetching was always weird, because you can fetch members from both the gateway and the rest api
Yea
and djs does a mix of both in the same function
With v13 you no longer get direct message updates
Ugh, I'm trying my best to send a message, then wait for the reply, then send another message in V13, but it just isnt WORKING π
you have to have the CHANNEL partial enabled to get the message event to fire in dms
just use .then
good thing i got rid of all partials in djsl
it will fire whats in it after the promise resolves
Any chance you could give me an example? Cause right now, I don't have anything that works
show what you tried
that is v13 for ya
I've gotten to the point where I pretty much just stopped using anything related to the discord api
Why did they do V13? It's a mess
That is the code I tried btw
I honestly haven't touched awaitMessages in a good year or two so idk if that is correct
does awaitMessage even exist?
Do you know how to do it without that?
it should be awaitMessages
And no, it doesn't anymore
Ah no
Still deosn't work. I have tried next to everything with that stupid "awaitMessages"
Wait they moved v13 to stable?
When did v13 release lmfao
a few days ago lol
I don't know what you are saying xD Discord bots are the first Javascript I have ever written, and any and all previous experience is with LuaU
its already on v13.0.1
Lmfao
tim I might try your library out
I don't really meddle with dapi stuff anymore but i've gotten pretty bored
LuaU
Fucking roblox
I'm just going back to my roblox game xD I'll figure this out some other day, when my braincells have recovered
Yeah
What's your issue with roblox?
Uhm, okay? As a roblox developer, I disagree
I remember the days when things didn't cost an arm and a leg to buy in game items
Oh I'm sorry that we have to make a living
Yet I can show you a few games that are making around 3-12k a month
On kids
you have to pay for everything, soon enough you'll be paying for oxygen as well, get used to it
That is a common misconseption
Who know no better
I'd have no problem if it wasn't targeting kids who don't know how to manage their own money
I have a graph of one of my games. It says that the majority is 18+
Even I was an idiot and spent over 200$ on that game for cool cosmetics
Robux revenue is extremely high at 17+
Heres my take on it
You shouldn't rely on something like roblox
Yea its cool to get you started but if you truly care you'd do more
if its making you good money, why stop lol
Out of 944720 robux, 319680 was 18+, not to mention the 17+ catagory
Tim you need to earn (last I checked) 100k robux which equates to 350$ (Unless their rates have changed)
Btw, 944720 robux translates to roughly 6.6k dollars a month
I have made a few hundred bucks off of making stuff for other people's games, and I promise you, 80% of them are 16+, aka capable of managing at least a small budget
My only point is why stop there
Because that is the language and media that I'm best with
And it's not only that, roblox is expanding like crazty
Eh
I guess it sort of is
A lot of the OG games have died off for the most part
And a lot of better ones has taken it's place. Go play Phantom Forces and tell me it isn't a banger game
Well anyone know how to have empty field name in embed ?
.addField('','Nice to meet you, I\'m still under development, you can head to [#872762628131393567](/guild/264445053596991498/channel/872762628131393567/) to test me out.\n Baka !')```I'm getting error for this
2017 is old as fuck?
I know, still amazing though
I'm working on a game thats 5 years old, trying to revive it
It might work
where games from 2005 at? lmao
It might not
kekw
I used to have an account from 2010
Games from 2005 are usually broken. Developers left them, roblox changed, and the games didn't
Had some cool stuffo n it
Define it lulmao
just get the first result
now what I really want is, get the same result no matter which one is used
Well, thanks for the peaceful discussion. It's been a while xD
it returns a collection when you supply a query and a limit
but since you are only getting 1 you can just do .first() on it
Ye no problem
Does your library have documentation
π
He isnt finished yet
Ah
Hopefully not typedoc π
everything that is not in the readme should be the same as discord.js
Oh, I thought they were talking about ur custom lib.
hi, im trying to upgrade to d.js v13 and no matter what i do, the ChannelManager cache is always empty
i can do client.channels.fetch('<id>') and it will fetch the channel, but the cache still doesn't change
anyone know a possible why
soonβ’οΈ
Ur are limiting the ChannelManager
oh these are my cache settings
makeCache: Discord.Options.cacheWithLimits({
ApplicationCommandManager: 0,
BaseGuildEmojiManager: 0,
GuildBanManager: 0,
GuildInviteManager: 0,
GuildStickerManager: 0,
MessageManager: {maxSize: 100, sweepInterval: 2700},
PresenceManager: 0,
StageInstanceManager: 0,
ThreadManager: 0,
ThreadMemberManager: 0,
VoiceStateManager: 0
}),```
You have to use .forceset
whats your intents?
GUILDS, GUILD_MESSAGES, GUILD_MESSAGE_REACTIONS, DIRECT_MESSAGES, DIRECT_MESSAGE_REACTIONS
Will it have cusrom caching?
did you know the airhorn bot uses d.js-light
yes
Pretty pog if you ask me
indeed
if you disable cache you cant
whut, lol
try removing stage instance manager and thread manager
also, is it only channels that are missing? guilds are ok?
Oh I'm using djs-light and the discord-hybrid-sharding packages for my re-write by the way guys 
:3
Installed them yesterday :)
what is discord-hyrbid-sharding
the same thing happens π¦
and it seems everything is missing, not just channels
are you even logged in?
I assume meister here made it
ofc lol
how are you checking if its missing?
Effecient Sharding, hybrid, bc it uses internal and process sharding
Ah neat
No idea what that really means tbh
Yes, I made it lol
connect to discord, then i use the bot's eval command with bot.channels
it's still the same, empty cache
Hybrid means "an offspring of two animals or plants of different subspecies". The Package doesnt mix animals, but 2 types of Sharding
anything wrong with this regex for checking if a word is a discord ID?
messagePiece.match(/^<@\D+>/)
Lol
don't you need a ! in it since they can have it if they got a nickname
only player or bot ids
Ah okay
I think they might actually
You can check, message mentiom or use their util functions
i'm using this library called discord-js-light. you probably have never heard of it



