#development
1 messages · Page 1737 of 1
It means the API request was canceled.
I think Discord.js will cancel a request after a certain period of inactivity.
Oki
How would i make a button on a website kick a member of my server?
Im very confused
bind the buttom to the user object, when pressed send a request to the bot to make it kick the user by id
How can I turn an iterator to a slice in rust
this but keep in mind to keep the interaction locked behind your site's api
so you'd have something like
Figured it out
client makes DELETE request to your API (i.e. DELETE /api/kick/:guildId/:userId) -> your API extracts the user id and the guild id -> your API makes a request to discord with those params -> your API returns the status of the discord request
no errors, it just doesn't register the &joinevent command when &startevent rps is run
Nothing at all? Not even if you print something at the very start of the command?
uhh
let me try that
hold on
@dusky sundial not even when I print something
hm
also im making this joke command to kick this one user in the server. idk how to make it only kick him
const data = fs.readFileSync('unti.json');
const user = JSON.parse(data);
await user.kick();
thats part of the code
in the json
{
"user": "196381315967352834"
}
await client.send_message(user, "Please select R, P, or S.")outdated code, this was changed 3 years agocontext.send(f"{user} lost due to disqualification! Game Over!")this isnt awaitedtime.sleep(1)this will stop the entire bot not just the command, you need to useawait asyncio.sleep(n)- JSON is not meant to be used like this, please dont use it like a db, use SQLite at the least
@subtle river
oh and also response = client.wait_for("I'm waiting!", check=check) isnt awaited
@modest maple how do I do #1 in the newest version? I got it from stackexchange
await context.send
dont use stack overflow or anything similar for bots
yes and?
if you're trying to dm someone it's await user.send
what's happening with your command is you run the first command and then deadlock your bot
I'm still getting deadlocked @modest maple
probably
That wont work
i got this now
let member = message.guild.members.fetch("196381315967352834");
member.kick().then((member) => {
const embed = new MessageEmbed()
.setTitle('Kick Unti')
.setDescription(`unti was kicked.`)
.addField('Member', message.member, true)
.setFooter('funny kick unti')
.setTimestamp()
.setColor(message.guild.me.displayHexColor);
message.channel.send(embed);
})
"stack": "TypeError: member.kick is not a function
fetch is a promise
Await it
still doesnt work
await message.guild.members.fetch(......)?
"stack": "ReferenceError: member is not defined
await message.guild.members.fetch("196381315967352834");
member.kick().then((members) => {
const embed = new MessageEmbed()
.setTitle('Kick Unti')
.setDescription(`unti was kicked.`)
.addField('Member', message.member, true)
.setFooter('funny kick unti')
.setTimestamp()
.setColor(message.guild.me.displayHexColor);
message.channel.send(embed);
well you didn't define member
you're doing the fetch but aren't storing it anywhere
so, it doesn't exist

so use cache?
you really need to learn js, or rather how to think logically
Why are you trying to send message.member, an obj, as a field?
And message.member will be the author of the kick command, not the user kicked
the whole point of the command is a joke
its supposed to kick this 1 user in the server
when anyone runs it
addField implicitly converts it to a string and iirc a GuildMember has a tostring override
Ahhhh
The member field will be giving the author, not the kicked user
yes
ik
Im trying to make it kick this one member
wait i fixed it
thank you all for the help tho
that sounds like something id do 10 years ago
but the way they thought thats user object ahahah
That makes it even worse, but already using JSON is such a faux pas
As a database it's fucking horrible.
oh yeah
Oh you're being sarcastic. got it.
yeh anyway
at some point i used ini as database
cant speak much here personally ahah
why would u do that
mongodb did it
if you feel old fashioned use sqlite
you can do json files as storage, but noobs don't do it right. They're not doing atomic reads and writes and conflict resolutions.
nedb does it fine. I've seen some modules that did it using external fs modules that properly do atomic IO actions. But most... they just "fs.readfile" like cavemen trying to rub 2 sticks together next to a natural gas vent.
but why would you need to use json as storage out of all the options
"it's easier"
"I just want to learn"
"I don't understand sql"
"Databases are too complicated"
"I'm just testing!"
I didnt mean to type here 
you owe me 9 seconds
json db is bad mky, if someone needs help with a json db, then they have other priorities they should be taking on first 👀
I've got a question with requests. How do I make a body? I have this code
r = requests.get(
f"https://client.sweplox.net/api/userinfo?id={member.id}", headers=headers_dict)
data = r.json()
requests.post(
f"https://client.sweplox.net/api/setresources?id={member.id}?ram={amt}", headers=headers_dict)
await ctx.send(f"Added `{amt}` ram to **{member}**")
But it skips the requests.post part. I also heard that I need a "body" but I'm not sure how to do that.
I'd wager by adding body=yourbodyhere in your post request?
just like you have the headers there
so do i pass it as a parameter instead?
you pass it exactly like the headers
body = {"id": member.id, "ram": amt}?
Pretty sure it'll have to be a string though
No the entire body will have to be a string and not an object, I'm sure. unless python does that conversion automatically
i guess so
requests.post(
f"https://client.sweplox.net/api/setresources", body={"id": str(member.id), "ram": str(amt)}, headers=headers_dict)
lemme check
requests.post(
f"https://client.sweplox.net/api/setresources", json={"id": str(member.id), "ram": str(amt)}, headers=headers_dict)
It still does nothing and just sends the message
What do you mean "just sends the message"
await ctx.send(f"Added {amt} ram to {member}")
it only sends this
but it doesnt update the data
Ah well I don't actually know python so maybe it's a specific python thing with strings.
¯_(ツ)_/¯
i don't know python that well either but what do you get when you log r, data, and the result of the post?
My guess is you set your views path somewhere else than where you're trying to render from
Hello, may I get some feedback on my latest project? https://ad.aakhilv.me/
A free advertising system where you can get your site advertised by advertising other sites using a small ad in the corner.

i don't see where you set your view paths, for example, app.set('views', '/path/to/views');
wdym?
that i don't know, i use pug template engine, similar to ejs i think, i haven't used ejs myself
and i set the views path
hm
does views even depend on the renderer?
Idk, I didn't set it when I ran it on my PC and it worked fine but on my vps it says fuck you
guessing its just linux vs windows?
try using ./ and ../ and whatnot rather than resolving a path?
express is looking here already, https://i.woo.pics/0a37dfe50f.webp
well nice woopics
doing a great job
only 10 seconds to load
Nice
I fixed it
Just by moving all the fucking pages to a view folder
cuz express won't let me do anything else
thats where they are supposed to be anyway when using ejs
or you can set it with this
so i messed something simple up in my code I think but i have yet to sleep so I don't see my issue here:
@commands.command()
async def lockall(self, ctx, channel : discord.TextChannel, time : str, *args):
if not isinstance(ctx.channel, discord.TextChannel):
return
if not ctx.author.guild_permissions.administrator:
return
if ctx.guild.id in self.locked_channels:
await self.bot.message_handler.send_message(ctx.channel, 'lockall_already', author=ctx.author)
return
time = time.lower()
if not time[-1:] in Moderation.MUTE_MULTIPLIERS:
await self.bot.message_handler.send_message(ctx.channel, 'lockall_badtime', user=member.mention, author=ctx.author)
return
try:
time_converted = int(time[:-1])
except ValueError:
await self.bot.message_handler.send_message(ctx.channel, 'lockall_invalid_number', author=ctx.author)
return
time_converted = time_converted * (Moderation.MUTE_MULTIPLIERS[time[-1:]])
everyone_role_perms = ctx.guild.default_role.permissions
everyone_role_perms.send_messages = False
await ctx.guild.default_role.edit(permissions=everyone_role_perms)
await self.add_locked_channel(ctx.guild, channel, time_converted)
await self.bot.message_handler.send_message(ctx.channel, 'lockall_success', author=ctx.author, time=time)
await self.bot.message_handler.send_message(channel, 'lockall_start', reason= ' '.join(args))
if anyone can see what i messed up lmk
pretty much lockall should only have a time value needed not a [Channel] & [Reason]
thanks ❤️
(I think its in the beginning but brain is dead atm)
Please remove the red background.
For steps 1 and 2, you should state that the tag needs to be in the tree (e.g. <head>) as opposed to words like "between" and "before the closing body tag.
http://img.extreme-is.me/h5EQwxwdD8YhQP26 for some reason when I attempt to get a guild?
discord.js client base with kurasuta sharding manager
youre trying to transfer a full guild object
if youre using kurasut in worker mode, which i believe is the default, workers use structured cloning algorithm to serialize objects, which is more powerful than json but has different behavior
its the bla man
iirc json simply ignores or stringifies functions, but structured cloning errors out on functions
so what should I do insteda?
dont transfer the full object
create a normal object with the propeties you want from that guild
can i ask if someone has some improvement ideas for my logo?
noone said no, so i think its a yes 😄
Twirp?
looks good?
Yeah
Looks good
Though more spacing between the bird and the p would look better
Actually, @quartz kindle... I am using the .toJSON() but I later on have to call roles#cache# in places from the guild object and I can't do that with toJSON() is there a work around for this?
Yeah, looks good
thx 🙂
Ah ok, thanks
Should I invert the colors? like make the red parts white and the white parts red?
I'd suggest you let it default to the background by applying no background color (usually white), or make it some cool color that won't hurt the eyes.
Ok, sure
I don't mind the inline code being in red like head
cool color gradients look good too imo
Like this?
Try allowing the text to default to its preferred color (e.g. black). And instead of surrounding the inline code with a red background, remove the background and make that text red
Ah ok
is anyone good with py.
when i do for exemple !give @eager lake 9999999 it does not say anything but when i do !give @eager lake it says you have to specify the amout of coins you want to give
how do i fix that
Hard to say without seeing your code
@dusky sundial here is my give command code its just the give that is the issue
now it gives this
There's still a return that isn't indented
now that stars an indent/undent game
what?
nvm it got under control

now it says i got this i was reformaint it like the video
i cant figure out how to get my top.gg widget to only show server count
everytime i change the size nothing happens
Do you know how python works?
can you get a users online status without the presence intent?
I got 2 bots a py experimental bot and a js one and idk much about py but thankfully my next class is python
For coding
try removing node_modules from your github because we don't need it. everytime you deploy your app to heroku, heroku will install all the modules in your package.json
oh, i don't think you can delete files through phone. need pc to delete all the node modules and commit it
I deleted directory
i didn't see engine there. try adding
"engines": {
"node": "14.15.1"
}
after dependencies
The await is outside of the async function, await can only work inside async functions
hi i am trying to get my bot back online, and i had help with it a few hours ago and it does not seem to be working, can someone help
Hi, how can i access the API in python so i can keep track of the number of votes of each person and when they can vote again ?
What's the problem
Why will it not go online
i cant get it online, i had the stuff right hours ago and it wont come online idk what i did wrong
i am doing node index but
PS C:\Users\hoove\Neos> node index
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'C:\Users\hoove\Neos\index'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
@deep mantle thats whats happeining
I'm a python coder I can't help you sorry
oh
What the error say quite clear though. It cannot find the index.js
You sure on right folder
it was working fine hours ago
can someone help me with this error
i don't get why it would just stop working
who can help me
plz
I want to put the message clearly
Try just putting one of those special quotes instead of 3
I dont think you can format the msg the way ur trying to using three of them
"\n"
for new line lol
duh
yes
in the string
"" is string
'' is character
`` is javascript hurts my head and java or any C language is better change my mind oh wait you cant
If I have an announce command, which posts announcements to the mentioned channel, would i need any permissions for that other than checking if the member can send messages in that channel
Finally got my bot online.
So I'm getting this error whenever someone reacts to the message in my reaction role command, how do i fix it? its working in my tester bot but not in my main bot :/, Here's the code where the error is coming : ```py
@client.event
async def on_raw_reaction_add(payload):
if payload.member.bot:
pass
else:
with open('reactrole.json') as react_file:
data = json.load(react_file)
for x in data:
if x['emoji'] == payload.emoji.name:
role = discord.utils.get(client.get_guild(
payload.guild_id).roles, id=x['role_id'])
await payload.member.add_roles(role)
@client.event
async def on_raw_reaction_remove(payload):
with open('reactrole.json') as react_file:
data = json.load(react_file)
for x in data:
if x['emoji'] == payload.emoji.name:
role = discord.utils.get(client.get_guild(
payload.guild_id).roles, id=x['role_id'])
await client.get_guild(payload.guild_id).get_member(payload.user_id).remove_roles(role)```
", ' and ` all delimit strings in JavaScript with ` allowing for template strings. Single quotes are used internally for most strings and only uses double quotes when a single quote is included in the string.
JS makes little distinction between string delimiters with ` being the only exception, leaving the quote choice to be user preference. Discriminating against user preference is what's disgusting.
Lol, what the point bashing other prefered languange of programming?
Maybe just want some heated argument ig
you should be putting that data in the .env file.
For future reference if something like that happens and you're certain you want that JSON in your code, you need to initialize it to a variable name
the .env file is where the bot token is
I use a json file
If you copy paste that into a json file and then require it in bot.js like this:
const { prefix } = require('JSON FILE')
Itll work
this is what the thing shows to do
{
"prefix": "!",
"token": "your-token-goes-here"
}
Yes, in another file
what another file
.
create config.json file
and put this
i did
const { prefix, token } = require('config.json');
You didn't. You put that inside the same file as your bot
well where does it go then
In a json file
i am using discord.js guide for it
put this on the config.json file
-
Create a file named
config.json -
Paste the following into the json file:
{
"prefix": "!",
"token": "YOUR TOKEN"
}
- In
bot.js, paste this at the top:
const { prefix, token } = require('config.json')
Whats a trailing comma
Can bash files use environment variables on replit?
For frameworks like react or nextjs, why do we need to specify a root element like,
<div id='root'></div>
why dont we just select the body element, this will save a extra div element too.
like this
ReactDOM.render(App, document.body);
lmao that card
no you cant. you have to do such things inside the broadcastEval
and only return the final result
why if I split some code into different folder why doesn't discord.js detect it
what does discord.js have to do with reading commands from folders
you don't tell your code to look for folders so it doesn't do that
lol
this would be a good time to stop trying to write code and start trying to understand the code you've copied
long desc
cant ping in footer?
nah
Is is possible to integrate a discord bot with statuspage.io so if the bot goes online it will show down time there?
i mean, they have an API so of course
what's your code
why are you using async but not awaiting ur promises
nvm
not await delete() to not block i guess
could it be that fetch is pulling from cache
lol
sec
it doesn't seem to be pulling from cache
oh
right
your problem is that, since you're not awaiting message.delete();
the code won't wait for it to complete
and it fetches the message that you're deleting with delete();
and passes it to bulkDelete
but at that point it doesn't exist anymore
so just await the message.delete();
don't think
Been playing around with a client implementation using Typescript / RxJS: https://github.com/tim-smart/droff
It is definitely lean and mean!
client.on('messageReactionAdd', (reaction, user) => {
if(user.id !== memberfirst){
return 0;
}
if (reaction.emoji.name === "\u0031\uFE0F\u20E3" && m[0] == easy.results[0].correct_answer){
message.channel.send("**Congratulations! You have answered this question right!**")
s.delete({ timeout: 5000 })
return 0;
}
else if (reaction.emoji.name === "\u0031\uFE0F\u20E3" && m[0] !== easy.results[0].correct_answer){
message.channel.send("**You have guessed wrong... sorry!**")
s.delete({ timeout: 5000 })
return 0;
}
if (reaction.emoji.name === "\u0032\uFE0F\u20E3" && m[1] == easy.results[0].correct_answer){
message.channel.send("**Congratulations! You have answered this question right!**")
s.delete({ timeout: 5000 })
return 0;
}
else if (reaction.emoji.name === "\u0032\uFE0F\u20E3" && m[1] !== easy.results[0].correct_answer){
message.channel.send("**You have guessed wrong... sorry!**")
s.delete({ timeout: 5000 })
return 0;
}
})```
does anyone know why my bot says "You have guessed wrong... sorry!" 2x after one answer?
while i just reacted to 1 emoji
please ping me if anyone knows what i am doing wrong here
"2x after one answer" - what does this mean?
also you dont require the elses, if you're immediately returning form the function
that code can be boiled down to 2-3 lines
Where can i view that?
const emojis = {"\u0031\uFE0F\u20E3": 0, "\u0032\uFE0F\u20E3": 1};
if (reaction.emoji.name in emojis && m[emojis[reaction.emoji.name]] === correct_answer) {
// Use answered correctly
} else {
// User did not answer correctly
}
nerd
lol
in quick.db, i use db.set to add items to user's inventories, how can i make that they could get more than one of the item's and that in the inventory it wont just be true or false, but the number of items
yah but i don't even get how this works tbh.
like why does it have : 0 and : 1 after it?
you asked that yesterday and I didn't understand what you asked, and i still don't understand what you're asking
Why not just put 1 instead of true? I feel like this is exceedingly straightforward
yes and then how can i see how many i got?
get the value
and if you want to add more items, then you need to get the current value, add 1, then set it back
to see if they got it or not i do: https://sourceb.in/NEdVNS889P
but i dont know how to make it to show the amount
db.get(`jet_${message.member.id}`)
This gets you the number
you can compare it with another number using normal math operations. >, <, >=. <=, etc
this is what happens with my current code
emojis is an object, \u0031\uFE0F\u20E3 is the unicode representation for 1️⃣ , so it's value is 0 (the first element in the array of answers), "\u0032\uFE0F\u20E3" is the unicode value for 2️⃣ , so it's index is 1 (second value in the array of answers).
This way by doing emojis[reaction.emoji.name you can get which answer they chose easily, and then compare it to the correct answer
hmm alright
i just figured that i can use a reaction collector instead of a messagereaction event
that will save me lots of codes
You can also use awaitReactions, probably the bast way to do it
hmm yeah
ty, worked, just 1 more thing
noice
What do you mean showing null
how can i make that if its null it will say 0
Oh maybe you need to add some parentheses to tell JS that it's name + (item or 0) instead of (name + item) or 0
basically just like math, there's order of operation in javascript
so you have to do stringinventory += name + (db get || 0)
naww
i have a code and i want to get the cmdUsage out of every command module but when i run this i just get undefined```js
const fs = require('fs').promises;
const path = require('path');
let cmdName = [];
let cmdModule = [];
module.exports = {
run: (client, message, args, getUserFromMention, Discord, logsID) => {
(async function registerCommands(dir = '../../commands') {
const files = await fs.readdir(path.join(__dirname, dir));
for(let file of files) {
const stat = await fs.lstat(path.join(__dirname, dir, file));
if(stat.isDirectory()) {
registerCommands(path.join(dir, file));
} else {
if(file.endsWith('.js')) {
cmdName.push(file.substring(0, file.indexOf('.js')));
cmdModule.push(require(path.join(__dirname, dir, file)));
console.log(cmdModule.cmdUsage);
}
}
}
})()
},
description: 'help command',
cmdUsage: 'help'
}```
wtf
var out = (stringInventory==0?null:stringInventory)
if stringinventory is 0 return null, otherwise return stringinventory
@rocky dagger probably because you're not declaring .cmdUsage anywhere.
Not that i can see at least lol
just console.log(cmdModule) and see what the possible properties are.
Sorry, i misunderstood the question
Just do:
if (stringInventory==null) stringInventory = 0;
I mean... the solution I gave was fine
what you're saying is seriously lame tbh 😛
I mean the code specifically
then i get cmdUsage as a element
Well, one: rude
Two: again, i misunderstood the question. Therefore your response didn't make sense.
Now it does, so i just look like a jackass.
Which is fine its my thing anyway. 💅
can you show one of your commands? like your ping command for example?
module.exports = {
run: async(client, message) => {
message.channel.send('Pong!');
},
description: 'ping command',
cmdUsage: 'ping'
}```
and how did you know i had a ping cmd?
because everyone has one
Ok well I don't see how this particular command would show undefined
are you sure you didn't forget to add cmdUsage to some other commands?
then i would have gotten an error
Depends. it could just literally show undefined in the output
because the command exists, but there would be no property called cmdUsage which would show undefined
Anyone has an idea of how to add permissions to my bot. I just created a bot for a server and they have an application system. They asked for a 'hold review' command and I created this ```js
client.on('message', message => {
let args = message.content.substring(prefix.length).split(" ");
switch (args[0]) {
case 'hold':
const holdapply = new Discord.MessageEmbed()
.setColor('#6700a3')
.setTitle("Apply held for review")
.addFields(
{ name: "\u200B", value: "**Thank you for your applying process**, your request has been held to the apps team, you'll get a response if you got accepted! If you didn't get a response by 12 hours, this means you have been denied." },
{ name: "\u200B", value: "*Please don't ask if you have been accepted or denied, this will decrease your chance of getting accepted.*" },
)
.setImage('https://cdn.discordapp.com/attachments/784821281883291651/840186989336723456/Held_for_review.png')
message.channel.send(holdapply);
break;
}
})
I even want it to lock the chat for @every0ne when the -hold command runs
Thank you man
https://srcb.in/sxeS8a7KiQ this is what i get if i log just cmdModule
Ok so... Where does it show undefined, exactly?
it happens when i log cmdModule.cmdUsage
But... I mean... ... that's just not possible 
wait
are you sure cmdModule isn't the ARRAY?
can you try logging just cmdModule[0] ?
Can anybody help?
DO I need the server intent
if I have a level bot, that gets user ids, server id's
?
Getting user and member data individually does not require member intents
What requires it is getting all members, or getting member events
Now, please note, Discord does NOT grant member intents for leaderboards.
so only getting the member and server ids and storing it on a computer, it is okay?
Yeah, sure, that's fine
okay
thanks
so I mean that, if somebody sends a message, then it writes into a document the server id, and if the person is not in the list, then adds it too.
it's fine, right?
Yep, that's how point bots usually work

I only store ids
and people can always ask me on the support server to remove them (idk is it makes sense)
if(db.fetch(`ph_${message.member.id}`, 5)) return message.channel.send("you already have a phone, you cant have 6")
its not working
i can buy only 1
and it sends it
ty but now i have another problem
if you could please not ping me for every problem that'd be great
I have a feeling fetch doesn't do a number comparison
I dunno, like, it feels like that isn't valid at all
So at this point I feel like you don't know JS and you're just mashing buttons
Error: SQLITE_ERROR: near "-": syntax error
11|app | Error: ENOENT: no such file or directory, open 'token.txt'
11|app | at Object.openSync (fs.js:462:3)
11|app | at Object.readFileSync (fs.js:364:35)
11|app | at Object.<anonymous> (/root/pokecards/src/app.js:10:12)
11|app | at Module._compile (internal/modules/cjs/loader.js:999:30)
11|app | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
11|app | at Module.load (internal/modules/cjs/loader.js:863:32)
11|app | at Function.Module._load (internal/modules/cjs/loader.js:708:14)
11|app | at Object.<anonymous> (/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js:33:23)
11|app | at Module._compile (internal/modules/cjs/loader.js:999:30)
11|app | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) {
11|app | errno: -2,
11|app | syscall: 'open',
11|app | code: 'ENOENT',
11|app | path: 'token.txt'
11|app | }
```umm how is this possible
i literally have the txt in a reachable place
and running it on vsc worked fine
but on my vps it doesn't .
then i just get { run: [AsyncFunction: run], description: 'Ban user', cmdUsage: 'ban <@user>' } multiple times when i just want ban <@user>
i figured it out
i just had to add .cmdUsage at the end of cmdModule.push(require(path.join(__dirname, dir, file)));
its still gross ¯_(ツ)_/¯
Oh yes because ```c
printf(($"Color "g", number1 "6d,", number2 "4zd,", hex "16r2d,", float "-d.2d,", unsigned value"-3d"."l$,
"red", 123456, 89, BIN 255, 3.14, 250));
looks **much** better than \`\` of course. And so does ```java
String sf3=String.format("value is %32.12f",32.33434);
Ah yes so much cleaner and readable! Love it. 
What the fuck lol
caveman concatenation way best /s
Just woke up anyone see anything wrong with my code I posted last night?
tbf, ```java
String str = "Hello %s, your balance is %s coins and %s gems".formatted(
user.getAsMention(),
NumberFormat.getCurrencyInstance().format(atm.getCoins()),
atm.getGems()
);
is a lot more readable than
```js
let str = `Hello ${user.getAsMention()}, your balance is ${NumberFormat.getCurrencyInstance().format(atm.getCoins())} coins and ${atm.getGems()} gems`;
I'd not say one is better than the other, it really depends on use-case
I finally got my school's internet password
I think it's basically personal preference, I really prefer JS template literals
I like both
Does a break; in switch statements act as a return?
return await send() (new line) break;
in a way, yes, but only for the case block
Oh, sweet.
return await send()
break;
Oh.
you dont need break if you return
you need break if you want to do something else after the switch
Oh, that makes sense.
switch (1) {
case 1: {
console.log("1");
},
case 2: {
console.log("2... this executes too if you don't put a break in the previous case!");
}
}
also return await is redundant, you dont need to await if you're returning
Alright, for sure. 👍
if(db.get(`ph_${message.member.id}`) === 5){ return message.channel.send("you already have a phone, you cant have 6")}
Thank you! 😊
I'm getting an error like this and part of me has too high latency do you have an idea?
i have 3200 server and 65 shard but im getting so much ratelimit. whats can i do ? ```
what
65 
guys i was try 3-4 shard
still too much
what kind of ratelimit?
they almost spamming..
because most ratelimits are local not global
using command i think
you cant fix rate limits with sharding lol
what command?
you're doing something very wrong
ye ...
yes, because you're suffocating so hard your poor vps that it's slowed down
do you have an idea @quartz kindle
still
you need to fix the source of the problem, not bottleneck your process
what command was causing the ratelimit?
what does it do?
i cant figure out which one because i didnt getting ratelimit every time
i just see in console the user aborted a request
which commands are causing the ratelimit
do you have any mass dm command?
well, first of all go back to 2 shards (or 3 because disc's recommended is 1500 sv/shard)
or something that sends a lot of messages?
these are against tos so could be an issue so Tim might be right if you do
i dont
i have code for dm but
its just sending 1 times
listen to the rateLimit event
ah
client.on("rateLimit", console.log)
^^
its daily rewards from webhook
nah, that's fine
whatdo you use to access your VM btw?
it doesn't happen too quickly to hit rtlimit
like putty, etc
openssh
you shouldn't be maxing your resources but try mobaxterm and do the remote monitoring it will help you

whats your discord.js version?
this is what mobaxterm shows
v12.5.3
what does that have to do with ratelimit?
and node v14.16.1
not saying for ratelimit he should do the ratelimit command/code for that
ratelimit command?
im saying for his server resources if he is capping them (shouldn't be though)
v12 doesnt support stage channels, so that why it happens. just disable the debug event, or make it not log if the debug message contains "unknown type"
this sorry code not command
Okay
Anyone know how I can make a domain like discord.example.com redirect to a discord invite on Cloudflare?
find the source
i have so much canvas
what language @next ferry

I messed something up here, it should only need a time and the command for ex. {prefix}lockall <time> but it is wanting a reason and a mentioned channel along with the time
@commands.command()
async def lockall(self, ctx, channel : discord.TextChannel, time : str, *args):
if not isinstance(ctx.channel, discord.TextChannel):
return
if not ctx.author.guild_permissions.administrator:
return
@lockall.error
async def lockall_error(self, ctx, error):
if not isinstance(ctx.channel, discord.TextChannel):
return
is that code yours?
yeah
really?
I can show the whole thing
its a bunch more lines
those are just the issue and error
at work rn xD
im a network specialist for a living so rn im trying to do Linux and than looking over at my python code going "can i just rm -rf" everything
so kinda at a code block I can't personally multitask or in this case "multicode"
async def lockall(self, ctx, channel : discord.TextChannel, time : str, *args):```
I believe its in here though just will need to look at again once home I guess
@crimson vapor .js
@crimson vapor .js
holaa
You asking for language
#general-int for spanish
yes so I can point you in the correct direction
Oh yeah
You can help me i want to do vote required condition but 😭
you can either fetch (they have a 15 min delay or something iirc) or you can setup a webserver using @quasi shale-gg/sdk and save votes to the database with a timestamp. Then you can fetch from the db where the timestamp is less than 12 hours ago and if its there they have voted
what the hell I literally typed @top-gg/sdk
poor top
what do you need
ice cream
same
how can I add it to my git repo? I am using a new computer with linux
And I already have a repo
I just want to update a file
😐
git remote add repoName https://github.com/username/repo.git
I need this remote thing then?
so If i already have it i need to do it?
y e s
If you already have the repo created
Then git pull then git push
yes
It says this now
do git pull
it says an error in the pull
can someone tell me all the commands i need to use?
please
i rlly need it
pls
and you're using linux??
i'm not english like i said
same
and I have no knowledge in git
so please help
I did it on my old pc
but for some reason it says errors
@crimson vapor or somebody help
well they have unrelated histories
are you trying to push a different repo to yours?
no
I have a folder
that i have my bot in
and I just want to update my bot on github
I did it a lot of times
I only used git commit -a -m "my message" and git pull
it worked
but now idk how to use
yikes
not working
nothing is working
bruh
please somebody a full guide
to which commands do i need to use
pls
after doing git pull origin master
I did everything listed here https://product.hubspot.com/blog/git-and-github-tutorial-for-beginners
please guys
at least in dm
but help me
I want to update it
if you already set it up then just do git pull -f
that looks like you either got an empty repo or u haven't set anything up
git pull origin master -f
since you said u didn't speak english, are you trying to send data to your repo, or to download data from it
I know this question sounds dumb but I need to ask
to send
ok
if you already made a commit u just have to push it
and since u already set the upstream to your repo you should be good to go
if u get anothet error then I can't help at all
because I'm busy doing some stuff
so as db.push puts the item(s) i buy from my bot’s shop in my inventory... and when i want to sell whatever items i want that i have in my inventory, would I use db.pull? ping me with reply!!!! (the db is the var that is used for the const to require the quick.db package btw),
or do i use db.subtract... the buy file for buying items uses db.push
sorry lol
I just typed in some random text here idk why
so:
I got this error @copper cradle
git push --set-upstream origin master
you don't have to use levelbot11
i tried origin too
git push -f --set-upstream origin master
run this exact command
ffs
this happened because u don't know what you're doing, you already have data in the repo, use the -f flag to force the push
OHH IT DID SOMETHING
you already uploaded data to that repo, which made your local files be behind the latest commit, it's asking you to update, you only had to run git pull and that's it
yet you somehow managed to end up running git pull --set-upstream...
no
the f forced the push
because you already had data in the repo
it made you loose whatever that data was
when you're bored so you make a calculator in react
cool
what's that?
for db like firestore, how do I limit the creation of documents using firebase functions
I just want restrict some documents to be created on a condition from a firebase function
Can someone tell me what I messed up here for my top.gg description? the pill badge should be in red since its a warning
<dl>
<dd><code>.test</code> ╿ testing the <strong>test</strong><span class="badge badge-pill badge-warning">1 Hour Cooldown</span></dd>
</dl>

I think it could be the dark vs light mode but unsure since you can't preview it
aaand we just got nuked
Our Server currently seems to be getting raided, sorry for any Inconveniences
A JSON DB is a JSON DB, they say...

I prefer josh
I should turn jasondb into a mongodb wrapper?
oh no
a JSON DB is a Jason DB
who is this Jason and why do people hate him as a database?
no clue
he seems like a great person
I was told he had short term memory loss tho
I don't understand
DO NOT USE THIS IT WAS MADE AS A JOKE
inb4 it has 100+ downloads
scrapers
Enable writing the file path, may cause random files to appear
lmao
@opal plank test please ty
I prefer
It isn't very fast and is very memory inefficient.
inb4 somebody makes a toml database
cargo init
Does anyone have a real and working Token Gen?
I need it to test out my friends bot.
It's an Anti-Nuke
token gen?
and he wants to see if it's bypassed by some nukers
mess
makes discord accounts for you
yeah don't do that
In order to test the bot we would need to manually make 500 accounts and join them on a server
self bots aren’t allowed
That's not a self bot
it is

A Token Gen isn't a self bot
It's not something linked to an account
You can possibly make it a self bot
Anyways i'm not tryna manually make 500 accounts and I don't have a 500 member server to dispose of...
It's ok if I can't get one
then you're willing to manually join 500 accounts and using them to test your bot, but you're not willing to create them
creating 500 accounts by using a bot is self botting & will get you banned off the platform
inb4 they say "that's not a bot"

A Token Gen is a software used in cmd to automatically create discord accounts and save A LOT of time. It's not ran through discord bots.
This has to do with discord API, so I should prob go there.
Wondered is some people here had one.
it’s ... still against ToS iirc. even if it’s not a bot account, that is the definition of self botting, as you’re creating a user account.
Ok
- That's called an account generator
- Making mass accounts will just get your ip banned
- It's still against discord tos
Imagine this, you own a live chat service, and some random dude just starts to create 500 accounts in less than a minute, if u see no problem in that then I won't even bother
ok
i used to have a friend that wrote self-bots and they could do token gens but bots can also do it had a friend that had his bot just connect to the clients and make them all do the same action
there is away around #2 but I won't state that in here (im not talkng vpn either)
I know the way
It's gonna be a pain just creating so many accounts manually
you can't even USE Them
hey sometimes maunal pays off in the end
yes you can
why would you need 500 accounts
they changed the library is all
do you realise that in order to actually get many accounts to join fast you need to use selfbots?
So you didn't read at all??
There's better ways to test your antispam/raid bot
you also realise that basically non of us need need that many accounts TO TEST A BOT
you need like 1 ALT MAX
hell i dont even need 1 alt
My friend developed an anti-nuke bot, we're gonna test how good it is against the best nukers.
Hold up guys stop getting triggered and let's help them instead
😐
I smell something sketchy behind all of this
You and your friend should know there are better ways to do this
What library are you using to make your bot?
than get a bunch of friend's alts to spam
making a anti-nuke bot by nuking 
There's some nuke bots that can ban 500 people a sec.
discord.js
Ok good
So instead of creating 500 accounts
All you need to do is to PRETEND they joined
Do you know what an anti-nuke is?
This ain't no anti-spam.
i literally have coded my bot as one...
using client.emit('guildMemberAdd', { some fake user here })
there. Problem solved.
You can now test the bot
ah my b i thought you said anti-spam
and not actually affect anything
put that shit in a for loop and you're good to go
yep
Add timeouts to simulate slower joins
use a for i loop to specify how many
you can also simulate the message event in the same way
super easy. barely an inconvenience.
I'm not simulating joins, I have to simulate bans, and good nuker bans a lot a second, and his bots reputation will be bad if it's bypassable.
Simulating one ban wont help either.
what do you mean "simulate bans"
how will it know when to simulate these bans
You can ban users as fast as the global rate limits will allow IIRC, which is like 50/s
You can't make this faster, so, what's the point of simulating this?
i actually never knew this I needed this info for years xD thanks
Because you're a filthy whitename, thanks
ffs
Here, I don't think ur understanding me. I need 500 accounts to serve as Server Members, my friend wants to see how good his bot can protect those server members and how fast it'll ban a good nuke bot. The nuke bot will be mass banning these accounts.
Bruh
What specifically do you think you need to test with a mass ban? What part of the mass ban requires actual banning to test?
tbh
print("Hello World!")
you only really need a handful of accounts
webhooks aren't even remotely close to being relevant to this conversation
I was joking 
and as far as massbans go as long as your in the ratelimit area your fine it also depends on how many resources it uses
webhooks can be used for testing anti spam maybe?
mine personally can massban according to the ratelimit in a 21k member server
yeah but this isn't what the conversation is about at the moment
yup
Nah, cuz when I ban a single person on my alt it bans my alt fast asf, but some bots, in the same time it took to ban one person on my alt it'd ban like 300, so i'm tryna test out how much bans a bot/user can get off before getting banned by my bot.
you don't need to worry about that
just literally ban them in a loop
discord.js will take care of ratelimits for you
It's all put in a bucket (queue) which properly handles ratelimit headers, so, you do NOT need to worry about banning a high number of members as fast as the ratelimits will allow
i personally use discord.py so unsure if there is something like that
this is not something Discord will ever block you from doing, assuming you're actually following ratelimit headers (which discord.js does)
client.on("guildBanAdd", async (guild, member) => {
const log = await guild
.fetchAuditLogs({
type: "MEMBER_BAN"
})
.then(audit => audit.entries.first());
const user = log.executor
if (user.id === guild.owner.id) return;
if (user.id === client.user.id) return;
let whitelist = db.get(`whitelist_${guild.id}`)
if (whitelist && whitelist.find(x => x.user === user.id)) {
return;
}
guild.members.ban(user.id, { reason: 'Xyber| banned a member' })
})
Here's my event for banning, some bots can bypass this.
Well yeah that's actually a bit your fault
because of your awaiting of the audit logs
¯_(ツ)_/¯
You're slowing this down because of that query
if bots can bypass might also be their role being above that bot but check what Evie said first
Hey I know that free vps are not good but I can't pay for the good ones so can y'all suggest any? Except Heroku please
So instead of that, you might want to consider having some sort of in-memory structure like a Map, which holds the bans on each guild in the last X seconds, to know if someone has banned recently. This will be many times faster than relying on the audit logs
There are no good free VPS for bots, period.
yeah
there are cheap good ones just gotta find them
lemme send you something helpful
don't buy those cheap and shady ones though
or those so called "panels"
nah I can't buy anyways so :/
not if you do what I do owning a VPN company
don't ever buy those
Heroku can't save data and is complicated (and also requires CC)
Glitch bans you
Repl can be banned by Discord and is somewhat unstable
AWS and Google require CC
etc.
There's no good ones
I have went through probably 200+ providers
Why a VPN
different datacenters mainly
Hmm yes, I'm using heroku rn
but also the backbone structures
@umbral zealot Fixed
ok whatever bye
like OVH for example have a UDP vacuum
Repl can be banned by Discord and is somewhat unstable?
Well yes, repl is unstable
ip bans affect you
Does anyone know how to set a guilds vanity URL with a bot in djs?
oh yeah
personally i use AWS due to scalability but yeah you need a CC
Oh, I'm 16 so can't get a CC rn
This isn't how to set it
also they are dynamic servers which is a somewhat newer technology
set it? I don't think you can
Yeah, we can't
I don't think bots can change the vanity URLs at all
Some other anti-nuker does it
ok and... ?
are you just re-doing this entire anti-nuker exactly detail-for-detail?
what's the point?
smh
No?
Glitch bans you? What-





