#development
1 messages · Page 1769 of 1
but it's mostly an ide
is hosting
const express = require('express')
const Topgg = require('@top-gg/sdk')
const app = express() // Your express app
const webhook = new Topgg.Webhook('topggauth123') // add your top.gg webhook authorization (not bot token)
app.post('/dblwebhook', webhook.listener(votedUser => {
//Give user reward
}));
app.listen(3000)
Ever heard of "hacker" plan ?
yes
How to setup it
but u have to pay
*js words
. .
just needed to reset the token
save it in blah.js
Put your Auth token
Start it with node blah.js
boom you're up
if you need to resort to hacker plan chances are you're better off renting a vps
You didn't expect me to "BUY" hacker, did you ?
||There's no way I'm hosting a bot on repl whatever it's hacker or not. If a single bot gets RL all the bots on that ip gets rl. I'd choose a ipv6 vps over repl||
how to get dbl_secret ?
Does MongoDB $lookup run in parallel?
Like if i have 2 look ups but i want them to run in parallel. Is that possible and if so how to do that?
depends, what do you mean with "parallel"?
Like i have 2 $lookup in my aggregation pipeline and they execute in parallel. Not like after first completed and then the second $lookup starts working. When they both end it returns the data
if I understood right, it joins the two tables and return the aggregation of them
so I guess it's sequential
and damn, if it is equivalent to this sql then that's a VERY costly operation
I don't think such widely used operator in aggregation would be an issue in mongo.
in vsc, I want to see source code of a function in node_modules. But instead it leads me to the type declaration.
So do I see that?
welcome to typescript
the .js file should be in the same folder hopefully
usually its file.ts/file.js together
so I manually need to search through the files?
not quite
open the file delcaration and it should point u at the current file on ur file explorer
@rocky hearth
im editing it so it changes the embed, how would i completely remove the buttons after either one is clicked?
ooh wow. How do u make these gifs?
components: []
sharex
so when im editing the msg, just add that?
yeah
no clue, are you using discord-buttons?
yep
yeah idk
thats quite a few uncommitted changes
button.message.edit({
embed: embed,
components: []
})```
i had 160 uncomited changes before
Erwin is a normal person
lies
ive had 53 max I think
they don't commit every time they change a single line
discord.js doesn't support components yet so use properties that discord-buttons extend
oh, that may be true
still doesnt work
but im clearly not normal
lets me click it even after the dit
you aren't though, or are you 
discord-buttons kinda cringe
discordjs cringe
true
use detritusjs
Ah yes, detritus ads anytime I open development
so only one use can use the button correct
i mean the person who ran the command can only use the buttons right
detritus is not bad, just not really that mature so that beginners could pick it up
no
Hey
I have a question, if its possible to: if a user has a specific role, add a line in a embed
Why this not work? Discord.py
@client.command()
async def invites(ctx, user:discord.Member=None):
totalInvites = 0
left = 0
joined = 0
for i in await ctx.guild.invites():
if i.inviter == ctx.author:
if ctx.guild.get_member(i.id) is not None:
totalInvites += 1
joined += 1
else:
left += 1
joined += 1
await ctx.send(f"Invites: {totalInvites}\nJoined: {joined}\nLeft: {left}")
how do i make that if my command is !cd then bot replies after 1min
What language are you using
js
Use setTimeout
ok
For it to say
Invites: 10 (the amount of invites of users still in the server)
Joined: 10 (The amount of users that joined the server even if they left they are counted)
Left: 0 (the users who left the server)
Are you intentionally only incrementing the total if the invite was made by the message author
ye
In short words i am trying to remake plasma's invite system
Because plasma dead
async run (client, message, args) {
const embed = new Discord.MessageEmbed()
.setColor('#e0bff2')
.setDescription(`ok`)
setTimeout(function(){
`Your cd is over!`
}, 5);
message.reply(embed);
}``` like this?
For a minute it should be 60000 instead of 5, putting 5 makes it wait 5 ms
can Anyone help me make that is discord.py
but is this correct?
Well, what does Your cd is over go to?
like if i cmd !cd then replies ok I'll remind you after a min and after a min bot ping and says your cd is over
Well here's code you can use:
//...
const embed = new Discord.MessageEmbed()
.setColor('#e0bff2')
.setDescription(`ok`);
message.reply(embed);
setTimeout(() => message.reply(`Your cd is over`), 60000);
//it makes the embed, then waits 60000 ms (1 min) to send another message
No problem.
if i want to delete the ok msg after a min
Ok:
const embed = //...
const sentEmb = await message.reply(embed);
setTimeout(() => {sentEmb.delete(); message.reply(`Your cd is over`)}, 60000)
Make sure it's async
^^ please
code
@lunar patio in case you didn't see I ping you
expected vs actual results please
lol
lol what?
I asking for the expected vs actual results
like, what you expected to return
yeah ik
vs what you got
ok so, first of all you are checking for users that created the invite and if they're in the server
you can't check what users used what invites
for this, people tend to use the guessing trick
like, let's say your have two invites: A and B
A has 0 uses, and B has 2
an user joins the server, you check the uses again
A now have 1 use and B 2 uses
so you know the user that joined the server used invite A
you need to do that everytime an user joins the server and store the value to the database
Invite A: 0 uses
Invite B: 2 uses
an user joins the server
Invite A: 1 use
Invite B: 2 uses
then you add +1 to invite creator's invite count
Does anyone knows the vs code cmd terminal good?
yeah, it had a select dropdown menu and it vanished lol
after I click on some option
now I am not getting the dropdown back 😦
bruh just press +
not the drop arrow
just press +
or from menu
click on new terminal
did it, but does not give the dropdown
did you try restarting vsc
pressing + just opens onto new terminal
did this too, I restarted my whole pc
doing this, does:
tf
what exactly is this?
I thinks, thats the alternative of the dropdown, but there isnt a option to convert back to the dropdown
you could try fresh installing it again

How to get how many uses an invite has in discord.py?
you can also just use your terminal
wdum?
the default terminal your OS provides...
I mean, I do not have the problem with the terminal. The Dropdown feature is away
and I am to lazy to start cmd lol, enter the path....
What are some good hosting services?
u dont need to
just go to the folder where ur file is
do this
Hi devs, I use a webhook to communicate from my game to Discord. How can I accept a webhook's input?
if db[userid]["level"] >= config["mining_info"][mine]["lvlreq"] and db[userid]["prestige"] >= config["mining_info"][mine]["prestigereq"] and db[userid]["rank"] >= config["mine_info"][mine]["rankreq"]:
Why is throwing a "excpected bytes" error?
so you want to send a webhook back to the game?
or from the game to discord?
It's still experimental in node 14
From game to Discord.
I want the Game to push a command to the Discord (which works already) but the RaffleBot does not accept the input. If I copy paste the command manually, it is accepted. And since its a webhook and not a user, I cant give him permissions since the add permission command requires a roletag
i'm pretty sure the file needs to have the .mjs extension if you use js instead of ts
excuse me, i'm doing a Partnership bot, I just finished doing the event in which it says that: if a member who is a partnership manager makes a partnership (link server) the bot sends an embed with the partnership number s that the user performed and the total number of partnerships made on the server. I found a NaN for the total of partnerships in the server but not for those of the user ... why, could you help me?
do you use javascirpt?
yeah
idk how moongose works
ok...
sorry but icant help u lol
np
totalPartners: {
type: Number,
default: 0
}
Here my schema (it's for other people who are reading this conversation)
And what I use to increase the data by 1
Guild.totalPartners += 1;
Guild.save();
idk i never did a bot who joins in vc
so you want to control a bot with webhooks?
:(
i tried this
if (message.member.voice && guild.voice && message.member.voice.channelID === guild.voice.channelID) {
return message.channel.send('>>> :x: | You need to be in channel together with me.',);
};
sorry we detected a error cutie here is the error : TypeError: Cannot read property 'voice' of undefined
Yes, so lets say the webhook shoots out !raffle roll "Weekly Raffle" in our channel called #raffles. But adds the red cross emoji (so it failed). If I copy this line myself and paste it, it does work.
someone know how to use mongoDB?
ik someone
who?
one min brb
wont work, bots wont listen to webhooks
you will have to make your own raffle bot
Crap 😦
then you could expose an API within the Bot to start the raffle
they offline
):
well, they can technically
but would create a shitton of other issues
I don't have knowledge about coding my own bot. That's a bit unfortunate.
well any decent bot ignores Bots, webhooks are sort of bots, atleast they get the tag
you make a game but dont know how to write a simple bot?
Yes, never tried it. Thats why
they are not really hard to make
Ok, then make me one hehehe
depending on what languages you know there is probably a api wrapper for the language aviable
i could make one, i might get friday off, so i could spend 4 days on making one
4 days? xD You said it was super easy? lol
it still requires some time lol, and i wont spend the entire day coding on it
aaah ok, I will try and look into it, thanks
for starting the raffle, can you call an API from the game?
would make it probably quite easy
I use a discord webhook api class
should probably work if you can make http requests
I have to look up what I have to code in order to make a bot post something
how do i check if the member in the same vc as bot
anyone can help me
get the bot's voice channel
and check member list
iirc you need an intent for that tho
if (message.member.voice.channelID === message.guild.voice.channelID) {
return message.channel.send('>>> :x: | You need to be in channel together with me.',);
};
message.guild.voice.channelID what?
it was guild.voice.channelID
a guild can't have voice
you right
you need to get the voice channel of the bot
Hello how i can make this code to send me the records
exports.enter = function(msg, channelName) {
channelName = channelName.toLowerCase();
//filter out all channels that aren't voice or stage
const voiceChannel = msg.guild.channels.cache
.filter(c => c.type === "voice" || c.type === "stage")
.find(channel => channel.name.toLowerCase() === channelName);
//if there is no voice channel at all or the channel is not voice or stage
if (!voiceChannel || (voiceChannel.type !== 'voice' && voiceChannel.type !== 'stage'))
return msg.reply(`The channel #${channelName} doesn't exist or isn't a voice channel.`);
console.log(`Sliding into ${voiceChannel.name} ...`);
voiceChannel.join()
.then(conn => {
const dispatcher = conn.play(__dirname + '/../sounds/drop.mp3');
dispatcher.on('finish', () => { console.log(`Joined ${voiceChannel.name}!\n\nREADY TO RECORD\n`); });
const receiver = conn.receiver;
conn.on('speaking', (user, speaking) => {
if (speaking) {
console.log(`${user.username} started speaking`);
const audioStream = receiver.createStream(user, { mode: 'pcm' });
audioStream.pipe(createNewChunk());
audioStream.on('end', () => { console.log(`${user.username} stopped speaking`); });
}
});
})
.catch(err => { throw err; });
}
ok
Say you were making an RPG game, and say there were different kinds of vehicles you could own. How would you track that? I was thinking of having a Many-to-One and One-to-Many relation between a Vehicle entity and my user entity (using typeorm), is there anyone else who has any better suggestions?
Say you were making an RPG game actually I am making an RPG game hehehe
so One-To-Many
Yea so a user can have multiple vehicles but a vehicle can only belong to one user
So my method was the best way?
yo i got a quick question about node.js, can i add a setTimeout in a function, when the function is ran, end that process, start the process back up again and it'll continue on with the setTimeout, any ideas?
not the ManyToOne part
the time will be from a db, not in the memory
do you really need backward reference to the owner?
if you do then yes, use OTM and MTO
else just use OTM
I have to have an ManyToOne
It is required by Typeorm unless I am doing it inverse
so it enforces backward reference
Yep
but yeah, use that
Would a OneToOne relation between a clan and user be logical?
if (client.voiceConnections.get(message.guild.id).channel.id !==
message.member.voice.channel.id) {
return message.channel.send('>>> :x: | You need to be in channel together with me.',);
};
definitely no
Well heres the thing I don't know how to actually handle it
OTO means one clan could only have one member
I was thinking of only creating an instance of a clan for the owner
btw how do I add my server to top.gg?
and when people join it they get pushed to a members array
nonono
But that doesn't seem logical
go OTM when something will have N children
and OTO when something will only have 1 child
How would an OTM work though
yes I guess
Cause the person who creates the clan should be the owner
one clan can have N members
How will I tell who is the owner and who are the members?
just create a field in members
either a boolean to indicate ownership or an enum field to indicate hierarchy
Mmm, so what you are saying is attach the clan they join to them and push them into the members field?
yes I guess
What do you mean by Enum?
js doesn't have it, so read "constant"
I know what an enum is but what do you mean when you say to indicate hierarchy
I am using typescript
Typescript has enums
different enumerables = different levels of hierarchy
yes yex
you can use it in premise to indicate some form of level or ownership
Can I make an example of what I think you guys are talking about?
in php but obv same concept
abstract class Enumerables
{
public const MEMBER = 0;
public const MODERATOR = 1;
public const OWNER = 2;
}
echo Enumerables::MODERATOR;
The higher the number bigger authority ?
sure
I'd use reverse sorting, but ye, that's the concept
its however you want to design it
but an enum would be a nice way to efficiently neaten and do it
Is there a way to copy paste multiple command in one shot? Example:
!raffle tickets add "Weekly Raffle" "chosenlegacy" 138
!raffle tickets add "Weekly Raffle" "Cobb" 112
!raffle tickets list "Weekly Raffle"
!raffle roll "Weekly Raffle"
!raffle reset "Weekly Raffle"```
nope unless you make it possible
So I could do something like this:
//enums.ts idk
export enum Rank {
MEMBER = 0;
MODERATOR = 1;
OWNER = 2;
}
// ClanEntity.ts
import { Rank } from './enums.ts'
export class ClanEntity extends BaseEntity {
@PrimaryGeneratedColumn()
_id!: string;
@Column({name: 'rank', type: 'smallint', default: 0 })
rank!: Rank
}
I assume anyway
dat indent
but yes, looks fine
Sick
you should use const enums most of the time
Also initializing the enum variants is unnecessary in this case
Ah I see
const enums?
const enum ...
Ah
It wasn't letting me do that for a sec
What is the difference?
between const enum and just enum
const enums get transpiled down to integers, while regular enums get transpiled to functions which return an object
Ah
can we add a gap between flex items?
I hve 3 children of a parent flex element.
the Middle one is flex: 1.
And I want to add a gap between
how long does it take for a bot profile picture to update
that goes in #support but if you go on your bot page, edit and hit update it should update immediately
though they might've changed something
try doing ctrl + f5 on your bot page to force your browser to reset cache?
emptying cookies sometimes helps as well
oh not the food
fuck off
:( ruski
message.channel.send(part1, part2, part3, part4, part5, part6, part7, part8, part9, part10, part11)``` all the parts are embeds. but they just turn out into [object] and stuff.
help
what.
Me brain is suffering
you can't send multiple embeds in one message
i did it before
no you can't
u cant, you can either split:true or use webhooks with embeds:[]
otherwise, u cant
and i think split:true is only for strings
or, for loop?
you can send multiple embeds if you're using a webhook
you can also use a for ... loop
webhooks support multiple embeds too, which seems to be your goal.
if (message.guild.voice.channelID === message.member.voice.channelID) {
return message.channel.send('>>> :x: | You need to be in channel together with me.',);
};
TypeError: Cannot read property 'channelID' of undefined
a guild doesn't have a voice property
message.guild.voice isn't a thing
for ts, I hv a type Theme from a package.
I want to extend it, so everywhere I use Theme type variable. I also see my properties.
this is that type
export type Theme = {
dark: boolean;
colors: {
primary: string;
background: string;
text: string;
};
};
I want to add my own colors to it.
bruh discord.js server said this
guild.voice.channelID === member.voice.channelID
who?
Monkey#8028
it is not a thing
export type YourTheme = Theme & {
dark: boolean;
colors: {
primary: string;
background: string;
text: string;
};
};
so what can i use
what are you trying to do
but then it would be YourTheme .
I want to change the Theme itself, from the package
The package is not using any namespace or interfaces.
So is it possible?
Theme class/type in package?
check if the user in the same vc as bot
you probably got told to use the me property on the guild
i would do
declare module "package name" {
export interface Theme {
//my params
}
}```
im doing this in my bot ts declare module "discord.js-light" { export interface Client { readonly commands: Collection<string, Command> twitter: Twitter } }
guild.me.voice
thx
yeah, but as I said, Theme is a type not an interface.
Will it still work
idk try and see
interfaces and types are treated very similarly
if you're just declaring types, using either works
How to create a d.ts file for a module
if that were the case a single weak link would break encryption for everything
me may be dumb
if (message.guild.me.voice.channel === message.member.voice.channel) {
return message.channel.send('>>> :x: | You need to be in channel together with me.',);
};
It stop it form changing vc but it still run the command
I wouldn't bet my life on it but it sounds extremely unlikely
=== is equals to
maybe you want to compare the channel ID rather than the instance
You can't. If you want to merge two interfaces, you'd have to rename the base interface then declare that the interface you want extends the base interface
or if you want merging conditionally, you could do Interface1 & Inferface2 where you need it
The Theme is a type coming from an package, which I can't do anything about.
And I want to redeclare it, somehow
you can import it under a different name then extend it or do whatever
But then, I have to pass around my extended type, everywhere
and forcefully convert to it whereever it is required
didn't work.
But I've did this, //@ts-ignore
And it is working
js is very lenient for errors, but I'd still prefer not to ignore linter highlights
i understand, but Ive no choice
And its just for code completion, so no issue
i played sound using ytdl core. It plays for like half a second and then it stops playing. How can i fix this?
const Discord = require('discord.js');
const fs = require('fs');
const ytdl = require('ytdl-core-discord');
module.exports = {
name:"stage",
async execute(message, args){
if (message.member.voice.channel) {
const connection = await message.member.voice.channel.join();
connection.play(await ytdl("https://www.youtube.com/watch?v=5qap5aO4i9A"), { type: 'opus' });
}
}
}``` this plays for half a second then stops. can someone help?
help 😦
Hey all, I made a pretty cool discord bot, but it's pretty unorthodox, maybe looking for some advice on how to go about this.
hmm?
Maybe? Maybe not? The answer to all life's questions is 42?
ok cool
Cool
So basically. It's a chrome extension
and it should probably read the commands as an actual bot, and not read from just parsing the chat in the browser as I'm doing
does that make sense?
No idea what you are talking about hah.
Just post the advice you are looking for as a question.
if i remove the { type: 'opus' }, it works for me so try
connection.play(ytdl("https://www.youtube.com/watch?v=5qap5aO4i9A"));
i can also use other options for the video and it works.
ok
it doesn't work
is there a link?
oh
what should i do tho?
@pale vessel ```js
const Discord = require('discord.js');
const fs = require('fs');
const ytdl = require('ytdl-core-discord');
module.exports = {
name:"stage",
async execute(message, args){
const url = "https://www.youtube.com/watch?v=5qap5aO4i9A"
if (message.member.voice.channel) {
const connection = await message.member.voice.channel.join();
async function play(connection, url) {
connection.play(await ytdl(url), { type: 'opus' });
}
}
}
}``` it doesn't play
sorry im using just ytdl-core not ytdl-core-discord.
why are you trying to do a music bot anyway
it's just a waste of resources by this point
oh ok
nobody will use it because there are thousands of superior bots which do it better
i'm using it for my server
oh, private use
is there a way to sleep in python without using async?
or if so
like how do i turn EVERYTHING async?
this isnt discord related
I would generally not recommend this, as event emitters don't listen for promise rejections.
One message removed from a suspended account.
c# god
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
nope
One message removed from a suspended account.
i barely read dapi anymore
lmfao
how do people still use net fx
i mean companies i get ok expensive to port
One message removed from a suspended account.
One message removed from a suspended account.
yeah
so expensive
idk
some companies are just dumb
i still refuse to use c# for ui though <33
How do I add something in which the user would need to type yes before the command does its action?
I've been trying a few things but the only thing I can think of is: .<command> {yes|no}
ive been considering using ultralight c# bindings (so i can render html/css/js from c#) but ultralight has licensing issues unlike electron
One message removed from a suspended account.
yeah
core was marginally faster ever since it came out
and the fact that you can run it natively on linux is chefs kiss
One message removed from a suspended account.
honestly i have no idea
well
until core 3, you had to use framework for ui
but still
maybe some people studying cs and c# have older curriculums so they use framework
without reading the docs
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
C# pog
Just very complicated when you are first starting to learn it cause of how powerful it is
C# is an all around language, it has money to be thrown into it. It is apart of .Net core so it just keeps getting more and more upgrades.
Indeed
Especially if you are using Unity it is very beneficial in the game dev environment
After learning C# I would try and learn C++, very different. I like both, but C# is by far my favorite, since you can make pointers anyway
I know the basics of C# for the most part
If you know what your doing you can even make Managed types into pointers
I just got tired of it cause I couldn't figure out how to make a table in the database I connected too :^)
Use dapper
Haven’t heard of that one
But I just got tired of C# after that so I took a break and decided to use Kotlin instead
Npgsql is just for postgres
I was using C++ but I couldn't figure out how to compile
I am going to learn Rust next, since I heard it is the most loved language.
It looks really nice
I know basics of rust as well ahah
Heard discord is moving to it
It would be better if they did I think
Were you using VS?
Yea, so that is my next step, heard there is a great library for web development on Rust
nah I was using visual studio code
visual studio wanted 25 gigs I was like fuck no
You should still be able to use a compiler no?
I could never compile my code at all so I couldn't program much lmao
Lol
well I made games and stuff with it just can't run it
what do you mean?
Unreal engine (By games I assume you mean that kind)
I don't even remember what I have lmao it's been a bit
You said games, unreal uses C++
Do they really use it much though
Now they have blueprints
which does a lot for you right?
I don’t think it gives out too much freedom
Yea
But I am not too sure, have not used it, just seen it
Heard it is a good language
It is pretty decent
Imo its better then Java just cause of how simpler it is
Syntax is pretty similar to TS as well by the looks of it so it was rather easy for me to learn
I also wanna learn py
funny enough don't know the basics to py anymore
Kind of forgot about it after learning new stuff
I hate that I have to have perfect spaces in it. But I have not used it too much. I used it before I really started liking programming
I had many issues with ytdl-core-discord, and all of them were solved when I just used ytdl-core instead. If you're still having issues, try using ytdl-core instead.
I used ytdl-core-discord. No sound came out, switch to ytdl-core, suddenly my bot start speaking
https://www.npmjs.com/package/discord-ytdl-core Have not try this one yet.
I need help coming up with ideas 😩
So I wanna generate a map of some sort for a rpg bot I am making. What are some good ways to do it
Depends
Procedurally is more random and dynamic
Asset-based can be more detailed
Mmmm, well since it is a discord bot it is limited to what I can do no?
If at all possible it would be nice to have some kind of graphic map but I doubt it would be easily doable
You're only limited on what you can output and how users interact with it
The entire point of it is to be vast enough that it can be explored, clans can claim territory, and resources can be mined from planets, asteroids, etc
Other than that, theres pretty much no difference from making a discord bot and making a pc game
Mmm true
I am just not the most skilled person when it comes to this so idk where to begin
I mean, I made a fully functional trading card game for my bot
Sky is the limit I guess
Start off thinking on how you'd do it
Making interactive games on discord is no easy task
Sure
But I am not sure how I would actually manage tracking what part on that map you are on.
Like I could use x,y values right?
Kind of like coordinates
I once made an interactive tabletop rpg module for my bot
Here's my opinion:
Wait for discord menu update
Like, in the current state you'll rely fully on messages, and trust me when I say that you'll end up with a huge amount of embed menus
That's one of the reasons I discontinued it
Mmmm, so you are saying put it on hold for now?
Yeah, discord announced they are making custom pop-up menus bots can create
With them creating inventory, character sheets, monster sheet, map, etc will be a lot easier
Makes more sense then rewriting later
Yea, ima wait.
But now I need something to do to pass the time
Practice map generation
Like, make a map-only module for your bot
A map where you can move pawns
You'll use that later on probably, so it's good to practice
Mmm what should I use?
Idk, up to you
No idea what is out there to use
I'd go for a procedural map that's generated based on a seed
There are many tutorials regarding that for game devs
Ima start 2D first
how can i make custom prefix in discord.py?
You can pass a function that takes bot and message as arguments to the command_prefix parameter when instantiating the Bot object. You can then do the logic there, e.g., return the prefix based on the guild id
How would I go about listening for reactions on this message?
Discord.js
<@&304313580025544704> ^
two of us have green
yeah but not sure who would respond
two of us have green
okay fair enough
like you would on any other message
awaitReactions or a reaction collector
alright, thanks!
Is there a way I can set headers for an axios request later?
So if some conditions are met set an axios header and then use those headers in the final request
headers = {};
if (x)
{
headers.y = "z";
}
sendrequest(headers: headers)
🤦♂️
Just ping everyone to ask them how their day is going..
why in the world would you ping moderators
their job is not to answer development questions, it's to moderate the server
just ask your question
somebody will eventually answer
I was not pinging them for the development question, someone posted an obvious scam link in the chat, they just deleted the message
I’m aware that they’re not here to answer development questions
Atmods
Why is everyone still bringing this up

hey is it possible to compromise your discord account via your bot token?
no
well, in a certain way it is
if your bot's token gets leaked and someone uses it to break ToS then you're fucked
oof
Yes very much so
@rustic nova Same here
What does this mean?
client.settings is undefined
How can i define it?
Idk its your code...
you just bind settings to client
What are you using to store this info?
quickmongo
then follow the readme and bind settings to client with the instance of a new Database
https://www.npmjs.com/package/quickmongo Quick Example
(node:36) UnhandledPromiseRejectionWarning: Error [SHARDING_READY_TIMEOUT]: Shard 0's Client took too long to become ready.
at Timeout.onTimeout (/home/container/node_modules/discord.js/src/sharding/Shard.js:163:16)
at listOnTimeout (internal/timers.js:555:17)
at processTimers (internal/timers.js:498:7)
(Use node --trace-warnings ... to show where the warning was created)
(node:36) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:36) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
i am having this erroe can somone halp
Why are pinging a staff member
sorry
well now its ghost ping :^)
can you please help me with this
at my personal hosting
. bro shoud i give access to my files can you solve this
const {MessageEmbed}=require("discord.js")
const glob = require("glob")
module.exports = {
name: "reload",
description: "reload all cmds",
execute: async(client, message, args) =>{
if(message.author.id!== "769077060944658452") return
client.commands.sweep(() => true)
glob(`${__dirname}/../**/*.js`, async (err, filePaths) =>{
if(err) return console.log(err)
filePaths.forEach((file) => {
delete require.cache[require.resolve(file)]
const pull = require(file)
if(pull.name){
client.commands.set(pull.name, pull)
}
if(pull.aliases && Array.isArray(pull.aliases)){
pull.aliases.forEach((alias) =>{
client.aliases.set(alias, pull.name)
})
}
})
})
message.channel.send(new MessageEmbed()
.setTitle("Bot Reloaded")
.setDescription("Bot Reloaded Successfully")
.setTimestamp()
.setColor("RANDOM")
.setThumbnail(message.author.displayAvatarURL())
)
}
}```
Error set is not defined
My reload command
Ping me if you got it
Well this work I'm command handler
client.commands.set
When I am attempting to use a Custom Emoji on a embed it shows the following:
(node:17209) UnhandledPromiseRejectionWarning: TypeError: modembed.react is not a function
Literally the easiest question I know, but its once again 5:45am xD and haven't slept.
code: modembed.react('MY_EMOJIS_ID')
Thanks console!
You don't react on embeds, you react on the message that contains the embed 
You can add reactions on embeds....?
Re-read what I said
My brain capacity rn = null
Ill figure something out.
modembed is an embed, not the message that contains the embed
< Literally me
const sentMessage = await <Message>.channel.send(modembed);
await sentMessage.react(...);```

I just tried that... still test.react is not a function
Show your code I guess
Nvm
.then(embed => {
embed.react("EMOJI_ID")}````
Works 
alright
im bored
what shit should i do with js and replit today
GTA V in JS
lol
ill do this
#general ....?
and ill jsfuck the code before putting it for production

You do you-
?
fine ill make a visual slash command payload generator then
quick s a s s y question
if i have this rule in my scss file:
.button {
.active {
/* stuff */
}
}
will it match anything with BOTH the button and active class OR will it match a child with active class inside a parent with button class?
because i want it to do the first one
Where is the error in this sql query? It is run automatically for each artist that is played on an online station, but gives this error.
ive an array of objects haivng a single property.
Is it possible to access this property, without knowing the key?
I mean I just want to grab the only property the object have
array.find
but I dunno the key, and I dont want the object itself.
array.find(e => Object.values(e).includes(value))?
neither I know the value 😅
by hving a single property, I mean key value pairs with distinct keys
show us your data
const arr = [
{hello: 0},
{hi: 'value'},
// etc etc
];
I dunno the key and value in these objects
But I know, it would only have one key value pair
<Object>[Object.keys(<Object>)[0]]```
Or just
Object.values(<Object>)[0]
Ooh, yeah, how can i forget, these methods exists. Thanks
object object object
anyone halp?
yes it will do the 2nd part
bcoz it will compile to this in css
.button .active and not .button.active
Hi
so how do i make it do the first part
Wait so are u sing discord.is
yep, definetely js not css
Im not sure, but may be this
.button {
&.active {}
}
imma try that
yes it is https://sass-lang.com/documentation/style-rules/parent-selector#adding-suffixes
U can even split ur class names. Thats awsome
Syntactically Awesome Style Sheets
Copy the button to my bot, I repeat, it makes me write once and there is no error in the log, how can I solve it?
I don't understand?
same here
So, when I am using:
if(command === 'mod'){
*code here bla bla bla*
}```
I noticed that when I add another command like:
```fix
if(command === 'currency'){
*rubbish*
}```
it will display 'mod' when I try to use 'currency'.
first: console log command and see what's there
second: don't use too many if (use else if)
third: that should be working if I guess correctly
petition to delete discordjs.guide for teaching everyone this shit way of handling commands
That works for only 2, then the 3rd one sends the 2nd one.
@earnest phoenix
if(a == "a"){
//
} else if (a == "b"){
//
} else if (a == "c"){
//
} else if (a == "d"){
//
} else if (a == "e"){
//
} else if (a == "f"){
//
} else if (a == "g"){
//
} else if (a == "h"){
//
} else if (a == "i"){
//
} else if (a == "j"){
//
} else if (a == "k"){
//
} else if (a == "l"){
//
} else if (a == "m"){
//
} else if (a == "n"){
//
} else if (a == "o"){
//
} else {
//
}
Also,
Your code works fine
It doesn't.
forget the error at top
this is the same code for fuq's sake
@earnest phoenix What exactly is your issue if I might ask, it has been burried
I just ran it in console cuz I was too lazy to make a file
Friends, I added a command to my bot, but once I type the command, it throws its answer non-stop. I wrote the command at 13 o'clock, it still writes an answer and there is no error in the log, how will this be fixed?
if (command == 'moderation' || 'mod'){
const modembed = new Discord.MessageEmbed()
.setTitle(message.author.tag, message.author.displayAvatarURL({ dynamic:true }))
.setThumbnail(message.guild.iconURL())
.setDescription(`Hey <@${message.author.id}>! Here are the **\`Moderation\`** Commands!\n\n> x/kick - Kicks a User.\n> x/ban - Bans a User.\n> x/mute - Mutes a User.\n> x/unmute - Unmutes a User.\n> x/lock - Locks the Current Channel.\n> x/unlock - Unlocks the Current Channel.\n> x/slowmode - Set a Channels Slowmode.\n> x/nuke - Nukes the Channel. (Clearing all Messages.)`)
message.channel.send(modembed).then(embed => {
embed.react("846988261057626122")}
)
} else if (command === 'currency' || 'econ'){
const currencyembed = new Discord.MessageEmbed()
.setTitle(message.author.tag, message.author.displayAvatarURL({ dynamic:true }))
.setThumbnail(message.guild.iconURL())
.setDescription(`Hey <@${message.author.id}>! Here are the **\`Currency\`** Commands!\n\n> x/setlogs - Set the ModLogs.\n> x/[enable/disable] - Disable a Command Category.\n> x/enable - Enable a Command Category.\n> x/setverif - Set a Verification Channel/Role.\n> x/setmuterole - Set the servers Muted Role!\n> x/disableverif - Disable server verification.\n> x/setwelcome - Set a Welcome Channel.\n> x/dchannel - Disable Commands in a Channel.\n> x/echannel - Enable Commands in a Channel.`)
message.channel.send(currencyembed).then(currencyembed => {
currencyembed.react("846988972924207135")}
)}
This only displays the MOD Command.
I frfr accidentally just sent that in D-Devs API Questions
Well how are you executing it
it should be
if(command === "mod" || command === "moderation"){
}
not
if(command === "mod" || "moderation"){
}
I'd make it an array to be honest.
if(['mod', 'moderation'].includes(command)){...}
You're telling this to someone who doesn't even know how if works
how do you expect him to understand how arrays and .include work when he doesn't even know the ground basic of js
That really isn't my issue is it
If he doesn't understand he can say so or google it
I am just here to help not hold your hand
"hold my hand" ?
Okay?
I told him a better solution if he doesn't understand it again he can say so or google how the individual components work
You poor soul
oh wait a second I'm getting DM advertisement.
Gonna report to a mod
I'll be back soon
Mk
f every single mod is dnd and afk
🤷♂️
Hi does anyone know how to have it that your discord bot makes the muteed role
What library are you using
Node.js
Yeah
It has two examples on it...
For muted
What
Just follow the damn example
It tells you how to create named roles
and you can ignore anything you don't need
You can also click on the blue words under type
and it takes you to the page of what it contains
Actually, I do, it's the matter of it's 7am and I have not slept for 2 days now.
Why...
get a life before you get a bot
Why are you being a dick
Calm down, maybe you need to step away for a sec 😬
*steps away
i made a thingy
is the color scheme good?
https://spa.code913.repl.co
Nah really though
Why are you working on a bot without enough rest
It's bad for you both short and long term
At least I sleep well and don't exhaust myself to the point of passing out
1 - icon is so blurry af and contrasting to background that makes it unbearable
2 - menu items look like scam ads menu
3 - title doesn't feel like a title
4 - blue hyperlinks? really?
5 - either go full white/light grey or dark themed, pastel color backgrounds are never an option
Is it better to have commands in one file or
In singular files
Like a file for commands
It more common called as command handler. And better to have it seperate and called by 1 main file
tip: stop using colors
Separate command files that is
go with grays only. Have you seen any website that has a blue background like this?
Websites back in early 2000's be like
genuinely you don't need to use any color at all. User generated content alone (images and role colors in the case of discord) has enough variety in it in terms of color. Work in shades of gray and that's all you need
Yea
but really, that button shape screams ADS!
it doesn't fit modern design in 2021 at all
also
whitespace is your friend, not your enemy
use it
In Python you can do:
x = """
hello
"""
How do you do this in Javascript? 😁
let x = "hello"
no i mean
or if you don't want the value to change use const
x = "hello\nbye"
x = """
hello
bye
"""
are the same thing
in Python
how would I do that in Javascript
x = `
hello
bye
`
Yeah ty 😄 😄
np
I guess that could work
iirc though if you were to send that in a discord message it would get rid of the new line
\n
I assumed they didn't wanna use \n
not for Discord anyway 🤪
Alright then ig it will work
That is how you make a multiline string in python
hol on a sec
it does 😛
How to make commands in separte files
make a new file
Using a command handler
This isn't discord.py
I have command in my bot.js
He is using discsord.js
Have you tried using google
there thats generic
I mean everyone who uses a language assume its their language the problem is about
Yeah
lmao
Actually try before asking to be spoonfed, please
I know this
Hello, I have an image gallery where some images are taller than others, and I was wondering, is there was a way I could keep the width for them all the same, and have the height get cropped to, let's say 500px, and have it centered vertically?
if you're asking is there a way, yes
Ah, mind pointing me to a place that explains it?
in html I guess ?
yep
just make div elements with fixed size
them set bg to the image and set cover
Can't that reduce quality though?
easier method
hm
you can always use canvas crop the hell out according to your window.size/number of images then put it there. Maybe with some animation too
👍
Is this right ```js
module.exports = {
name: 'kick',
description: 'Tag a member and kick them (but not really).',
execute(message) {
if (!message.member.hasPermission('KICK_MEMBERS'))
return message.channel.send("Insufficient permissions (Requires permission Kick members)").then(msg => {
msg.delete({ timeout: 30000 })
})
const member = message.mentions.members.first();
if (!member)
return message.channel.send("You have not mentioned a user").then(msg => {
msg.delete({ timeout: 30000 })
})
if (!member.kickable)
return message.channel.send("This user is unkickable").then(msg => {
msg.delete({ timeout: 30000 })
})
const reason = args.slice(1).join(" ")
if (member) {
if (!reason) return member.kick().then(member => {
message.channel.send(${member.user.tag} was kicked, no reason was provided);
})
if (reason) return member.kick().then(member => {
message.channel.send(`${member.user.tag} was kicked for ${reason}`);
})
}
}
}
try it and see
the only thing I see, is that you are saying if(member) I dont know if this works in js though. But it does not make too much sense.
That does make sense
How would i have it instead of this const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
Does it?
Yes
Why?
Like for mmutliple folders
If there is no member mentioned return a message
ah gotcha
Like moderation in commands
You'd have to use for loops or a file walker
How?
how can i send every element of an array without using a for loop?
You could also trial and error it. I like to learn on my own, but to each their own.
Well not sure if there is a way
hmmm
Any examples
Just google it my god
I did
Then you would of found examples
Easiest would be to use a for loop ig
how do you put an emoji of my server in an embed for a public bot?
array.forEach()
you give it a pattern
it will walk those folders and return the files
in an array
Ok
idk how to do that in my case
Spoonfeeding vs. leading someone to the right path is different.
help?
Not when he constantly asks for example after example when there are perfectly good ones on what I give em
Array.prototype.forEach google that should be the first result
He does not know what to search up, you could give him an example of what to search. That would be more helpful, you could also show him an example from the docs.
in python
if you are appending multiple thigns to a string then just create a list then " ".join(list)
it is faster and uses less ram
that is my wisdom, use it carefully
I mean
this is what i need to send json.body.attributes[].name
smart
json.body.attributes.map(x => x.name)
map returns a new array of whatever element you tell it to
help pls?
I am not saying you are in the wrong in any way. He is just confused, he seems very new to it.
rebuild it
It is occurring inside a node module it seems
If this is replit then I am of no assistance
????
someone answered it
rebuild the modules
did they
yea
?
^ this right here
like thats your proably first choice
Oh right you're the C# enthusiast
no?

