#development
1 messages · Page 1601 of 1
you know when i said clustering for the sake of clustering is a bad idea 🤣
welcome to just the start of why
well then what can i do?
Clustering is scary tho
only about 1-2% of all bots on discord even need clustering ever
that's why I don't want to start clustering mine for now 
I really don't think 20k is enough to cluster
50k?
well that point you'll likely be more experienced with python and understand how to set it up
@slim heart when did u start clustering?
20k is pretty high depending on usage
okay
if you have presence enabled as a intent you'll generally need to start by then unless you have a high clockspeed
ok so, is there a way to align this?
why?
I don't have the presence intent yet personally
What ever language you're using should have support for string formatting and some form of padding
Discord declined my intent request
a lot of cache?
it's good if you can get the presence intent tho
because presence makes up about 90% of all the websocket events you get
Spooderfy went from taking up about 50% cpu usage on a 8 core to 5% when we cut presence 
bro ngl i wouldnt worry about it till you actually need it
chance are you're never going to need it
thats just a reality
If you dont need presence then its pretty pointless
Spotfiy's old code bad without presence
which imo a majority of bots dont need presences
very few need it
I mean you can cache/chunk your members as how it was previously
before the indents update
you can do that without presence
not really
Mmm yes really
ok ty
so im trying to do ipc
NameError: name 'client' is not defined```
and im getting this erorr
client is not defined 
lib?
no clue
discord.ext.ipc
well we cant guess your error
ik ik
like what ckuebt us ut>
we cant guess your code
is it the bot client or class?
https://github.com/Ext-Creators/discord-ext-ipc/blob/master/examples/cog_based_ipc/bot.py in the docs
🌐 A discord.py extension for inter-process communication. - Ext-Creators/discord-ext-ipc
it says my_bot
but mybot is the bot client and class
ye bot client
I was referring to this
Why does on_ready take so long to fire?
As part of the API change regarding intents, Discord also changed how members are loaded in the beginning. Originally the library could request 75 guilds at once and only request members from guilds that have the Guild.large attribute set to True. With the new intent changes, Discord mandates that we can only send 1 guild per request. This causes a 75x slowdown which is further compounded by the fact that all guilds, not just large guilds are being requested.
There are a few solutions to fix this.
The first solution is to request the privileged presences intent along with the privileged members intent and enable both of them. This allows the initial member list to contain online members just like the old gateway. Note that we’re still limited to 1 guild per request but the number of guilds we request is significantly reduced.
ah yeah
you cant get a similar system though now we can manually control the chunking
in some ways its a bit nicer because you can lazily chunk members
The upvote webhook thingy is still giving me a 500 error
@modest maple
class Bot(commands.AutoShardedBot):
def __init__(self):
self.ipc = ipc.Server(self, secret_key="ipc key")
super().__init__(command_prefix = prefix, shard_count = shard_count, shard_ids=shards_to_run, owner_ids=OWNER_IDS, help_command=None, activity=discord.Activity(type=discord.ActivityType.playing, name=f".help | bot website"), intents=discord.Intents.all())
...
if __name__== "__main__":
client.ipc.start()
client = Bot()
client.run("1.0.0", "token")```
this is the code
from discord.ext import commands, ipc relevant imports
okay so where do you plan on getting client from before you define it 
oh lol
this is what happens when you copy & paste code
how couldn't you see that was the problem
no this is parts of my code
I know
the point he's making is that its very obviously just copied from the example before you even attempted to understand it
i understood it
i just cant get it to work?


you're trying to acess client before defining it
check the code inside that if statement

( ´・・)ノ(._.`)
one a question
where i put max uses at this
msg.react('✔')
msg.react('❌')
msg.awaitReactions((reaction, user) =>{
if(message.author.id !== user.id) return;
if(reaction.emoji.name === '❌'){
msg.edit(notlike)
}
if(reaction.emoji.name === '✔'){
message.channel.send('Im glad you like this meme')
}
max uses?
Question: my bot doesn't have presence perms. Can I get an un-cached user's username from the API by doing client.users.fetch("USER_ID") instead of getting it from my database? If so, the only drawback of doing this is if that user doesn't have any mutual servers with my bot, the bot won't be able to fetch the username?
I could be completely wrong in this, but I think fetch is an API call so it should be fine. Just make sure to not use it too often
users.fetch should be able to get that information even if they’re not in the guild
Mine doesn’t have presence intents but it was able to get this
(Your user ID)

My only worry is hitting the API so often
How often are you doing it?
It's probably not too bad tbh. Every time a user calls their bot profile.
The profile command isn't in my top 10 most-used commands so should be ok
Lol I've been storing usernames in my db since October to be able to look them up 

😬

If you want to be really safe you could implement some limit. But you should be fine :)
const express = require("express")
const bodyParser = require("body-parser")
// Initialize express and define a port
const app = express()
const PORT = 3000
// Tell express to use body-parser's JSON parsing
app.use(bodyParser.json())
app.post("/", (req, res) => {
if(req.headers.authorization == "peepee") {
message.channel.send("Request recieved!");
}
console.log(req)
console.log(req.body) // Call your action on the request here
res.status(200).end() // Responding is important
})
// Start express on the defined port
app.listen(PORT, () => console.log(`🚀 Server running on port ${PORT}`))```
Hey could someone take a look as to why my webserver isn't recieving any post requests? Thanks :)
I tried using an API tester online and it worked when I pointed it to my webserver so not sure why it's not working with top.gg
#site-status message
This might have something to do with it? Perhaps
hmm maybe, i usually use the API to poll for votes and it went down today
but i tried using webhooks earlier, same issue
try using apitester to send a post request
so probably not topgg
I did, it worked
so it's not an issue on ur side
does the code look okay?
idk, but if u did receive apitester you're fine
yeah?
weird...
why is that weird
how would i have my bot send a message when someone votes?
rookie numbers
my command call logs db is 1.5 million rows 😂
Oh nice
14 mil in db
lmao
lol
Why do you store them?
identification
Why not use fetch?
Ah
my bot works on both platforms
well, one of them at least
twitch doesnt have any sort of user info
I have a question, I need to make a "reset command" lets say. I want to change everyone's x variable to 0. This is like 100ish users and would probably grow more, so should I just use a for loop or set interval and do it because it's too many request for database to handle?
you can just let the database handle
no need for loops
sql would be easy
UPDATE table SET X = 0 WHERE id IS NOT NULL
that'll run on all entries
oh
lol my dumbass was gonna set all user's one by one
yeah, dont
ok
You don't want to do all 14mil 1 by 1 @opal plank? 🤔
wdym?
jk
lol
oh, hell naw
the identificaiton table ALONE is almost 3GB
the user objects are massive
Listening to events on the Db class has been deprecated and will be removed in the next major version.
i store a SHIT TON of data
help
What VPS specs are you running?
1 sec
Mine struggles sometimes
i pulled about 94% of twitch's globall traffic with this bad boy
around 4 million viewers chatting at once
Where do you host?
let me check if i have some old gifs
good question
dunno the host name
i think its googles
Listening to events on the Db class has been deprecated and will be removed in the next major version.
server costs about 450 per month iirc
help .-.
Mysql eats up my CPU
💀
@earnest phoenix can tell you how much that shit abused twitch with the connections
he was in voice chat here watching this bad boy legit login 100k channels in over 30 seconds
me?
yes
i assume not with eventsub because that has a limit of 10,000 subscriptions and 100k channels is more than 10k 
not quite
i clustered it
what you see there is 87 different tokens
all clustered via my custom IPC cluster
oh lmao
Okay how do I do this in postgres:
Update set clanusers donation = 0
WHERE claninfo due = 2
I want to set all users (in clanusers) donation to 0 if the due (in claninfo) is 2
is it one twitch app though?
UPDATE clanusers SET donation = 0 WHERE claninfo = 2
oh i see
mmm. so how did you get the 87 different tokens?
except the due variable in the claninfo table
multiple accounts
theres nothing in TOS that says i cant have multiple bots to split the workload and cluster/shard it
yeah, you cant automate creation of accounts
THATS against tos
i assumed so lol
they were all proxied too
damn, that is a lot of work i guess 
so it wasnt all being done in a single IP
cuz otherwise that'd fuck up good time
yeah, that was one of my biggest projects
being able to fetch legit 95% of twitchs global viewers is an insane task
was one hell of an experience for clustering and large scale development though
i learned a lot
UPDATE clanusers SET donation = 0 WHERE claninfo.due = 1
ERROR: syntax error at or near "0"
definitely, and better you than me. i dont think i could do that with my current experience 
you're trying to squeeze every single bit of performance when you get at this scale, cuz it stacks, and QUICK
oh yeah
i used a promisifed IPC pipe between all slaves(processes) to assign channels to eachother
one central controller managing all of them and dispatching events
who would i have my bot send a message when someone votes?
what type is the donation field? are you sure it is integer?
you what?
😕
do you even have an approved bot?
@opal plank those words just go over my head tbh 
its complicated stuff trust me, i had a rough time
how
lmao
not who
how what
you have approved bot or no?
nope
ah, webhooks then
then you cant
why not?
because u need the token
i mean when someone votes for the server
webhooks dont need token
oh, yeah
@stark abyss hmmm, im not sure why there is a syntax error then
forgot that
you dont have access to the webhooks tab
nor can anyone vote for ur bot
cuz, yknow, not approved
oh, servers
@placid iron to like use a different table you go <tablename>.<variable> right?
check channel topic
ive never used foreign tables unfortunately so i cant help you there
okay ty
how do i make a webhook? i don't know how to program it
you NEED programming to do it, or pay someone to do it for you
i know how to program, but not how to make a webhook
then i can foward you the docs
okay
can webhooks give roles?
you can have a bot give roles when the webhook triggers tho
you'd host the bot WITH the webhook
what's node-sdk?
both together
me who uses the deprecated since it still works
its the package to use
you dont NEED it, but its good to use it
technically you just need express or some other webserver module
i thought that was java
Hi
i only know how to program python
use aiohttp smh
PM me for it
thanks
np
what happens when the bot is approved that allows me to use top.gg things?
i really do not want to try to make a webhook
One message removed from a suspended account.
you too
you NEED a webhook for servers, no other way around it
the role thing you dont need an approved bot
you can have a private bot for just your server
webhook is something LISTENING for incoming events (aka, in this case, votes)
a bot is a robot that reacts and does stuff, basically commands or something in that regard
webhook can't send messages right is that what you said?
it can yeah, but for simplicity sake, im explaining it very curdely
there's a different way to program bots too
which could check for stuff
indeed, but thats beyond the point
oh i see
i just can't make a webhook
you need a website or something
you dont
the examples in the docs literally give you an example
you can use your home adress
and host the bot yourself
or, webhook*
yeah but if you have a dynamic ip then things gonna be annoying
I can't seem to find on the internet, how do I use the built-in embed builders?
where?
in the docs...
g
where in the docs?
usually, you don't read the whole docs
literally in the docs that i sent you
but since ur starting from scratch, u should
you wouldn't read the entire discord.py docs
UPDATE clanusers
SET clanusers.donation = 45
FROM claninfo
WHERE claninfo.due = 2
ERROR: column "clanusers" of relation "clanusers" does not exist
LINE 2: SET clanusers.donation = 45
would relation be something that both table has?
I would if I were starting
👆🏻
Can I pass an async function to .call ?
shardsManager.broadcastEval(`(${sendRegisteredVoteNotification}).call(this, ...args)`)
async function sendRegisteredVoteNotification...
it's VERY long
try removing the clanusers.
i didn't really get much help here, bye
dang it worked ty so much
np 👌
did u ever heard about "Core Java"?
literally java bible
about 4kg of paper
can someone freaking tell me how do I use the embed builders?
with open('config.json', 'r') as config:
botStatus = config["botStatus"]
token = config["token"]
ipcKey = config["ipcKey"]
shard_count = config["shard_count"]```
says object not scriptable
no, I think it was Not Erwin who said you could do it another way without using D.js'
yeah, using objects, not the embed builder
I dont remember most of the formatting tbh
json.load the buffer and it'll be a dict.
@opal plank how to Embed through objects?
most of its straight forward from the looks of it
https://github.com/discordjs/discord.js/blob/8a7abc9f06d44bf693e35a615bb6ba2c3eb1d6e7/src/structures/MessageEmbed.js#L265
there is no sign up button

its just an object with various properties
same as payload from the api dosc
k
ipc = ipc.Server(secret_key=ipcKey)
TypeError: __init__() missing 1 required positional argument: 'bot'``` error with running discord.ext.ipc
am not running it in a class
{embed: {
description: '',
image: {url: ''},
fields: [{value:'', name:'', inline: true}]
}}
like that
ty
hehe, new interface
wait, Embed's a type, right?
so maybe I don't need an interface
Let's all have a SYNTAX HIGHLIGHTING PARTY!
It's pretty self-explanatory, you need to pass the Bot object
like client.ipc?
class Bot(commands.Bot):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs):
self.ipc = ipc.Server(self, ...) # self is the bot instance
# or
bot = commands.Bot(...)
bot.ipc = ipc.Server(bot, ...)
OHHHHHHHHHHHH
alr
in the docs their example is in a class
so thats why
ty
tysm @earnest phoenix
Ngl, it's the best ever documentation I've ever seem
It explains to minimal details everything
With examples, images, etc
Sadly it's paid
I once borrowed it from my teacher to research for my graduation proj
UPDATE clanusers
SET donation = 0
FROM claninfo
WHERE claninfo.due = 2```
So this doesn't return an error but but all donation is set to 0 even if claninfo due isn't 2
nice
Try using aliases instead of raw columns
what does that mean 
UPDATE c.clanusers SET c.donation = 0 FROM claninfo c WHERE c.due = 2
kill it before it reproduces please
ok erwin’t
Erlose
how are you linking clanusers to claninfo?
oh okay let me try that
because that query is literally doing "update a where b = c" but b and c have no relation to a
so it gets all from a
i haven't linked it to anything
Don't tell me those are individual tables

clanusers is one table, claninfo is another table right?
yes
you want to update donations of a specific user based on what?
how is the user linked to the clan?
with var "clan"
no like
Column, plz
how do you know which user belongs to which clan
does clan have something like an owner id? does a user own a clan?
or does the user have a clan id?
there is clan id
and users belong to that primary key called "clan"
does that make any sense?
nope

I'd have indexed user ID's as primary key unless users can be in multiple clans and then have the clan ID be a secondary key so that you can get user clan relationships quickly and also filter by all users in a clan.
Anyways, you're supposed to join the two tables on the clan ID
clanusers id is discord user id, and clan is a clan id
No, please no
ok so thats user
Don't tell me that's mysql
postgres?
Oh thank u
There's nothing wrong with MySQL?
so a user can only have 1 clan right?
yes
and you want to check if that clan is due
What's that manager btw?
so you would do something like ```sql
UPDATE
clanusers,
claninfo
SET
clanusers.donation = 0
WHERE
claninfo.id = clanusers.clan
AND
claninfo.due = 2
idk the exact syntax for postgres
oh
Ah, pgadmin4
okay thank you
There is actually, many things wrong
It's kinda niche I'd say
Go on, then. Explain why I shouldn't use it
there are a few articles about it
something about collations, data loss, error swallowing, allowing unsafe operations
etc
not being RFC compliant by default
requiring additional configuration to behave like a "normal" database
Stole from an tag but
TL;DR: MySQL is a bad database. Don't use it unless you have literally no other option.
Why shouldn't I use MySQL?
- MySQL has no transactional DDL. This means that if you fuck up creating a table in the middle of a migration, you cannot rollback easily.
- MySQL has a lot of security issues. New zero-day vulnerabilities are found regularly.
- MySQL is owned by Oracle.
- MySQL is slow. It beats Postgres etc at some things, but once you move beyond basic queries it begins to slog.
- MySQL disconnects you randomly. Unless you setup your connection specially, it will break regularly.
- MySQL allows all kinds of insane data to be inserted. '0000-00-00' is valid in MySQL.
- MySQL is not ANSI compliant. You have to turn it on; even then it isn't fully compliant.
- MySQL has no feature advantage over other databases; PostgreSQL has many more useful features (such as RETURNs).
There is no reason to use MySQL over PostgreSQL, or even sqlite3. See also:
https://blog.ionelmc.ro/2014/12/28/terrible-choices-mysql/
https://grimoire.ca/mysql/choose-something-else```
yeah those were the two articles i've read
Erwin iirc, right?
data loss is concerning and valid. I still believe people shouldn't be told the database they're using isn't a valid option considering there isn't a good way to discern the difference between MariaDB and MySQL
Proprietary and closed source software also doesn't mean that it's bad
there was also some complaint about it having multiple storage engines and how that made it all fucked up
but it's oracle so it's automatically bad 
Tell that to a bunch of professional work places and educational establishments who unironically use java 
Java is good, oracle is bad
Debatable
oraculus rift, java the hutt
I'd say the only thing java has going for it is type safety. Even then, most langs have that
oraculus rift: a new 24hz journey
why? because we're oracle.
24hz 
you also have to provide your social security number and your DNA sample before buying
So for some reason, my express is being stinky and not logging anything to console on this POST request
PostgreSQL more efficient than MYSQL?
Isn't site having issues?
make sure the req method you're using in postman/whatever is actually using post
nginx
It has worked before I had a problem with mongo and had to redo it
But it is probably a site error right?
the mongo problem happened around the same time as the site went down^
idk too much about nginx. If the rest of the site served by express works, idk
Idk what is going on
The button used to like make a little push when it was clicked right?
ya know, 24 fps is the so called "cinematic" framerate :^)
BREAKING NEWS: Oculus, Microsoft, HTC and Valve all push a firmware update limiting headset refresh rates to 24Hz. In an interview with them, they all said: "We wanted to give our users a 'cinematic' and 'immersive' experience."
ex dee
Guess I should have also tossed in nolo but whatever
they are working on many changes
so just wait a day or two for things to be normal again
Alright thank you
UPDATE clanusers
SET donation = 0
FROM claninfo
WHERE claninfo.due = 2
AND
claninfo.clan = clanusers.clan```
in case anybody wanted to know, ^this worked
yes, now it makes sense
is anyone willing to give me a sample bot program to do something when someone votes for the server?
the docs are very weird
Since nobody helped earlier, i shall ask again
https://images-ext-1.discordapp.net/external/X0Yp4vpkfNK5BD4ZSQCEQLy--dO-I9-R6ScKjAYAxbk/https/i.callumdev.pw/2ga2x.png?width=674&height=513
Why is this not working? The error is coming from data.append
Node version?
Table clanusers - clan, id, donation
Tabel claninfo - clan, due, fee
I want to subtract fee from donation each user (id) has.
UPDATE clanusers
SET donation = 0
FROM claninfo
WHERE claninfo.due = 2
AND
claninfo.clan = clanusers.clan```
This is how it sets the donation value on all `id` ig. Would I have to do this one by one, or is there a convenient way to do it?
@stark abyss i dont know exactly but i guess u have to do this one by one..idk maybe
that's what I am guessing as well
did u try by using one by one
no 
hmmm
wait no there must be some way
Anyone know how to fix?
tried ```sudo chown -R mongodb:mongodb /var/lib/mongodb
sudo chown mongodb:mongodb /tmp/mongodb-27017.sock
sudo service mongod restart```
Didn't work
bro
bro
your linux knowledge is off
shhh
its sudo service mongod status
sec
what the fuck
yea
ya all ever just feel so useless and want to quit coding
no
dang I am the only one 
probably not
What am I looking for here
then you have wrong command
no you need to add the status mongod
bro im just so bad at linux
LMFAO
you don't understand
i literally have the file in the folder
Do you?
i just said i did?
Remember ./ is "in the same folder", while ../ is "in parent folder"
Why does it have ...?
Feb 17 19:35:56 ExtremeDevelopments systemd[1]: mongod.service: Main process exited, code=exited, status=14/n/a
Feb 17 19:35:56 ExtremeDevelopments systemd[1]: mongod.service: Failed with result 'exit-code'.```
@crimson vapor
Hm
That's it
Try without ./
i did already
Weird
If u list all files in the folder what does it output?
wdym all the folders?
ls?
And print
whats the code for files?
Ls gives files
i think you gotta do with open('../folder name/config.json', 'r') as config
Why go up one folder?
Your python is mostly just not in the same directory at run time
well how many folders are there
ls doesnt show the config file
Just set the environment path to the files location
Then it's changing structure during runtime
so what can i do?
This is pog
Then just have everything relative to that files location
Which is probably what you got airway
Already
You don't need the name == main part
chown -R mongodb:mongodb /var/lib/mongodb
chown mongodb:mongodb /tmp/mongodb-27017.sock
Tried this
Didn't work
how can i like get it to see the config file?
Read my messages
Omfg
I'm going
i got it
Cya
UPDATE clanusers
SET donation = clanusers.donation - claninfo.fee
FROM claninfo
WHERE claninfo.due = 2
AND
claninfo.clan = clanusers.clan```
figured it out  wasn't all complicated as i thought
i do smth similar https://i.imgur.com/8KOYSWt.png
hey umm
my bot isnt starting even with the right credentials
it suddenly went down a while ago
and its not coming back up
Discord is down
but other bots are working?
Not at all
i tried to lift my test bot and it worked
Some seem to work, but some can't respond
Get used to it, happens from time to time
Just connected successfully
What do you guys think about this? Trying to find a more user-friendly method of getting help for bot commands.
Instead of having to force a user to type the name of a command, I could present them with a list of types of commands and then if they choose, it gives them more details.
Is this a good route, or should I stick to making the user type the command name through the help command instead?
@delicate zephyr @earnest phoenix dudes
i've got an announcement
the dashboard has been upscaled
I need luke rn lmfao
i told you, my test bot connects, but main one isnt connecting
theres now metrics to compare the local test bot with the prod version for stability comparison/testing
made it
that's a little obvious..
grafana
eng?
huh?
@lyric mountain any ideas to fix it?
so bots are eworking fine?
Like python not finding the file
@opal plank clean as always
I totally love this idea.
thank
i want to know if it's easier for people to do
I think it is since it pops up the options.
besides doing some stupid weird shit like /help [command name] [command arg]
that would drive people crazy imo
https://www.cloudflarestatus.com/incidents/hf8lpnp0yh5j
Was a CloudFlare issue. It should be fixed now
Right right
I thought cf banned my IP 
I'm making a fake version of this lol
how would i get the header value of a post req in aiohttp? i tried .header() doesnt seem to be an attribute though
/help
this shit was SO fucking hard to make
well, it isnt connecting even now
lol
theres like 5 different sources there
this dual one is nice as fuck
it added so much to what i had
if you click on the link, 9 mins ago they said they're implementing fix
i've been looking at it for the past 20 minutes nonstop
How can I subtract numbers in meowdb?

postgres documentation is almost 2.8k pages 
it says they're monitoring the results and im still not able to connect :c
welcome to big boy toys
thx
UPDATE clanusers SET donation = clanusers.donation - claninfo.fee FROM claninfo WHERE claninfo.due = 2 AND claninfo.clan = clanusers.clan
this one line took me like 5 hours but then new to sql and postgres
lol

;-;
Well you just gotta wait i guess
..
This is gonna be a pain. Moving from Maria to Postgres and queries by default lowercase table names and column names. Imported my old DB and everything got lowercased. Guess I'll just have to rename everything to snake case and change all of my client code which uses sql.
Any reason I would be getting the unknown user error 3 times inside this function?
https://paste.gg/p/anonymous/1dd5664cad6a4befa31fb29eabdda329
Its confusing because everything runs fine, I do not see where the error could be coming from.
How long does it take for a bot to be accepted?
thanks
could someone give an example of a python code that sends a message when someone votes for my server?
Hello-
that doesn't make sense
🤷♂️
hello
it's an example, but i don't know anything about the top.gg python thing
yey
hey where will i get information of chess bot
Yo
Python says a folder doesn't exist
Any ideas?
File*
It's in the same folder
Try printing os.getcwd()
at Api._request (/home/container/node_modules/@top-gg/sdk/dist/structs/Api.js:74:19)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Api.postStats (/home/container/node_modules/@top-gg/sdk/dist/structs/Api.js:94:9)
(node:26) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:26) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
read #site-status as there upgrading the api / New Version aka V2 coming soon. Veld has been working hard with his team so chill
what
does mongodb handle large collectrions well?
for finding docs
and how long it takes
what kind of size is your project?
is your bot going to be doing small DB stuff or is it going to need scalability/large-end tasks?
the database type you use will be really dependent on the size and scope of your project
i dont mind it i just wanted to post it somewhere so that i remember that this error exists
alright
ayo anyone know this error https://cdn.discordapp.com/attachments/811874115459219460/812185711993159690/unknown.png
my submit form discription i want to change
at Api._request (D:\DATA.C\Documents\bot_sandwich\node_modules\topgg-autoposter\node_modules\@top-gg\sdk\dist\structs\Api.js:74:19)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Api.postStats (D:\DATA.C\Documents\bot_sandwich\node_modules\topgg-autoposter\node_modules\@top-gg\sdk\dist\structs\Api.js:94:9) {
response: '<!DOCTYPE html>\n' +``` gg
it says bot is already regestered
Hmmm
You cant change any info that was submitted wait i forgot u can shhh
I could LOL
you can change the description...
ikr
go to your bot page, edit and go to description
ok
it says bot is already exist
ya
i want to say that
dats y LOL
i want t o edit that form
how
how to edit first form
Can someone help me send a image from a remote url through a axios post request? It just refuses to work for me no matter what I try
https://i.callumdev.pw/h40nz.png
What is source.pause() supposed to do? @snow urchin
idk, its what data.append is doin ig
The ad in English says: my stepmom is horny and says: it's time to teach my stepson how to be a man .
wtf!!!
the ad is from top.gg
Probably based on what you searched or something
lol
trolled
xd
Don’t get me wrong it’s pretty nice I read it 
ehh no the ad in top.gg is aleatory
Didn’t you write the code
source.pause is a function from data.append
It’s saying it’s not
If you actually read the error
If you are 100% sure it is an function you are likely not using it right
what is shards??
I don’t know much about them, but i think it’s like a server. I think of it as a server if you have like 10000 server you are going to have to get more shards in order to have the bot be efficient. This is what I personally understand it as I could be wrong
2500
oh
I wasn’t sure about the number that’s why I just made it 10k
shards is when your bot divides into more bots. each bot is a shard, and the servers amount gets divided within the shards
ohh
not really into more bots, into mutiple processes
but the shards is good or not?
They are good if you have large amount of servers
if you are at 2000 guilds yes otherwise no
If you don’t have large amount of server u don’t need it
hmmm
need help with discord py, how do you use is_on_cooldown when checking the cooldown of a different command?
command a displays the cooldown of command b
how can I fetch an uncached user by their username?
Hola
up
where is norizon when we need him
Hola
would be probably easyer to use the id instead of username, since you can just fetch it then (if you use js, idk in py or other langs)
at C:\Users\Acer\desktop\rr\node_modules\node-fetch\lib\index.js:272:32
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Random.getMeme (C:\Users\Acer\desktop\rr\node_modules\random-discord\src\random.js:10:17)
at async meme (C:\Users\Acer\desktop\rr\commands\memes.js:10:17)
(node:20024) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:20024) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.``` this error is popping up :( im using random-discord
case 'lb':
var money = db.startsWith(`money_${message.guild.id}`)
let content8 = "";
for (let i = 0; i < money.length; i++) {
let user8 = bot.users.get(money[i].ID.split('_')[2]).username
content8 += `${i+1}. ${user8} ~ ${money[i].data}$\n`
}
const leaderboardembed = new Discord.MessageEmbed()
.setAuthor(`${message.guild.name} - Leaderboard!`, message.guild.iconURL)
.setDescription(content8)
.setColor(bsc)
message.channel.send(leaderboardembed)
break;
i have that leaderboard command, its doing it for all users, i want it to show only the top 10 that are in the server that the message (command) was sent.
discord.js ?
yes
ight lemme see
^
then do i < 10?
what
for (let i = 0; i < 10; i++) {
@tardy hornet if you want to limit it to ten then use i < 10 instead of i < money.length
?
Yes
oki, now i want it not to send the top 10 of all
the API returned a empty result, handle the error properly and you are fine
just the top 01 in the server
const money = db.startsWith(`money_${message.guild.id}`);
let content8 = '';
for (let i = 0; i < money.length; i++) {
const user8 = bot.users.get(money[i].ID.split('_')[2]).username;
content8 += `${i < 1}. ${user8} ~ ${money[i].data}$\n`;
}
const leaderboardembed = new Discord.MessageEmbed()
.setAuthor(`${message.guild.name} - Leaderboard!`, message.guild.iconURL)
.setDescription(content8)
.setColor(bsc);
message.channel.send(leaderboardembed);
break;```
then money[0]?
ight i thought it was something with my code XD
yea, is common for users who are new to this, just add proper error handling and you are fine
you need to make sure that money is already sorted though
ok thx
did that just to test, its giving me that it has to be less than 2000 length
Hey i have an object in my guild config model with some properties inside it. I would like to delete it and its properties from all documents. Note: on some documents it doesn't exist. How would i do that use mongoose?
rare question but can webhooks post in announcements channel and still get published (as in channels following that channel will still get posts from the webhook)
use updateMany({filter},{query})
or did you just want to delete all documents including certain stuff?
Yeah i tried to updateMany and made that object null. But it still remains in the document. Is there a way to completely it?
maybe this helps https://stackoverflow.com/questions/18553946/remove-sub-document-from-mongo-with-mongoose
wait nvm this is for sub documents
look into deleteMany() it might be the correct way
ill try to explain a bit more. I have this object in my guildconfig documents. I want it to be removed from all of the documents. Only this object called automod not the documents.
I think i can .find all of them. Then delete the objects with node and update them 🤔
the answer is maybe the one you want https://stackoverflow.com/questions/40588709/how-to-remove-object-from-array-using-mongoose
just use updateMany instead
fixed it turns out there was something wrong with tht library i used another one
strange, ive get this errors sometimes from one API bcs the API decides to shit itself
$pull only works with arrays.
Unset seems to work, tysm 😄
XD
Im getting errors that I cant send empty message... why?
yhe var should be const?
I tried and it says: const is not a valid token
w
it shouldn't be a problem
8
w8
k
I cant find what is wrong
thiis is the error
@near stratus
??
someone
?
hol on
JS allows unblocked if ?
wdym
if(true)
//do this
instead of ```js
if(true){
//do this
}
lemme test it myself
ok
coz I think its worked in my other bot project
I didnt knew this too
I saw it on stack overdlow I think
and I think its actually worked on my other bot... so weird
It works on my test too
discord.js v12?
.setColor('#0099ff')
.setTitle('text')
.setDescription('text')
.setThumbnail('')
.addFields(
{ name: 'name' },
{ name: 'name' },
{ name: 'name' },
)
.setTimestamp();
message.author.send(testembed);```
here
I dont need reaction
just delete it then
@amber quiver could you send the code
yes
like paste here
client.on("message", message => {
if (message.content === `${prefix}clear`) {
if (!message.member.hasPermission("MANAGE_MESSAGES"))
var embedMessageError = new Discord.MessageEmbed()
.setColor('#FF0000')
.setTitle('ERROR')
.addField('OOPS', 'It\'s look like you have no permission to do that!')
message.channel.send(embedMessageError)
.then(msg => {
msg.delete({ timeout: 5000 })
})
if (message.member.hasPermission("MANAGE_MESSAGES"))
var embedMessagesuccesful = new Discord.MessageEmbed()
.setColor('#FF5800')
.setTitle('succesful command')
.addField('a^clear', 'the messages got deleted!')
message.channel.send(embedMessagesuccesful)
.then(msg => {
msg.delete({ timeout: 5000 })
})
}
})```
here
and also, when Im trying to catch errors in the code, the bot is still stopping
even tho Im using .catch(console.error) or try and catch
When I write your code manually I don't get any error but when I copy it it shows error
wow
what
how
when you wrote the code'=, it didnt show any errors?
and when you wrote it manually, it shows error
lemme modify it little bit
You need to put the code in the if statement in a code block
I do
...
}```
look closely
You don't

