#development
1 messages Β· Page 1672 of 1
you unlive forever, because you become undead
you just 'exist'
maybe a bit off topic π€£
let n = 22; // number obtained at runtime
let exp = 1;
for(let i = 0; i < n; i++) {
exp *= 2;
}
number * exp;
``` is an order of magnitude faster than ```js
let n = 22; // number obtained at runtime
number * (2 ** n)
i bet the second is recursive
ur dead when all parts of ur body stop moving
so basically thats why you die when ur heart stops
lets turn it to programming related then, what would happen if you live long enough to cause an integer overflow in life?
but it doesnt make sense
like
why are math powers so much slower than multiplying in a loop if its basically the same thing
thats not power though, just permutation/factorial
math ew
did you benchmark that on v8 or spidermonkey
i thought so
can someone help me, i am trying to ake the bot respond when it s pinged but i can t figure it out xD
lol
how are you measuring that it's slower? are you sure the engine isn't optimizing the loop away in the first one
the issue is the engine does not know how to optimize Math.pow() nor the ** operator, if one of the numbers is obtained at runtime
it optimizes fine if both numbers are static tho
that's odd
Can somone help me I canβt invite suggestion bot
very odd indeed
im testing 1 million iterations of a function
switching from ** to the for loop above
the time taken went from 230ms to 80ms
bigger bot devs: what do you use for hosting and how much do you pay for it?
well that question really depends
some developer scale their hosting vertically whereas some scale it horizontally
I'm not sure what that means
I'm not sure what that has to do with the question
how much do you consider "big"?
yes that
15k+ I guess
about ~10 shards at worst?
yes
you need to shard anyway
Dang
sharding is required by discord to load balance connections
its not about caching
but there are many ways to shard
for example internal sharding
honestly it depends, if your bot has CPU intensive commands/features, then maybe a tiny server won't be enough
my bot handles emoji uploading/downloading etc - galazygate wasn't cutting it for me so I moved to vultr but I just wanted to see if I'm paying too much
but on the contrary, if its just simple commands that uses a database or mainly fetching remote data such as through an API, then maybe you don't need that much resources
Anybody here use a dashboard with their bot?
which tier were you on btw (galaxygate)
Can I have videos in discord embeds?
Take a look at pulseheberg. They're the best value I've found so far. I've been using them for almost a year now. Bot is in 8k+ servers.
i think it was lightning 4gb?
Contabo is good too.
yes I second contabo too
Very cheap and great quality
what about it wasnt cutting it for you?
welp I wanted to ask that and tim you beat me to it
GG Tim
lul
also from some quick peeks at your github repo (supposedly for your bot)
I do notice some things that could be bogging down the speed
ive used to have a DO Droplet, but they give you relatively slow Cores (1.5GHz)
since ive started with some ML stuff ive had massive spikes in CPU usage, sometimes for 30 seconds just for a single classification.
now ive got a Dedicated Server with 3.6GHz clock and 6 Cores, and i dont even see a single core Spiking above 3% usage in Htop while the ML stuff runs
Hello, someone can help me?
Error: Cannot read property βsetTimeoutβ of undefined
Code line: ```js
let timeGet;
let timeNormal;
const time = Data_Time.get(${member.guild.id}.time.timeSet)
timeGet = time / 1000
if(!time) {
timeGet = 30000
timeNormal = 30
}
const collector = new Discord.MessageCollector(captchaChannel, m => m.id === member.id, { time: timeGet });```
the part that errors out is not even in this snippet
Yes, and its a problem
the full error would help
ok
does somebody know how many calls are allowed to update member roles (remove/add) until you hit the ratelimit?
@rigid shadow it isnt hard coded... you need to respect the ratelimit headers returned with every REST call
what things
thanks, it would be user actions
honestly I would like to know how galaxygate was not cutting it for you
but could be a lot of request in a short time
your captchaChannel is not a valid channel object
thats the point
your library will handle the limits for you
Yep. Dyno does it by delaying between each role change by 1s. So giving 30 people a role with Dyno takes 30s. But yeah definitely be careful and check.
bot was slow, so I thought fuck it I'll try a new host and it was much better
just make sure you dont send a lot of requests asynchronously in a loop
Can I have videos in discord embeds?
Nope
Only way to show a video embed is to share a link in the message content
ah I see, do you have the CPU usage or something?
yes, I know... that JDA will handle it.
But I'm curious if it would work or if it would hit the ratelimit.
In the case that it would hit the ratelimit I won't start it anyway.. thats why I was looking for a ratelimit
the CPU/ram usage was not that high, but I couldn't fix the lag, so I just tried a new host as a lastr esort
slow by what metric? because im on the 1gb one at galaxygate, and havent had any performance issues at 8k guilds
sounds like a slow CPU
response times were all over the place
if you have the CPU running at 800MHz it will feel sluggish
anyway, thanks for your attention and help :)
if you're worried about people using commands at the same time, the lib should handle it for you.
if you have a command that sets multiple roles per usage, then you could space each role by a second or so
100Mbits should be fine, and usually most hosters these days should give you this bandwidth atleast
It would be an event, so every user would have access to the command as far as it started, so probably it would hit the ratelimit, I guess
expecting like 150 members
unless they give you 100Mbits shared then it could cause issues with a Noisy neighbor
if each command only adds 1 role, it should be fine
yes it does
if you're worried you could add a cooldown to the command
they should give Tim a special role here, he is stackoverflow on 2 legs
i know
help vampire food? π
instead of blood you feed him code
what if i want blood?

or better yet, money
Tim is op. Needs a nerf.
ok I do have a qn rn
is it theoretically allowed to have another bot ping a bot to check if the bot is up
I know it sounds dumb
why wouldnt it be allowed
well I guess
my 4 year old code has somehow gotten quite the load of weird issues that I can't be bothered to rectify since I'm working on something else
Couldn't you use webhooks?
and for some reason it'll just go rouge sometimes (not respond to any commands etc)
could be a library issue
but I've yet to triage it though
webhooks from the bot or what
Client network socket disconnected before secure TLS connection was established wth is this?
network issues?
k, weird
I don't understand
red on black ... my eyes are hurting
def get_prefix(client,message):
with open("prefixes.json", "r") as f:
prefixes = json.load(f)
return prefixes[str(message.guild.id)]
client = commands.Bot(command_prefix = get_prefix)
@client.event
async def on_guild_join(guild):
with open("prefixes.json", "r") as f:
prefixes = json.load(f)
prefixes[str(guild.id)] = "?"
with open("prefixes.json", "w") as f:
json.dump(prefixes,f)
means prefixes no have "817415362925881610"
yes
if not return a default prefix
also json no recommend for storage but whatever I'm too lazy to argue on that
return isn't a valid syntax...
Basically it says thereβs no value thatβs named that
so itβll return that error
def get_prefix(client,message):
with open("prefixes.json", "r") as f:
prefixes = json.load(f)
if not return prefix[str(message.guild.id)]
client = commands.Bot(command_prefix = get_prefix)
@client.event
async def on_guild_join(guild):
with open("prefixes.json", "r") as f:
prefixes = json.load(f)
prefixes[str(guild.id)] = "?"
with open("prefixes.json", "w") as f:
json.dump(prefixes,f)
``` What to do?
you check if the guild is in the prefixes
if not
return default prefix
I do see that you assign a prefix for the bot when it joins a server
but when your bot is offline and somehow someone adds it to their server, it will not be included
true
hello guys
yeah unbold i think
i think its on my end
lemme reset discord
does anyone use canary and did it change for them
elsewise its probably on my end
im making a task for my bot so i can change statuses by its self and this is what i have so far and for some reason its not work can some one tell me what may be be wrong with this
from discord.ext import tasks
from itertools import cycle
stats = cycle(['Test Status 1', 'Test Status 2'])
async def change_status():
await client.change_presence(activity=discord.Game(next(status)))```
oh i see where i fucked up hold on
What lang is that?
python
I think python
Thats what I though
@soft glade working?
yep
yeah its python
in py, how would i add to a {"aaa" : "aaa"}?
such as adding bbb but keeping aaa
.update will replace aaa
yourdict["bbb"] = "bbb"
...
okay so..... I was writing the large description, and I thought it should look like this.....
but how would i add directly to "aaa": and keep "aaa" to make it {"aaa": "aaa, bbb"}
result: lol
okay ignore the url just wait for embed lol
gonna send two
this next one is cancer
didnt need blocked1
my bad

cancer
mmmm yummy
all discord.py devs or?
LMFAO
nah, detritus/ts devs here too
god.cogs.god 
yummy
like i said
cancer
i know
its only for my server so i don't really care about it being cancer
Of course you had to mention Detritus smh
yes i have
as you can see in the ss
but then how would i add to "aaa" but keep "aaa" in the dict
why wouldnt i? 
which aaa
keep both aaa's
1 2 3 4
lol
how would i add more to "none"
.update replaces
instead of adding
there aren't 2 aaa's
keep key and value
and add new value
without replacing the value
if that makes more sense
you can't add 2 values to a single key
fucked
what you CAN do is add an array to a key
and an array can have multiple values
{
"aaa": ["aaa", "bbb", "ccc", "ddd"]
}
that way "aaa" only has one value
and that "value" has N values
that makes sense
(node:11868) UnhandledPromiseRejectionWarning: TypeError: ErelaClient is not a constructor
const { ErelaClient, Utils } = require("erela.js");
const { nodes } = require("../../other/json/node.json");
module.exports = async bot => {
bot.music = new ErelaClient(bot, nodes) // <-------- Error at here
.on("nodeError", console.log)
.on("nodeConnect", () => console.log("Successfully created a new Node."))
.on("queueEnd", player => {
player.textChannel.send("Queue has ended.")
return bot.music.players.destroy(player.guild.id)
})
.on("trackStart", ({ textChannel }, { title, duration }) => textChannel.send(`Now playing: **${title}** \`${Utils.formatTime(duration, true)}\``).then(m => m.delete(15000)))
bot.levels = new Map()
.set("none", 0.0)
.set("low", 0.10)
.set("medium", 0.15)
.set("high", 0.25)
console.log("Music.js file is working.")
};
Am I doing something wrong?
Check their docs
Alright.
you might want to use const { Manager } = require("erela.js") instead since I'm not seeing ErelaClient anywhere in their docs
Official MenuDocs' Written Guides for beginner to high level developers.
for erela.js rewrite
client.channels.get(channel).send(message.replace('{user}', msg.author).replace('{level}', curLevel))

am i doing something wrong
I would prefer seeing code as well
yes
vsc is gae
const { voice: { channel } } = message.member;
const { voiceChannel } = message.member;
if (!voiceChannel) return message.channel.send("You need to be in a voice channel to play music!");
How am I supposed to do this? π
const { voice: { channel } } = message.member;
if (!channel)
Maybe anyone smarter than me can help me figure out why i'm getting
this NullPointerException: https://paste.helpch.at/uvebicuyiy.cs
Code: https://paste.helpch.at/ayisuhuheg.cs
(error when running -raha)
lmk if you need any other classes
This was before, and I saw the documentation and applied the changes.
const { Manager, Utils } = require("erela.js");
const { nodes } = require("../../other/json/node.json");
module.exports = async bot => {
bot.music = new Manager(bot, nodes)
bot.music = new Manager({
nodes,
send: (id, payload) => {
const guild = bot.guilds.cache.get(id);
if (guild) guild.shard.send(payload);
}
})
.on("nodeError", console.log)
.on("nodeConnect", () => console.log("Successfully created a new Node."))
.on("queueEnd", player => {
player.textChannel.send("Queue has ended.")
return bot.music.players.destroy(player.guild.id)
})
.on("trackStart", ({ textChannel }, { title, duration }) => textChannel.send(`Now playing: **${title}** \`${Utils.formatTime(duration, true)}\``).then(m => m.delete(15000)))
bot.levels = new Map()
.set("none", 0.0)
.set("low", 0.10)
.set("medium", 0.15)
.set("high", 0.25)
console.log("Music.js file is working.")
};
I kind of got lost on where to put the remaining code.
which are the .on
you defined bot.music twice?
Ignore the first one
Where am I supposed to put ```js
.on("nodeError", console.log)
.on("nodeConnect", () => console.log("Successfully created a new Node."))
.on("queueEnd", player => {
player.textChannel.send("Queue has ended.")
return bot.music.players.destroy(player.guild.id)
})
.on("trackStart", ({ textChannel }, { title, duration }) => textChannel.send(Now playing: **${title}** \${Utils.formatTime(duration, true)}``).then(m => m.delete(15000)))
bot.levels = new Map()
.set("none", 0.0)
.set("low", 0.10)
.set("medium", 0.15)
.set("high", 0.25)
Damn...
This is going to take a long time.
Let me apply the changes.
Node "localhost" connected.
it connected
but somehow it didn't work to play a music.
you need the raw event as well
How to add masked links
@hearty horizon teach
Who can help me: I send links but my program donβt work.. where is the problem? thx
https://gist.github.com/VinxVinx/f03c56c99a65738191176aedce76ce26
you need to use array.some()
in order to check if the content includes one of the elements
if(message.content.includes(whiteList.some)){ ?
No, if (array.some(elem => message.content.includes(elem))
array being your whiteList
I have already try but donβt workβ¦
so the discord.py stuff should have definitions correct when right clicking and pressing Got to definations?
ok
Is it a great idea to go back in versions?
no, it's not
if there's a major lavalink change, you HAVE to use latest version of that library
since old versions would break
urm so non of the discord.py stuff has definations insideof vsc....
just like how you have to migrate from discord.js v11 to v12
ima just reinstall discord.py
I'm trying to make a coin flip command where it says {user} won but im not sure how to make it so it can randomize user tags
actually
just use Math.random() and round the result
it'll either return 0 when r < 0.5 or 1 when r >= 0.5
what do you mean randomize user tags
Connecting new session...
Received READY, session: ef2c0fa6fe150133138e5bbb80f68ab8
Emit heartbeat, seq=9
OOF! Error from underlying websocket: 1000
ReadLoop exited
SSL closed
WS reconnected
Resuming session ef2c0fa6fe150133138e5bbb80f68ab8 with seq=11...
Successfully resumed session id ef2c0fa6fe150133138e5bbb80f68ab8
YAY resume works π
get a random user I guess
just use collection.random()
you can only use those inside embeds
or webhooks
Footers also dont work
Do you guys know how to easily get the embedded role that comes with a bot when you invite it to a server?
kk
may I ask u why?
yup, i don't want to give admin permissions to my bot, so, I have to check if my bot's role is above any role that the bot needs to interact with so it doesn't crash
maybe there is an easier way to do it
i probably just don't know about it
I think that's only for authors.
Nope
ah ok
even with admin, role-check is still a must
Hi
Is there anyway to get a array from a file with javascript without node js?
i want to make a setprefix command with mongo db but nothing seems to work
Then how would you approach getting that role?
wdym without node
with a browser?
you can fetch the file and use JSON.parse() to parse the content
Ok i will try that
anyone knows why using jsdelivr.com caches the "latest" version so if u update after, it wouldn't be the actual latest?
here's what I mean.. the site would say
omit the version completely to get the latest one
so, a version(or 2) ago.. i loaded https://cdn.jsdelivr.net/npm/webject/webject.js
now after I update, and I load it, it still returns old version, so now for any update I gotta use the very version name itself.. I also loaded https://cdn.jsdelivr.net/npm/webject@latest/webject.js so it won't load the latest version either.. has this happened with any of yall?
also is the only solution using the exact version name?
does anyone know how i get the date and time on bottom of discord embed discord.py
yeah how
?
looks like they have the usual max-age headers for caching
did you try clearing your cache?
get the highest role for your bot
it doesn't matter the bot role
what matters is the highest role
ah, okey
i was experimenting with finding the role with the attribute managed = true
but if the highest role does the job i'll go with that
im gonna try on tor.. if the issue is with local cache
still loads an old version
the caching is server side
https://cdn.jsdelivr.net/npm/webject@1.0.75/webject.js is the latest version
just ctrl+f and search for 75 and the latest version would show results, the "latest" wont
this url https://cdn.jsdelivr.net/npm/webject/webject.js does show 1.0.75 for me
NANI
hmm
it does..
so i gotta clear my cache huh
ugh.. but having the package request its version would make sense
cuz i dont wanna tell users to clear their cache on new updates
How is the rawPosition of the role "BOT" 16???? Shouldn't it be, like, 4?
Well 5xx are usually server errors, nothing you can do I guess
I mean you could try to regenerate the token and use the new one
that's not http code though
Well then as I said thereβs nothing you can do
if it is it would've only said internal server error
that's discord.js error code
never mind I'm not even sure
Itβs coming from the REST
how do i imploment the / commands feaure into my bot?
I think thatβs an internal server error but you may wanna take a look into the docs, I canβt atm
The GET request catching the guilds for bot ID x failed
that DiscordJsError text confused me
Yeah understandable
Anyways I guess he just has to wait if the docs doesnβt say anything else
someone has the avatar command to lend me?
Make one
idk
when i ping someone it doesnt display
but when i put ΒΏavatar it works
idk
xd
for the devs with bots in thousands of guilds.. do yall use several different processes? and are these processes on different devices?
you use sharding
which is different instances of your bot's backend each managing up to 2500 guilds
i use a single process at 8k
bots that are in 150k+ tend to use 16 shards per process, so one process for every 15k-25k guilds
but you can easily run 50k guilds in a single process, depending on your needs
oh i thought it was one process per shard? don't know much because my bot is nowhere near big enough for sharding
discord.js's sharding manager does 1 process per shard
big bots dont use it because of that

huh, interesting, is it not customizable? lol
not in that way
im using shard.js
1 million users and 35k guild
:D
and im using quick.db
B R U H
whatever
app.post("/api/cortex", async (req,res) => {
function CortexAPI() {
let soru = question
fetch("URL.com", {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
cortex: {
key: "91AB82CD7EF",
soru
}
})
})
.then(res => res.json(res))
.then(veri => console.log(veri));
}
})
im gettings this error
.then(veri => console.log(veri)); this part is not working
Ah. can not be ...
no i edited
also where is question coming from
why are you testing on runkit?
res.json({soru: convert, cevap: bot.translation, bot: response, src: bot.src})
like this
my father and mother are sleeping. I use it to reduce the keyboard noise.
I don't want to do alt + tab all the time runkit so it's good
if msg.startswith("b!kick"):
if message.author.top_role.permissions.administrator == False:
await message.channel.send(message.author.mention + " you're not an admin!")
return
try:
await client.kick(member)
await message.channel.send("User has been kicked by " + message.author.mention + ".")
except:
print("Failed to kick or send message.")
try:
await message.channel.send("Couldn't kick user " + member.__name__ + ": " + ValueError)
except:
print("Failed to send debug message.")
what
YAY!!!
My bot is in another server
That makes 5 severs, 4 if you exclude the support server
pog
does anyone remember what the line of code is to fetch a user's avatar url
seems to not be working
discord.js btw
avatarURL()
Is there something that i could use instead of pandas to edit bits of a file rather than editing a copy and replacing the original? i'm using discord.py
anyone know what code you use to add reactions to rich embeds discordjs
message.react seems to not work on embeds
const embed = new MessageEmbed()
//your embed here
const msg = await message.channel.send(embed)
await msg.react('emoji') //idk if it's working without await but i prefer to use it
what if you sent the embed through a webhook like this?
https://lev-is-a.hitman.services/emDA9DAc8.png
I seem to get this error;
https://lev-is-a.hitman.services/em6D2Fb45.png
@tight sierra What coding language
thats a rich embed
um, some bots can make for you or you can code your bot to make it
Wait, that's Mimu. That's not their bot js
i just need a brief explanation again
heres a good example
well last time i did it like ".embed create" etc
// at the top of your file
const Discord = require('discord.js');
// inside a command, event listener, etc.
const exampleEmbed = new Discord.MessageEmbed()
.setColor('#0099ff')
.setTitle('Some title')
.setURL('https://discord.js.org/')
.setAuthor('Some name', 'https://i.imgur.com/wSTFkRM.png', 'https://discord.js.org')
.setDescription('Some description here')
.setThumbnail('https://i.imgur.com/wSTFkRM.png')
.addFields(
{ name: 'Regular field title', value: 'Some value here' },
{ name: '\u200B', value: '\u200B' },
{ name: 'Inline field title', value: 'Some value here', inline: true },
{ name: 'Inline field title', value: 'Some value here', inline: true },
)
.addField('Inline field title', 'Some value here', true)
.setImage('https://i.imgur.com/wSTFkRM.png')
.setTimestamp()
.setFooter('Some footer text here', 'https://i.imgur.com/wSTFkRM.png');
channel.send(exampleEmbed);
oh, I'm not sure how to make with a bot but I can teach you how to code it in Python
@lapis violet That bot is not theirs. So it's likely a command with Mimu which was made by Iara
wym
discord.js right?
if so that should do it
Nvm lol
Is that JS?
mhm
I just pulled that from the discordjs guide for him
oh
too lazy to type it all out
It's much different than python
plus the guide includes everything he can do
yeah I've tried py before
I like discordjs better
I barely know JS haha
Very much
haha
To clarify, they said "They made that embed" which confused me since the screen shot was of Mimu.
I think I learned 3 years ago without knowing I was learning JS
yeah
!fuck
?
lol what
Uh no?
uh ok
*eat pup
why is my nickname this aaa
How old are you.
Sure. Anyways if you're going to troll do it in #general or #memes-and-media
fr
hellow poop
and pipi
@earnest phoenix if you're about, mind doing the thing plz ^
I'm looking for a slash-command api wrapper but I can't find anything online. I was told to ask here. Do you guys know of any easy to implement api wrapper for that?
@earnest phoenix no trolling please, if you don't need help or aren't helping others dont post in this channel
β€οΈ u
most of the well established Discord API wrapper have this function. D.js gets it with V13 but you could merge it yourself since its a open PR on the github page
-b @earnest phoenix
Banned tu le das al play#6848 (@rain cobalt)
ban
Haha
aight, thanks. ill check that tomorrow ^^
ok so uh
i made my embed
how do i make it so when people react they receive a certain role?
Hi
The description of my bot should look like this:
but when I save and go to my bot, it appears like this:
Any solution?
the one you want to copy probably uses HTML and you use Markdown
no i use html
then idk
Ok thx
Where can i find my Ip adress for the api
Hy
oh, if it's a webhook, then i don't know. never tried that. sorry
np
how do i make people recieve a certain role for after reacting to a discord embed
through the message reaction add event
uh
sorry what
You add logic to listen for the message reaction add event then give them a role based on what reaction they react to. Simple
im trying to make it like this
i already made the embed
and desc etc
can you tell me like what cmds to do
You should try to learn your language and library more before attempting to do anything. We told you the answer and it'd be up to you to look at your library's docs
People aren't gonna code for you. Just a harsh reality
If you're not coding, I'm afraid very few people are going to be able to help you out here
im making an embed
in discord..
this is the one i made in the past
i forgot how to tho
If it's through another bot you don't own, then this isn't the place to ask and you should ask the bot developers
im not
Yes you are
This channel is for coding support. Not other bot support
alr
this channel is for smart people

idk man. I'm kinda stupid

This is development
How can I include CSS in my long description?
Style tags
so only <style> </style>
in html yes
ty
tfw
Late Night
we fucked up on a big bot that fucked up a lot of users's edition
There was no apology
they probably lost a couple thousand servers on that joke ngl
specially with people spreading stupid messages like this
compromised 
discord bug = compromised, your account will be hacked, please delete the bot
One of the team members reset the token 
that's how it got offline so fast
Still funny how people make a big deal out of stuff without knowing the full picture. It's also quite a shame people will never know that Discord fucked up
indeed
hey i am about to sign up for computing science in the netherlands, Nijmegen.
How hard do you need Mathematics calculus b for cs?
I'm really not surprised people come to idiotic assumptions right away without even investigating or giving the case time to be resolved
Reminds me of how WalkSafe was accused of leaking data to other users on TikTok and Twitter with absolutely zero evidence π€£
its scary af when you're accused of something thats not your fault
my bot was accused of raiding once because i didnt have properly implemented command rate limits
and it was delay-responding to a real raid

its never discord
must be the bot owners
can't be discord
discord is perfect it doesn't make bugs
it must have been hacked using cmd!!!!!!=11840148148Γ18
they have hacked into the mainframe!!!
hacking dank memer... 10%
hacking dank memer... 50%
hacking dank memer... 69%
lol
I love how stupid people can sometimes be
xD
01001010101010111101010101010110
look guys im hacking
omg how did link do that1!?Γ1Γ1Γ
π±
ok I will stop
lol
cringe ik
idk what is even using that much ram
I just created it
htop to the rescue
htop ontop
probably my vscode server
I have running
using the ssh extension in vscode
lol
hello
Apparently my bot stopped responding to commands (no errors) and when i restarted it my shards didnβt load and got timed out
Why is this happening
Theres nothing wrong with my code, i didnt even do anything
It just suddenly stopped working
Yo,what can i help u about
any good hosting?
Any random VPS, AWS, Azure, GCP .... Etc
free vps?
No
is good heroku for host a mc server?
@humble rock see this #development message
I had 2 yrs free VPS with AWS (Used Github Student)
dang
To be honest Repl.it seems good (I have premium though)
Cuz you can start for free then switch to hacker that'll give you
20 repl(4 gig ram, 2 gig storage each) for 7 $ per month (Now they have always on)
I personally consider repl more of a convenient testing environment rather than a hosting service
does repl.it actually give you multiple vms for the price of one?
if so thats cheap af, there has to be a catch
i make it thanks
why does spliting a txt file by \n work on linux but not on windows?
I have to do \r\n on windows
bcs windows is stupid
Install arch on ur main pc
split should accept a regular expression
just have a part of the regex be lazy with matching \r
so /(?:\r)?\n/g
(?:\r) non capturing group where it tries to match \r the non capturing group is useless by itself, but the ? after it makes it important. It means that it doesn't have to match what's in the group. then of course matching the \n
the g at the end of the regex means that it should match multiple times. By default, it only matches by 1
Where can I learn regex?
https://regexr.com/ is a fun website I use all the time
thanks
Caching what?
After getting the intents you also have to use the intents
new <discord.js>.Client({
ws: {
intents: <discord.js>.Intents.NON_PRIVILEGED | <discord.js>.Intents.FLAGS.GUILD_MEMBERS
}
});``` for example, since you're using discord.js
@quartz kindle why code no work
const tim = require('tim');
message.channel.send(tim)```
v8::LazyError: Tim didn't come in development chat```
You deconstruct client class on that part, not the client setup
Can someone help me in port forwarding my rasp?
xD
you can deconstruct Intents as well, like you do Client and Collection
this.ws.destroy is not a function
you cant do this
client.ws is a WebSocketManager class, by doing this you are replacing it with an object
there is raid on The Coding Den server
intents are stored in the client options
no
either do new Raven({ ws: { intents: ... } })
or if you want to hardcode them, then this.options.ws.intents = ...
yes
has anyone any recommendation where someone can learn bash scripting in mac?
which cache?
where are you running that code?
is the bot fully logged in when you run that?
are you using discord.js v12 or master?
This is now a thing? if(!guild.available);
That's been a thing for a long time
though I think it used to be unavailable instead of available...
I added the code of this.
I think it would work.
smh
I forgot to add that.
π€¦ββοΈ
Also, question.
Now If there is a server, I made it return, meaning it won't send the const embed right?
If I want it to send the embed, I don't make it return, I set it as false?
There's a problem with this code and it's that you're trying to return from within an asynchronous function
which doesn't work
anything you do within a callback or promise happens after the code after your block, runs.
can you console.log this.client.options.ws.intents in your command code
should prob just link them to a async explanation document
so, everything from line 35 to 45, will happen before lines 12 to 32.
Guides to understand promises:
A Promise is an object representing the eventual completion or failure of an asynchronous operation. Since most people are consumers of already-created promises, this guide will explain consumption of returned promises before explaining how to create them.A Promise is an object representing the eventual completion or failure of an asynchronous o...
good ol bitfield
Hm. do I await save()?
Ok, but what about the return thing.
read
Read the material and it will become clear.
you dont have presences
if you dont enable presences, you only get members in voice channels
why do you need the member cache tho?
you can do most things without it
What features?
This is a question you will have to answer for intent request during or after verification so you might as well discuss it now
Right but why do you need a member list is the question
What is the unique compelling feature that would convince Discord to grant you the guild member intent?
@quartz kindle Your daily news about things you don't care
fuckin hell
ETA (another) 9-13 days
xD
members can be fetched, thats the point
presences will only give you online members at login anyway
not all members
he already has the members intent
because they dont need to be
its just a waste of ram
and if you REALLY want them, then just fetch
you need to fetch anyway, there is no intent that gives you ALL members
fetch by id and check if the fetch worked
If you have a user ID you can fetch that one member from the guild and see if it exists.
if the member is not in the server, the fetch will error
with an id
yes
and await
and catch
How could I get a free vps for a discord bot
Sorry to break it to ya, but you'll never find a good free VPS.
It's either free, or good
If you want to host free use heroku
If you find a free vps, its a bad one
#development message
See this message for an explanation
If you sign up for aws and give them a credit card they will give you a free vps for a year.
Actually you can get 2 of them for free. One linux and one windows.
From what I've seen AWS still has limitations that might be annoying for bot hosting though
is generating a bunch of channels and roles once by using a command breaking any rules?
It depends on if it causes your bot to get rate limited
is that something that should happen automatically? like, i've tested the command a lot of times and everything seems fine
So me and a friend are working on a dungeon feature now we're using canvas to send a mesage to a special channel to then get the msg url and put tht as an embed image, is there a better way of doing this?
You can usually tell if your bot is being rate limited if it stops doing anything for a few seconds and then continues
https://discord.com/developers/docs/topics/rate-limits#header-format
You can read about rate limits here
Integrate your service with Discord β whether it's a bot or a game or whatever your wildest imagination can come up with.
Does this look like is being rate limited? https://imgur.com/glt77xn.gif
I would say that that could definitely cause it to be rate limited
probably if u'd do it too often too close after each other yes it'l be rate limited
u might wanna dd a time out between creating the channels
Users could easily get your bot limited by spamming that command
it's not a command that can be used often
it's just a command to set up a layout in the server
Still, if like 10 people do it at the same time
can only be done once
Yeah, like Vigintallion said. Add a second or so between each creation
yeah... but thats unlikely
better safe than sorry
#development message anyone?
Why embed image? Why not just attach the image?
The channels and roles creation are already asynchronous so I'm making the function await for each one of them so they aren't created all at once. Is that enough?
Try to send an image as a file attachment and set the embed image URL to attachment://filenamehere
no
It's still happening a lot faster than Discord would like it to happen
The general rate limit is usually 5/5s. So 5 requests every 5 seconds, or once per second if you will
we tried that
but it doesn't work as we do it when editing the message
not when sending the message
But I believe the rate limit for creating/deleting channels is even more strict than 5/5
Okey, then 1 s per ch and role creation is fine, right?
I'd say that'd be fine, but I'm not too sure about it
Hmm, there are at max 46 ch or role creation calls in that command. I just dont want the users have to wait 1 minute for that. But i guess that it may be a problem...
U have to wait
Does anyone happen to know a GUI app for creating OpenAPI v3 specification docs
I can do it manually but if anyone happens to know a tool (I'll even pay) I'm all ears because this is exhausting
const bountyID = require('../config.json'); is in bounty.js and i am trying to read config.json
shouldnt that get the bountyID variable stored in config.json
did you use json as a database?
yes
DONT
why?
file based databases are slow, prone to corruption and file manipulation is single threaded
I'm assuming you mean something like
{
"bountyID": ""
}
in that case you need
var ids = require("../config.json").bountyID
yes
also @lusty quest while that is true, you don't know their use case
json is fine for static stuff, if it gets dynamic, dont
but out of the name of the value he wants to get i would guess there will be mutiple of them and maybe even dynamic uses by users who can claim it
i am making a command for someone that already has a bot and he told me to do it that way
in that case follow what they requested, while it may not be ideal, it is what they requested
read is fine, writing can cause issues
in my case i only need to read
i talk about in future not now
They asked about the present. While I see your point in mentioning the future, you've made your point now.
idk what his plans for the future is
did you plan to have stuff like per guild configs?
its a personal bot
Super. They just said they don't know the other developers plans. Lay off.
for 1 guild
ok then it should be fine
idk how long you lurk around here, but the amount of Devs that use Json as a database is scary, sure they think its easy to start with, but it will become hell when they get the first corrupted file and loose all data.
I understand that, but you cannot control all of their actions- while it would be nice to help prevent all future issues, you can't become overbearing and controlling.
thats when you begin writing tho
Correct
or can it happen when you read
read is fine
writing causes some issues due to having an easy time corrupting the file if as example 2 processes try to write at the same time
that makes sense
thank you
if you want to start with a database, sqlite based Databases should work quite well (if you dont use a Free host like heroku they delete the entire app and pull a fresh one from github -> all data gone)
You are suggesting things they didn't ask for
They asked a simple question- specific to their use case, and you began spitting out cautions and other needless information that wasn't requested
There is a time and place for suggestions like that
more informations?
What do you mean
const embedError = new MessageEmbed()
.setColor(red)
if (!args[0]) {
embedError.setDescription("β Please mention the category you want to view.");
return await message.channel.send(embedError);
} else if(args[0]) {
if (!message.member.hasPermission(["MANAGE_GUILD"])) {
embedError.setDescription(noPermissions);
return await message.channel.send(embedError);
};
}
I did this.
I didn't mention args
.. and it is returning that.
const { red, cyan } = require("../../other/texts/colors.json");
red is the hex
.. and the description wasn't set.
Thats a default discord embed
if you send a embed at all even with invalid data itll send that
Ik, but idk why it is empty.
ohhh I see.
@commands.command(aliases=['user-info'])
async def user_info(self, ctx, user: discord.Member):
"""display specific user information"""
embed = discord.Embed(title="user details:", description=user.mention)
roles = []
for role in user.roles:
if role.name != '@everyone':
roles.append(role.mention)
if len(roles) > 0:
roles = ' , '.join(roles)
else:
roles = "user does not have any roles."
permissions = []
for permissions in user.has_permissions:
if permissions != f'{has_permissions}':
permissions.append(permissions.Permissions)
if len(permissions) > 0:
permissions = ' , '.join(permissions)
else:
permissions = "This user currently doesnt have any permissions"
embed.add_field(name="roles:", value=roles)
embed.set_thumbnail(url=user.avatar_url)
await ctx.send(embed=embed)``` sending error in a second
error
im not sure where to put the member?
@feral aspen Perhaps try Discord.MessageEmbed() - assuming discord.js
No, I defined as { MessageEmbed() }
ah
Hm, it's been a hot minute since I've used default d.js tbh so I'll leave it to someone else lol
user.guild_permissions
What the hell is permissions.Permissions
Also you're overwriting your list
No its { MessageEmbed }
Yes that.
It's still not working.
let me see again
ahh ok
What the fuck are you doing there
π
You should use permissions_in() instead since that's just the global perms
ctx.channel.permissions_for(user) ftw
Since that returns a Permissions object, we can then use a "simple" one-liner to just list the permissions and then join the elements in that list with a comma
is worried
Any help on this.
What s noPermissions?
It's a String
Whenever I don't mention args, it returns this.
.. and even if I mention args
it yet returns that.
wot
How can I learn slash commands?
ok flaz got it before me
How do I request for privileged intents after the bot has already been verified?
Ty very much kind stranger
Is it fine having firewall installed on a VPS of your bot?
Like I am currently thinking about it. Seems stupid, but at the same time it wonβt anything bad (apart from using some resources)
It's fine
But like eh.. why do people even do that?
To keep their machines from being accessed publicly
It will become even more laggier and it wonβt probably provide as much security as I think
Hm
Laggier?
Well, it will glitch a lot
The firewall or the machine?
The machine will be more glitchy with having firewall installed
I use Windows Defender
On a vps? XD
On a VPS sure
What firewall do you recommend?
I use ufw since my VPS is Ubuntu

Firewalls and antiviruses on linux based VPS' are kind of useless if you don't download anything other than what your project depends on and so long as you have some form of secure authentication such as public key authentication only
Would only take up cpu time
Yeah true
Agree, thatβs why I was asking. Hard to decide (for firewall, not AV)
?
So itβs βreactiveβ in your opinion?
Security is good and cozy, but i shouldnβt be too focused about it 
Yes. What purpose does a firewall serve if you know what you're downloading and no one else can access your VM
Are there any blogs where it is stated how much resources does firewall on different vps (or UFW if being specific) use
Nvm
sup
const Discord = require('discord.js')
module.exports = {
name: 'approved',
run: async (message, args) => {
const sayMessage = args.join(" ")
let embed = new Discord.MessageEmbed()
.setTitle("Approved")
.setDescription("message.mentions.members.first(); has been approved")
.setColor("#00ff00")//it's aco's green color hehe
message.channel.send(embed)
}
}
Guys how to make the bot edit his msg? just tell me the name method, i'll see the docs
The bot was suppose to mention the user I mentioned
Pls just say the problem this time
wait
const Discord = require('discord.js')
module.exports = {
name: 'approved',
run: async (message, args) => {
const sayMessage = args.join(" ")
let embed = new Discord.MessageEmbed()
.setTitle("Approved")
.setDescription(message.mentions.members.first() + "has been approved")
.setColor("#00ff00")//it's aco's green color hehe
message.channel.send(embed)
}
Djs right? <Message>.edit
this should work
yep, thank you
Now it sends Id but I want it to mention the user {?}
hi so i don't want all my html files to have the header code coded in i want to find another way to maybe load another file into the html file i am using express
switch to an SPA framework that uses components, i.e. react or angular
so no more html
welll yes and no
lol
const Discord = require('discord.js')
module.exports = {
//Mention
function getUserFromMention(mention) {
if (!mention) return;
if (mention.startsWith('<@') && mention.endsWith('>')) {
mention = mention.slice(2, -1);
if (mention.startsWith('!')) {
mention = mention.slice(1);
}
return client.users.cache.get(mention);
}
}
name: 'approved',
run: async (message, args) => {
const sayMessage = args.join(" ")
const approved = getUserFromMention(args[0])
const approvedM = message.guild.member(approved)
let embed = new Discord.MessageEmbed()
.setTitle("Approved")
.setDescription(approvedM.username + "has been approved")
.setColor("#00ff00")//it's aco's green color hehe
message.channel.send(embed)
}
}
``` @frigid mountain try this
it's complicated to explain
Oh wait
i used pug before but i don't like it tbh
you want to mention the user?
