#development
1 messages ยท Page 1566 of 1
๐๏ธ ๐ ๐๏ธ
please link them ur message about learning nodejs and js
Here, please read this #development message
k thanks
we already said you should read the guide before asking here again so please do that
k
You can't just take a bot online and then throw in random code from some other bot and expect it to work. Please learn javascript first.
How do i get the json information of my bot's ratelimits bucket?
ratelimits aren't returned in json, they're returned in the request headers (except when you're actually ratelimited, you get Retry-After header set in the json response)
also
your lib should handle ratelimits for you
why do you want to access those
Just to make sure my bot doesn't gets ratelimited?
As far as i know discord.py creators say it handles the ratelimits for me
see this
yes
that is correct
you can even hit the ratelimits even if they handle them
Yes
I mean you can hit ratelimits
That's what's worrying the heck outta me
the libs just re-schedule and wait till it clears before sending again
So again asking is there a way to enquire information about ratelimits bucket or i take steps (make some sort of wrapper) to prevent bot sending messages too quickly?
you should not do something like, change channel names every minutes
again, you're library should already handle that for you
you dont know the ratelimit untill you hit it when it gives you how long to wait for
thats not the problem, add a simple cooldown of 1 second, then its fine
Alright then ty guys.
channels?
change channel names are every 2 times every 10 minutes
changing channel name, thats just possible every 5 minutes
the only ratelimit discord has publicly disclosed
I feel dumb i still don't know what channel are you talking about. Or how do i change it
change the channel name of a channel, this has a limit xD
#topgg-api you can just change the channel name every 5 minutes
Okay that's fine but what about DM channels then
you can not change the channel name of dms 
Yeah exactly
Ok I'll figure a way out to keep discord away from swinging that block hammer upon my bot ty again.
It happens just, when you try to do bad practices lol
in discord.py i know i can do @has_permission(permission=True) but i need it to be more modular like if ctx.author has permission == permission or if ctx.author.role in approved_roles: is this possible? whats the method to get a users permission, ive been searching up online but most of the results for me are either outdated using the old discord library or only cover the first method which is not what i need.
Is it normal to not get a reply on your intents application after 19 days? 
With Discord nothing is normal
Fair enough
There was apparently activity on my request 5 days ago, but no replies
You can use check any
Or manual one as shiv mentioned, both work
ok thanks for the suggestions
check any is exactly what im looking for thanks
I am still in need of assistance. I tried something else and it didn't work and I'm struggling.
one more question is there a way to get a list of an authors permissions as well?
For what usecase?
You wanna list it as string or you wanna check if the author has certain permission?
them being abnormal is normal
both
ideally
was i pinged here?
the ping is in a superposition of ping or not pinged

Get a Permissions object first, assuming author is a Member object, you can do either author.guild_permissions or channel.permissions_for(author) or author.permissions_in(channel). And just get the attribute you want to check and it'll return boolean. If you wanna list out all the perm the author has, you can do [perm for perm, allowed in permissions if allowed], it'll return list of str
How do IDEs do syntax highlighting? I mean, you can't insert markup inside an html input element so you can't use CSS to color stuff or some other wizardry.
they don't use html for that.... they use js 
non-electron ides neither do that
with css iirc
how are you gonna insert css in an input
Well put a hidden textbox
And on keypress
if (keyword === "return") return <p classname="main.css">return</p> ig?
Change a div
With css
And on click on div focus window to the hidden textbox
Simple
there's an entire jquery plugin that does that
but the div is behind the input so it cant color the text itself just add backgrounds
he's asking how do they highlight it
your best bet would be just to look VSC code in github
You can do that using css
reading code is best way to learn (actually 2nd best way but still)
will goto sleep and wake up next morning then see the answers on my stakuverflo question about dis
aka learning by ctrl c ctrl v
no?
Spoonfeed ?
yes?
Forking go brr
with i n t e l l i s e n s e
Fuck spoonfeed is bad
amazing this worked thank you
Hmm
no its not
Consideravleee
bad practice
function feed() {
return "spoon";
}```
idky but i thought his profile was a psyduck :P
You could copy pasta stuff from hastebin highlighting @earnest phoenix
smh my head
hi
if you're still wondering, vsc uses their own highlighting engine
you can snoop around the source code
Noice
hey, after so many guides i made a code
but bot is not replying to that
ban command
heres the code
its above 2000 characters
use hastebin or something
ok wait
bro i used some public codes n merged them n edited them
i used kick command
and edited it
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
I cneed help reloading all files inside of a folder. I get it to read the files but I need it to walk through the files and reload them and I have no idea how to do this and google isn't helping.
I want to prevent restarting my bot when I add new commands, I wanna reload an entire folder of .js files and cache new commands.
can u share a ban code for node.js, as i tried 3-4 codes none of them works, but it works in kick
I have it looking at the files and its able to tell me the files that are in the folder, but I can't figure out how to reload them and cache new ones.
its likely your command handler
you can clear the cache
then re run the command loader
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
please check this out
How would I do that?
When i spoonfeed
bruh
wait
No
Its a part of the spoon conversation
bro i did it already and even changed
token is working in the kick command but not in ban command
heres the code
but bro i did it in kick command,n its working 100% fine
but same code with ban
not working
Reset your token now!
Literally giving away token
it does yes
Add the kick command also man its just code for ban
didn't you have a full command handler earlier with commands in their own files
that you copied from github somewhere
bro im making 2 different files
one for kick
and one for ban
kick is working fine
but ban is not
Thats not how its done
You just run 1 insuance of the bot
And add the kick command and ban command in one file
First learn js
Theory: You took this ban command from an online tutorial and tried to paste it in ./commands/ban.js
All the commands that are working fine are the ones you stole from the original repository with the rest of the bot, don't pretend like you actually wrote anything.
anyways, after resetting token ban command also worked
n yes, discord.js publically posted an example of ban n kick command
not every developer with their bots in 100+ server made their bot fully on their own
Whatever other people do doesn't matter. We're telling you, you need to go learn javascript, we're not going to spoonfeed you when literally all you've been doing is shoveling random code into your bot
bro m learning ok, not just copypasting it, im understanding each line n fixing on my own
You're 100% absolutely definitely not writing anything right now, stop pretending.
not all but most, and at least understand it
Except botghost peeps
when did i said m writing
If you even remotely knew what you were doing, you'd know you don't copy/paste a full bot with events and login inside a command file built for a command handler.
m saying i am understanding each line, n thats enough for my knowledge
Go learn JS, you will not get further help from us until you show you at least understand a square peg doesn't go in a round hole.
I'm sorry but you McFucking what?
that was not very cash money of you
They're just trying to justify their crap shoveled bot by trying to bring other bot devs down, indeed, that's most definitely not kosher.
No dosh for you.
Tylers don't listen until you start becoming harsh. I'm saying this from years of experience.
I can agree to that.
Literally I've said worse to people and they come back and thank me for pushing them to go learn. I will continue to do so in the foreseeable future.
I'm over here with a 600+ server bot that I hand made, barely copy pasted shit and if I did it was because something didn't look right and I couldn't figure out where to put a line.
Evie also helped me a bit so props to them.
I mean, obviously if you think I'm wrong, @swift umbra , you're free to DM them fully made code that's working, and keep doing it. Falling victim to a help vampire is nothing to be ashamed of, if you feel you're doing something right by it.
You wouldn't be the first one, and not the last, and I've been sucked dry before so I know the feeling ^_^
module.exports = {
name: "ban",
aliases: [""],
description: "Ban Mention User",
usage: "<mention|id> [reason]",
category: "moderation",
run: async(bot, message, args) => {
let member = message.mentions.users.first() || message.guild.members.cache.get(args[0]);
if(!member) return message.channel.send(`Please Mention A User`);
let reason = args.join(" ").slice(22);
if(!reason) reason = "No Reason Specified";
if(!message.member.hasPermission("BAN_MEMBERS")) return message.channel.send("You Dont have permission to kick member");
let paras = new MessageEmbed()
.setTitle(`${member} ban`)
.setColor("RED")
.setDescription(`
banned User: ${member}\n
Mods: ${message.author}\n
Reason: ${reason}
`)
.setTimestamp(new Date())
let userE = new MessageEmbed()
.setTitle(`You've Been banned From **${message.guild.name}**`)
.setDescription(`
Mods: ${message.author}\n
Reason: ${reason}
`)
.setTimestamp(new Date())
message.guild.member(member).ban(reason);
message.channel.send({paras});
member.send({userE});
},
};```
can anyone atleast tell me that where it is wrong
what is the issue?
The peoblem is that
You are nowhere making a command handler
ah
looks like it works
but not banning user when mentioned
Hmm
is the user above the bot on the member list?
i tried editing same code 10times
Lol
on the top
I see the error
admin perms also
bots can only ban users below them
what?
You are not correctly banning the corrdct member
means?
code here
nope i didnt
@umbral zealot I know you programmed Enmap (at least your take on it for AIG), but could you assist me with something since I'm struggling?
bruh
lol
the problem is ```js
message.channel.send({paras});
member.send({userE});
?
do { embed: paras } /{ embed: userE } or even just paras/userE instead
through your bots code
i didnt got u
first of all, since you're using repl.it open the terminal and actually read what the error is
oh
the error's gonna be "cannot send an empty message" which i guess points to where the mistake may be
oky
Go ahead and ask and we'll see if I Can help (or maybe someone else can)
I have asked but nobody has exactly helped.
Except for tim, tim has been busy.
@grizzled raven i did what u said, but after running that the bot stopped responding to .ban command
@earnest phoenix read the error
I need to be able to cache new commands after adding them to the bot without restarting my bots processes, basically I need to reload an entire command folder.
no error comng bru
I have it reading the entire folder, but it won't reload the commands or load new ones.
show a screenshot of the repl.it terminal
show code
Is this not an error? Never used replit
its the last few characters of the error
expand that console goddammit
exactly
no error comng bru


Translate is smart
This is not valid JSON, but it is close
And it kept the original JSON keys
look, jsons are either valid or pure trash actually
const folder = args.slice(0).join('');
const files = fs.readdirSync(`${__dirname}/../../commands/${folder}`);
try {
if(!folder) {
//return error
}
else {
message.channel.send(`Reloading`);
client.unloadCommand(files);
client.loadCommand(files);
message.channel.send(`Reloaded`);
};
};
With some by-hand cleanup, I could make this valid JSON
you must only pass dictionaries to DictType
@quartz kindle @umbral zealot
just switch double quotes for single quotes
or escape them
I tried to get the entire member list of my server, but it only show 15 users on 60k, i enabled intents on the client, and i'm whitelisted, but idk why it doesn't show me the entire member list https://cdn.discordapp.com/attachments/798651788353994822/806937787797864488/unknown.png
Gotcha, thanks
or use a locale file
instead of json
it's a simple key-value file too, but it is delimited by newline
@grizzled raven
by the way, thats not how you use ban
reason must be inside an object
my locale file for example
the good thing about it is that it treats anything after "=" as a string
no need to escape anything
Nice
I might eventually switch to that
what does unloadCommand and loadCommand do?
also shouldnt you be checking for folder errors before and during using fs?
that way it will error out anyway
Load Command
async loadCommand (commandPath, commandName) {
try {
const props = new (require(`.${commandPath}${path.sep}${commandName}`))(this);
props.conf.location = commandPath;
if (props.init){
props.init(this);
}
this.commands.set(props.help.name, props);
props.help.aliases.forEach((alias) => {
this.aliases.set(alias, props.help.name);
});
return false;
} catch (e) {
return `Unable to load command ${commandName}: ${e}`;
};
};
Unload Command
async unloadCommand (commandPath, commandName) {
let command;
if(this.commands.has(commandName)) {
command = this.commands.get(commandName);
}
else if(this.aliases.has(commandName)) {
command = this.commands.get(this.aliases.get(commandName));
}
if(!command){
return(`The command \`${commandName}\` doesn't seem to exist.`)
}
if(command.shutdown) {
await command.shutdown(this);
}
delete require.cache[require.resolve(`.${commandPath}${path.sep}${commandName}.js`)];
this.logger.log(`Unloading Command: ${commandName}.`, "warn");
return false;
}
can't u just read the file on runtime instead of caching them?
i tried using code give on
https://discord.js.org/#/docs/main/stable/examples/moderation
Still an error
@quartz kindle
readdirSync returns an array of file names
your load and unload functions dont have anything to treat arrays
My loader on startup
const directories = await readdir("./commands/");
client.logger.log(`Loading a total of ${directories.length} categories.`, "log");
directories.forEach(async (dir) => {
const commands = await readdir("./commands/"+dir+"/");
commands.filter((cmd) => cmd.split(".").pop() === "js").forEach((cmd) => {
const response = client.loadCommand("./commands/"+dir, cmd);
if(response){
client.logger.log(response, "error");
}
});
client.logger.log(`Loading a total of ${commands.length} commands in ${dir}.`, 'log');
});
thats not the issue
you took files from readdirSync and gave it directly to load/unload as a first parameter
Okay, what should I do then and how would I do it?
I look at each directory and then read whats in each directory.
exactly
so logically, you have to do the same thing
before you can give the file and path to load/unload
look at each directory, read whats in each directory, and use load/unload on each file found
Okay, how would I work that in? Using my loader on startup and using the mentioned directory like in const files?
its not that hard
just copy and paste your loader and replace the inside of it with what you need
this
any idea why this happens
somebody see please
const members = await message.guild.members.fetch();
const memberlist = members.filter(x => x.user.flags != null).array();
for (let index = 0; index < memberlist.length; index++) {
const m = memberlist[index];
await m.user.fetchFlags().then((flags) => {
for (const flag of new UserFlags(flags)) {
console.log(`${m.user.id} ${flag}`)
}
});
}
This is only returning id of user with his flag, but i want to know how many user get a certain badge, how i can do that?
hello ๐ I'm getting to sharding and if I understand the concept correctly, each shard runs duplicate bot code?
so if I'm posting server count on top.gg from the bot.js every 60 minutes, does it mean each shard will post it each hour instead of just once? should I move the post code to the new sharding manager file - index.js then?
same with getting top leaderboards from my db, if I pull from database top players every hour, does it mean it would run the same code 10 times with 10 shards?
yea
I have a domain and a html file, how to host it as a website with tht domain?
ariight, so I should basically move all the interval code parts to the index.js instead right?
host a webserver and upload that to your webserver
for example on your vps
how to set tht domain fr tht html file?
Hihi! I was told to come here for advanced markdown development--the markdown cheat-sheet provided to me in support isn't really what I need. I'm trying to find ways to have automatic counters, coloured/animated backgrounds, etc. For example:
https://top.gg/bot/649604306596528138
or even something as simple as
https://top.gg/bot/646937666251915264
or you just buy a webhosting
I'm new to web development
You need some kind of machine to host that webserver on, i suggest reading over https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-16-04 if you have linux experience
oops, I'm windows
oof kk
@quartz kindle Okay so I have made progress, but now its saying that commands.filter is not a function.
setTimeout(function() {
client.logger.log(`Loading ${folder} back into the cache.`, "ready");
const commands = readdir(`${__dirname}../../${folder}/`);
commands.filter((cmd) => cmd.split(".").pop() === "js").forEach((cmd) => {
const response = client.loadCommand(`${__dirname}../../${folder}`, cmd);
if(response){
client.logger.log(response, "error");
}
});
client.logger.log(`Loading a total of ${commands.length} commands in ${folder}.`, 'log');
}, 5000);
@lyric mountain are you awake?
fs.mkdirSync(this.dir);
``` is throwing an error because the directory doesnt exist? i thought it was **m**a**k**e**dir**ectory
if you're using fs/promises then you have to await readdir
Okay.
it will throw if the parent doesnt exist
unless you give it recursive:true
whelp i thought it did but i have my class in a folder so where its being called may have bad refrence, ty, ill try doing the recursive.
ono what have i done
@quartz kindle Now it says it can't find the modules.
that makes sense tho ig, i have the db.js in a diffrent folder than the index.js
yes but im moving from one large to lots of small
ok be careful since if you try to read and write the file at the same time it will corrupt iirc
or if you write and crash
ik
yep
thats why im splitting it up
and gonna make a queue
that way it cant corrupt data for more than 1 member in 1 guild
and i could add restart to that queue
you shouldn't have too many files
so even harder
I understand different files for different purposes, such as settings or stuff
but not per guilds
each guild is a folder, and each member is a json in the folder
I'm not Alan but yeah
favor for erwin poggers
i need to check if cloudflare is blocking ip's
ik, i just did that cuz i can add the ids to the string ๐
ty for not getting mad kek
sure
but it needs to be someone from brazil
which IP should I ddos?
and iirc you're brazilian, no?
lol
yep
and you're in brazil, correct?
^
perfect
okay ๐ฉ in a moment it will be time to write some code to transfer my old db to the new one
you really should use a real db just so you know
ik, many people say that but i would prefer this
@umbral zealot enmap is persistent right?
Don't go to MySQL, unless you have no other options.
yes
yes, if given a name.
use enmap
ill think on it
why use enmap when you can use json kappa
because I was told to tell people to use enmap

ive really got to fix my json database
add queues and shit
so its not fucking stupid
jason.db
yes
lmao you too 
wanna add queues for me? @mellow kelp
I made it as a joke but yes
ive got to maintain it now
erwin found a way to break it
looks like a good challenge 
bro i broke mine by getting 100 guilds in 36 hours
only 1 im allowing is atomic write
k
thats if the queue system doesn't work
well
work well
@opal plank how should a queue system be implemented?
ok
my personal thinking is i make a global array and the write waits till its the top of the array and then writes and removes from the array
what kind of queueing you do need?
nah it needs to be more advanced than a simple array
json db
try to lower the writes
because if you're splitting into many files, you dont need queueing, unless you need to write to the exact same file at the same time, which you can mitigate by using writeFileSync
m whelp i just gave away what i was going to do so 
1 file tho for me
writeFileSync is blocking but since the files are small, the amount of block time will be pretty much irrelevant
mka imma trust you on that, mainly because im too lazy to implement what i just said
iirc I don't use writeFIleSync

do like me and split the file way up
/**
* Write to the DB
* @param data Data to be written
* @returns {boolean} success
*/
_write(data) {
// Check if "data" is the wrong data type
if (data === undefined) throw new Error('Tried to write to DB without any data');
if (!['object', 'array'].includes(typeof data)) throw new TypeError('data must be of type "object" or "array"');
// Write to "tmp/data.json" and rename file. Throws if errors
try {
data = JSON.stringify(data);
fs.writeFileSync(this._tmpFilePath, data, 'utf8');
fs.renameSync(this._tmpFilePath, this.path);
return true;
} catch (err) {
throw new Error('An error occured when writing to the DB:\n' + err);
}
}```
dunno, i hate queue systems
I do
rip, I need a way to not corrupt files
also if you implement the "write temp then rename" you also dont need queueing nor sync, so you get non-blocking as well, best of both worlds
don't just want to rely on blocking
idk man, erwin made errors
https://million.is-a.computer/files/nFDnhoBG2RBatAyE.png what the fuck
hmmm yes
jar
erwin made errors?
yes
what errors did i make?
you broke my code
@lyric mountain it was me being stupid and forgot a ssh tunnel with a fucked up port
when you were testing my package btw
so I need to fix
lmao
idk how tho since it works on my computer
the thing is
I know a fix but you may not like it
exactly what failed
?
i dont recall it either, you'd have to check what i sent before
i usually send enough info to replicate it
iirc no perms to write file happened
btw you're always using the same name for the temp file?
probably
the name of the temp file should be randomized
which do be dumb
always random
thank you discord
LOL
ptb?
canary > prototype > discord
THANK YOU DISCORD
65% of my CPU going to discord
what cpu?
why don't you use the app?
lazyness
all my chats and social media are always on the browser
makes sense
trk var mฤฑ
how long does it take for a discord bot to be verified?
1-2 weeks
oh
huh ?
this
what does that have to do with anything
Unhandled promise rejection: Error: 502 Bad Gateway this means what?
Bad gateway intent error
how do i fix?
Dunno
agreed, except i use the app on my Linux machine cuz sudo pacman -S discord is too easy
[2021-02-04 12:36:51.710]: ERROR Unable to load command test2.js: Error: Cannot find module '.C:\Users\Administrator\Desktop\betarpbot2\commands\Administration../../dispatch\test2.js'
Require stack:
- C:\Users\Administrator\Desktop\betarpbot2\base\Bot.js
- C:\Users\Administrator\Desktop\betarpbot2\rp.js
@quartz kindle This is my current error.
ah yes windows
winshit 10
Yeah but it's a really big number
why 53 tho
i find the lack of a power of 2 disturbing
i mean 53
o
2 to the power of 53
that's also the max safe integer
why is vs code going brrrrrrrrrrrrrr
Number.MAX_SAFE_INTEGER is 2 ** 53
wut
json go brrr
I didn't know there was
53 to the power of 2 !== 2 to the power of 53 ๐
meth
^^^
meth class
kekw
ex dee
ex deen't
n'tn't
your path is broken
you have administration../
instead of administration/../
Tim
you're probably using string concatenation
how can I check if an array is 1, 2, 3, 4, 5
use path.join()
path.resolve > *
yeah or resolve
idk how to use them well tbh
if an array is exactly 1,2,3,4,5 or if an array contains the sequence 1,2,3,4,5
<Array>.every((e, i) => e === i + 1)
is there a modmail in this serever
nope
why are you looking for a server which has a modmail?
spam 
i need to show something
to my friend
please
anyone know
send the lin kto my dms
the link of the srver
server
am i doing my get wrong?
are you doing a class?
array.join().includes("1,2,3,4,5") xd
yes
getters and setters are like functions but
I'm getting : Can't Read Roles Of Undefined
https://pastebin.com/d6415Bcv
Am I doing anything wrong ?
(Javascript)
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
you don't call them
so do i include the ()?
a proper for loop will probably be faster, but that way is much easier
yea
mka
its like big boy lines
there now vscode has shut
wonderful
wait im big brain
I think
if lines = array.length + 3
then it has to be in order ish
actually no
idk

is the array always sorted
just curious
im new to fs stuff
is there like a way you can get an array of all the files in a dir?
(dont put too much effort into it, just give me something to look up)
fs.readdir / fs.readdirSync / fs.promises.readdir
tysm ill look into that
idk
lol
ig I just stopped it then
but the default is js // Autorole autorole: { enabled: false, role: null }, // Auto moderation automod: { enabled: false, ignored: [] },
so what am i doing wrong?
I'm getting : Can't Read Roles Of Undefined
https://pastebin.com/d6415Bcv
Am I doing anything wrong ?
(Javascript)
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
HALP
have you tried reading the error
no
there is no guild in guildMemberAdd
short for directory entry, class in the fs namespace
Directory Entries (The GNU C Library)
Ah. That makes a lot more sense
hellp how i can send to user just vote in dm using top.gg/sdk pls help me ?
Almost to 10000 lines of my rewrite
@quartz kindle I got it! I got it working!
not sure what your asking
try calm down and ask again
*.java
All java files
lol
how i can send thanks msg to user voted for bot
omg! me too! 10k line rewrite ๐
don't call me out like that ๐ญ
support pls
whelp on the vote event (not sure how that works) you would make sure that you have a mutuall server and then send
#support does exist.
this is a #topgg-api question actually
close enough
did you check the examples?
did you try the code from there?
no
then i would start with that and ask if you have any questions
Don't you need to use the system directive or something in order to use Console.WriteLine()?
not if you're using the namespace iirc
yes
but i include the namespace and a ton of other ones when processing the script
o
I cannot start my shard again. I get this error.
Anyone has an idea=
I used for index2 the most simple script..
youve been ratelimited
will that go over after a certain time?
iirc, its in the headers when the ratelimit expires.
Hihi! I was told to come here for advanced markdown development--the markdown cheat-sheet provided to me in support isn't really what I need. I'm trying to find ways to have automatic counters, coloured/animated backgrounds, etc. For example:
https://top.gg/bot/649604306596528138
or even something as simple as
https://top.gg/bot/646937666251915264
markdown doesnt do animations counters or anything like that
its just markdown
your looking for css
I was wondering the way I could implement a live web canvas editing system to allow customization of my welcome image (just like the one from https://probot.io). Anyone got an idea how I could do that ?
sure, just save any assets/config to a db, and use them when needed.
use one of the many canvas frameworks out there. plenty of them let you define objects and move/resize them around
save the final resulting image in your server
and have your bot use that
I just found konvajs, sounds a good option to me
it has a drag and drop method etc.
guess I'll be using this
thanks alot
when i try to print with color
?[31mhello?[0m ?[32mworld?[0m
why?
print(colored('hello', 'red'), colored('world', 'green'))
@delicate zephyr yo you here rn?
Actually wait I will just ask
So if I want to redirect on a app.get() to a localhost on the server (not the user's pc) can I do redirect('localhost:3029') or will that not work?
I don't think you can do that
Is there a way to redirect to a localhost on the server
trying to get it to redirect to my mongo db link
you could use nginx
just /mongodb goes to the correct link
here is luke to correct me
Proxy pass with Apache
NGINX has proxy pass
Google time
pog
Can I get the docs for discord.py the top.gg ones
anyone help me with colored text?
Why would your Nginx listen to 27017
27017 isnt that commonly used for mongo/other db's
Yers
Yes
That's what I am using it for
nginx is redirecting the port to 27017 then I am pulling my mongo db from it
because that is what port mongo is on
couldn't you just do that without a proxy
Could someone explain to me why this works in @commands.command() but does this in @tasks.loop()? Unhandled exception in internal background task 'weatherembed_loop'. Traceback (most recent call last): File "/home/pi/.local/lib/python3.8/site-packages/discord/ext/tasks/__init__.py", line 101, in _loop await self.coro(*args, **kwargs) File "/home/pi/Documents/Room_Sealer/cogs/room-sealer-weather.py", line 84, in weatherembed_loop alerts = res3['alerts'] if res3['alerts'] else [{'title': 'None'}] KeyError: 'alerts'
SyntaxError: Unexpected string in JSON at position 186
Im trying to launch it with nodemon so i can have it restart as changes are made
your json file is broken
@slender thistle
Reeeeeeeeeeeee
Wtf is this and those nested context managers lmao
Don't question it
LET ME SATISFY MY OCD!!! TwT
Alerts dosent exist
Lemme get you the API data
{'country_code': 'US', 'lon': -73.71, 'timezone': 'America/New_York', 'lat': 40.72, 'alerts': [], 'city_name': 'Floral Park', 'state_code': 'NY'}
Interesting
Now idk if its cuz of an empty list lemme debug
nah thats not it, are you sure the api is returning that data?
Is it making a request every loop of the task?
A lot of factors too why it dosent exist
wait is that a ternary operator?
client.getAllGuild = async () => {
const req = await client.shard.fetchClientValues('guilds.cache')
return req.array()
}
How can i get an array from all server guilds?
?
i mean
is that really how python does ternary operators
thingIfTrue if condition else thingIfFalse?
ternary operators in python are like
"Owner" if ctx.guild.owner else "Not Owner"
ew
weird
Like a usecase would be
#some userinfo badge
staff = ":somestaffemoji:" if member.public_flags.staff else " "```

Yes
and you are sure it's returning it?
try printing it when you make the req
One message removed from a suspended account.
One message removed from a suspended account.

For java I just compile the code, run it in background and return the output
One message removed from a suspended account.
One message removed from a suspended account.
See how to compile during runtime, I mean, if there are IDEs made in C# then it can compile during runtime
has anyone looked at implementing the whole / commands thing with the new update yet?
You mean the slash commands?
yeah
They're kinda superfluous actually
But yeah, some people did migrate to them here
yeah thought about adding a couple commands to mine
like /help /invite and like /report
Note that it'll be a mess if more than one bot uses it
Because they will all appear together
don't they separate?
it categorizes them i think
Like
/help
/help
/help
https://million.is-a.computer/files/5ZvysRE7Cr7hMKcE.png different bots get different categories
That if you click, if you type it manually it's a mess
https://share.tetramedia.us/sAha5/zaXOhOVA88.png just found one
agreed
https://share.tetramedia.us/sAha5/CinitONA83.png but also shows the icon next to it
Still a mess
yeah
I might implement it for mine if @slim heart adds it to his basic command handler like a smart dev should

but he won't because he sucks
lmao
const blacklistedUsers = new Set()
module.exports = {
name: 'blacklist',
description: 'Blacklists a user from WaffleBot commands',
args: true,
staffOnly: true,
CanMentionRole: false,
execute(message, args) {
const userMention = message.mentions.users.first()
if(blacklistedUsers.has(userMention.id)) {
blacklistedUsers.delete(userMention.id)
message.channel.send(`User ${userMention.id} removed from blacklist.`)
} else {
blacklistedUsers.add(userMention.id)
message.channel.send(`User ${userMention} added to blacklist`)
}
},
}
``` How would I be able to read the IDs in blacklistedUsers in my main index.js file?
no not really
the way you are doing this isn't very good
it would be easier to do message.client.blacklistedUsers = new Set() but you need to deal with not creating a new set every command
also, a Set is not persistant
every time the bot restarts, the set would reset
assuming you aren't resetting it every time you run the command
Yeah, I'm fine with it resetting. I'd rather not deal with any sort of database storage solutions as this is just a bot for my friends and I to use and mess around with
but it doesn't work that way either
you're creating a new set every time the command is executed
Oh
absolutely no data is being saved, not even between commands
I just split my bot into multiple command files so I'm new to this lol
yea its best to use message.client.userBlacklist or something similar
^
in the index.js you can <client>.userBlacklist = new Set()
then you should be able to access it from any command using message.client.userBlacklist
Oh okay, thanks!
what happens if I reach 2500 guilds without sharding? will the invites get temporary blocked as before verification?
iirc your bot won't receive the servers
pretty sure the bot wont even start
i thought it errored requests for more than 2500 servers
perhaps
๐คทโโ๏ธ
anyways a big bad bad huh
I started today when it reached 2k, it gained 200 more since then and I'm lost af 
what library do you use?
most have built in sharding iirc
like easy to use at least
ik djs does
discordjs, I got the sharding manager working, but I have pieces of code like setLeaderboards, which runs like 1000db reads almost at once each hour and I just can't make it run from one shard
what db do you use?
is there a reason you need to do that many reads?
all my leaderboard stuff i would do in one request, and then cache it.
I also do it in one request, granted its a find({ guildID }) using mongoose and mongodb
@crimson vapor you
cringe trying to slut shame me
how do i do sharding
it's vanilla MongoDB
wait, am I misunderstanding the definition of read? one request = one read?
I thought each document I get even as part of one query counts as read
one request is one read
aka if I make a find request and limit it with 50 returns its 50 reads?

which you probably shouldnt be doing
well, good to know ๐ leaderboards aren't the case where I'm looping, it's one find request ๐
mongodb at full scale can handle millions of requests an hour iirc.
full scale !== 1 process on a 2 core vps
full scale is like a full dedi just for the db
well, typically the main slowdown on mongo is memory isnt it ๐
that sounds about right, I was adjusting some old attributes on a 4k documents collection and monitoring showed 12r/s
you could have one thread and 4+gb and still handle many hundreds of thousands of requests an hour.
on properly indexed data of course.
actually bs what I wrote, it had to be a longterm chart or smth
pretty much what i use it for currently, just a quick throw in rather than spending the time to use sql.
depends on the type of data, a lot of stuff is moving away from sql from what ive heard.
interesting https://woo.pics/images/c3389b7e1a.png
`@client.event
async def on_message(msg):
try:
if msg.mentions[0] == client.user:
with open("prefixes.jsno", "r") as f:
prefixes = json.load(f)
pre = prefixes[str(message.guild.id)]
await msg.channel.send(f"My prefix for this server is {pre}")`
error :-
prefixes = json.load(f) ^ IndentationError: expected an indented block
what to correct there ?
looks to me like your formatting maybe wrong
you didn't indent properly
oh
gotta love file type acronyms
YAML - YAML Ain't Markup Language
TOML - Tom's Obvious, Minimal Languag
ghost pings
FileNotFoundError: [Errno 2] No such file or directory: 'easy.txt'``` in py
const members = await message.guild.members.fetch();
const memberlist = members.filter(x => x.user.flags != null).array();
for (let index = 0; index < memberlist.length; index++) {
const m = memberlist[index];
await m.user.fetchFlags().then((flags) => {
for (const flag of new UserFlags(flags)) {
console.log(`${m.user.id} ${flag}`)
}
});
}
This is only returning id of user with his flag, but i want to know how many user get a certain badge, how i can do that?
maybe it's in a different directory
nope
i just had mario flashbacks 
its in literally same
read the bitsets according to the discord api
does python read directories relative to the script or relative to the command's directory?
TOML - Tim's Obviously not a Marketing Language
but it's GuildMember and they doesn't have bitfield
flags: [UserFlags],
also
.txt danger danger
name: 'memberinfo',
description: "COMMANDS!",
execute(message, args, Discord) {
const usernamemention = message.author.username();
const avatarmention = message.author.avatarURL();
const idmention = message.author.id();
const tagmention = message.author.tag();
const nicknamemention = guildMember.nickname();
const permmention = guildMember.permissions();
const lastmessagemention = message.author.lastMessage();
const Statusmessagemention = message.author.presence.status();
const infoembed = new Discord.MessageEmbed()
.setColor('RANDOM')
.setTitle(`**${usernamemention}'s Information**`)
.setAuthor(`${usernamemention}`, `${avatarmention}`, `${avatarmention}`)
.setDescription(`Every Bit Of Detail About <@${message.author.id}>!`)
.setThumbnail(`${avatarmention}`)
.addFields(
{name: '**Server Nickname:**', value: `**${nicknamemention}**`, inline: true},
{name: '**User Tag:**', value: `**${tagmention}**`, inline: true},
{name: '**User Id:**', value: `**${idmention}**`, inline: true},
{name: '**Status:**', value: `**${Statusmessagemention}**`, inline: true},
{name: '**Server Perms:**', value: `**${permmention}**`, inline: true},
{name: '**Last Message:**', value: `**${lastmessagemention}**`, inline: true},
)
.setImage(`${avatarmention}`)
.setTimestamp()
.setFooter('I Told You, Every Detail...', `${avatarmention}`);
message.channel.send(infoembed);
}
}```
Help
How Do i Make It A Function?
You don't
Or Fix
Remove ()
Ok
Remove from all your consts
kk
None of them are functions
What Abotu Avatar?
Yesh
lol
Ok Im Restarting The Debugger
New Error
;-;
How Do i Fix This?
Ok, lemme reword that question
Did u research about how javascript works or you're following a video/stackoverflow?
it might sound a bit rough, but try making simple applications before making bots



