#development
1 messages ยท Page 1942 of 1
@woeful pike (forgot to hit reply)
~35% of the 512 mb available
not sure which of them is which, but the top 2 are using 99mb ram each
yeah I understand what you're saying but that increasing program complexity doesn't go away with dynamic types, it's more of an "out of sight out of mind" situation if anything
RES is what really counts as memory usage
but they have about 30mb which is shared (SHR)
so basically the process is using 99mb of ram, but 30mb of which is shared with other processes, so when you put it all together, it accounts for less % of the total available ram
that's nice of node to share
i have 2 shards so the top two node processes are probably the shards
yeah, multiple node instances probably share quite a bit of ram
probably yes
alternatively you can always run process.memoryUsage from an eval command
and/or use broadcastEval to check other shards as well
I think some of it does and some of it doesn't. Person1 and Person2 may be compatible here and there, so you do need to concern yourself about it, which can be annoying and complex, but now you can share most of the semantics that are compatible.
i think they recommend just calling process.memoryUsage.rss() nowadays
~ its faster according to docs
im too scared to run eval on my server
xD
yolo!
yeah its faster if you want only rss
but sometimes its good to also have heap and external information
yea but does the rss show total combined? like, isnt heap a part of whats showin in rss?
idk tbh, but i thought it was
yeah, rss is basically what RES shows in top
Just manually calculate your memory usage based off of your typ- oh wait
but for example if you're debugging memory issues, looking at the differences between rss heap and external will help you locate the problem
high external = buffers, high heap = js objects, high rss but low everything else = c++/native addons/fragmentation
hmm, i never thought of that tbh. i suck at debugging memory leaks lol
hence: 3.5gig on my nub bot
lol
lel
there was a memory leak on one of the mongodb version a long time ago and it kept crashing the nodes
wasnt there also a weird issue on the official mongodb driver for node?
๐ฎ
that crashed the processes
i dont really like mongo, but i only tried it once tho
Mongo has a good history of what not to do when building a database tbh
xD
I wrote the discord button code in my command file but when i do the slash command there is no button
They spent most of their initial investment budget fixing their original mistakes
i used to use sql, but i used to use php. when i moved to js for everything, mongodb and node's mongoose module just made sense, everything is in the same language now
~ bar html/css
Like using memmap for file handling only to realise... That they have no idea if the os has actually fully stored the data or not or what's being cached or not
memmap is notoriously hard to use, from what i've seen/heard
How do i fix this?
Well in alot of cases people use it for the wrong things
It's great for WORM based systems
we cant help you if you dont give us any information, for example your code
Ok i will
But it's nearly always faster and more efficient to write a custom system the issue with tbat though is that's even harder
uhh
Overall though memmap is actually quite simple
well crap my laptop crashed and it wasn't able to save the changes
wasnt there a stupid fast db based on memmap?
if sql is the standard db, mongodb craps all over that in terms of speed
let me try to remember what it was called
@quartz kindle Here is the code
In databases its always faster to write a custom buffer pool system than the OS because you have context of what the program is actually doing
did you register the commands as application(slash) commands?
Postgres remarkably is actually one of the only databases that actually even relies on the file system cache to be efficient (double buffering)
Uh i think i forgot to
let me check
ah i remembered
LMDB
it says client is not defined
i dislike having to pre-register the commands. but i get it
just a pain when making changes ๐
that error means you are not organizing your files correctly
uh
the client variable needs to be accessible
Was just about to mention that one
And yeah its um, interesting xD
if you want to use client in other files, you have to send it, or access it from something that includes it
wow i don't even understand what your saying
Its fast, for an embedded database, although sqlite is generally still the better choice if you need fault tolerance
In 2011 Google published software which allowed users to generate micro-benchmarks comparing LevelDB's performance to SQLite and Kyoto Cabinet in different scenarios.[12] In 2012 Symas added support for LMDB and Berkeley DB and made the updated benchmarking software publicly available.[13] The resulting benchmarks showed that LMDB outperformed all other databases in read and batch write operations.
lel
there was a version of sqlite that was built on top of LMDB
but its not very well maintained
im confused
at the end of the day, there are a lot of good db choices out there
as long as your not manually trying to write your entire db to json or something, your probly doing ok
(and even doing json writes can be good enough for small data chunks)
everyting in the red square is supposed to be in your main file, or whichever file you use to add the event listeners
{
"bootups": 848,
"release": "12/18/2021, 11:33:07 PM",
"version": "0.8.48"
}```
^ is the contents of a json file that auto updates upon each boot during development
ok
pm2 keeps track of boots for me
kinda
Uh @quartz kindle I got this DiscordAPIError: Unknown interaction at RequestHandler.execute (/home/runner/Nodejs-16/node_modules/discord.js/src/rest/RequestHandler.js:349:13) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async RequestHandler.push (/home/runner/Nodejs-16/node_modules/discord.js/src/rest/RequestHandler.js:50:14) at async CommandInteraction.reply (/home/runner/Nodejs-16/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:98:5) at async Client.<anonymous> (/home/runner/Nodejs-16/index.js:49:3) { method: 'post', path: '/interactions/921926470606127124/aW50ZXJhY3Rpb246OTIxOTI2NDcwNjA2MTI3MTI0OlZEY2dGeVRIM290d3cyNGQ4VWhhSnJONkphRVlJV2lmNFZMZ04xOFJ3UzFHNTh0Z0NoazR1YVMyeURLS3ZoSkZqSGtaNUZlMTJ4Zjk4VDBtdjN2ZUY5TWUyT2pGRXIycEZIMkRnRmUxdXZ3TFM0b2tXUVZVZ1lKUkFlUGRZenox/callback', code: 10062, httpStatus: 404, requestData: { json: { type: 4, data: { content: 'Pong!', tts: false, nonce: undefined, embeds: undefined, components: [ { components: [Array], type: 1 } ], username: undefined, avatar_url: undefined, allowed_mentions: undefined, flags: undefined, message_reference: undefined, attachments: undefined, sticker_ids: undefined } }, files: [] } } exit status 1 ๎บง
show your index.js
ok
oh, thats more a basic bitch version manager system i wrote up. if .env has a development variable then it will increase the bootups number, which is used to determine version number
version numbering* doesnt really manager shit
lol
The issue with that was most of the tests never exceeded the memory of 8GB so it just becomes a battle of whether the db touches the memory of not
i see
@quartz kindle Can i send you a hastebin link of my index?
Each key value pair yhey did was only 116 bytes
Not that it matters much because in reality sqlite is still the most used db in the world
And no one is gonna top it for its utility lul
@quartz kindle I sent you my hastebin file of my index in dms
interactions can only be responded to once, here you are responding to the same interaction multiple times
you have a duplicated listener
AYO @quartz kindle Thanks
๐
if you want to put that code inside ping.js, you have to require the file, the run execute(interaction)
otherwise you can delete ping.js since you're not using it right now
Do you guys use cogs when you make discord bots using discord py?
Pycord is good
how does it face against nextcord
I added a new slash command to my bot why is it not showing on the slash command popup
oh ok
Thanks good to know
fixn't
wats the difference between let and var kekw
let is block scope, var is function scope
aka don't use var
function bla() { // this is a function scope
let a = 1;
var b = 2;
for(xyz) { // this is a block scope
let c = 3;
var d = 4;
}
// c does not exist here
// d does
}
that ^
var is deprecated
in 99% of cases you don't want to use var, it's just outdated
its not deprecated
it isn't?
its part of the language standard
shit I read this thinking it was js lol
lmao
another difference is that let cannot be redeclared, var can
so with var you can accidentally overwrite another var with the same name
with let it will error
fuck initialization modifiers. All my homies implictly assign to global ๐
another difference is that var defaults to undefined if you try to use it before initializing it
let will error if you try to use it before initializing it
hi
so
i just wanted to ask
does the discord.js api have an event like client.on('error') or something like that
do i use this like
client.on('error', (error)=>console.log("oh error");
```this?
yea that should be fine
v12 still has the same event for the client so that shouldnt be an issue
if your using like exactly above, your missing an )
client.on('error', console.log);```
or
client.on('error', error => console.log(error.message));```
i'd do one of those ๐
oh
let me try
wait also
what if when i want to send the error to the channel lets say
then do it? ๐
no i mean
as long as its not an error that causes app termination it should be fine ~ assuming your bot has access to the channel
yes it does have access to it
oh, no, the error object only has error data
you would still use the channel object for whichever channel you want to send the message to
๐
which channel is the question? ๐
that error event doesnt happen on a channel, it happens on the client
i want the bot to say that to the user who invoked the command
thats a function i used in my old v12 bot to get a specific channel for sending report messages
i see
but it would only work for sending to a specific channel in a specific guild
ie, sending a bug report to me ๐
hm
alright
also
is there a way i can check a user's custom status
like you know the text and the emoji we use in the status
yes but you would need a presence intent after your bot reaches 100 guilds iirc
yesyes i know that
if you want to have access to status data like online and custom status
Uh no
no? you cant get custom status data?
You can use it until you reach 100 then you gotta verify
*^
BUT
how do i check a users custom status
like get the emoji and the text
Also I'm not entirely sure if your custom status is part of the returned data from a presence
Last I checked you can't
oh god
i think ill just go back to python then ๐ช
That's just your presence not necessarily your custom status
lemme try that
assuming you have the intent/less than 100 guilds
so like, user.presence.status should have some data
That's just your dnd, idle or online stuff
omg thats online status loool
There is no way to check it as far as I can tell
what about activities
Unless discordjs treats it as an activity maybe
Maybe
I noticed it says customEmoji
Which you can set an emote for you custom activity
Try checking out activities on presence stuff
It might be what you need I've never tested it tho so no guarantees
how do i convert the
message.author.presence to a json thing
Wdym
so i can read it
like if we use message.author.presence.status it returns idle in my case since im the user who invoked the command right
Yes
so obv the message.author.presence must have something stored in it
like a json
thing
Presence returns the presence data
so in order to read that thing we need to convert it to either a string or a json data
how would i do that
If you logged it you'll see what it looks like or just read the docs
oh alright
JSON.stringify(object)
ie, you can do: channel.send(JSON.stringify(message.author.presence))
but might just be easier to log to console lol
THERE IS OMG I FOUND IT
DO U GUYS HAVE THE EVAL THING IN UR BOTS
AYE THANKS MAN CREDS TO U
well go get the eval command in ur bots then
its usefull
tbh
for debugging and stuff
my v12 bot has an eval command, but i havent written one since i started rewriting my bot ๐
i've just being doing specific admin commands for things i want to test. no need to be able to eval on the fly during production imo
~ if your having to eval the same things often, it should have a command (imo)
this deserves a pin ๐
tbf, eval is good for quickly testing random lines ๐
yes
it doesnt
im in love with that color scheme atm!
(its red and green, and fades from one to the other and goes through that funky brown state)
so nice to watch ๐
oh so did u know that before i exposed how to get a custom status of a user in here
what lol
nothing lol
armful, why not armless? ๐
*^^
thewhat
๐
why would i need it
not u
but
others who want to implement this to their bots
and also a google search can help me
might need it
go on
or d.js docs
lmk if u find it on google
oh yes
go on docs too
lmk if u find it there
and the usage too tho cause that is what is main
<GuildMember>.presence.activities
they're entertaining
there you go
not that
im talking abt cusomt status
that gives u the
idle
online
invisible
thing
and well u prolly saw my image idk how u cant remember what u saw
<GuildMember>.presence.status
easy as that
*^^
ur free to try it
it will return
online
if the user is online
idle if user is idle
invisible if the user is offline
grow up rei
the fun thing is we all just been over this 30 mins ago lol
u know u lost yet u keep arguing
dont be a kid
๐
ITS FUNNY LMAO

*^^^^
and thats it???
๐
wdym
the text thing
and the emoji
yea d.js doesnt give you that
in ur case its https://reis.ml/
oh yeah?
bruh
u sure abt that
it does
i just figured it out
๐
you first said status and now that
you are confusing
look what i said
custom
i didnt spell it right
but
u can still see it
cmon rei accept it u lost
cant we all just get along โค๏ธ
i could edit this and correct the spelling but then u would still keep arguing so i didnt edit
*^^ ๐
dek
i like u bro
ur nice
isnโt it .user.presence.activities[0].state
yep but u saw the image i sent so doesnt count
i didnโt
yea
i thought you did some sketchy stuff at first
who knows
nope

i figured you were using a user account to fetch the information
i was just curious lmao
LMFAO look at her copying armful
๐
wtv bro lets leave it here
ima go do mine
please lol, no need to be rude
1 im a guy (never look at someones pfp)
2 i was already going to try it lmao
anyways
isnt everyone online a guy by default?
๐
question: anyone here display a highscore type list of users on their website?
if so: how do you display the information / what default discord user info do you display?
@neat ingot i donโt do 100% public lists-though weโre working on a level leaderboard on a per server basis for my bot
i want to reward our users for being active, but the leaderboards will be per server for privacy reasons
yea, i get that, its a fair reason tbh
i did consider having a per server listing, as well as a global listing
but i obviously dont want to expose much data on the global list
Global leaderboards are fine imo if it's just their username
i was thinking of just user.tag and avatar
keep in mind you will have to either make the global leaderboard opt-in or make this clear in your privacy policy
indeed
if you are looking to display identifiable information at least
I'm not sure why youd make it optin at least if all you're doing is using their username
Usernames aren't exactly private
i intend to inform the user of my policy etc when they use their first command
and i have a command to remove your account entirely from my db
itโs identifiable and can be used for targeted advertising
literally the only data i store is discord id, username, and avatar
Just don't use the discriminator
the rest is custom junk from my bot
though as i said, if itโs in your privacy policy youโre good
yup
I don't see it being an issue as long as you don't show a discriminator but either way like armful said still putting it clear in your privacy policy is a nice idea
maybe try make your numbers .toLocaleString()
i dont see displaying the discrim as a big deal. users can change those easily enough
With the discrim you can directly add and then harass them
i always include what and where we store user information to be transparent with our users
my numbers will be split with , when i fix the display ๐
Without you just know someone named Bob is number 1
iโm working on rewriting our privacy policy atm to be more clear and transparent
yea i guess this is true
Can't do much with a username unless you wanna make a script that goes through all the 4digit discriminator combinations for that username
i mean, thats not that many...
donโt need a tag to sift a database
You don't store a discriminator
At least I see no reason to
You already have their ID
Which you can use to get their user data anyway
iโm saying if someone is using their username across several platforms and such as their email it can be used for targeted advertisements
As long as they still share a server with the bot at least
Eh ig
what iโm saying has no relation to discord
assuming i was selling my user records to some ad company? ๐
I was under the assumption we were talking about a leaderboard
assuming anyone can scrape your leaderboards information
i should have made that clear on my end, sorry
you guys make a fair point, ill have to have a think about if i include the discriminator or not
but i will at least be showing usernames and avatars ๐
yeah iโm just being the devilโs advocate here
and yea its a limited leaderboard list, not an entire list of all my players
limited to 100
has 2 atm ๐
hereโs my advice
if you want to use discrims
make it opt out and include it in your privacy policy
and youโll be good
Or don't use em at all since it's useless info anyway
^
if its useless info, then what harm is there to show it ๐
ha yea thats fair
useless in the sense that most users won't care whether it's there or not
anyone randomly have the default discord avatar url?
huh? you cant have features in beta? what? lol
Who told ya this
I mean, if it's behind gated experimentation meaning only select people get to test it then it is obvious it's not allowed
Tbh just comply with discord it's a losing battle
Mmmm
You could try submitting again or make a ticket or smth
if your bot doesn't actually feature anything that is gated behind experiments i'd suggest reaching out in your original ticket and clarifying this with them
the more you provide them with the better
attach screenshots where applicable etc
they tried saying my bot's growth was inorganic at first, though after i explained our partnership with Medal.tv they realized their mistake and verified my bot regardless
ยฏ_(ใ)_/ยฏ
good luck resolving it
pretty happy with how that looks. but if i decide to remove the discriminator, ill have to redesign everything lol
its basically storing the latest player card attachment url that the bot sends and showing that ๐
Imagine using $ and not ยฃ
i cant help the fact there is a bigger market in $ ๐
my bot only accepts payment in $ also lol
i mean, paypal converts it for ya anyway ๐
i need to make my crappy little player card look better
not at all happy with the design ๐ฆ
maybe try .toLocaleString() on the top right cash value
other than that it looks cool
yea, idk why its not delimiting the digits properly, it should be, looking into that now
i guess .toLocaleString() is a quick fix lol
the little (i) is a tiny bit off and its driving me nuts lol
monospace font ftw โค๏ธ
haha
lmao yea its not monospace, just smaller ๐
discord.js v13
Problem: Trying to defer a slash command without reply
For Example in button it is possible to use .deferUpdate();
are there any workaround for slash commands.
you could use this to trick discord.js into thinking you sent an empty message
try {
await interaction.reply({ content: undefined });
} catch (e) {}
then edit the original interaction message using
interaction.message.edit({ embeds: [your_embed_here] }).catch(err => console.err);
you can also edit it with message content, though i chose to use an embed in the example above ^
hopefully this helps
.deferReply() i believe is a thing ๐
const wait = require('util').promisify(setTimeout);
client.on('interactionCreate', async interaction => {
if (!interaction.isCommand()) return;
if (interaction.commandName === 'ping') {
await interaction.deferReply();
await wait(4000);
await interaction.editReply('Pong!');
}
});
By the way you can just import setTimeout from timers/promise and await that instead
yes but i don't want the thinking state
EN ัะตะบัั
Hey, what should I put in the webhook url in the server page so I can send requests to my bot whenever someone votes for the server ?
You should put a URL to a server you operate.
can u give an example pls?
When a user votes for your bot, top.gg will send an HTTP request to that URL with the user info.
There are examples on the documentation.
client.topgg_webhook = topgg.WebhookManager(client).dbl_webhook("/dblwebhook", "password")
it's for a server
i did this but not sure what to put in the webhook url in the website
/root/ARCHERSBOT/node_modules/discord.js/src/rest/RequestHandler.js:349
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Invalid Form Body
parent_id: Maximum number of channels in category reached (50)
at RequestHandler.execute (/root/ARCHERSBOT/node_modules/discord.js/src/rest /RequestHandler.js:349:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/root/ARCHERSBOT/node_modules/discord.js/src/r est/RequestHandler.js:50:14)
at async GuildChannelManager.create (/root/ARCHERSBOT/node_modules/discord.j s/src/managers/GuildChannelManager.js:141:18) {
method: 'post',
path: '/guilds/457267927536631819/channels',
code: 50035,
httpStatus: 400,
requestData: {
json: {
name: 'ZOXMS',
topic: undefined,
type: 0,
nsfw: undefined,
bitrate: undefined,
user_limit: undefined,
parent_id: '732368761130188820',
position: undefined,
permission_overwrites: [
{ id: '457267927536631819', type: 0, allow: '0', deny: '1024' },
{
id: '399263715385540618',
type: 1,
allow: '101376',
deny: '0'
}
],
rate_limit_per_user: undefined,
rtc_region: undefined
},
files: []
}
}
Someone can help me with this error here. it happens when i execute any command with database when the bot is hosted in my dedicated server
you can't create more than 50 channels under a category
This error has nothing to do with your hosting / code
how to read errors pls help 
Hey guys, so i am trying to make a voting reward system with my custom bot
so whenever someone votes for the Server the bot will send a message and give them the currency we have. I have actually received help regarding this system before but my old account was hacked and lost the notes i kept about it TwT, here is what i remember
client = commands.Bot(command_prefix=prefix, intents=intents)
client.topgg_webhook = topgg.WebhookManager(client).dbl_webhook("/dblwebhook", "password")
client.loop.run_until_complete(client.topgg_webhook.run(PORT))
@client.event
async def on_dbl_vote(data):
if data["type"] == "test":
print("reveived a test vote")
else:
await client.wait_until_ready()
memberID = data["user"]
guildID = data["guild"]
guild = client.get_guild(int(guildID))
member = guild.get_member(int(memberID))
print(f"{member.name} has voted")
@client.event
async def on_dbl_test(data):
"""An event that is called whenever someone tests the webhook system for your bot on top.gg."""
print("Received a test upvote:", "\n", data, sep="")```, the thing is, i don't remember what should i put in the `Webhook URL` inside the webhook page of the server
Hello good, I need you to delete my old bot from top.gg to add another application, can someone from the staff delete it for me?
You can delete it yourself
The delete button on your bot page
Thanks
hello good I need help with a command from my bot could someone help me?
It's better you state what exactly you need help with.
So anyone who may know the answer can answer.
In a command of my bot I have to indicate the users of the black list with this function $ {blacklist.length} and I put sh! botinfo and it appears undefined I do not know why it puts that to me exactly
...
You may want to check the type of blacklist
A blacklist will usually contain a collection of user IDs.
the users I store them in megadb
yes
So if my blacklist looked like this
let blacklist = ["825789766859358249", "140862798832861184"];
Then I could use it like so:
let s = `Number of blacklisted users: ${blacklist.length}`;
let sl = `Blacklisted user IDs: ${blacklist.join(", ")}`;
Yet I don't know how you're using it exactly.
Of course, you say you're using megadb, and I've never used or heard of that.
Assuming you query the database and get the IDs, it's roughly the same process.
Thank you
const { Client, Intents, Collection } = require('discord.js');
const client = new Client({
partials: ['MESSAGE', 'CHANNEL', 'REACTION' ],
allowedMentions: { parse: ["users", "roles"] },
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_MEMBERS,
Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
Intents.FLAGS.GUILD_WEBHOOKS,
Intents.FLAGS.GUILD_INVITES,
Intents.FLAGS.GUILD_PRESENCES,
],
})```
All of the intents are enabled on hte bot too
One of them isn't valid
Which one?
ohh
It's cause I kept defining client in each command file.
That's why.
Or that lmao
Is there a way to generate a random number from 1-1000 as rn I am just putting 1-1000 in a array and yeah I have to have a lot of patience atm ๐คฃ
What you're looking for is something like this:
// Returns a random integer from 1 to 10:
Math.floor(Math.random() * 10) + 1;
Notice how the 10 and 1 control the range.
I added a live market feed for my silly drug trading bot that ive been making. Tell me that color scheme isnt amazingly suitable! i dare you! ๐
its something
lol
i wasnt keen on it at first tbh
but the more i look at it, the more i really like it ๐
its the red and green from the avatar icon, but they fade and mix into one another
looks really neat ๐
if(!db.get(`yasaklฤฑKanal_${i.guild.id}`))
{
console.log("hello")
db.set(`yasaklฤฑKanal_${i.guild.id}`, [] )
}
db.push(`yasaklฤฑKanal_${i.guild.id}`, { Kanal: ch.id } );
db.push(`yasaklฤฑKanal_${i.guild.id}`, { Kanal: ch.id } );
db.get(`yasaklฤฑKanal_${i.guild.id}.Kanal`);
is undefined
hmm, gif looks trash, but w.e, it shows the animation lol
looks way better if you open out ofdiscord for some reason 0o
yea meth is the drug of the rich ๐
tbh, i think math fks me up more than meth would ๐
crap usually has me scratching my head, debating my entire reality ๐
~ math that is, idk about meth ofc
xD
does anyone here know if ovh allows port 25 ๐ค
why wouldnt it?
fair
Why does this still show Unknown#0000 all the time even tho there is a filter?
let money = db.all().filter(data => data.ID.startsWith(`money_`)).sort((a, b) => b.data - a.data);
if (!money.length) {
let noEmbed = new Discord.MessageEmbed()
.setAuthor(message.member.displayName, message.author.displayAvatarURL())
.setColor("WHITE")
.setFooter("[] Nothing To See Here Yet!")
return message.channel.send({embeds: [noEmbed]})
};
money.length = 10;
var finalLb = "";
for (var i in money) {
if (money[i].data === null) money[i].data = 0
finalLb += `#**${money.indexOf(money[i]) + 1}. ${client.users.cache.get(money[i].ID.split('_')[1]) ? client.users.cache.get(money[i].ID.split('_')[1]).tag : "Unknown#0000"}** [๐ฒ] ${money[i].data} Coins \n`;
}; ```
first of all console.log(money[i].ID.split('_')[1]) to check if that actually gives you a valid id
second of all, the users might not be cached, in which case you have to fetch them
show your totally code what is ch.id what is i
I solved it thanks
๐
anyone else getting this error when trying to bat a bot to play a yt video to a vc?
the bot joins and sits there untill this error pops up and then it leaves
i have updated ytdl and it made no diference
this worked fine in d.js v12 but now after updating it to v13 and rewriting the code it wont play anything
this is where the error is comming from
anyone else had this issue or am i just dumb
EN ัะตะบัั
-m @tired geyser
zxc.sflove#4014 was successfully muted
So with this client.on('guildMemberAdd', async member => { let blacklistedusers = db.get(`blacklisted_${member.id}`)How would I actually see if the user is blacklisted? Like do I put if(member === blacklistedusers ...) not sure where I would put TRUE at.
if(blacklsitedusers === member || true)
``` this was my thought ๐คฃ but it's starting to make no sense.
if(blacklsitedusers.includes(member.id) === true)
Maybe that o-o
Ye
Assuming blacklistedusers contains an array of user IDs
though how you have it setup is confusing
lol trust me ik ๐คฃ
If blacklisted_<member-id> existed, that would indicate if the user is blacklisted alone.
But having a general entry like blacklisted return an array of users would suit the array of user IDs part
what did you save blacklisted_memberID as?
like show your blacklist command, or show where you use db.set to store the blacklist id
db.set('blacklisted_${member.id}', true)
then you only need if(blacklisteduser)
so if(blacklisteduser === member) {...}?
no
since db.get(blacklisted_memberid) already gets you the true if you stored it and undefined if you didnt, or false if you did store false
doing if(blacklistedusers) already does the job, because it translates to if(true) or if(false/undefined)
Ah sounds good.
what is wrong?
import * as express from 'express'
const app = express();
const router = express.Router();
app.get("/", function(req,res) {
res.send("a")
})
app.listen(3000);```
idk you tell me
Cool router
that router be doing the heavy lifting of routing
does any one know if there is any documentation (that actually works) on how to make ytdl play music to a vc using a discord bot? cuz everything i have tryed does not work
I have seen plenty of videos and tutorials of that online lol.
there is a possibility that its because its timing out since my internet is junk so is there a way to make the timeout longer?
yes but they all iether use dustube or are still on d.js v12
and i really dont want to use distube
looked for examples to copy studdy so that i can update my home made player from v12 but they all just come up with the same error of:
How can I get the server Owner's ID?
i know thats what im doing
i already had a simple player for v12
and i updated it
the bot joins the voice chat and stays there untill something times out and then it leaves
the fact that it joins and leaves fine indicates to me that its not a fault with the discord.js side of things
mmm
all up to date
i just upgraded my server
what lang
new hdd os everything so all packages are installed and uptodate (hence moving from v12
djs
bruh
that method was depreciated cuz it was inaccurate
its like guild.ownerId
in the docs.
but that doesn't work.
it says its not a function
It says owner is undefined lol
So clearly owner doesn't exist on guild anymore.
Also you can do message.guild instead of message.member.guild
Well ik, was just using what was given ๐คฃ
So I can't get the Owner's ID at all?
I believe in your ability to use 3 braincells.
ownerId should work.
It's not a function it's just a property.
I literally just said it's not a function.
remove the ()
remove the () at the end
๐
Documentation 
ALSO, when the ERROR says is not a function what should you do?
i still coulda swarn that they removed the ability to find the owner of a guild cuz i remember it from the docs
Yeah, it's now guild.fetchOwner()
also
anyone know why the bot says im not in the vc
unless i restart it whilst im still in it?
Do u have guild_presences intent?
so how do I set up a bot on repl.it?
I've written the code but now I'm getting this error
welcome to the club
SyntaxError: Unexpected token 'const'
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1031:15)
at Module._compile (node:internal/modules/cjs/loader:1065:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Sonic-Symphony@1.0.0 start: node .
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Sonic-Symphony@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-12-20T01_08_30_597Z-debug.log
exit status 1
npm const dotenv = require('dotenv');npm
I remove const and i get an error.
I remove npm and I get an error
I remove dotenv and I get an error
bruh
lol
why did you put npm there
bruh why have you just writen npm everywhere
npm isnt anything to do with the js code
someone told me to do that
anyways I removed it and now I'm getting a ton of errors
what errors
A bunch of logging in Green and then this
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Sonic-Symphony@1.0.0 start: node .
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Sonic-Symphony@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-12-20T01_10_59_989Z-debug.log
exit status 1

Might be worth to learn how to use the coding language you wanna use before using raping it

i mean i learnt js just by doing random discord bot things but damn its a rocky road
yeah repl isnt that fun
I had to go through a whole seperate process to get discord.js to run
I wonder how that platform can cause issues with code you wrote or more likely you didnโt write
"wrote"
what do you mean "get discord.js to run"
it requires node 16 while repl by defualt runs on node 14
ah yeah ok
so im gonna say it but if you did coppy code it will most likely be for discord.js v12 and discord.js v13 is what you are running
and thats probably where alot of errors are comming from
Well I followed a tutorial so its probably why
yeah thats why
i would suggest looking at the d.js v13 docs and ripping the code off that first
Thereโs a project you can copy on the platform to use node v16
well not just rip the code off but you know what i mean
ok
Does anyone have any system for checking the time of users' calls? I would like to study a little about this to make a command of my own but I can't find any on the net
inorder to do that you would need to have a database and all that
there are ways of doing it but its hard (but then databases scare me)
Database are scary, wut?
God bless their existence
also befor i go to sleep any one know how to play music on a bot cuz i have found so far 7 different ways of doing it both from the docs github and the likes and none of them work
the only databace i ever got to work consisted of 300 json files
const dotenv = require('dotenv')
const pathย = require('path');
const { Client }ย = require('discord.js');
const { SlashCreator, GatewayServer } = require('slash-create');
const { Player } = require('discord-player');
const { registerPlayerEvents }ย = require('./events');
const { generateDocs } = require('./docs');
dotenv.config();
const client = new Client({
intents: [
'GUILDS',
'GUILD_VOICE_STATES'
]
});
client.player = new Player(client);
registerPlayerEvents(client.player);
const creator = new SlashCreator({
applicationID: process.env.DISCORD_CLIENT_ID,
token: process.env.DISCORD_CLIENT_TOKEN,
});
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
console.log('Generating docs...');
generateDocs(creator.commands);
});
creator
.withServer(
new GatewayServer(
(handler) => client.ws.on('INTERACTION_CREATE', handler)
)
)
.registerCommandsIn(path.join(__dirname, 'commands'));
if (process.env.DISCORD_GUILD_ID) creator.syncCommandsIn(process.env.DISCORD_GUILD_ID);
else creator.syncCommands();
client.login(process.env.DISCORD_CLIENT_TOKEN);
module.exports.client = client;
module.exports.creator = creator;
Is everything in this ok?
damn your going for slash commands? very brave of you

I was using python. Then discord.py went bye-bye. Now I must use slash commands with node.
bruh

Log connection and you will notice your issue
you can still use python
i still do
i use both pycord and discord.py
pycord is identical and a maintained fork of d.py
lol
Only thing is idk how to do music commands on that but I will learn
i do with discord.py
everything worked fine on d.js v12 and then v13 came out and everything went tits up
99% of music bot examples are written for v12
send
i know and its bloody annoying
i cant even get an mp3 to play
https://github.com/bchurton/Frosty ignore the rest of the commands and look at play
its really simple
but it works
ok
just about
you would need to add that
imo, if you depend on examples to make a music bot you shouldn't make one.
its a complex subject, and odds are once you get a single error youll be stuck and cant fix it.
thats fine
also once you start making more complex/large music bots you will start to have all new issues.
look at the ytdl shit and then from there make it play from that stream
ayyy I don't need to install ffmegg
(just a side note, what is your code @wooden ember )
i'm looking at a kimsufi dedicated server (OVH), anyone used them before?
$7.99 dedicated server 
f
i mean i just want a play, skip, and stop music bot and i orriginally used an example offa github but im trying to update it to v13 and its not going well
one sec
I dont see those in stock ๐
cheapest I see is $21
at the moment this is all there is since i can get the bot to join but just not play anything the executefunction runs first and then that runs the hotdog function
Dedicated server from โฌ8.00 excl. VAT/month. Intel processor - 100 Mbps bandwidth - 500 GB to 1 TB hard disk - 2 to 16 GB RAM
Doubt itโs a dedicated server
I would guess dedicated reasources
lol
bruh i just host my crap on a free dell optiplex i got
i just need something with high ssd storage
I would never home host anymore
has a dual core athlon from 2006
and costs my 3 quid a year to keep up
rpi is unreliable though
Rent a cheap cloud server then
Since it depends on your ISP, Power, etc
atm i'm using a 512gb hdd vps for ยฃ3.50 a month
i mean last year i got 250 days of uninterrupted run time on my server
but this year not so good
might be cheaper to use bucket storage, rather than a vps for storage
i just like self hosting stuff
well what i have is an express.js server on it which gets the file from a post requests, saves to a static folder and then uploads the relevant details to a database
even though its a pain in the ass some times
then you can then access the file quickly
works for me
and upload is way quicker than using a different service like cloudflare images etc
just upload the file to discord and use that as storage
Why shouldnโt you?
I have moved a lot of my infrastructure back home
well the lightning strike for one
i expect their internet is crap or somthing or they just dont like hardware
or that lol
but then thats an act of god
plus cheaper to get remote backups while hosting third party
i mean true the only thing i would use a vps for is backups
plus, I already pay for backup services to limit downtime
but then you can just use cloud storage and use a home server to upload it so you dont even need a vps for that
just google drive or somthing
@spark flint
whats this stuff for?
dbuser = "db username"
dbpass = "db password"
dbname = "db name"
dbhost = "db host"
plus plus, generally speaking cheaper in the long run(excluding using old hardware, but then reliability issues)
for part of the bot
not relevant to music
It stores the snowball and snowflake count in the database
ooh
and connects using those details
its a database
yeah
makes sense
reliability issues? tell that to my dads 20 year old voip server haha (i know its a mirical that thing still works but eh)
๐
same
lol
Good HDDs, depending on the IO, last like forever
tbh, I dont doubt it. but, lets say that hardware fails. how quickly can you get new hardware in and running?
Currently, if my vps fails completely it can be restored within 10 minutes, if it happens at night maybe a few hours because I cannot directly request it.
The actual node will be repaired within the day, every time.
Depends on the disk size
If a HDD fails in my home server I put a new one into the hot plug slot and restore the RAID
do you have a backup cpu? ram? motherboard? psu?
are you around to fix it if need be 24/7? ๐
But you better donโt go for comparing consumer hardware with actual server hardware
Funny things is, yes I have
had to replace one of the card on the pci cards
run your server on a 250kg 2gb HDD from the 80s
But a CPU or MB doesnโt actually die without any external impact
i mean they can the caps can go for one
you're very much an exception then, 99% of home hosters very likely wont be able to bring their hardware back up after a failure, without significant downtime.

well, factory issues can happen
(including myself)
i mean it depends if you are into the hobby of hosing stuff the chances are you will have bachup hardware
Because 99% of them have no clue what they do or own shit consumer hardware

lol
Friend of mine spent around doing 15 grand on building a big home server to host his and his parents stuff
and then it goes back to cost.
its not cheap to have 2x of everything for backup hardware.
i mean my server costs 3 quid a year to run
and that runs mc and some discord bots
and a vps with the same power would cost 5 quid a month
Yes I know better than others..
Bought two 1080 Ti a few years ago from completely different sellers.
Both came with the same hardware issue 
the pc its self could be bought of ebay for 10-15 quid so in 3 months you would have payed it off already
reference circuit diagrams go BRRRRRRRRRR
Idk how you're spending 3 grand a year to run a home server
Power alone mine cost nothing
whos spending 3 grand?
๐ quid = grand now
lol
Thing is professional hosting at home is nonsense
Regarding infrastructure, bandwidth and redundancy as well as reliability hosting providers are always the right choice
if you want relyability get a vps
if you want to save money self host it
pretty much that simple yeah
Yeah basic hosting sites cost too much for the little they give you
honestly most times a vps will be cheaper than self hosting
So I canceled them and made my own
Lmao
i mean for larger scale thing sure but small things like mc servers and discord bots not really
5 quid a month just to host a discord bot thats mad
actually really cheap imo, unless its for personal use.
yeah thats what i mean
public hosting anything for 5 quid is super cheap imo
If you want reliability you never go with virtual instance but your own dedicated servers
yeah if its public sure but is that bot really gonna run on a 5 quid vps?
i pay ยฃ1.50 a month for mine 
what are you renting a potato?
how much are you paying for 24/7 computer electricity + quality internet per month?
unless you're running something stupid cheap and have stupid cheap internet, a vps will always be cheaper
i mean i already have internet to use for other things and it costs 3 quid to run my server 24/7
and you have to have internet to even use a vps anyway
have you done the math on the energy costs?
infact yes i forgot 3 quid is to run my old raspberry pi I forgot it costs about 5 quid for my main server
how tf can i align two forms next to each other
Steal the electricity of your neighbors and use public WiFi like everyone does 
i did calculate it a while ago
so it ends up being pretty much the same
xD
5 quid a year VS 5 quid a month
i used to steal neighbours wifis
not realy the same
You devil
a year? you said a month before?
thats pretty cheap
anyway i need to sleep i been talkin about VPS' for over an hour now and its 2am
lol 2am vibes
but well, its low power stuff like rpi
its a free dell optiplex i got of a mate
Youโre living in the past Sir
it was made in 2006 lol
Oh fuck the 20th already?
out of curiosity what are the specs?
uuh athlon X2 2.22GHZ dual core
4GB ram and a random 80 gig hdd I found
Actually my home server will pay off itself in a few month compared to the fact I spent 120 bucks / month a the dedicated one
i have just bought one of those sun cache pcie card to use so that will drive the power consumption up a bit
and you said that machine costs 5 bucks a year in power, and the rpi costed 3 bucks a year?
sadly the sun f20 isnt bootable by defalt but I have an hdd in there that runs proxmox and then i set the 4 internal sas ssds to a zfs storage thing
yeah the rpi calculation was done based on a 2A current draw 24/7 and the server has a 3 amp fuze in it
and well it did
honestly that makes no sense
i mean it is asuming that the pi was at 100% all the time
and my server is mostly idle
a full rpi uses 3-5 watts of power, while an athlon x2 cpu alone has a TDP of 45w, a 3.5 inch HDD alone uses ~20 watts, ram uses 3-4 watts per module...
Regarding the fact the system probably eats like 100W constantly I wonder if you your electricity is for free then
exactly
Oh RaspberryPi ahaโฆ I thought PC
i understand an RPI using 3-5 bucks a year in power, since it consumes 3-5 watts, but that system easily consumes 20x more
athlon X2 at 2ghz is like 85w
(up to)
i cant remember how i did the calculation tbh but i know the pi uses more like 15 w of power
at 2.22ghz its going to probably be more than that.
true
yeah athlon x2 goes from 22w to 95w depending on model
its the first athlon dual core i think cuz its really not powerfull
then it should be 45w
My xeons both have up to 95W TDP but actually take around the half
Under normal load ofc
average cpu power tends to be around 2/3 of their tdps
Does anyone know why my help command doesn't work?
command
@client.command()
async def help(ctx):
embed = discord.Embed(title=":snowflake: Sonic Commands :snowflake:", description="Version: v1.0.1")
embed.add_field(name=">howlong", value="NEW! Shows you how long until Christmas day!")
embed.add_field(name=">play", value="Play Audio, YouTube support coming very soon!")
embed.add_field(name=">np", value="See whats playing.")
await ctx.send(embed=embed)
error:
File "main.py", line 21, in <module>
async def help(ctx):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 1263, in decorator
self.add_command(result)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 1149, in add_command
raise CommandRegistrationError(command.name)
discord.ext.commands.errors.CommandRegistrationError: The command help is already an existing command or alias.
but yeah it can go much lower under lower loads
Anyways whatever you calculate a company like data centers always get a better price for electricity than you can get, means in terms of costs hosting at home only saves you money when we speak about expensive systems you would have to pay lots of cash per money to the provider
you didnt post the error lol, you posted the code twice
Lol
there
The command help is already an existing command or alias.
afaik discord.py has a built-in help command. you have to remove it first to make your own
bot.remove_command('help')
something like that
oh
yes what big bunmas said
client.remove_command("help")
This correct?
Yep
everytime someone says "tysm" i think about TSM (the esports team)
ok so after some maths
lets asume my server is constantly at 50% usage where the cpu uses 20w and the rest of the server uses another 20w totalling 40 watts
there are 8760 hours in a year
8760x40= 350400
350400Wh to KWh is 350.4
the price of power in the uk atm is 17.2p/KWh (damn it was 10p like 4 years ago)
350.4x17.2 = 6026
and thats a grand total of 60 quid a year
hot damn thats alot of money
that makes more sense yes
RPIs have ridiculously low power usage compared to regular servers
you can easily expect the difference to be 10-20x or more
but still that like exactly the same price as a ยฃ5/M vps so eh
just looking at hetzner,
if you get a CX21, thats 2 cores, 4gb of ram on a modern cpu.
Not if you run Pi OS on your own hardware 
youll get much much more performance on a vps
wat
wat wat?
wat watt

ohm
i mean i host 3 bots and an mc server(sometimes) i dont really need performance
