#development
1 messages · Page 1687 of 1
ohh lol ok
so im setting permissions for a channel
and i get this
UnhandledPromiseRejectionWarning: RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number.
the permissions im doing are
allow: ['VIEW_CHANNEL','MANAGE_CHANNEL','MANAGE_PERMISSIONS','CREATE_INVITE','SEND_MESSAGES','EMBED_LINKS','ATTACH_FILES','ADD_REACTIONS','MANAGE_MESSAGES','READ_MESSAGE_HISTORY']
well you got at least one error here
MANAGE_CHANNELS
The correct flags are listed here https://discord.js.org/#/docs/main/stable/class/Permissions?scrollTo=s-FLAGS
ah
i just thought cuz it was a specific channel and not a category
was just doing these
compare your list with the actual flags listed on in the docs.
ik im doin dat
best to just check role permissions as it says channels
but yea docs best to see the permissions
does anybody know how to get values from mongo in descending order using python
do you mean giving your bot admin perms?
.find().sort({"somekey": -1})
Actually hold on
.sort("yourkey", -1)
if(!tickets) tickets = await message.guild.channels.create('tickets', { type: 'CATEGORY' });``` anyone know why it cant find the channel after its been created? it creates a new category every time the command is executed
its probably some dumb error
Hello, can you help me to send an image in an embed with a slash command please ( Python )
alright so I have 2 mongodb collections
videos
{
"_id": "uuid-here"
...
}
watched_videos
{
"user_id": "uuid-here",
"video_id": "uuid-here"
}
How would I get a random video (got random, just need check) and make sure the video isnt watched?
I dont think its meant to be capital CATEGORY
try lowercase?
at c.type
nice
thanks that helped alot
Copying the example from https://docs.top.gg/libraries/python/ & using my own token, the server counter is being updated but the online status is permanently offline even with it being online 
known thing that happens
team is trying to find a way to show the status of the bot
nothing to do with the lib
bots use to show their status on the website fine whenever they were here
but due to discords 50 bot limit they were all kicked
iirc that was not a real thing
since I’m pretty sure my bot is in a server with like 10k bots
They've been talking about it for a while and the reality is there's currently a 50 integration limit so bots with slash commands
It wouldn't be possible to have more than 50 bots with slash commands here, is what I mean
Yeah i doubt they will ever add a limit to actual bots
which is already a solid limitation
Either way having bots here was crap, just a spamfest in some channels and constant DMs and invite messages and stuff
better off not having them
I like how the bots are added now, I hate mudae and Dank Memer tho it sucks
So now my question is; how do some bots currently have their status shown?
Bots that post get put as online iirc
Posting their server count?
yes
My bots currently doing that & is marked as offline
Then idk
ahhh i figured that but now it says this error:
Command raised an exception: AttributeError: 'coroutine' object has no attribute 'sort'
here is my code:
async def leaderboard_invites(self, ctx):
rankings = await self.bot.invites.find({"guild_id": ctx.guild.id}).sort("invites", -1)
i = 1
embed = discord.embed(title='Invite Leaderboard', timestamp=datetime.now())
for x in rankings:
try:
temp = ctx.guild.get_member(x["inviter_id"])
real = x["invites"]
normal = x["normal"]
fake = x["fake"]
left = x["left"]
embed.add_field(name=f'``{i}.`` <@{x["inviter_id"]}>: **{real}** Invites (**{normal}** Normal, **{left}** Leaves, **{fake}** Fakes)\n')
i += 1
except:
if i == 11:
break
print(f'``{i}.`` <@{x["inviter_id"]}>: **{real}** Invites (**{normal}** Normal, **{left}** Leaves, **{fake}** Fakes))')
await ctx.channel.send(embed=embed)```
Idk py but I assume you didn’t await something
idk what else i should've awaited
Idk py

Give me a moment to do some testing, I think you need to .flatten() the result before the .sort
hm ok
rankings = await self.bot.invites.find({"guild_id": ctx.guild.id}).flatten().sort("invites", -1) this might work
lemme try it
I get this Error [VOICE_CONNECTION_TIMEOUT]: Connection not established within 15 seconds. while trying to have my bot connect the voice channel, any idea what causes this?
AttributeError: 'coroutine' object has no attribute 'flatten'
same error
but with flatten

Can you just print the result of await self.bot.invites.find({"guild_id": ctx.guild.id})
ok
try
(await self.bot.invites.find({"guild_id": ctx.guild.id})).sort("invites", -1)
ahhh it shows up as None
so it didnt find the data
which doesnt allow it to do the rest of it

statuses are deprecated, it shows now but they're removed in the new design
sadge
there'll be a different system for submitting bot statuses later
probably in api v1 which will happen after summer
thats what i did i think...
gotcha
it's got an extra pair of brackets
thats a bit better... it doesnt explain why guild_id is none though
if i have the data
right there
ah ok i fixed it, but now there is no data to sort from

Did you load the env?
i did
how
ok then do .prefix as he said ig
Then perhaps the path is expecting exact path
I’m not too familiar with .env but you might need to surround the ! In quotes
Show your file structure
anyone happen to have a suggestion on the most accurate way to get # total users in (all) guilds?
what library are you using?
JDA
Ah then I don't know
@near plover what’s your definition of the best method? Do you care about duplicates? Do you want to avoid caching all users?
If you don’t care about duplicates, you can iterate over all guilds (JDA.getGuilds()) and add up their member count (Guild.getMemberCount()).
If you do, you’ll need to cache all users and get the total (JDA.getUsers().length()). Note I haven’t tested these.
so i made a discord bot online with plain client side js and im rlly proud of myself because i finally did something that isnt completely useless
its mostly useless
I assume the cache would be most accurate though or do both methods only count at start-up?
It depends on how JDA implements updates. I'd assume it tries to be up-to-date via the gateway.
The member count method is usually chosen since it's more accurate in most cases.
@quartz kindle I have a question about gc and shit, if I make like 100 EventEmitters and stop using them, will they be gc'ed?
not as long as you have references that can be used to reach the event emitters
so say I have a command that creates a new eventemitter and after about 15 seconds it stops emitting any events, it will be gc'ed, or no because it still has listeners technically
how is the runtime supposed to know that the event emitter isn't going to emit events later
is there a way for me to specifically say that, or would I have to remove the events command side after the timeout?
let object = { a: 1, b: 2 }
let alias = object;
alias.c = 3;
// other stuff
object = null;
// object STILL exists because there is an alias that still references it
as opposed to
let object = { a: 1, b: 2 }
object.c = 3;
// other stuff
// object exists
object = null;
// object is now garbage because there's no possible way to reach it
and by object here I don't mean the variable name object I mean the memory allocated for { a: 1, b: 2 }
so if I want to get rid of the emitter, I would need to set the reference to null or something similar
you need to reassign the reference to make sure it can't be reached. This happens automatically for things like local variables in functions because they all go out of scope
https://javascript.info/garbage-collection is a good read
will read that ty
for an instance of a class, could I just do this = null technically?
well you can't reassign this can you
no a class cannot be responsible for its own garbage collection
ok
nor should you do it even if it's possible (like in C++)
Thats one downside, it doesnt, i can tell u what i did to implement my own
yes, what did you do?
im attempting it with a class extending an EventEmitter
but the issue is that idk if it will be gc'ed
@opal plank
i did something more crude
how to check if a user has a specific role in a specific server by ID in JS? (i.e. "bot mod" role in a support server)
Define the guild/fetch it, fetch the member by id from the guild and check their roles
how do i get a guild by ID? client.guild.cache.get?
client.guilds
but yes
Then provide the Id via string
await ascGuild.members.fetch() //821127514969342002 Role named Developer
const developers = ascGuild.members.cache.filter(dev => dev.roles.cache.has("821127514969342002")).map(dev => dev.user)```
client.guilds.cache.get("id").members.get("userid").roles.get("roleid")
ah
got it, thanks!
This gets a guild then fetches the members then filters through them to find one with the specific role id then maps them
all good
All good happy to help
is .get not synchronous?
got it
well that's not valid js I guess
what's noderequire
also what's the actual error you failed to paste here
under the ^ ? that's pretty important
ReferenceError: noderequire is not defined
at Object.<anonymous> (F:\DISCORD\bots\REAL\index.js:1:1)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47
alright great, so that's definitely not defined
where did you gather this from? a tutorial ? what?
yes tutorial
so that tutorial must have defined that line somewhere, no?
you didn't just pull it out of your hat, did you?
can you explain i can i define
since noderequire isn't part of nodejs it must be an external module or something that the person is using. pay attention to what they're doing, they're probably installing it or something
I don't konw what it's supposed to be
so I can't tell you how to define it
the tutorial should be doing that
basically its calling to .env file
yeah I can sort of guess
from the context
But what does the tutorial say it is or how it works?
in node .js how can i call .env file
Oh so we're going with "fuck that tutorial" then? Alright that works. dotenv is the module to do that.
@scenic kelp https://www.desmos.com/calculator/ndatgrdkgk
@crimson vapor lemme know if my snippet gets confusing, but it should be very copy-pastable
its basically => start reaction collector => reactionAdd event listener => if reaction message.id has an entry in cache => run its function
Is there a webhook to trigger when the bot is invited for a guild ?
a webhook? no
an event? yes
right now you can't, it needs to be approved first
how to make instagram commands?
Does Instagram even have a public API?
probably not
fuck whats up with instagram recently?
i recommended someone to make an instagram botg like 3 months ago
and now, every now and again i see someone mentioning it
comment bots
everyone is wilding for them now because they can promote their page
that probably isnt the motive behind the question above though
Hey could I get some help with something? I'm trying to make a channel in my discord server image-only, and, I'm not sure how to tell if a message has been edited after being sent. basically if you send anything other than an uncaptioned image it deletes it, but, people are still able to edit their messages and caption them. (Discord.js)
Message edit event?
If a message is edited, its edits property would have more than one elements
You can also just use messageUpdate event
would you mind helping me like write that as code?
thank you
Wait would you mind helping me with this? I edited my message in the channel and it still doesn't work. Would you mind helping me with like whats wrong?
client.on('messageUpdate', (newMessage) => {
if (message.content !== "" || newMessage.content !== "") { // Message content "" just means it is an uncaptioned image.
if (message.channel.id === "828097106400641065") {
message.delete()
message.channel.send(`Haha lmao <@${message.author.id}> just tried to send something in <#${message.channel.id}> how stupid. Don\'t they know this is an image only channel? What an idiot.`).then((msg) => {
setTimeout(function() {
msg.delete();
}, 12000)
})
}
}
})
oh okay i deleted that part, didn't know i needed it
and I don't think you have message defined
I do
Where?
i'm not exactly sure how to do that really
client.on()
client.on() haha
you out it outside message's client.on(), doesn't matter where
Just needs to be outside its callback function
that event is triggered when a message is edited so it should be separated from the message event
so wait do i change newmessage.content to oldmessage.content?
you should just check if newMesaage.content exists
if (newMessage.content) deleteMessage()
like that
k
An empty string would be falsey
but if they edit their message, it'll be truthy and pass
Wait would you mind if I resend my code? Idk if i did something wrong but it doesn't work still
Sure
client.on('messageUpdate', (oldMessage, newMessage) => {
if (message.content !== "" || newMessage.content !== "") { // Message content "" just means it is an uncaptioned image.
if (message.channel.id === "828097106400641065") {
if (newMessage.content) deleteMessage()
message.channel.send(`Haha lmao <@${message.author.id}> just tried to send something in <#${message.channel.id}> how stupid. Don\'t they know this is an image only channel? What an idiot.`).then((msg) => {
setTimeout(function() {
msg.delete();
}, 12000)
})
}
}
})
You should replace your message variables
wdym
oh so do if oldMessage.content !== ""
hmm, new message perhaps
Wait
Old should always be empty
a new client.on message?
you can just use if (newMessage.content)
newMessage
okay
you used message.content but message is never defined
oh ok
it's either oldMessage or newMessage
so do client.on('message', async newMessage => {...
old message would be unedited , right?
messageUpdate, not message
Yeah
alright
For your timeout delete, you can also use a shorter syntax which is msg.delete({ timeout: 12000 }) instead of using setTimeout
Where did you put the event
right before my login, right after the complete end of the client on message
Can you show your new code
yep
client.on('messageUpdate', (oldMessage, newMessage) => {
if (message.content !== "" || newMessage.content !== "") { // Message content "" just means it is an uncaptioned image.
if (message.channel.id === "828097106400641065") {
if (newMessage.content !== "") {
newMessage.delete()
}
message.channel.send(`Haha lmao <@${message.author.id}> just tried to send something in <#${message.channel.id}> how stupid. Don\'t they know this is an image only channel? What an idiot.`).then((msg) => {
setTimeout(function() {
msg.delete();
}, 12000)
})
}
}
})
You're still using message
actually you can remove that
remove what
it's already handled by newMessage.content !== ""
wait but remove what
the message.content !== "" || ...
the channel id comparison?
wait im confused
that should be the top
oh ok
here is my new code
client.on('messageUpdate', (oldMessage, newMessage) => {
if (oldMessage.channel.id === "828097106400641065") {
if (oldMessage.content !== "") { // Message content "" just means it is an uncaptioned image.
if (newMessage.content !== "") {
newMessage.delete()
}
newMessage.channel.send(`Haha lmao <@${oldMessage.author.id}> just tried to send something in <#${oldMessage.channel.id}> how stupid. Don\'t they know this is an image only channel? What an idiot.`).then((msg) => {
setTimeout(function() {
msg.delete();
}, 12000)
})
}
}
})
why oldMessage.content !== ""?
i dont have message anymore
yeah
okay
yeah remove it ig
so i just need to make something inside the message event to do the same thing but only initially?
yeah, check if the message content isn't empty
in the first message event tho right
Yuh
k
and messageUpdate event will handle the edits
Check your code
client.on('messageUpdate', (oldMessage, newMessage) => {
if (newMessage.channel.id === "828097106400641065") {
// Message content "" just means it is an uncaptioned image.
if (newMessage.content !== "") {
newMessage.delete()
}
newMessage.channel.send(`Haha lmao <@${newMessage.author.id}> just tried to send something in <#${newMessage.channel.id}> how stupid. Don\'t they know this is an image only channel? What an idiot.`).then((msg) => {
setTimeout(function() {
msg.delete();
}, 12000)
})
}
})
I'm not sure what's wrong
does it log anything in the console
like you mean an error?
Yes
did you edit an old message
Alright
thank you lol
it worked
then i just gotta add the original code in the message event right
to prevent it from happening in the first place
Just a simple if (message.channel.id === "channel id" && message.content) message.delete()
You should also optimize your messageUpdate event code
JavaScript
How do I make my embed like these
Like what?
somehow the console log is like this after sending the request
undefined
4
it should only be 4 but why is there an undefined?
Maybe you logged something else beforehand?
Like to be inline
The empty line?
it does not log anything besides the "4" that it gets from the request
Like
Embed Name
Value
Value
Value
Value
Is the addblankField
Yes
Guess reading docs does help
Request is so old and deprecated, you should use a library like node-fetch. It supports promises too so there won't be callback hell
Oh okay 😄 thanks ^^
That method is removed in v12, use embed.addField("\u200b", "\u200b")
const number = await fetch("domain/script.php").then(res => res.text()); // 4```
@pale vessel rate the code bro ```js
worker.awaitMessage = (ctx, filter, timeout) => {
return new Promise((resolve, reject) => {
const func = (m) => {
if (!filter(m)) return
resolve(m)
ctx.worker.off('MESSAGE_CREATE', func)
}
ctx.worker.on('MESSAGE_CREATE', func)
setTimeout(() => {
ctx.worker.off('MESSAGE_CREATE', func)
reject(new Error('Timeout Exceeded'))
}, timeout)
})
}```
thank you!
Add client.incrementMaxListenerCount (I forgot what that's actually called, read docs) and decrement it after done so that it won't error in case of multiple awaitMessage being called at the same time
also ```js
worker.awaitMessage = () => new Promise(() => {
});```
no
yes
excuses smh
wdym?
I'm assuming the empty lines between the fields
\u200b i think was an empty line
ah, idk how to do that, i just do .addField("_ _", "_ _", false);
I think you can do that in an already existing field with \u200b at the end
atleast thats the way i do it 😄
hmm
how do you have a custom url for the share ex?
that too works also *** ***
@delicate zephyr's pyrocdn
Ye
he got a gf
Indeed

there is image hoster called pays.host which allows that
but it is invite only
idk why
can you invite me?
I just made one with an easy to use interface ¯_(ツ)_/¯
dont lie
shush
i have no invite left atm xD sry
interface needs lots of work still
ehhhhhhhhhhhhhh
Yeah, how do I change my password
if i have one left over i give it to you @river panther
took me an hour to set up fucking ssl
change?
Yes
themk
Since I added cloudflare support you dont need to anymore
unless you use full strict
it took an hour to figure out how to enable cf support
How do I change my passwd
don't
Why
you can't
Well yeah
does Collection also supports Set?
i am clicking on register now but nothing happen
Lol, I tried to find that! 😅
cause you're already logged in
soon™️
yes i figured it out
I'll be adding password resets later
is that website maded by you?
why would he not
because lastpass is trash
@delicate zephyr
since he had a paid subscription
1Password is 100% better
but whatever it's unrelated
I might use 1Password if I can figure out multi devices
I cba to switch at this point
yea
it should be easy
I write it off as a business expense anyway
export and import
If it works it's fine ig
yea
ye
password.txt moment @pale vessel
yea
wowowowowowowowowowowowowowowowowow, can i get the source code?
ah damn
and tonkku uses 1password too iirc
he does
what do now?
yea I remember him mentioning that
sm0l.thegreatandthefailure
You missed the point of how that works
sm0l.thegreatfailure
left = domain name (google.com example)
right = subdomain
just go for sm0l.pyrocdn.com
ye, so thegreat is the domain and sm0l is the sub
short and simple
@river panther i like this subdomain for my screenshots xD https://i-am-sure-that.anime-thighs-are-the.best/
breh
@river panther for example https://img.pyrocdn.com/1cDDw8OI
ah
i got to know that, discord.js-commando is built in typescript, but why can't I find source code on github in ts?
There's only js files.
@delicate zephyr https://-.pyrocdn.com is valid according to your site
Ye ik
it shouldn't be ts
I will fix it million
ok
I have other shit going on atm
Shiro is a bigger prio atm
I understand
development more like pyrocdn-supoort
POG
One message removed from a suspended account.
gamer
gamer?
One message removed from a suspended account.
gaming
then what?
Is that compiled version of ts files
One message removed from a suspended account.
LOL
there should be .d.ts but no .ts files
function_1 moment
I don't think you're supposed to commit dist
do you all do that
just create a script
only for heroku
hmm, but there's pre build script where you can use tsc
does heroku compile ts files?
how
somehow im kinda dumb there I get console.log promise<pending> but it shouldnt be because the .then is there or am i missing something
if there, is .d.ts, then y they use jsdocs?
like js "scripts": { "pre": "tsc" } in package.json
nt sure if it was called pre or pre-build
could be something else
prestart?
I haven't used heroku after I got a VPS
probably, you can try it out
just make sure typescript is installed
are you missing the await
eh what do you mean with "missing the await"
do you have number = await or number =
thanks for reminding me I need to add highlight.js to pyro

no no it is const number = await ...
is the scope async
the function also is async
its pog
cringe
Again
use ejs
reeeeee
can you show the function
mans is gonna do it server side isnt he
Show where you're running that function
You need to await that
ahhh
ahh okay
top level await 
Nah, I just have a better idea for how I wanna implement it
I also wanna have the ability to add more features to the paid plans
so
ahh its finally working
ok pog
hi
hi
Is this correct
client.user.setStatus("STREAMING")```?
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
What does webhook_path mean here?
im not sure
Refer to https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_is_a_URL#path_to_resource
With Hypertext and HTTP, URL is one of the key concepts of the Web. It is the mechanism used by browsers to retrieve any published resource on the web.
how would you be able to know if a message sent is the first one in the channel? in discord.js
https://i-am-sure-that.anime-thighs-are-the.best/ Can somebody help me figuring out why the cosole log is Entries: 0 it should be 6
can this be caused because it is in module.exports and something is messing with it?
console.log(result); is returning a 6
no
Could anyone assist me with adding Pterodactyl Panel commnads to my bot? I do not understand it, or just some pointers.
what's that?
Pterodactyl Panel is a hosting thing, it can host anything from minecraft servers, to rust, to discord bots.
i do not know
what did you want to do? you probably have to make yourself an API integration
There already is an API integration
i havent used the panel in a few years, but if there is one where is the issue?
Aws-selfhosting
i use a Dedicated Root
Pick a host that fits your needs
the docs are actually quite decent, where are your issues with the integration
My issue is it calls for like the panel panel its self when I dont own that, I just have access to my specific server
yea the api is not really designed for this usage i would say
they expect that you have the Panel hosted by yourself
I use azure lol
microsoft azure gang
How so?
I have an API key to my account
you need to know your server id
nice
I have github student and they let you use azure with a 100$ credit and no credit card needed to sign up
which is very nice for my case
I know that/have it
https://pterodactyl.file.properties/api/client/servers/<yourexternalserverid>/resources this is how you get the usage of your "server"
should look like this
and respond with the stuff below
Oh shoot, im in py, thanks for helping tho, very much appreciated
this uses curl in a linux terminal
lool
you can use it in pretty much every language that allows http requests
My server must be weird bc its ID is crazy long, almost like a bot token
you just have to send the headers
They changed
.addblankField()
To~
.addField("\u200b", "\u200b")
for what?
github is not really an IDE its more an Code Share / Versioning platform
glitch is for hosting websites, but i think they got an build in IDE
most competent people here use a proper IDE like Visual Studio Code
Same
Visual Studio is an IDE
Visual Studio Code is like an advanced text editor with some extensions to make things easier. Like Notepad++ but better, or Atom.
it got deprecated over a year ago when V11 got deprectated lol
Now I have to remember numbers
If I remember correctly, VSC was actually based on Atom.
:dab:
Improvising without nitro lol
i wonder how many people cry now bcs theyre bots doesnt boot anymore bcs V11 is now dead dead
Probably not a lot if they understand what they're doing
there where already 3 or so yesterday
I still dont know how to host my 24/7 I self host lol
Interesting
i self host my bot too and its 24/7
I just host mine on my GalaxyGate VPS
Same but I'm tired of self hosting
why? just get a VPS
how can i make it that when a user triggers a command the bot waits for a promise to be resolved so that the promise can assign a value to a variable
make your command async and await
If you need a host I highly suggest GalaxyGate. There are guides available that show you how to host on Linux servers. I recommend Ubuntu Server as your OS.
const user = await
I think
Use await before calling the function that returns the promise.
(Assuming you use JavaScript)
ive started with Digitalocean, but they got at some point to expensive for what you get, now i have a dedicated root
okay thanks
yw
I currently i have this in my bot.py in the on_ready, is it possible to put it in a cog?
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="over you"), status=discord.Status.dnd)```
When your phone is at 10 % but you a coder
Const phone = battery = 100%
/android.js
Lol
exept you get a syntax error
I am giving up on the await thing I just can't get it to work...
https://i-am-sure-that.anime-thighs-are-the.best/
How in the world can I get it to work that the promise will assign the value to a variable so that I can use the variable later in the embed I spend like 2 hours now trying to fix it but I just can't
make your execute run async
you.... return the value of the promise?
like literally my brain is fried
then rest and come back tomorrow
Put async next to execute
It'll become an asynchronous function
More recent additions to the JavaScript language are async functions and the await keyword, part of the so-called ECMAScript 2017 JavaScript edition (see ECMAScript Next support in Mozilla). These features basically act as syntactic sugar on top of promises, making asynchronous code easier to write and to read afterwards. They make async code lo...
read this when your brain isnt fried
Then you can use await to make Promises return their actual value before doing anything with them
Btw how do I get my bot to randomly mention a user
lmao can't believe how they fix the issue
the fuck is that? discord.js?
xD
and i've been using it for a couple days to
reject discord.js, come to detritus.js
Reject managed libs, make threaded workers yourself with modular libraries
is it possible to use discordjs in deno? It's written in tahpscrept and uses es6 imports so
deno doesnt have support for require
use detritus instead which is ts already
and a whole lot of node only apis
Just stick to commonjs flavor tbh
or manually change build target
then create your own libs to replace node libs :)
some node libs are exported to npm
@opal plank @untold token I fixed it in another way... I don't know if it is a good solution or not.. but I put the Embed Message which the bot was going to send inside the ```js
.then()
and for now it seems to be working since I just give the embed now the result
krista will love deno because it uses rust instead of cpp
just turn your code async my dude
That's an option, certainly not the best one but it works
when your code is a complete mess but it does its job
yes
unless you using anything less than es5, theres no need to NOT use async/await
im telling you right now
fix that
when your code is a complete mess but it does its job
https://github.com/AmandaDiscord/Amanda/blob/psql/modules/utilities/orm.js
otherwise soon you'll keep on nesting promises and get into callback hells
I will later on but for now I go to bed xD
oh okay good to know
uses quote
basically: trust me, dont do that
you'll get into a rabbit hole
same for usin .json as database
not another rabbit hole
your code will grow
reply was not appropriate to use there
and then you'll get the oh my code is too big now to change everything
i am fed up with the hololive rabbit hole and i dont need any other in the future
oh btw here's a list of shit codes that do their job: https://github.com/nodejs/node/tree/master/lib
bruh
i can do one better https://github.com/discordjs/discord.js
"i have the shittiest code in the world, you cant beat me"
"i know but he can"
https://github.com/top-gg

lord forgive me for this
https://npmjs.com
I am pretty sure that if I would compete on the "shittiest code" I would get instantly banned from the server
"friend of mine"
didnt i....
one sec
https://cdn.discordapp.com/attachments/688416503120396299/768137828986912798/unknown.png
https://cdn.discordapp.com/attachments/272764566411149314/801827848725200946/unknown.png
https://cdn.discordapp.com/attachments/272764566411149314/792789174042099732/unknown.png
https://cdn.discordapp.com/attachments/272764566411149314/791090756441866310/unknown.png
https://cdn.discordapp.com/attachments/655288842433200129/747330215344209991/unknown.png
https://cdn.discordapp.com/attachments/272764566411149314/787760323640688660/unknown.png
https://cdn.discordapp.com/attachments/272764566411149314/777496593138057217/unknown.png
https://cdn.discordapp.com/attachments/655288690192416781/708356643297165312/unknown.png
here are mine
well
that remembers me of one of my coworkers
basically in the third year he quit the job because he was like "meh programming is not for me"
he got a task to program a sql client for a customer and well.. it was a winform with only one form named form1.cs and in the form there were like 5k lines of code that did everything .. when I looked at it one time I saw another form called "methods.cs" well.. it was blank form and the code was all methods he had created before 🙂
18.9MB jesus
I see
This certainly is my favourite.. guess which is inside these .txt files
im pretty sure it was him that i gave the generator code
wait
no
was it flaz that did the thing
hmmm i think it was borbosso
wrong encoding of the file its posible that its saved as UTF-16 and you open it as UTF-8
yeah
someone did it
mathew mnight be another one
someone actually generated thousands of shit like this for something
i dont recall who
maybe xD idk
but i did send borboss the code to generate a dictionary

I have a small problem: I made sure that when a member joins my server, his log name in the console, however, the event does not activate:
console.log(`${member.user.username} joined the ${member.guild.name} server !`)
});
probably not suggested
const embed = new Discord.MessageEmbed()
.setTitle("UwU")
.addField('placeholder','placeholder')
message.channel.send(embed);
as PapiOphidian already mentioned: field values in .addField can not be null or undefined since u will get an error that discord can't send empty messages or some shit
embed field values cannot be null or undefined
but it was invalid code
what is the differennce in these two importing techniques?
import EventEmitter from 'node:events'
and
import EventEmitter from 'events'
Nothing
What is a great way to model the shop or the buy command in discord.js
Do I make a switch statement where args[0] will contain many cases meaning many items?
.. or is there a better way?
👀
i already told you, it's not suggested
it's like trying to run a windows 95 program on windows 10
it might work, it might not
well not really its like running windows 7 program in windows 10
it will work but you will run into problems
there is gonna be lots of outdated things
lol
if(commandfile) {commandfile.run(bot,message,args)}
^
TypeError: commandfile.run is not a function
at Client.<anonymous> (C:\Users\James P\Desktop\SUPPORT BOT\index.js:43:34)
at Client.emit (events.js:315:20)
at MessageCreateAction.handle (C:\Users\James P\Desktop\SUPPORT BOT\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\James P\Desktop\SUPPORT BOT\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\James P\Desktop\SUPPORT BOT\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (C:\Users\James P\Desktop\SUPPORT BOT\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\James P\Desktop\SUPPORT BOT\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\Users\James P\Desktop\SUPPORT BOT\node_modules\ws\lib\event-target.js:132:16)
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage (C:\Users\James P\Desktop\SUPPORT BOT\node_modules\ws\lib\websocket.js:825:20)
How can i fix?
Your exported command object doesn't contain a run() method, you probably named it execute() or something
oh ok
thanks
thank you so much 🙏
uws
if your code won't break on v14, yeah ig
did you get commandfile from fs.readdir?
we hired a thousand people to review your shit. have patience or you can always switch to a different bot list
i fixed it but thank you you guys are so nice. 🙏
im tired of people asking review my botum fast pleasssssse
yw
and yes they cant do all the bots it takes time they are not the flash.
no one:
people in dbl: patience needed to wait for bot review === breaking into area 51
lol
IoI
btw do u review the bots after your bot was approved?
what
ok if the bot was approved do you help approve after?
we dont
we're not brs
(Bot ReviewerS)
ohhhh lol
IoI
also
Guys this is #development 👀 use #support or #general
k
oooops?
question: is deno better than node
yes, only downside is you can't use npm packages in it
import package from "https://esm.sh/package-name";
you can use npm packages
Then yea, its just defined to be better than node
Created by Node.js's own creator, just rearrange node and vuala, deno 
imma go make a discord interactions client in deno
say node 20 times really fast and you find yourself saying deno
personally i dont like the idea of deno
it uses rust instead of cpp
dice would love that
The thing I love about it is top level await outside of module files
and importing from url
and tahpscript support
and 25mb total size
and.......
Node.js + all kinds of crazy features + type definitions
pogging
nodejs - shitcode

Gotta love how there is an open issue to implement native typings to Node.js still open to this day, then there's deno


meh
why is mongoose needed when using mongodb?
it's not
oh it isn't?
you can use mongodb without mongoose
mongoose just gives you the ability to define schemas for your documents
I'd say it makes it safer, not easier
Personally I use TS with mongodb so mongoose becomes completely pointless
oh
Would I be correct in saying you can only fetch messages by ID if they are less than 2 weeks old?
if you're gonna use typescript with mongodb just go with a proper orm like typeorm
mongoose useless
the mongodb driver is already almost an orm by itself, if you don't need type safety why add anything on top of the driver
hi
I am new to making a bot in node.js, but i have a simple question.
How to store the id from a message that was send by my bot.
what are you planning to do with it
play a song
delete var a, if exist
send message which song is playing. and store this message as var a
await the send call and assign it to a variable
your variable will then contain the message object
when you want to delete the message, call .delete() on that object (your variable)
it's a promise so you should probably await that too
async all the way down pattern
Do you guys think that it's a bad thing to make a bot DM the owner of a server when the bot gets kicked to ask him if he wants to keep saved the settings for that server?
(I've got controversial responses to that so I'm just wondering)
dont think its a good idea ,anyway if the bot is kicked and doesnt share a server with the owner it will not be able to dm him
well i think it is good idea but idk
it has so much exceptions so i dont think it will worth it
just save the settings
My bot stores settings for 6 months after being kicked, then deletes them from the db.
Iam just Ask 😐
damn that's a lot of time
I was thinking of 24h kek
hey ask
24h is good too. Whatever you think is best for your bot's users. But in any case it's pretty much impossible for your bot to DM the owner after being kicked unless they're in another mutual server.
yeah ik
So the easiest option would be to store them for a while then delete if it doesn't rejoin
Where do you save the list of guild IDs marked for removal?
In a separate db table
kk
I don't know, I like the poll idea tho xD
Because, I also send them a little poll about why they kicked the bot, if they wanna answer it
But they won't receive it in 99% of situations
uhm true
I don't know
The only thing that's holding me back is the fact that I have to activate the private messages gateway intent
Which idk if it puts more "stress" on the bot
If they kicked it, they don't want to hear from you or answer a survey. Just store the data for a while, state how long and what you store in your TOS and Privacy Policy, and delete it if it doesn't rejoin at a later date.
If they kicked it, they don't want to hear from you or answer a surve
Don't know about that honestly
do you know anything about that?
What lang are you using?
kotlin, JDA
Not sure how that works for you then
It still doesn't solve the matter where the bot has left all mutual servers and won't be able to DM the owner of the server it was just kicked from.
Yeah I would just mark it for removal in that case
Seems to be the best option
my bot prefix is small r when i type Capitol R not responding how can i solve
provide your code and your language
transform the message content
use toLowerCase on it
save that in a variable
and use that variable instead of the message content throughout the code
gysu how to online the bots
bot.login(token)
What's the library you use
Yes
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
that
not code but just use klik new apllication and creat a bots
tehere said to me my friedn told me to build there
Do you know how a bot is actually made and run?
my friend dont tell me eather
Hi
i have something for you
what
A Discord bot is generally (taking out slash commands combined with HTTP requests) an active websocket connection between a program and Discord, which exchange data between each other constantly
And im usng my minor skills
is that needed
what the its like just 12 seconds
maybe just use botghost
Create your own discord bot in 5 minutes with no coding required. Use our discord bot maker to create a bot for moderation, music, twitch.tv, fortnite and more.
what do u mean
im so lagging
my wifi its 1 bar
I'm having troubles with this as it is not working when there is no args.
https://srcb.in/u0dopNB4Rx
It's a program connected to a certain bot account via bot account token
Hence why you need to create a Discord bot account
you need args because it is required here
and args makes it easier
and simpler
But in order to actually run it, you need to use packages that allow you to work with websockets and HTTP requests. This is where libraries can be used to simplify (abstract) that process, since it will do the basic stuff for you, like handling websocket calls
But I am trying to make it that If there is no args, I define the user as the author, and if there is args, I define the user as the first mention
yes because args[0] might also be the command name depending on how you made the event handler for message
No, it's not the command name.
!warns to show the author warns and !warns <@user> shows the user warns.
But doesn't work for the author
Even though I defined the message.author as user
why will the user warn himself?
What?
gyus the bot use can



