#development
1 messages ยท Page 1747 of 1
fixed
new database server definitely worth it
this is latency graph
new db server is that tiny tiny area on the far right of the chart
have to zoom in to even see it lol
i would go for the second one then, but keep the .catch on the same line
ok thats what ive been doing, it is cleaner imo
nice
One message removed from a suspended account.
some yes
One message removed from a suspended account.
hey everyone I'm back, I'm trying to change my data inside the database but doesnt work, works only for me and IDK why
https://srcb.in/ggVIUgFKyZ
This is the schema with my try in changing the guild ID
One message removed from a suspended account.
oiscorda
not bad
seems like a nice replacement to shareX's ocr feature
One message removed from a suspended account.
u writing it in c#?
One message removed from a suspended account.
Anyone knows any nsfw api?
a lot of people just use the reddit api with nsfw subreddits
I just remembered that I'm not allowed to say that website here, but that one related to cat girls and reddit also works
just a heads up, using the api he is talking about will get your bot banned from discord ๐
if this is for a bot
Oh really?
neko.life?
^
wait what
all of nekos life nsfw endpoints contain lolis
Oh. I didn't realize it returned under aged
since when was that site against discord TOS
I thought it was just against top.gg rules
One message removed from a suspended account.
One message removed from a suspended account.
ah
Why?
loli's are against discord tos no?
One message removed from a suspended account.
One message removed from a suspended account.
I don't get why people get the urge to even draw such things
in nsfw channels they against?
Even in nsfw channels, yes
You may not sexualize minors in any way. This includes sharing content or links which depict minors in a pornographic, sexually suggestive, or violent manner, and includes illustrated or digitally altered pornography that depicts minors (such as lolicon, shotacon, or cub). We report illegal content to the National Center for Missing and Exploited Children.
https://discord.com/guidelines
So
I guess that can be spun if the character isn't actually a minor
Bro it will work in nsfw channels so its against
any loli's will get you banned no matter if its a nsfw channel or not.
nothing to discuss tbh
its against TOS plain and simple
I don't have any image functionality like this in my bot so I had no clue, but woo is right
I shall no longer suggest that api, then. Good to know it shows lolis
make your own api
then you can control it's content
this is part why triviabot doesn't use e.g. open trivia db
that and OpenTDB doesn't support image questions
I really need to finish my dog api 
@solemn latch can I recommend cheweybot api
it has dog, cat, birb, tons more
and all sfw
this one ? https://www.npmjs.com/package/cheweybot-api
pog you I know chewey
part of my api is having facts about the breeds and whatnot.
weight age size average litter size, etc.
and hard restrictions on image quality, size, and single dog requirements.
a lot of these api's will have 2-3 dogs in it of several breeds, etc.
yeah, i get breasts and butts being NSFW, but thighs is debatable.
in some countries exposed ankles is nsfw and huge taboo
go with what Americans find nsfw
lol
Ohh
no im the person who made this
still new to coding, so on some bots you can see how many servers the bot is in, how would i do that to my server
so people can see how many servers the bots in
A simple Top.gg API wrapper written in PHP. Contribute to top-gg/php-sdk development by creating an account on GitHub.
php
Language?
i'm actually going to send a PR to it soon
yeah American TV rule: so it's fine to show acts of horrid violence but don't show boobs..... nah I'm joking don't show either of those
i was gonna hit up @green kestrel for stuff
im still not sure how to follow through a logger
showing shoulders is forbidden!1!!
does the lib itself need a logger?
I'm liking where your php API is going fl0w
no, the lib itself doesn't need a logger
just support of one, aye?
hmm
yup
I made the same choice of logging in my discord lib... other c++ discord libs have a hard dependency on the lib devs favourite logging API, I just expose an on log event and let the user hook on whatever they want
c++ doesn't have psr's etc
I guess closest it has is iostream and nobody likes iostream
yeah kinda same here, i don't believe in forcing the dev to use a specific logger
I think it varies from area to area, some southern areas are very strict still iirc
pls ๐ฅบ
yes, i live in parts of the US which still has quite strict views on nsfw.
I very much have a hard time still with deciding if something is nsfw for bots.
you might run into some issues with ID's
each user can only have one serverID at a time because the way you are requiring uniqueness.
hi
i have a special offer in Discord Bots Case...
its a bot like pastebin
but in discord
its 10x times faster
you can write, read thru servers
all this Is because I have some Friends that are testers and are in different servers. I would like that everyone have the guildID where they use beg
with the bot
how can I fix It?
what if they have multiple servers they beg from? ๐
you can make a joined key like
UserID-ServerID and make that the unique key.
It Is not where beg the problem, the problem Is the leaderbord of a server
if the have the id of my testing server, they don't figure out in the leaderbord of their server
Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo
why shoul this resolve my problem?
it doesnt, it just prevents a whole host of other problems youll run into.
your issue seems your just fetching any user from a guild(the first one it finds from that guild), then not modifying it.
let profile = await profileModel.findOneAndUpdate({
serverID: message.guild.id,
});
which you probably would have found out, if you did the above thing.
#development message
Is there a way to check all the dms a bot receives?
Like we can redirect it to a particular channel on our server with the author id?
as in, an event for it?
just the regular event, and check the type.
@solemn latch so I just check if the chat is in DM
And if it is
Then send the message content to a channel
Ri8?
I would suggest using a webhook rather than a message, for the higher ratelimit, but yeah.
And the same goes for replying back using user.send(msg)
Yeahh
yep
just a heads up, this should be a staff only channel. dms with your bot should be consider private information.
Cool Thanks!!
@solemn latch Yeah It'll just be available to Me
On my private server
yep perfect
I want to change the serverID aka guildID

you are changing it, in the search query. which means you're getting it, not changing it.
let profile = await profileModel.findOneAndUpdate({
serverID: message.guild.id, // this is what you are searching for. you are not setting anything on this line.
});
heres the docs for it, please read them. https://mongoosejs.com/docs/api.html#model_Model.findOneAndUpdate
findOneAndUpadate Is only read?
but when I use beg in different guilds It changes
nope, you're just not using it correctly.
please read the docs i linked to which explain it.
but for other It doesnt work
I'll do It
can i change scrollbar with css is it allowed?
yep thats fine
i could not do anything with quick.db it gives error like this. even when i just do const db = require('quick.db'). also it gives error
you shouldn't be using any sqlite-based database services with repl.it
repl has its own database server, either use that, or use an external database server.
hey how do i make a leaderboard of all the users in my mongodb, depending on their $$ count:
it not working past 3 days
yeah ok ? And?
guildId: reqString,
userId: reqString,
coins: {
type: Number,
required: true,
},
})```
before past 3 days it workds
I'm not worried about it working or not
request the number of users, and sort them using sort.
It's not about whether you can it's about whether you should. And in this case... you should absolutely not use sqlite on replit
yeah i know the .sort function. How do i get all the users in the mongodb tho?
like, for loop the call function?
oowh mongo has a getUsers() property
okay one quick question, I actually already have a !leaderboard command for my leveling
what should i call this economy leaderboard?
my another bot replit quick.db working without any problem
I literally just addressed that
are you ignoring me but just don't want to listen? But you still ping me to get my reply? Why?
use mongodb ๐
better
or try to install quickdb again and again it will take time
some time it suck for me
The reason you don't use quick.db or any sqlite-based database on repl is because the entire information is public
he can buy hacker plan
your data is public
don't use repl with quick.db or sqlite or enmap or anything using files.
then how my another bot work
...
it's works
but sometime it can't be install
If you strip down and take a dump in the middle of main street, does your anus work?
Legit question here. It works but you shouldn't do it
? not able to understand
Well I guess the important thing is that they understand, I don't really care whether you do.
i can install
But you should not
it install successfull
do you not understand what I'm saying?
Am I using the wrong level of english?
sqlite bad on replit
no use sqlite
all can read your things
works but very very bad
any other free hosting
none that are good
galaxygate has a 3 dollar plan. Would recommend that one.
Pretty cheap and good enough for a begin bot,
There are a lot of cheap hosting. good "free" hosting doesn't exist.
uptime , how many bot can host on 3 dollar bro
i don't know about paid hosting
a lot
okay
I can tell you, I am hosting 4* instances on it right now and my memory and cpu are never exceeding 70%.
You have a few choices:
- Ask on the replit server for help with their service
- Use the internal replit database as is suggested by them
- Use an external database like mongo or firebase
ok we can host and update our code
okay
ok next time i will update too ๐
but my data are privet
i need choose vps pack right for discord bot host
You can check the pins for a lot more details about how to choose a host.
ohh ok thank you
if i am not using repl then what ๐คฃ
HWAHAHHA
Help pelase
I legitimately do not understand how me helping someone else suddenly turns into some rando just butting in and saying irrelevant things and trying to bring the topic back on themselves.
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
em = discord.Embed(title = "Spaming isn't cool my boi", value = 'You can use this command again in {}'.format(datetime.timedelta(seconds=int(error.retry_after))), color=0xf9b9ff)
await ctx.send(embed = em)
else:
print('Ignoring exception in command {}:'.format(ctx.command), file=sys.stderr)
traceback.print_exception(type(error), error, error.__traceback__, file=sys.stderr)
@tasks.loop(seconds=15)
async def change_status():
await client.change_presence(activity=discord.Game(next(status)))```
I'm going to take a wild guess and say... if isinstance(error, commands.CommandOnCooldown): is returning true
does anyone know how i can get all the users from my mongodb schema (so i can make a leaderboard): const profileSchema = mongoose.Schema({ guildId: reqString, userId: reqString, coins: { type: Number, required: true, }, })
trying to find something useful in their docs, but i can't find anything
never used mongodb but that looks like what you want
<schema>.find({ guildId: <id> }).map()
TypeError: Invalid sort() argument. Must be a string, object, or array.
it just returns me a model query
should return all guilds with your id
What are those troglodytes at stackoverflow doing
They're changing the font again!
oh true
hey!
Not really what i want, I rather want to get all the users
What is the recommended way to host a bot? seems like a weird question but im reaching the limits of one server, do I just upgrade it or is there a good way to have it work on multiple servers? maybe a load balancer?
upgrading the number of cores for more threads, and ram for more caching.
sharding to give your bot the ability to use more threads(and preventing hitting 2500 cap)
you can just upgrade your vps as you need more.
Ah I need to work on getting shared then, and I need to upgrade my VPS,
ive maxed out my ram and my VPS has been crashing
ah, yeah just upgrading the vps is fine. or try to limit how much you cache to only what you really need.
Currently I dont explicitly cache anything, only what discord.py caches by default.
I think sharding should help alot with the crashing though, il look into setting that up.
if your hitting ram limits, sharding will make the problem worse.
sharding inherently increases ram usage.
ok, so upgrade AND shard, ever since I added logging my bot has crashed my VPS.
๐ are you logging to a single file? is that file getting really large?
ah
How much memory is your process using?
about .9 gigs
I'm not familiar with discord.py, but it is probably caching more than you think. Are you requesting all the members for each guild or something?
Yes I have members intents, if its auto caching those I need to fix that
And how many guilds are you in?
im in a little over 150 guilds
๐
OK you don't need sharding
.9 gig on 150 guilds?
holy
IKR thats why im coming here
9 gigs??
**.**9
possible memory leak?
Does python have a heap dump / inspector tool? It would help here.
im sure there is a package if there is not one by default
๐ we have people here with 3700 guilds, and using less than .1 gb.
HOW
ok there is clearly something I need to fix
How many members roughly in all the guilds? Sounds like it might be caching all of them.
300000
Well yes
yeah, your just caching every member
OK I think that is the issue then.
Okay, il look into fixing that then, I have no idea how as of right now
thank you
It will also mean if you are actually using the cache somewhere, you will need to refactor the code to use the REST api.
const test = await profile_schema.find({ guildId: message.guild.id }).sort([['coins', 'descending']]).exec()
const user = test.map((a, b) => b.userId)```why is user returning undefined? Test returns me:
``{
_id: 609a7b24a1dca52fa0d87418,
guildId: '838039757493764176',
userId: '345138133429649408',
coins: 162,
v: 0
}
{
_id: 609be2908126d347788d1f57,
guildId: '838039757493764176',
userId: '745253908275920986',
coins: 0,
v: 0
}``
Unless the member object is sent with whatever event payload you are using.
i have 5.200 guilds and my bot using 400-450 mb ram lol
Okay, this gets much more complex the more you grow! Thanks for the assistance though!
๐ you can achieve less.
this shows you can realistically get under 20mb on 3000+ guilds.
https://i.woo.pics/7ce6385341.webp
๐ not bad for normal djs
Maybe my bot is wasteful
Well it is a trade-off between memory usage / performance / API limits.
170 mb ram usage with 150k users
yeah but maybe I should use eris.js
and im at 900mb with 300k users, SAD times
i hear detritus might be a good option
the graph i used above was for discordjs lite
High memory use isn't inherently a bad thing, especially if it makes your bot feel fast & snappy.
But the problem is that often the client is caching stuff you aren't even using / stuff that isn't in your "hot path".
I think about every 10 seconds or so im fetching for any given guild the member count.
member count is on the guild resource though right? Don't need to get all the members to work that out lol.
maybe I should limit the caching of other things that I am not using often as well, just never crossed my mind that I needed to limit what discord.py cached
๐คทโโ๏ธ discord gave me members intents for it, if it functions without caching them il gladly make it never cache members and see how that goes
https://discord.com/developers/docs/resources/guild#get-guild
Use with_counts
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
Yea, I think it may be a good idea to write my own member counter, Although I am not exactly sure how to implement that, maybe fetch the guild members and get the length of that?
I would personally just poll this endpoint every minute or so.
AH so create my own feature, okay, I can do that.
It looks like discord.py will automatically update the count using member events, even if they aren't cached. So you could just use that.
perfect il disable members caching then!
I could be wrong though, do the research ๐
Currently am reading the documentation and in a little while il take a look at the source and check out whats going on! thanks for the help!
Hi, why is this a problem?
2021-05-13 22:14:11,574:ERROR:discord.shard: Attempting a reconnect for shard ID 3 in 2.00s
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/discord/shard.py", line 151, in worker
await self.ws.poll_event()
File "/usr/local/lib/python3.8/dist-packages/discord/gateway.py", line 582, in poll_event
raise ConnectionClosed(self.socket, shard_id=self.shard_id, code=code) from None
discord.errors.ConnectionClosed: Shard ID 3 WebSocket closed with 1000
How to solve it?
hmmm wait i have an array that contains 2 ids. i tried for looping so it would fetch each users id:
for (const names of user) {
console.log(user)
client.users.fetch(names).then((user) => {
finaluser = user.name
})
}```
why is it still not working( in the name of, returning undefined?).
user = [id1, id2]
Heya, I am trying to save some information on MongoDB but for some reason its only saving the guild ID
Guild: message.guild.id
}, {
$push: {
Info: [{
Category: category.id,
Channel: channel.id,
Role: role.id
}]
}
}, {
upsert: true
});```
how can i get only 8.50 texts with cheerio?
Your naming scheme is throwing me off.
Why is your array of users called user
Your user id called names, and finaluser a name
Also, djs? Don't think User#name exists.
Is this everything your doing with mongo?
I have 1 more line, I'll upload it to pastebin when I wake up
I get this error everytime my bot thinks something is wrong but thereโs nothing wrong as it only happens when the internet has a lag spike how can I stop my bot from having a false error?
And thatโs referring to my channel create logger I think might be the member update one
.guild is null
Either you want to check what channel really is or if .guild will always be available
Itโs the exact same thing I have on my other bot I tested it on same version of node and d.js and it never threw that error but Iโll experiment with it in a few hrs if it doesnโt hiccup again, Iโve been in a bad mental state to attempt to fix it due to a ongoing medical condition
the error is someones dming your bot, so channel.guild doesnt exist. which is what he is telling you to do to prevent the error
Ohh
hi
can someone fix my problems?
just do my bot for me?
and my dashboard?
thanks
Ok turns out when someone joins the server and the welcome message sends itโs crashing the bot o.o i got some work on my hands
how to add random words to your bot invite link?
u dont
its discord randomized
i see
a happy little tree
yikes... Discord Bob Ross edition (tm)
How to get rid of this error ?
It shows nsfw doesn't exist in TextChannel
You mean DMChannel?
Cast it to a TextChannel
if (!(<TextChannel>message.channel).nsfw) or if (!(message.channel as TextChannel).nsfw)
why don't you check weather the channel is a dmchannel if it is not then continue
What actually does this error mean?
I want to dynamically set a function to behavior, so doSomething is the initial behaviour.
ahh
and it works.
Thank youu
wish TS wouldn't yell at checking truthiness for values that might not appear on all signatures for a type
Among other things, TS could be better
Warning: Accessing non-existent property 'sendMessage' of module exports inside circular dependency
When I try to pull my function in a defined class, I get this error.
It has never happened to me before
does anyone know why this is triggering ratelimit?
hello sir, Would you like to know more about our lord and saviour, detritusjs?
If I use it like this the problem goes away
https://www.npmjs.com/package/detritus ??
0 downloads ?
thats the old one
if it does actually interest u in using a ts library, check this #development message
might be worth checking early in development
okay I'll see thank you
const token = '!';
const commandClient = new CommandClient(token, {
prefix: '..',
});
commandClient.add({
name: 'ping',
run: (context, args) => {
return context.reply('pong!');
}
});
Too much simple, I repeat Too much simple
https://tenor.com/view/spider-hide-food-eat-snatch-gif-5662188
Erwin strikes again.
reminds me of discord.py
thats why its good, most of the stuff you would normally have to implement yourself is already handled by the lib
yea
ratelimits? boom, we got em
aliases? got it
custom prefix? got it fam
ratelimits per guild/channel/user? you bet
anything u need is already there and its so much more organized
not to mention, well, its an ACTUAL typescript library, so types will be available for everything
<CommandClient>.clear();
<CommandClient>.addMultipleIn('./commands', {subfolders: true});```
boom, you now got your handler right there
and to reload
now just yeet ur commands in /commands folder and u good to go
or you could write all this crap https://discordjs.guide/command-handling/ 
@opal plank can I use music commands with it ?
like this is the play function I'm using https://pastebin.com/zn0Me2xM
So I.m using things like channel dispacher reaction-collector etc.
yeah i use lavalink for it
are they available in deritus ?
natively no, but its pretty easy to setup
import lavalink, and dispatch the events to the manager
thats it
lavalink handles everything for you
oh okay
this one ? https://www.npmjs.com/package/lavalink
let me get the same one i use
1 sec
@near stratusimport { Manager } from 'lavaclient';
lavaclient is the one
https://lavaclient.js.org/guide/setup.html this is with d.js, but you dont use that at all
needless to say, i attched my managed to the commandClient
for easy access
and this for the other event
and thats it, you got yourself setup with voice
now u just make a command play and setup a new player
you just use those 2 methods.
serverUpdate()
stateUpdate()
Did I do this right?
var hosts = ['192.168.1.10', 'google.com', 'yahoo.com'];
async () => {
await Promise.all(hosts.map(async (host) => {
})).then(() => {
console.log("Done");
});
};
I'm trying to make a command so that when the owner of the guild that the message is sent in, it does something
if (msg.author.id === msg.guild.owner.id) {
const laicheckmark1 = client.emojis.cache.find(emoji => emoji.name === ("LaiCheckMark1"))
const laix1 = client.emojis.cache.find(emoji => emoji.name === ("LaiX1"))
if (msg.content.startsWith("Lai nuke")) {
msg.channel.send("DO YOU WANT TO NUKE?!").then(msg => msg.react(`${laicheckmark1}`) & msg.react(`${laix1}`))
if (msg => guild.owner.react === (`${laicheckmark1}`)) {
msg.channel.send("It worked maybe?")
}
}
}```
I have been testing all day and this is the closest I have gotten so far
This is a owner only command
what are them variable names,
I tried looking a websites
Let me think
Well take it from the message event
ok?
Ummm....
have it log
good variable naming lmao
wdym, it IS good

obj
ist an object
fair
yoo i get this when i try to make / commands for my guild.
"(node:16391) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Access"
does it have permission to add slash commands in the guild
but it has admin
god I hate that
You need to authorize the client with the applications.commands scope for it to be able to create slash-commands
ohhh
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
for more info
How do I insert a row into my spreedsheet and save it using this https://www.npmjs.com/package/google-spreadsheet
probably like this
ight. well woulld this get me rate limited?
interaction.getApplicationCommands().then(e => {
e.forEach(async r => {
await interaction.deleteApplicationCommand(r.id, )
})
})``` im getting all the / commands and its returning Command[] and so then i mapped it and delete each Command
idk
I meant into an existing sheet
how
idk how the js package organizes sheets
thats what Im confused on
okay thanks
kinda afraid to ask if u using sheets as a database, cuz most people who refer to it here do just that

@opal plank no Im not
anyways that is just geting an object of them all
I dont know how to get a already made sheet
could I get some helps
Hey, how can i know if a user's status is online/offline/dnd/idle?
i did a research and i found presence.status
oh lol
idk, I don't use js
Member
Doubt, they want users' status, not the bot itself
ah that's true
hmmm
member.user.presence.status
or ig GuildMember.presence.status works
actually i want the bot's one, but it is a webhook
i want the webhook to send a message when the bot is online/offline
and im doing it in a different code
also how to get a guildMember by it's id?
probably fetch
Pls work
i got an error
well fetch isn't actually a method
there's just probably a fetch method or something in js
I don't code in js tho so I don't know the exact name
if const client = new Discord.WebhookClient(process.env.id, process.env.token)
shouldn't client.guild be a thing?
hmm i haven't messed with discord webhooks before
https://discord.js.org/#/docs/main/stable/class/WebhookClient doesn't appear to have a guild property
do y'all guys know a bot hosting site with reasonable price and performance?
galaxygate
hm
sad
Soooooooo
but there is a Webhook class
Any ideas on how to make a bot on/off message?
that has a guildID property
hm
you mean like turn your bot on and off?
when the bot is on the webhook sends a message
and when it's off it sends another
Do you have any ideas of where i could search an answer?
whats the issue again?
big brain, make another bot for seeing whether your bot is online
im doing that
lmao
send it to guilds/$guildId/members/#userId
just a single request will do
that'll get your user on that X guild
If you just want to notify if the bot goes offline, why not just send it on shardDisconnect or something?
i mean, i could do a online message in the bot's code by coding an embed, bot.on(), find the guild and the channel and send the embed
but the bot can't know when itself is offline
There must be a disconnect event
bot.on('shardDisconnect', () => {
axios.post(webhookurl, {
content: 'bot offline'
})
})```
that simple
just axios, request or whatever other http lib you want
webhooks dont need tokens whatsoever
no need to bloat ur code with clients
either way, back to coding
hm
what's axios exactly?
,
fetch, request, axios, got, anything
request is deprecated iirc tho
so use anything else
or just webhookclient.send ?
why bother bloating ur app?
just send a raw request
use that snippet i sent above instead of all that stuff u doing with guilds or whatnot
too messy and bloated
k
while doing the autoposter thing I am getting this error TopGGAPIError [Top.GG API Error]: 401 Unauthorized (You need a token for this endpoint) at Api._request (/home/runner/Shinchan/node_modules/@top-gg/sdk/dist/structs/Api.js:76:19) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async Api.postStats (/home/runner/Shinchan/node_modules/@top-gg/sdk/dist/structs/Api.js:96:9) { response: { error: 'Unauthorized' } } but I inserted the token there it was working this morning but now it is showing like this (I regenerated the token a few also but the same error )
Can someone help me please
hey
Why is my embed sending undefined only?```js
let reke1;
let maka;
let reke2;
const profile_schema = require('../schemas/profile_schema')
exports.run = async (client, message, args) => {
const test = await profile_schema.find({ guildId: message.guild.id }).sort([['coins', 'descending']]).exec()
const coins = test.map(profiles => profiles.coins)
const user = test.map(profiles => profiles.userId)
const guildname1 = test.map(profiles => profiles.guildId)
for (const nguilied of guildname1) {
reke1 += client.guilds.cache.get(nguilied).name
}
const resultembed = new discord.MessageEmbed()
resultembed.setColor("RANDOM")
resultembed.setFooter("AwsomeCord || Games")
resultembed.setTimestamp()
for (const names of user) {
console.log(user)
client.users.fetch(names).then((user) => {
reke2 += user.username
maka += (**AwsomeCord's Economy Leaderboard!**\nUser: ${reke2}+ " " + Server: ${reke1} + " " + :coin:: ${coins}\n)
})
}
resultembed.setDescription(maka)
message.channel.send(resultembed)
}```
I've done this as my for loop was sending all the messages apart from each other, wanted them all in one embed.
use async/await
you're not blocking your code so the embed builds and the message gets sent before even the first fetch completes
ew you are mixing async/await and promise patterns
smells like copypasta
anyways
get rid of the then in the fetch, await the fetch instead
https://srcb.in/VdouPQ6mR1
Good morning, I have a quesion about the change of the serverID (aka guild.id).
I have a leaderboard that take only the member in a server based on the guildID in the server, there is a way to change this? But I would like that peole that joined my server for testing the bot can appear in the leaderboard of their main server. How can I change this ID bcs changing it manually seem a little bit too long
you can always just ask a question without trying to flex, people are more willing to help if you humble

I'm not the person that can Flex in thiws server
can I return the same anonymous function, it is in.
So I could do
funCall()()()
I'm a noob in coding and also u know
Hey guys, how do i log stuff in console? i ask ebcause my bot is in 8k servers and with 950K people, so i need to know.
this seems too much ๐ฆ
the server count/membercount you provide is completely irrevelant to the question, thats my point
Youre right, I'm really sorry
theoretically, yeah
I do have eval's that i use for a discord bot, but my question is, is there a way to have it execute strings in code with a debugger?
The use case for this is when the bot is offline and it cant reply to discord, so im trying to figure out a way to use the debugger console to get variables from the code. The issue lies is that i could potentially use readline package to do it, but the debugger isnt technically a terminal from what i can see, more like a vm ish.
https://cdn.discordapp.com/attachments/746439312018505788/842686910182457354/unknown.png
there are workarounds i can do, like using an api and a bare bones website to send it strings to be evaled and return the results, but i'd like iff possible to do it this way since i can ssh into the bot and attach a debugger on the node
basically, in sum:
i ssh with vsc
i attach to the debugger
i want to be able to use the terminal to eval within the app, like the example above, trying to console.log(manager) which is in the code```
basically i got until the very end, im already ssh'd into it, but instead of a console, im inside the debugger with the node already attached to. The issue is the debugger terminal
https://cdn.discordapp.com/attachments/746439312018505788/842690206423056384/unknown.png
of course this wouldnt work, but the idea is basically be able to do this
https://cdn.discordapp.com/attachments/746439312018505788/842690540049793024/unknown.png
the debugger terminal kinda like acts its on process
@clear marlin good luck
const aFun = function () {
return arguments.callee
}
aFun()()()() // As much as I want
// OR
(function () {
return arguments.callee
})()()()()()()() // LOL
How to do same with anonymous function?
(() => {})()()()()```
this
na na
Hmm..? How would that work
that seems like hell though
the function returns nothing
give me 200 minutes to read this
even anon functions have proto right?
doubt I'd understand either way
give you 10 pats if you can answer that question
that question is VERY vsc oriented, thats why i was asking if there was a VSC discord server, i doubt anyone here would be able to help with that
I use this VSC lame
Your snippet doesn't work erwin, anon functions do have a prototype but I don't see how that's related cause you're trying to call the return calue of an empty fuction, which is undefined
isnt it the same frm what they sent?
pls guys ๐ฆ
Anon functions don't have access to arguments afaik
it's not possible with anon functions, i think then
on the offchance you might know, do you think you know the answer for this @cinder patio ?
small question, do you have to push Global commands again when the bot joins a server?
I added my bot to another server and suddenly the bot doesn't have slash commands in that server, while every other server that it is in, still has the commands
or did I do something wrong with the invite?
no
global cache up to 1hrs
global commands are accessible everywhere, only guild specific commands would be needed to be passed/added
yeah that's also what I expected, but for some reason it doesn't work for other servers
the bot role has permissions for that
Like I said, it can show up to 1hrs
const economy = require('../schemas/economy')
const discord = require('discord.js')
const mongo = require('../mongo')
let reke1 = ''
let reke2 = ''
const profile_schema = require('../schemas/profile_schema')
exports.run = async (client, message, args) => {
const test = await profile_schema.find({ guildId: message.guild.id }).sort([['coins', 'descending']]).exec()
const coins = test.map(profiles => profiles.coins)
const user = test.map(profiles => profiles.userId)
const guildname1 = test.map(profiles => profiles.guildId)
for (const nguilied of guildname1) {
reke1 = client.guilds.cache.get(nguilied).name
}
for (const names of user) {
client.users.fetch(names).then((user) => {
reke2 = user.username
console.log(reke2)
const resultembed = new discord.MessageEmbed()
resultembed.setColor("RANDOM")
resultembed.setFooter("AwsomeCord || Games")
resultembed.setTimestamp()
resultembed.setDescription(`**AwsomeCord's Economy Leaderboard!**\nUser: ${reke2}`+ " " + `Server: ${reke1} `+ " " + ` :coin:: ${coins}\n`)
message.channel.send(resultembed)
})
}
}```this embed gets sent multiple times, with the correct info tho, but how would i put them all within 1 embed? I know this is because of the for loop, and I tried defining the embed outside the for loop but it sent me an empty embed
yeah, but I was trying to avoid using a variable.
Global is not immediate
this is not the same as slash commands
that just enables users to use it iirc
not the bot
you need to scope on the invite for that
aha, so I messed up the invite
not possible then
https://discord.com/oauth2/authorize?client_id=513710706852364288&scope=bot&permissions=2147584000
This is the invite URL, do I need to add a scope to the back of this?
oh wow I only just noticed that ๐
yeah that
i trust u when it comes to lang, but i guess we're on the same bot when it comes to specifics of that

why no VSC discord?
i never even got vsc's debugger to work correctly
i always debug via chrome dev tools
its the best thing ever
// Using
(function (sign) {
return arguments.callee
})(-1)(1)
// must be better than
[-1, 1].forEach(sign => {})
What u say??
i only use chrome to profile
the ram profile and snapshot is amazing
but VSC is better in every other thing
press f5, add normal configs, gg ez
it would get stuck on "waiting for debugger to disconnect"
every time i ran it
and do nothing
thats odd, never had that
that fixed it, thanks! 
even when i just used js
no problomo
fuck
might have to resort to stackoverflow or their github

was trying to avoid to leave my footprint in those places
see no one knows
:(
only person who MIGHT know is xetera
xetera is notorious for knowing a lot of shit im in deep need for, almost like im following their trail of issues
proabbly gonna get pissed for the random ping, specially busy with the new translator thingy
might ping tomorrow
.help
@quartz kindle js message.guild.owner.user.tag is not working in my public bot. But it's working in my private bot.
Console is showing 'user' is undefined
How?
Ok
how do i make a 1-10 count in my embed?
Like: 1. user
2. User etc
var leaderboard = [];
for (var profile of profiles) {
var username = (await client.users.fetch(profile.userId).catch(() => false)).username
var guild = await client.guilds.cache.get(profile.guildId)
var coins = profile.coins > 0 ? profile.coins : 'No Coins'
leaderboard.push(`User: **${username}**`, `Guild: **${guild.name}**`, `Coins: **${coins}**`)
}
embed.setDescription(`\`Economy Leaderboard\`\n${leaderboard.join("\n")}`)
return message.channel.send(embed)
}```
For loop
Hmm it stays the same!
for (let i = 0; i < profiles.length; i++) {
content =+ `${i+1}.`
}```
@dusky sundial
hello can I ask how can I set up reaction roles and how can I bind them in a message in aspecific channel?
command => send message => dumb id in database => start reaction collector => add roles
bot restart => fetch ids from database => fetch message => restart reaction collector => add roles
thanks my guy
dump
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: d:\\casino\node_modules\parse-ms\index.js
require() of ES modules is not supported.```
why isn't require supported? I know that i have to switch to import, just curious.
https://nodejs.org/dist/latest-v16.x/docs/api/esm.html @eternal osprey
What is difference between dotenv and a config.json file?
Do you guys know any free proxy providers??
i will kiss your dog
config.json is a .json that you named config
ok
before you edit to kill or something http://img.terano.dev/omGZ23_Y
basicaly: if your project public? use .env
else use .json
.env is standartised, but even so, i absolutely hate it
it makes tokens and private stuff accessible throughout the whole process, which could make a privacy concearn
Is there any performence difference or just a standart?
.json can be imported dynamically by ts in one go, rather than having to dotenv() and cast everything to their proper times to be passed around
doubt it
.json might be a couple microseconds faster
I tend to use json
JusT uSE BOtH
config for configurations
haven't really tried .env
.json is better
source: trust me, im a dev
unless you making it public, then people will talk about standardization, which i cant really bitch too much about
im really liking using env actually
but in terms of usability, i'd personally rate .json scales above
.env is limited to strings, in case you need arrays, objects, numbers, etc, you have to parse and/or cast them
its a pain and a half
say, a whitelist of users whitelisted in your bot
i dont really use .json directly, the important stuff is in a .env and then i have a default config for the guilds as fallback defined in a .js file where the rest is defined. the default config is also used to pass in as values if a guild dataset gets created
@opal plank if someone fucked something up and left fucked up typings, is it fine for me to use @ts-expect-error?
in json it'd be just ```ts
{
whitelist: ['123', 12],
}
import * as config from './config.json';
though in env it'd have to be
```ts
WHITELIST = 123,124
dotenv()
let config = {
whitelist: process.env.WHITELIST.split(',');
}
i find the former much better. of course this is a single example, but for actual types and passing stuff around, specially not making tokens available in a whole process, which could be taken from a malicious code(since env's are teh first place you'd yoink stuff for malicious reasons) i find it much better
i use it a couple times, yeah, mostly due ot my own library and me using private properties from classes
Erwin you gotta add as number[]
string[]
and split() already returns that
but yeah, imagine if that was a number array
o
you'd be even more fucked
but you see what i mean?
json already compiles all that already
without having to map()
which is hella slow
map() is slow af
you need to do a lot of manipulation to your variables to amke them "usable" and in the format you want, hence why i would personally always go for json over en
personally, like i said, i'd go for .env for a public usage(if your code is going to be public) and .json for private
.json will give you more malleability and performance, while .env is standard practice in the ecosystem
Erwin
speed doesn't really matter on startup
especially since .map is still faster than any ws connection
kinda does, but this is negligible
the token parsing would happen BEFORE any ws connection million
you dont have a token parsed before you start the client

Can anyone help I want my bot to send a thanking message when it joins any server client.on('guildCreate', guild => { const channel = guild.channels.cache.find(channel => channel.type === 'text' && channel.permissionsFor(guild.me).has('SEND_MESSAGES')) channel.send("Thank you for inviting me") }) but it cant send a message if the first channel doesnot have messaging it perms so how do I make to see for a channel where it can send message and then send the required message?
i would use get() with conditional chaining instead
oh
nvm
i see what you doing
wouldnt it be better to use oauth for that?:
Ok I didnt understand you I am kinda beginner so..?
@welcome.command()
@commands.has_permissions(manage_channels=True)
@commands.guild_only()
async def channel(ctx):
db = sqlite3.connect(db_path)
cursor = db.cursor()
cursor.execute("SELECT channel_id FROM welcome WHERE guild_id = ?",(ctx.guild.id, ))
result = cursor.fetchone()
print (result)
if result is None:
sql = ("INSERT INTO welcome(guild_id, channel_id) VALUES(?,?)",(ctx.guild.id, ctx.channel.id))
await ctx.send(f"Welcome channel has been set to {ctx.channel.mention}")
elif result is not None:
sql = ("UPDATE welcome SET channel_id = ? WHERE guild_id = ?",(ctx.channel.id, ctx.guild.id))
await ctx.send(f"Welcome channel has been updated to {ctx.channel.mention}")
cursor.execute(sql)
db.commit()
cursor.close()
db.close()
``` idk why this isn't working, but it wont insert the guild id and channel id in the table. any idea why?
hm
also is it fetchone or fetchOne?
fetchone
thats not the problem cuz if i remove that bit the whole command wont work
how so?
you specified only 1 param in the query, it was supposed to error due to dangling commas
neither do i know ๐
Is JDA better than discord.py?
Was thinking to use java, but i already comfort with dpy :/
py is quite known, but py is not the most efficent language out there, java has gotten way better with its resource usage over the past years, also got some stuff that is better than py
aight
I mean they're different languages completely
it's like asking if english is better than spanish
well is it?

The answer to both questions is : "It depends on your needs"
Is spanish better if you're in spain? yes. If you're in the middle of Arkansas? Probably not.
you never know :^) there should be plenty of mexicans in arkansas
Sorry for bothering just having some issues- could someone help me out, on why this isnt working (no error code or anything)
Its python
in what way is it "not working"?
It should find a random song related to the previous one, instead- it doesnt play anything and when someone tries to play something, it queues it infinitly instead of playing it off.
you have to disconnect the bot and then reconnect it (since that clears what it is playing and the queue) to be able to play something agian
if that makes sense
so it just keeps adding the same song to queue?
No- it doesnt add anything, what it is supposed to do is find a song related to it, in other words autoplay, just like on youtube if you leave it on, itll play the next video. instead it doesnt play anything at all. and prevents anyone else from playing anything
๐
song = Song(source)
self.current = song
does song include source
self.voice.play(self.current.source, after=self.play_next_song)
Using Mailjet
you should buy one then. especially for a mail server
Lemme try
I dont really know python, the formatting kills me when reading it 
VPS?
a domain doesnt need a server.
https://www.godaddy.com/
^ these guys sell domains
^^^got mine from there
Even cloudfare doesn't add my domain...
Then how I can find the DNS records there!?
dns settings on your domains page
heres there guide on it. https://www.godaddy.com/help/change-an-a-record-19239
I can't find it
@solemn latch nah doesnt work-
as in song doesnt have source?
hmm, ive looked through it a few times and cant find the issue.
I would just start using debugging tools
Does anyone have any suggestions on how I would rate-limit users to prevent them from spamming my bot? Iโm using discord.py
My bot uses APIs for some of its commands and I donโt want those APIs to get rate limited if someone attempts to run the command 1000s of times in a short period
How may i help?
Thanks
it may help to also add your own ratelimit prevention for those api's you use. the same way discord py does with the discord api.
Will do. Afaik the rate limit for the API I use is like 100,000/day but I still would like to make sure people arenโt abusing it
ah at 100k a day you realistically wont need anything api side for awhile the command cooldown should be plenty
hey can i know how to make panel similar to wickbot's?
just ping me if somebody knows..
Itโs just custom css right?
you can just ask
yea I am rn
ah
how can I reassign a typed part of a class when extending it. Basically there is class Worker which I am extending and I am trying to change the Worker.commands to a new value but ts doesn't like when I do that, is there a way for me to force it to not care?
Can't you
class ExtendedWorker extends Worker {
commands: ...
}
TS shouldn't be complaining here
not without losing type safety
hmm
um can anyone help me in a javascript stuff?
its strange because im just extending the old one
and the worker is always the correct worker
so I would think that it would let me just reassign the property with no issues
wait no im not
thats wrong
It won't because in the constructor of the old class assigns commands a different type
I realized im duplicating the class and having it extend another
so it's unsafe
anyone have any ideas on how to create an xp system that goes across all guilds rather than one? Right now i'm thinking i have to make a database for each guild, but I'm wondering if there's other easier ways.
Using sqlite btw
I use quick.db as it is easy and I use creative ways to make it more than enough useful for my bot
whats your issue tho
thats crazy
use @commands.cooldown
um ok then my question was that... how can I check if the message author got a role higher or lower than the user he/she mentioned
what exception does that give when someone tries to run the command while on cooldown? discord.ext.commands.errors.CommandOnCooldown doesnt seem to work
in which library
also
language tip
english has they/them
gender neutral
you can use they when you're referring to a person but don't know their gender :p
they have a nice smile etc.
anyway
back on topic
yah true thats a good idea rlly
sorry forgot to off ping
message.member will return you the author's member object (this will be null if the command is in a dm)
now for both members you have to return their topmost role
a member object has this https://discord.js.org/#/docs/main/stable/class/GuildMember?scrollTo=roles
hmm
and that object that i just linked
has a highest property
get that on both of your members
you'll get the highest roles
and after that just compare the role positions
so you'll have something like
...authorMember.roles.highest.position >= ...mentionedMember.roles.highest.position
if this returns true it means that the author has a higher or equal role position to the mentioned member
if it's false, it means the author has a lower position
im trying to create a starboard
so i create an event messageReactionAdd
and i coded it and stuff
and when i react to a message
it doesnt do anything
im super confused
ic that was ez to understand thank you very much
have you checked if the event is firing in the first place
are you using intents?
what are those
okay so you probably aren't
then you probably need to enable partials
alright ill take a look at that
make sure to read the warnings a bit further down the page
you didnt add the neccesary intents
that seems to be correct...
strange. ill look into it
discord.ext.commands.errors.CommandOnCooldown: You are on cooldown. Try again in 56.77s
says that in the console so that part works
cant get it to send it in a message tho
You can make an error handler for the command
and check if the error is CommandOnCooldown
Hello, i'm gonna try to make an economy system for my bot, it's gonna be using codes to gain currency, I just wanna know how I would check if the code is claimed. I'm storing the value claimed as a boolean.
const code = (Math.floor(100000 + Math.random() * 900000));
const data = await cooldownSchema.findOne({ Guild: message.guild.id })
.setInterval(() => {
const dropEmbed = new Discord.MessageEmbed()
.setAuthor(`New ${data.Currency} Drop!`, guild.iconURL())
.setDescription(`Type ${prefix} ${code} for ${data.Amount} ${data.Currency}`)
.setImage(data.Image)
const channel = data.Channel
channel.send(dropEmbed)
}, data.Cooldown);
if(data.Claimed === true) {
const alreadyclaimedEmbed = new Discord.MessageEmbed()
.setAuthor(message.author.tag, message.author.displayAvatarURL())
.setDescription(`This drop has already been claimed.`)
channel.send(alreadyclaimedEmbed)
}
if(data.Claimed === false) {
const claimedEmbed = new Discord.MessageEmbed()
.setAuthor(message.author.tag, message.author.displayAvatarURL())
.setDescription(`You have sucessfully claimed the drop for a total of ${data.Amount}.`)
channel.send(claimedEmbed)
}
you don't need to compare booleans with booleans btw
it won't show an error either way
ok thanks
so, what's the error?
he's storing data as boolean
i feel like you asked the question, and gave the answer in the same message
There is no error, I just wanna know how to do sum.
how do you check if its claimed? check the boolean value.
add it to the previously stored value


