#development
1 messages · Page 1846 of 1
Discord's own API team called interaction response attachments a "plan" because they're not possible right now https://github.com/discord/discord-api-docs/discussions/3581
Yeah but that's two requests
ppl aren't answering in D.JS' server, gonna ask here
the bot isn't reacting to bot.on("messageCreate")
You're going to need to show some code for us to be able to help you
no problem
intents are there
and the bot is working before messageCreate events, but if I try to work with anything inside this event handler, nothing comes out, not even a console.log
I guess there isn't any code to be shown tbh
just the intents xD
new Client({ allowedMentions: { parse: ['users', 'roles'], repliedUser: true }, intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MESSAGE_REACTIONS] });
I'm starting the event handler like this bot.on('messageCreate', async message => {
forget about it, I've been testing and found out what the problem was
it actually detects messages
fully workin' 😉
how can i add the hearbeat animation using css
I know a library that can do that
i want to add it on top.gg's invite button
Hm
i dont think this would work
i did try this css .titleandvote > a:first-child .votebutton { animation: heartbeat 1.5s infinite; }
but doesnt seem to work
because the css doesn't know what heartbeat is
try using https://animista.net/ to generate an animation you like
what should i do then
ok
then i put that code in this?
inside .titleandvote > a:first-child .votebutton {}
copy paste the keyframes
ok
then?
where do i have to put it
i copied css .heartbeat { -webkit-animation: heartbeat 1.5s ease-in-out infinite both; animation: heartbeat 1.5s ease-in-out infinite both; }
just ```css
-webkit-animation: heartbeat 1.5s ease-in-out infinite both;
animation: heartbeat 1.5s ease-in-out infinite both;
that goes in this
you need the keyframes too though
thanks
what hsould i do?
...copy the keyframes
Why not found
If I need to save some files for each user should I assign each file an ID and handle everything with IDs or should I instead just use file names directly?
i just copy replit discord bot python starter code to my repls
Can anyone help me with discord bot welcome msg? here is my code - https://pastebin.com/9aGfJqqE but it only showing single server and other server that I am not in
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.
i use the kick command and console show me like the image that i post
for guild in client.guilds:
embed = discord.Embed(title = "Sagiri Welcome Massage", description = 'Welcome {} on {} server!:partying_face: Enjoy your stay :) '.format(member.name,guild.name),color = (0xF85252))
That's your issue
why are you iterating over the guilds
@opaque seal What should do?
what do you wanna do?
@vivid fulcrum do you know??
Working with file names is a better idea in this case
any specific reason why?
The reason being performance regressions and concerns, such as a case where you have to look for documents/data of a specific user or whatever and you'd have you look through every single assigned ID to find them and do whatever, but as I said, if you're working with file names this should be really simple and better performance-wise
a guy told me that there is the risk of file names having special chars that I'm not able to process though
@opaque seal I mean how can I get client guilds name without looping client.guilds?
Not sure if you're also assigning the user's other details on the file name that might contain unicode characters that might be hard to parse but this should be an easy process if you're splitting the details with for example a delimiter using : or _ and using regex to find the one you're looking for
nah I just need users to upload and download files nothing else
maybe rename them too
and delete obv
not understanding your question
If you're willing to give them the option to also rename the files then you're better off working with assigning IDs to the files
May you rephrase your question?
inspect element > get the className > put css
i tried this
but it didnt work
i tried that code
I want bot msg to new members for joining new servers, but my issue is it only showing one server and not multiple servers, like if my bot in example server1 and I am joining on example2 server but bot showing I joined on example1 server and not example2 server. How can I fix it?
you are missing the <style> thing
do you have "GUILD_MEMBERS" intent ?
you are iterating over the guild with the for loop but effectively you only have one embed variable that you send to the user
no i have it
So, how can I do as same servers as joined?
Also this is not too clear
my bot in example server1 and I am joining on example2 server but bot showing I joined on example1 server and not example2 server
i jsut didnt include it in the bbin
Yes
as i have a lot of code
then make sure you used the right css class selector
is it this ```css
.titleandvote > a:first-child .votebutton {
}```
show 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.
I don't see any .votebutton class n top.gg
what hsould i do then
It's python

inspector
Yes, it's
yeah but after opening it then?
Not using js
how do i find the class for the invite button?
Hope someone else will help you
.entity-header__actions .entity-button--primary:last-child
should be this one
that's the vote button
may i know how you found this out
and the ivnit ebutton?
oh thanks
all here
thank you so much!
Well no one understands question but more clearly is I just want to show new member on dm that he/she joined on that server like "welcome "Member name" you have have joined on "Server Name" in real time.
How to find server name?
@client.event
async def on_member_join(member):
await member.send('You joined {}'.format(member.guild.name))
Haven't really used python before
so syntax could be wrong
seems adding member before guild.name solved thank you.
bruh
bruh?
bruh !
Lol
Growth Inorganic. Why this happens any idea?
I think this answers your question #697236247739105340 message
I think i don't have perms
I dint joined
Thx
Hii
I need help
I cant add yt togeather feature in my bot
It shows many erors
Invalid token exit status and many more
Hmm
I have code but i cant add
Cofe?
const {MessageEmbed} = require('discord.js');
const fetch = require('node-fetch')
const {MessageButton} = require('discord-buttons')
module.exports = {
config: {
name: 'youtube-together',
aliases: ['ytt'],
category: 'fun',
description: 'Watch Youtube in a vc with your friends!',
usage: '',
},
run: async (client, message, args) => {
const channel = message.member.voice.channel
if (!channel) return message.channel.send(
new MessageEmbed()
.setTitle("You must be connected to a voice channel to use this command!")
.setColor("RED")
)
fetch(https://discord.com/api/v8/channels/${channel.id}/invites, {
method: "POST",
body: JSON.stringify({
max_age: 86400,
max_uses: 0,
target_application_id: "755600276941176913",
target_type: 2,
temporary: false,
validate: null
}),
headers: {
"Authorization": Bot ${client.token},
"Content-Type": "application/json"
}
}).then(res => res.json()).then(invite => {
if (!invite.code) return message.channel.send(
new MessageEmbed()
.setTitle("I was unable to start a yt together session! pain")
.setColor("RED")
)
const ytt = new MessageButton()
.setStyle("url")
.setLabel('Watch Youtube Together')
.setEmoji("870909668090851399")
.setURL(https://discord.com/invite/${invite.code})
message.channel.send({
buttons: [ytt],
embed: new MessageEmbed()
.setTitle('Watch Youtube Together grin')
.setDescription('Click The Button Below To Watch Youtube Together In A Voice Channelcoffee')
})
})
}
}
Gmm
Hmm
Heroku while deploying branch
https://sourceb.in/Add7XmcD3D
@opaque fern Can you help me in this error ?
https://sourceb.in/Add7XmcD3D
One message removed from a suspended account.
Is there a way to respond to an interaction with one non-ephemeral message and one ephemeral? 
Yeah. I hate testing slash commands because I have to reload my browser client whenever I reload my commands otherwise it’ll give me that error
so fucking annoying... can't send any slash command anymore
Reload your discord
didn't delete or edit the registered command
tried that already clearing the cache, different browser etc.
same result
You sure you reloaded it?
Can you explain that?
It's basically another message after your initial message/response
You can set it to ephemeral
It doesn't edit your initial response though (unless you deferred it).
Have to disable Ecchi for now as slash command bypass channel. lolzer
I cache channels so
I just check the isAdult property from AniList or Hentai genre from Jikan
{
name: "Boosting since",
value: `${moment(member.premiumSinceTimestamp).format('Do MMM YYY') || 'Not a booster'}`, inline: true
}```
the bot should return "not a booster" if the user is not boosting but still it returns Invalid date am i doing something wrong?
will still have ecchi genre for anilist even if got isAdult = false
member.premiumSinceTimestamp ? moment(member.premiumSinceTimestamp).format(...) : "Not a booster";```
Ecchi isn't NSFW though
I mean
As in it should be OK
well, my bot rejected on first review
The covers should be fine and all
ah ok ty
because of ecchi
then second time, got accepted since I have to hardcode it to exclude ecchi for now
I should consider filtering ecchi shows too then

But that'd be a lot of good shows
ikr
In vsc how do I attach a debugger in a folder called web present in my root folder
Well thank you, figured it out now 👍
beautiful growth. I'm wondering how those got 100+ per day while I'm like 4 guilds. Lmao
yeah was forced to leave all guilds before somebody told me reinviting will overwrite the permissions

shit happens
how can u help me like
shall i go in shell ?
and type what ?
I'm guessing replit?
yea
i am in it only
shall i send u invite
?
can u fix it
?
<client>.on('channelDelete', (channel) => {
let channeltype = channel.type
})```
lol i asked is it possible or not. I didnt ask the code xd
Anyway thanks lol
Error: Cannot find module '@keyv/mysql'
But @round hamletv/mysql is clearly installed:
"dependencies": {
"@keyv/mysql": "^1.1.4",
// More dependencies...
},
ok why does that ping someone
that's bullshit
npm ls @keyv/mysql what it say?
You know what
I'll just make an express server in my bot and use that to access the data
I couldn't be bothered
nvm i fixed it
http://radio.garden/listen/nee-swaram/l1iIOlkw
i want to use this auido ...help me (discord.py)
Travis Scott yml 😳
?
i got those goosebumps everytime i see this code 
@small tangle i replit user?
what
wdym
no
acknowledge it
Anyone uses replit
im using my rpi
he is having an event, but there is always that
what does the console say?
me ?
ye
nothing
morning
const {MessageEmbed, MessageActionRow, MessageButton} = require('discord.js')
module.exports = (message) => {
if(message.channel.id !== "673558424025432085")return
message.delete()
let embed = new MessageEmbed()
.setTitle('Le saviez vous ?')
.setDescription("De: <@!" + message.author.id + ">\n\n" + message.content)
.setColor(`#18F5FF`)
.setFooter(`Oui: 0, Non: 0`)
let row = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('oui')
.setLabel('Oui')
.setStyle('PRIMARY'),
new MessageButton()
.setCustomId('non')
.setLabel('Non')
.setStyle('DANGER')
)
return message.channel.send({embeds: [embed], components: [row]});
}```
```js
if (interaction.customId == 'oui') {
if(!yesOrNot[interaction.message.id]){
yesOrNot[interaction.message.id] = [interaction.user.id]
}else if(yesOrNot[interaction.message.id] && yesOrNot[interaction.message.id].includes(interaction.user.id))return
let regex = /\d+/g;
let string = interaction.message.embeds[0].footer.text
let matches = string.match(regex);
let embed = new MessageEmbed()
.setTitle('Le saviez vous ?')
.setDescription(interaction.message.embeds[0].description)
.setColor(`#18F5FF`)
.setFooter(`Oui: ${parseInt(matches[0])+1}, Non: ${parseInt(matches[1])}`)
return bot.channels.cache.get('673558424025432085').messages.fetch(interaction.message.id).then(r => r.edit({embeds: [embed]}))
} else if (interaction.customId == 'non') {
if(!yesOrNot[interaction.message.id]){
yesOrNot[interaction.message.id] = [interaction.user.id]
}else if(yesOrNot[interaction.message.id] && yesOrNot[interaction.message.id].includes(interaction.user.id))return
let regex = /\d+/g;
let string = interaction.message.embeds[0].footer.text
let matches = string.match(regex);
let embed = new MessageEmbed()
.setTitle('Le saviez vous ?')
.setDescription(interaction.message.embeds[0].description)
.setColor(`#18F5FF`)
.setFooter(`Oui: ${parseInt(matches[0])}, Non: ${parseInt(matches[1])+1}`)
return bot.channels.cache.get('673558424025432085').messages.fetch(interaction.message.id).then(r => r.edit({embeds: [embed]}))
}```
i found a ternary operator polyfill for IE1
(condition && (ifTrue || true)) || ifFalse;
here's a polyfill for if statement
[
c => c == true,
c => (c + "")[0] != "0",
c => c.length == 0,
...
].some(test => test(condition) == true);
what the fuck lmao
necessarily it is not possible to make an event just to remove the error?
a polyfill for an ES0 thing that uses an ES5 thing
you should "remove" the error by implementing it the right way 
https://deploy-preview-638--discordjs-guide.netlify.app/interactions/replying-to-slash-commands.html look here for further information ^^
if you going to edit the original message, either use .update or .deferUpdate() on your interaction handler
the later in your case
await interaction.reply('Pong!');
await interaction.deleteReply();```
answer and delete the answer?
you dont need to delete
but you have to use reply or deferreply before 3 secs passed
I want to delete it because it is a show which will contain a lot of this kind of thing if the person answers all the "surveys" it will be spam
there is interaction.deleteReply() too you know

Can anyone help me? net::ERR_CONNECTION_REFUSED I'm trying to connect to my api which is on localhost, code:
// Bot : Server.ts
import express = require("express");
import cors from "cors";
let authKey = "key";
const app = express();
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(cors());
const port = 5500;
app.get('/user/:userId/key/:key', async (req, res) => {
// Get the data
res.json(data);
});
app.listen(port, () => {
console.log(`App listening at http://localhost:${port}`);
});
// Front End (react app) : User.jsx
const getUser = async (userId) => {
let userRes = fetch(`http://localhost:5500/user/${userId}/key/<key>`, {
method: "POST",
mode: "cors",
headers: {
'Content-Type': 'application/json'
}
}).then(res => {
console.log(res.json())
});
wow, I feel stupid
also you got .get and POST mixed up
You did
app.get
and then
method: "POST"
hol on a moment

https://www.freecodecamp.org/news/apis-for-beginners-full-course
https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Client-side_web_APIs/Introduction
https://www.mulesoft.com/resources/api/what-is-an-api
https://snipcart.com/blog/integrating-apis-introduction
https://blog.hubspot.com/website/application-programming-interface-api
https://www.w3schools.com/js/js_api_intro.asp
https://medium.com/the-era-of-apis/how-to-use-an-api-the-complete-guide-d701e32c7c9f
Here,
go through these tutorials again

so have this code that will set someone to inactive but if they are already inactive so a schema is saved to the database it still creates a new one alltought i tried to check if there is already one, can someone help me https://srcb.in/PXYtxE8XPM
Oh god
nvm fixed with an await
what
Not sure if it’s because I’m on mobile but that code is not very readable
why not
Very squished together
tested it and now it works
what should i do better then in your opinion
If it’s your style, that’s what matters
Assuming that you’re the only one working on it that is
Imo using a linter like Prettier or eslint could do wonders for you though
Or maybe it looks fine on desktop, idk, I’m on mobile rn
what does eslint even do actually
gives you headaches
probaly it'll look kinda the same
my friend uses or used it but i had no idea wtf it did
and i hate headaches
Personally I just use prettier
Ctrl+shift+F and boom my code looks nice
(For the most part, it’ll still fuck up some things for me)
well im fine with this
What language are you using
why does this https://srcb.in/1Y8Iu8aitW return this
that doesnt look like a proper tag for an emoji
youre sending undefined where the id should be
and random colons are missing
That’s a timestamp
Not an emoji
He’s trying to send a timestamp
Like <t:2774828154:R>
Etc
its a timestamp
so how can i fix it
dunno, what does the code look like?
@lapis junco see https://docs.top.gg/libraries/javascript/#webhooks
response object doesnt have a field called timestamp
it does
doesnt look like it
in your case for some reason its not defined
let response = await inactiveSchema.find({userID: userID});```
can you dump the contents of this value `response` somehow and see whats in it?
that from within the bot, underneath that line?
is the value of userid youre passing in, what you think it is?
console.log(response) in the line above the sending line logs this
if you're just trying to get one entry use findOne instead of find
it's also faster since it stops at one entry
and for the future you'd do response[0]
since the response is an array
yeah response is an array so you are trying to get .timestamp on the array
which is undefined
thx
Unhandled Rejection (TypeError): Cannot add property 0, object is not extensible
let columns = [];
// Some fetches to get data
let obj = {
id: userId,
username: tag,
avatar,
rank,
createdAt: turnTimestampIntoData(userData.started),
totalProfiles: totalProfiles
}
columns.push({...obj});
Alright I managed to solve it by doing this:
columns = columns.reduce((acc, current) => [acc, current], [obj]);
Nvm
it did not fix it
show more code, there's no way the error's coming from there
Why does this code https://sourceb.in/wUYi16Wa5A return cannot read property members of undefined and how can i fix
console log guildId to check if it's the correct guild id
hello, excuse me for bothering you but I have a big problem in the rush I delete important files from my bot on my virtual machine (vps) and my pc and I have no backup I have all deleted with bitcurrency ssh so nothing in the trash help me
You're so fucked up
nooo plz
at least 5 hours of work there
my vps and under debian isn't there a place where it could have stored things?
I fixed it by adding an await to one of the fetches idk why it fixed it but it did
I have access to the eval command, help me: c
You deleted all your bot files?
I deleted important files from the bot
I want to restore this or at least have its code so that I can redo each file
Require all the files in your eval and toString() them
I think it only works for functions though
You need to rely on cache at this point
I can not require them since it does not exist any more suddenly how to do?, going through the events / command would be possible?
If you required that somewhere then it should have been cached iirc
and how do I display it?
^^
If your eval command is in a separate file (eg eval.js)
then
Long story short
You're fucked
:c
Are you sure that's the correct path
yes I am sure
Do js console.log( Object.fromEntries( Object.entries(require.cache).filter(([K]) => !K.includes("node_modules")) ) );
And try requiring one of the paths
how do u make an owner slashcommand? Won't other people be able to see it?
They can see it unless you only create a guild command
oh
okay ? js .eval console.log( Object.fromEntries( Object.entries(require.cache).filter(([K]) => !K.includes("node_modules") && K.includes("/root/joe/assets/export/stats/addVoice.js")) ) );
.eval .eval console.log(
Object.fromEntries(
Object.entries(require.cache).filter(([K]) => K.includes("/root/joe/assets/export/stats/addVoice.js"))
)
); ??
Nop, just simple require("/root/joe/assets/export/stats/addVoice.js")
A
Oh sec
.eval Object.entries(require.cache).filter(([K]) => !K.includes("node_modules")).map(([, V]) => V.exports.toString())
My BOT just promped this, i think it's due the music plugin, i use ytdl and have no idea where i should put the maxListeners() into, if anyone could help
It will spam the console
for future prevention, ALWAYS use git
And not all the entries will guaranteed to look like what it would be originally
since toString() is only effective for functions
You can also use JSON.stringify() for JSON
But we'll see if this even works
Are all the stuff you worked on functions?
If so then yeah you're fine
Unless you exported an object
How would you guys react if I tell you that in JS you can break out of a if block?
Or I say, any block.
Just a pair of braces
@round cove
lemme guess, goto?
Js dont hv that
it does have
😳 u accidentally gave the answer.
Does message.guild.bans.create() keeps banning banned users as well? or does it returns an error?
if (true) stmt: {
console.log(1);
break stmt;
console.log(2);
}
but why would you ever want to do that
Same reason as of loops
breaking out of a for loop is very different from doing this
but you're supposed to check before entering the if clause
with for loops you are stopping the entire loop, so the next elements will never be reached, this is basically a return except it's not really a return, you're just stopping the execution of the statements after the break
and it's also hard to read
I don't know today I got to know about this and found it interesting
if you really don't want an extra pair of brackets then use self invoking functions
if (true) (() => {
console.log(1);
return;
console.log(2);
})();
you can use labels to break out of parent blocks, otherwise it only breaks out of the current block by default
but at that point you might as well put it inside a function and return instead, since return breaks all blocks
labels are useful when you're using em with loops yeah
but they're not supposed to be used like this
Lol, very nested
Heyo, when doing OAuth2 you recieve a permission key with every guild. How do i see if this permission number = administrator ? https://i.nidrux.online/Aug-16-2021_09-27-23.png
Administrator is 8
I believe there’s an enum for it in djs
Like Permissions.ADMINISTRATOR
Something like that
Hey, I'd like to ask a question.. so I have this function, well it is for an uptime command, and I've coded it whereas if the hours is 0, then it would now show in the return statement, but I don't think it's working the way I expected it to.. did I do something wrong?
const duration = ms => {
const sec = Math.floor((ms / 1000) % 60).toString();
const min = Math.floor((ms / (1000 * 60)) % 60).toString();
const hrs = Math.floor((ms / (1000 * 60 * 60)) % 60).toString();
const day = Math.floor((ms / (1000 * 60 * 60 * 24)) % 60).toString();
return `${day.padStart(1, `0`) ? `${day.padStart(1, '0')} days, ` : ""}${hrs.padStart(2, '0') ? `${hrs.padStart(2, '0')} hours, ` : ""}${min.padStart(2, '0') ? `${min.padStart(2, '0')} minutes, ` : ""}${sec.padStart(1, '0') ? `${sec.padStart(1, '0')} seconds` : "0 seconds"}!`;
};
console.log(duration(bot.uptime)); // Final uptime code result.
I believe so, yes
But member.user.username is working
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
But this time if no user specified it has to cache author and this doesnt work
Thanks <3
you can use num & 8
you can also convert the value to binary and see whether the fourth bit is 1 (1000 = has admin perm)
isnt that terribly inefficient? lul
I mean for human reading
like "hey I wanna see if this code includes admin (no code)"
ah xd
this just returns a list of 0 and 8.
when i log it
yes
what does it actually do ?? xD
if it returns 0, it means the permission is not enabled
if it returns 8 it means it is
The problem is... I only need to check if they have administrator. But when you have some other permissions the number still has an 8 in it
you're mistaking things
& 8 does a bitwise comparison
it doesn't actually mean 8 as in the number, but 1000
no matter what the number is, it can never have a bitwise 8 if they dont have admin
the fourth bit is the one that represents the admin perm
Ah
imagine it like a switch
0 is false, 1 is true
it returns 8 because it's returning 1000, which means 8 in decimal
if u wanna check other perms all u need to do is use a different bitmask
@round cove
how are u getting ur perm code?
is there any number bigger than 2 billion?
the actual flags
yes
if so you need to use bigint
as you can see, the fourth bit is actually false
normal numbers only support 32 bits for bitwise comparison
use this instead
BigInt(number) & 8n
What does the n do ?
Sorry if i'm asking stupid questions but i'm trying to understand what I'm pasting :)
oh alright
still returns 8n
that example shouldn't return 8
it's a small enough value
are u sure you're getting permissions and not id?
as I've shown, those are the permissions in binary
4th bit is 0, so no admin
There’s also a nice JS package for working with bigints incl. tons of methods for anything you need without the need to add the literal to any calculation by hand.
(and yes I know bigint in part of nodejs already)
wait
now ejs is being difficult
why are you comparing a bigint to string?
was trying something out
also why guild.owner === true?
still the same when its just 8n
just do if (guild.owner || BigInt(guild.permissions) & 8n)
guild.owner is probably returning an id or something
ah, nvm then
but anyway, since for JS anything is a boolean you don't need to compare a bitflag with the expected bitflag if you're masking it
since with a mask it'll always return either 0 or the bit
aight
array.length === 0
!array.length
I have to specify the length because i put some data in it
Yee !array.length will check if your array is empty
How do i check if an array is empty?
As well as if(array.length) to check if an array isn’t empty
length returns an integer and 0 is false (not boolean false tho)
Hello yall so im doing a music bot but im getting this error.
TypeError: Cannot read property 'get' of undefined
This is the code that terminal says that faulty code is.
const serverQueue = message.client.queue.get(message.guild.id);
well queue should probably be a map or a collection if u're using djs
In your case it’s not defined
!selfban

amogus bot
did u defined queue in your Client class?
I hate this connection error...
code?
This is sending only the file attached
no embed or anything
djs broken or what 
btw I have messageattachment abv
can u show us the messageattachment code
Damn at least take me to dinner first
0.name[BASE_TYPE_REQUIRED]: This field is required
at SequentialHandler.runRequest (/rbd/pnpm-volume/56561ae7-8856-4800-ac30-0bea8f35bfb4/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.js:198:23)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (/rbd/pnpm-volume/56561ae7-8856-4800-ac30-0bea8f35bfb4/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.js:99:20)
at async /app/index.js:41:5 {
rawError: {
code: 50035,
errors: { '0': [Object] },
message: 'Invalid Form Body'
},
code: 50035,
status: 400,
method: 'put',
url: 'https://discord.com/api/v9/applications/876296804340228100/commands'
}
- Routes.applicationCommands('876296804340228146'),
what are you trying to tell with the error message?
Slash commands require a name and description
Is this where you ask for help with your code?
Yes
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Card : MonoBehavior
{
public string title;
public string cycle;
public string pack;
public int number;
public string faction;
public string type;
public string traits;
public Card()
{
}
public Card(string Title, string Cycle, string Pack, int Number, string Faction, string Type, string Traits)
{
title = Title;
cycle = Cycle;
pack = Pack;
number = Number;
faction = Faction;
type = Type;
traits = Traits;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class Army:Card
{
public int cost;
public int command;
public int attack;
public int hitPoints;
public string signatureWarlord;
public army()
{
}
public Army(int Cost, int Command, int Attack, int HitPoints, string SignatureWarlord)
{
cost = Cost;
command = Command;
attack = Attack;
hitPoints = HitPoints;
signatureWarlord = SignatureWarlord;
}
}
Why can't I get the army class to inherit the card class
This is mostly related to discord bot development/web development, so you might not get a response very fast on C# unity questions, though you can still ask them here
I’ll take a look at it rq but my C# knowledge is sub par
oh, is there a channel for c# or a server
You could go to the official C# server, but if you have stuff specifically related to unity they’ll likely redirect you to the unity server
Are you getting any errors with this code?
No, the Card just does not turn green after the army:card
so it is not seeing the Card class
You have to include your file with a using declaration iirc
okay, I'll google it. Thanks for your time. I joined the unity discord.
Good luck!
I'll need it 🙂
how can i give the invite button a border
you can't give buttons borders
I need that 24/7 script. Please
What's the context
what script ?
Hey.
In my slash commands, I am not able to view all the slash commands except commands that are in one specific folder, anyone knows what could potentially caused, this?
You not loading all the files in other folder?
This is the slash commands handler code.
// Slash Commands
const slashload = dirs => {
const slashcommands = readdirSync(`./src/slashcommands/${dirs}/`).filter(d => d.endsWith('.js'));
const commandsArray = [];
for (let file of slashcommands) {
const slashpull = require(`../slashcommands/${dirs}/${file}`);
bot.slashcommands.set(slashpull.config.name, slashpull);
if (slashpull.config.aliases) slashpull.config.aliases.forEach(a => bot.slashaliases.set(a, slashpull.config.name));
commandsArray.push(slashpull.config);
bot.on("ready", () => {
bot.guilds.cache.get("737011108954505267").commands.set(commandsArray);
});
};
};
["social", "utility"].forEach(x => slashload(x));
I am, though, did I do something wrong?
Oh wait, the ready event fires once, probably, I think it would work.
I cant put Ko-fi widget on my website
<script src='https://storage.ko-fi.com/cdn/scripts/overlay-widget.js'></script>
<script>
kofiWidgetOverlay.draw('pgamerx', {
'type': 'floating-chat',
'floating-chat.donateButton.text': 'Support Me',
'floating-chat.donateButton.background-color': '#00b9fe',
'floating-chat.donateButton.text-color': '#fff'
});
</script>
my code
at Object.draw (overlay-widget.js:34)
at (index):7```
how can i change the buttons colors
Add defer at the end of both script opening tags
defer>
Thank you
(node:14024) UnhandledPromiseRejectionWarning: TypeError: guild.iconURL is not a function
at Object.execute (E:\C) Developing\Wolfy-NewHandler\events\guildCreate.js:9:29)
at Client.<anonymous> (E:\C) Developing\Wolfy-NewHandler\index.js:44:83)
Events/GuildCreate.js
const Discord = require('discord.js')
module.exports = {
name: 'guildCreate',
execute(client, guild) {
const join = new Discord.MessageEmbed()
.setTitle(`${Client.user.username} added to a new server!`)
.setColor("GREEN")
.setThumbnail(guild.iconURL({dynamic: true, format: 'png', size: 512}))
.setDescription(`Server Name:\n\`\`\`${guild.name}\`\`\` `)
.setTimestamp()
const LogChannel = Client.channels.cache.get('875612048602587146')
LogChannel.send(join)
}
}
also any way I can change the position of it to right because there is no option in ko-fi to change it
Uncaught ReferenceError: kofiWidgetOverlay is not defined
at premium:7
now this error
how to define things in script tag
guild is not a Guild object
also why are you naming client as Client on the last line
edited + client.user.username not working too
?
I think the guildCreate event returns guild as an object
okay
<script src='https://storage.ko-fi.com/cdn/scripts/overlay-widget.js'></script>
<script>
kofiWidgetOverlay.draw('pgamerx', {
'type': 'floating-chat',
'floating-chat.donateButton.text': 'Support me',
'floating-chat.donateButton.background-color': '#00b9fe',
'floating-chat.donateButton.text-color': '#fff'
});
</script>
Uncaught ReferenceError: kofiWidgetOverlay is not defined
anyone know what to do?
According to the error, kofiWidgetOverlay is not defined.. meaning there is no variable/constant that gives a value to this variable/constant.
Never used kofi, so I dunno
How do i check if bot cant send message to user
send it and catch the error
<user>.send("Hello World!").catch(return message.channel.send("I couldn't send a message to the user.");
Is const [cc] = args; same as const cc = args[0];?
how do i get utc time in javascript?
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
hey, does anyone have any experience with like
pagination in javascript?
send help
i have like a queue command which i want to make a pagination thingy possible with buttons
my "prototype" code right now is this
let a = 0
let b = 10
const embed = new Discord.MessageEmbed()
.setTitle(`Current Queue for ${message.guild.name}`)
.setDescription(`${queue.songs.map( (song, id) => `**${id ? id : 'Playing'}**. ${song.name} - \`${song.formattedDuration}\``,).splice(a, b).join('\n')}`)
const row = new Discord.MessageActionRow()
.addComponents(
new Discord.MessageButton()
.setCustomId("previous")
.setLabel("◀")
.setStyle("PRIMARY"),
new Discord.MessageButton()
.setCustomId("next")
.setLabel("▶")
.setStyle("PRIMARY")
)
const sentEmbed = await message.channel.send({embeds: [embed], components: [row]})
client.on('interactionCreate', async interaction => {
if (!interaction.isButton()) return;
if (interaction.customId === 'next') {
a = a + 10
b = b + 10
console.log(a, b)
await interaction.update({ content: 'The next button was clicked!', components: [row], embeds: [embed] });
}
})
well the thing i did wasnt working but
send help 
Help not arrived
man
don't create a listener inside a command
use a method that properly does it for you, createMessageComponentCollector
https://discord.js.org/#/docs/main/stable/class/Message?scrollTo=createMessageComponentCollector
there are packages for pagination button
there's no need to use bloated packages
yeah that
then what else?
ok so you can do something like
Button pagination
First add
client.pagination = new Map()```
to your client
then create 2 files one called button.js and one called buttons.js
in button.js paste this code https://sourceb.in/10XHip6RHU
in buttons.js paste this code https://sourceb.in/oyER8VEcTU
then this is the function for pagination https://sourceb.in/3k0j0tiFsF
an example of using it
```js
await paginate(message, client, { messages: [new Discord.MessageEmbed().setDescription("uwu"), new Discord.MessageEmbed().setDescription("owo")] });```
you may have to change file paths and edit some things like the emojis used in the function
lol
huhh
thats so bloated what the actual fuck?
whyyyy
bruh just create a collector and update indexes on button click and update the message
yes im thinking that aswell but
how?
my current queue list is this
queue.songs.map( (song, id) => `**${id ? id : 'Playing'}**. ${song.name} - \`${song.formattedDuration}\``,).splice(0, 10).join('\n')
splices it so only 10 songs at a time can appear
const pages = []; // paginate your queue
let index = 0;
const sentMessage = await channel.send(pages[index]); // could be an embed or whatever
const collector = sentMessaage.createMessageComponentCollector(...); // add filters and stuff
collector.on("collect" , async component => {
switch (component.customId) {
case "previous":
if (index - 1 >= 0) index--;
break;
case "next":
if (index + 1 < pages.length) index++;
break;
}
// edit your message with next page content
await sentMessage.edit(pages[index]);
});```
goddamn switch cases never seen them in a while
you could use array.reduce() and index % 10 to have 10 songs per page
that would be pages
also when declaring pages its actually an empty array?
you can't pass return to catch
use a function that does that
_ => i cannot send a message
Forgot to add the arrow function.
also the return makes no difference
promise callbacks can't stop the parent function
use try catch or do const a = await somePromise().catch(balls => null); if (!a) return;
in sentMessage i need to add like buttons aswell right
yeah
so ```js
const sentEmbed = await message.channel.send({embeds: [embed], components: [row]})
ya
what about this
const [data, err] = await promise.catch(err => [null, err]);
wait what do i define my embed then?
because like i have
const embed = new Discord.MessageEmbed()
.setTitle(`Current Queue for ${message.guild.name}`)
.setDescription(`${queue.songs.map( (song, id) => `**${id ? id : 'Playing'}**. ${song.name} - \`${song.formattedDuration}\``,).splice(0, 10).join('\n')}`)
only if promise returns an array
what's embeds
or js const res = await promise.catch(err => err); if (res instanceof Error) return bla();
b l a
you could define embed on top ```js
...
const embed = new TrashEmbedBuilder().setDescription(pages[index]).someBS();
collector.on("collect", async component => {
...
embed.setDescription(pages[index]);
await sentMessage.edit(embed);
});```
seriously are you fine LMAO

ye
ight one sec
@pale vesselight so i have my queue here
guess ill die
then index is actually 0 right?
declared by let because its the "page" number
0 because you want to send the first page first breh
- discord.js isn't a language
- this error has nothing to do with discord.js
by default you are using the commonjs syntax to import/require packages

shit.
replit problem
update to node v16
Use node 16
v14+
Like they can

you can there's a hacky way to do it
idk
they say in the docs "16.6 or higher"

npm i node@16
@pale vessel well the bot tried sending the whole queue
skill issue
go debug
code rn is just ```js
const pages = [queue.songs.map( (song, id) => **${id ? id : 'Playing'}**. ${song.name} - \${song.formattedDuration}`)].join('\n') let index = 0 const embed = new Discord.MessageEmbed() .setTitle(Current Queue for ${message.guild.name}) .setDescription(${pages[index]}`)
const row = new Discord.MessageActionRow()
.addComponents(
new Discord.MessageButton()
.setCustomId("previous")
.setLabel("◀")
.setStyle("PRIMARY"),
new Discord.MessageButton()
.setCustomId("next")
.setLabel("▶")
.setStyle("PRIMARY")
)
console.log(pages)
const sentEmbed = await message.channel.send({embeds: [embed], components: [row]})
you could do that with your songs in the queue
note that you must use pages[index].join("\n") or similar
Since it's a 2D array
well it something i did works
soo

works?
const pages = [queue.songs.map( (song, id) => `**${id ? id : 'Playing'}**. ${song.name} - \`${song.formattedDuration}\``).join('\n')]
...its something
then i just did .setDescription(`${pages[index % 10]}`)
it's gonna go back to page 1 (index 0) on page 11
oh
that's how the modulo operator works
im just heping you
becuase you asked for it
no one answered on the official D.JS server, does anyone now what the message constructor is?
I want to construct a message before sending
@pale vessel help? i actually have no idea what im doing
Type 'MessageEmbed' is not assignable to type 'APIEmbed'.
Types of property 'type' are incompatible.
Type 'string' is not assignable to type 'EmbedType'.
grr actually wait
Type 'MessageActionRow' is not assignable to type 'APIActionRowComponent'.
Types of property 'components' are incompatible.
Type 'MessageActionRowComponent[]' is not assignable to type '(APIButtonComponent | APISelectMenuComponent)[]'.
Type 'MessageActionRowComponent' is not assignable to type 'APIButtonComponent | APISelectMenuComponent'.
Type 'MessageButton' is not assignable to type 'APIButtonComponent | APISelectMenuComponent'.
Type 'MessageButton' is not assignable to type 'APIButtonComponentWithURL'.
Types of property 'style' are incompatible.
Type '"LINK" | "PRIMARY" | "SECONDARY" | "SUCCESS" | "DANGER"' is not assignable to type 'ButtonStyle.Link'.
Type '"LINK"' is not assignable to type 'ButtonStyle.Link'.
ill just look at docs for a second
great

wut
use MessagePayload
but, what is the target?
the channel where you want to send it
but the channel will only be defined on the other function
not on the one I am trying to construct
try overwriting the target prop
send() will be in another function
makes sense but, why?
you don't know where to use it or how it works
message.channel.send already says where it goes
where to use it
and also how it works because the modulo operator is like
the remainder
would be better to just construct a message without targets xD
so like 12 % 5 outputs 2
use that with array.reduce()
because the remainder is 0
well this is the complicated part to explain
you could also use loops
they're less complicated
but this is the way I usually use
Perhaps the easiest-to-understand case for reduce() is to return the sum of all the elements in an array.
well i can see that in the example

well how would you use array.reduce in this case?
the accumulated value can be anything
it can be an array or an object or even a string
but in this case an array
yeah?
you need to take advantage of the index that it provides in the parameters
...it is yes (misread)
if the index is dividable with for example 10, push a new array inside the array with the current element/song, else push the current element/song inside the last array in the accumulated value (remember, it's a 2D array)
after that, return back the accumulated value (since array.push() returns a number and you don't want to overwrite the accumulated value with a number)
this is an example
osiejfoes ir I can't
it's hard
that's the best I could do

i "tried copying" the example
still returns the whole fucking thing
well your current array has one fucking element cuz you joined them for some reason
[[..].join(...)] wtf is this
Remove the [] around it too
oh ok
just the usual array.map()
well
you have the example right
Unhandled Rejection at: TypeError: acc[(acc.length - 1)].push is not a function
console.log(pages.reduce((acc, cur, idx) => (idx % 10 ? acc[acc.length - 1].push(cur) : acc.push([cur]), [])))
peep this
return back acc, not array.push()
check my example
less complicated: js console.log(pages.reduce((acc, cur, idx) => { idx % 10 ? acc[acc.length - 1].push(cur) : acc.push([cur]); return acc; }, []))
can also do acc.push([cur]) && acc
:^)
can also use the new at() thing
acc.at(-1).push(cur)
node 16.6 ithink
typed arrays?
sorry just got back
ill try one sec
WAIT NOW IT SPLIT @pale vessel
pls explain what the fuck is happening here
try to understand it
whats the empty array at the end?
so thats index ?
then how do you flip thru like the "pages"
aka the current (cur) element's index
AAAA FUCK IT WORKS LETS GO
AND NOW I JUST DO index++ IF THE NEXT BUTTON IS PRESSED
THEN index-- if the previous button is pressed
but i gotta understand
what the fuck is happening in that pages.reduce function
and then update the embed
fuck it im doing this tommorrow when i forget everything

it's still early y not now
nvm I was careless I meant I am using discord.js like javascript language XD
wdym?
nope fuck it ive been coding for 2 hours already stuck on pagination

7:26 pm
ill wait for another minute
WYSI
Malaysia
left
UInt8Array, etc..
Hello... I've never used CSS before, and now am trying to do so.. Can someone help me on position?
I want something to be placed in a specific place.. Should look smmth like 3, 4, 5 inside I think.
I feel like its something like this:
position: <something>(1, 3, 6)```
ping in replies..
what're the 3 numbers? x y z??
In css
* {
float: left;
}
.box {
width: 33%;
}
and in html
<div class="box">3</div>
<div class="box">4</div>
<div class="box">5</div>
oh
ya
thats not really a good way to do it, but it is a way lol
i don't understand how that answers the question but eh if it works for you then go ahead
I'm not giving a 30 minutes flexbox lecture for this
neither did you ask or wait to see the exact thing hes trying to do
from the pic above your answer is not really related lel
if you want to take something out of the document flow and control it manually, you can use position:absolute

then use top/left/right positions
for example
position: absolute;
top: 10px;
right: 10px;
XMLHttpRequest
I mostly comfortable with axios
axios.get
its just a normal request, with auth headers and user-agent
just use fetch
it's built in browser
easy to use
its not built-in node.js









