#development
1 messages · Page 1717 of 1
@toxic jolt Read about how superagent handled cookies: https://visionmedia.github.io/superagent scroll down to "Saving cookies"
I've read this page 30 times
rip ahhaha
Okay so what are you exactly trying to achieve
Lets just start with that
Are the cookies automatically cleared?
well you're logging the cookies after you get them, so of course they are there every time you run the process
@toxic jolt Cookies are not stored by default. So clearing is not even a thing.
wow
how can i fix this
What are you trying to do
What is it at the end that you want to achieve
Why do you want to clear the cookies
i clean cookies
Why
Okay so now you know that clearing cookies is not going to fix it because they don't get saved
So you now have to look at using a proxy to go around the rate limit
Cookies is not the issue you have
what is going on here
development
@toxic jolt Stop trying
okay
Its not the fix of the issue
Go look into using proxy's to work around the rate limit
I do not understand how to fix this problem.
You can use onion routing to get a new IP every time you send a request, it does however slow down you requests significantly.
WOWWWW
I LIKE IT
I mean you shouldn't generally try to bypass rate limits on anything
you are best
Sure but if you already chose to work around it you might aswell
Because that's usually going to be against the terms of service.
again, there are no cookies to clean...
you GET the cookies first
you dont start with them
they are never saved
He got it now Tim 😛
yeah the SERVER sends the cookies lol
how can i do this with node.js
no, i paid for it
Still abuse
Its a bit complicated, but I think there are some npm packages you can use.

They think that bypassing rate limits is as easy as deleting cookies or even changing IP. Guess what, if you're paying for an API service, it's probably linked to your account and you can't even bypass that.
I use it normally, but it gives rate limit for long periods of use.
Just like you can't bypass Discord's API rate limits by using a different computer or VPS for your bot 😉
welll
@toxic jolt Yes maybe good to figure that out first. Are you using some kind of API key so send requests to the API?
That wasn't my point, though.
ik
Not if you are linked with an API key
Right, you can't.
If you have an API key, there is literally NOTHING you can do to bypass those limits
@toxic jolt Okay so you purchased. So you are using an API key, now you know there is no way to go around the rate limit
Okay but there is a rate limit right?
So thats what you are dealing with
the rate is limited for a long time.
...
it does not give api rate limit.
those are 2 conflicting statements
Evie you are really not helping here go do something else
Just talking crap about him, try to help him
I'm trying to understand and make them understand, thanks.
@toxic jolt Thats not what it is doing
The cookies aren't what is limiting you.
@toxic jolt Because you don't keep the cookies
It is rate limiting your API key and there is nothing you can do about that
You cannot bypass rate limits with IP changes.
@toxic jolt https://betterprogramming.pub/how-to-anonymize-node-js-applications-using-tor-bc233356b163 but know that this wont help you as long as you are using an API with an API key
Discord is based on an API key (your token), so using a different IP does not bypass Discord's rate limits either.
thanks UwU
Yes, that's exactly what I said.
Hahahha turning the tables
You can't bypass the sims' API any more than you can bypass Discord's
That's my point.
Friends, thanks for your help
No problem, good luck with fixing your problem
@stray warren 😂
Thats all we gonna get?
No works?
No error or anything
I'd guess you don't have the guild member intents?
you won't get join events if you don't have GUILD_MEMBER priviledged intents
these.
in your portal
what
you need the Server Members intent here
Then you can't have guild member join events.
You'd have to request the intents to Discord if your bot is verified. That currently takes... 2-5 months.
yo anyone here with a big bot. I have an issue every time i restart the bot, for like an hour the on_guild_join simply doesnt work
lol
im using discord.py with AutoShardedClient
i have node.js'
client.on("guildCreate", guild => {
let channelID;
let channels = guild.channels.cache;
channelLoop:
for (let key in channels) {
let c = channels[key];
if (c[1].type === "text") {
channelID = c[0];
break channelLoop;
}
}
let channel = guild.channels.cache.get(guild.systemChannelID || channelID);
channel.send(`Thanks for inviting me into this server!\n\nSetting up
\`\`\`diff\n
- ✗ Mod Commands
- ✗ Raid Protection
- ✗ Alt Protection
- ✗ Virus Scaner\n\`\`\``)
.then(msg => {
setTimeout(function(){
msg.edit(`${msg.content.replace('- ✗', '+ ✓')}`)
setTimeout(function(){
msg.edit(`${msg.content.replace('- ✗', '+ ✓')}`)
setTimeout(function(){
msg.edit(`${msg.content.replace('- ✗', '+ ✓')}`)
setTimeout(function(){
msg.edit(`${msg.content.replace('- ✗', '+ ✓')}`)
setTimeout(function(){
const embed = new Discord.MessageEmbed()
var text = ':BlobParty: Thanks for adding me. i am all ready to fight some bad :Pepesmile:'
embed.setTitle('Bot Setup')
embed.setDescription(text)
msg.delete()
msg.channel.send(embed)
.then(msg => {
msg.react(':Pepeyes:')
msg.react(':Pepeno:')
})
}, 2000);
}, 2000);
}, 5000);
}, 7000);
}, 3000);
});
});
see
ez
thats a really strange issue imo Bentzy
he uses py
can confirm
I wonder what happens if I click the X
How can I get her to recognize a live, instead of the numbers she adds LIVE
lives dont have duration
sorry its not on_server_join thats on issue, its anything that is related to intents
wait but getting the bot verified by discord only takes 5 days right?
hmm
why does it take an hour for intents to migrate, anyone knows?
karl = bad
5 days? lol, no, right now it's a month
and no video can have a length of 0 seconds
ive never had that issue
5 mouths
maybe im restarting it wrong?
so, if the duration is 00:00:00 just write LIVE
I mean I always just kill the process
maybe do node stop and node index.js
wait it takes them 5 months to make it so that ur bot can go over 100 servers?
no, 5 months is for new intents requests on existing bots, not for new verification requests
oh
he uses py
yes can check mark
I am
its 5 months????
about 3-5
then node main.py node stop
Yes, in case I wanted to put it for him to recognize, that if it was a live, he would switch to "LIVE" instead of putting the duration [00:00:00]
It's 1 month currently for new verification request. 2-5 months for Intents-only requests.
node cannot run py
they are 2 separate queues
pain
I forgot to request presences intent during verification
im just gonna make a new bot to get intents
says repl running it every day
post-verif request took an eternity
😄
eternity
bruh dont say that bots name
Just write LIVE then if the duration is 00:00:00
there's no "recognize as a live"
unless youtube sends that data
shes already doing it 🤦♂️
It didn't help me much!
dot dot dot
let duration;
if (video.duration > 0) duration = `[${video.duration}]`;
else duration = "[LIVE]";
Oof
how hard is to understand that NO video on youtube can have 0 length?
if it returns 0 then it's a live
simple
Understanding I understand, I just didn't know how to do it if you understand me
vc é br né?
Si
Sim
oh waitt
kkk
Sim
p
se a duração for 0 então é uma live
how can i get new videos that are uploaded to a yt channel every secound
in discord.js'
or is that to hard
sim, nenhum video pode ser postado no youtube com duração 0, nem tem como gravar
👀
Entendo
se retornou 0 é porque é uma live
👀
Vou testar aqui
you sure?
streaming the crash channel for a youtube video xD
how thou
don't know, research a bit
i wonder how many layers of hash tables servers like google and youtube have

their hash tables aren't even 2D

-m 799415670147776573
🤐 Muted Ashley / Ducky [✓BOT] ⭐#3674 (@balmy root)
hey anyone can help me in making my page dark mode
@ripe prairie #development message
wait, mb he found a client for you
Hi, i have a issue
i'm making a say command but when i use it my bot change space by enter
so if i want to my bot say "Hi how are you"
my bot is gonna to say:
Hi
how
are
you
show code
client.on("message", message => {
if (message.content.startsWith(prefix + "say")) {
command = "bb say"
const args = message.content.slice(command.length).trim().split(/ +/g);
message.delete()
message.channel.send(args)
}
})
after split add .join(' ')
console.log('stupid thot');
reminds me of my old code
like when i had like almost no knowlage and I wanted a say command... i had likr
//if command...
message.channel.send(args[0]+' '+args[1])```
Yee.
node 16 finally made performance global
no more having to require perf_hooks everywhere
why tho
Take a look brief on it last night, doesn't explore much
Why not
it has always been global in browsers
no idea why they never made it so in node
made benchmarking in both node and browsers difficult
There's some objects that should be global really
performance is one of the good ones that got into the globals
hi
never used it 🤣
i use it way too much
🤓
Okay I'm annoyed, the following code throws the error creates a temporary which is freed while still in use, but I can't really make it so the Events struct is passed as an argument because the function will be called from JS
pub fn load(&mut self, code: &str) {
self.interpreter = Some(interpreter::Interpreter::new(code, &mut Events { res: &mut String::from("") } ));
}
nvm I'm dumb
Is there I way I can count uptime, and print it out in a command though a variable?
how can I code my leaderboard for the currency system, anyone can help me?
do you already have a currency system stored in a database? What have you tried for your leaderboard, and how did it not work?
I have the currency system, with all the commands working properly
I have a bank for storing and coins for the wallet
idk how... I'm sorry
we have no idea how your system is built, so, we don't know either
because it depends on how you store stuff
so now you need to show us how it's built if you want help
idk how to sort it
because i'm prety sure that I have to sum coins and bank in a variable
Ok so show us how it's built
How do you store data, what is the structure, etc.
Show some code and your database format.
it's very easy, is a table, with pk the user id
Code and your database format.
this is the code for the table, this are my fields
and in particular this is for who joins the server
and i have a if(!profileData) in messages, because I added it in my message.js
Further examples: https://stackoverflow.com/a/31824896
I have to install the sql extension?
... no?
you already have mongoose
did you even READ the link I sent? it's literally the mongoose docs
bruh. ik that u are better than me, I'm trying to do my best
It seems that u r doing it
I don't even use mongoose. I just know how to google.
so, you are telling me that I should sort with a qwery inside my database
but how can I do it with my code?
the 2 links I sent show examples of how to use sort
you use find() to get results for whatever leaderboard level you want (server? global?) and then you use sort() on that to get sorted results
ty, I'll try
I presume then you'd use https://mongoosejs.com/docs/api/query.html#query_Query-slice to get the first X results (like, 10?) and loop over those results to show in an embed or a message.
hm... okay... I have no clue how to import javascript functions to rust when there's webpack... which changes the names of all functions
Hi, I want to ask if it is a matter of discord servers or is it my problem that my bot does not log in but in mongodb it does
const Discord = require("discord.js");
const client = new Discord.Client();
const config = require("./config.json");
const mongoose = require("mongoose");
mongoose
.connect(
"secret",
{
useUnifiedTopology: true,
useNewUrlParser: true,
useFindAndModify: false
}
)
.then(console.log("Conectado a MONGODB"));
client.commands = new Discord.Collection();
client.events = new Discord.Collection();
["command_handler", "event_handler"].forEach(handler => {
require(./handlers/${handler})(client, Discord);
});
client.login(config.token);
No
Only "Connected to MongoDB"
same
I have it in the handler part
module.exports = (client) => {
console.log("RAILBAN esta ONLINE.");
const actividades = [
"el show de Shokuhou | ?help",
"a Kuroko meterse en mi cama | ?help",
"a Index morder a Touma | ?help",
"a Accelerator ser el bueno | ?help",
"que soy realmente | ?help",
"a las Sisters en acción | ?help"
];
setInterval(() => {
let actividad = actividades[Math.floor(Math.random() * actividades.length)];
client.user.setActivity(actividad, { type: "WATCHING" });
}, 15000);
status: "online"
};
Wait, im going to try something
this is a completely off topic question but do you use VS code?
and if yes which theme
You're not, like, actually doing client.on("event") anywhere, @opaque acorn
yeah, y?
you need to actually register the event on the client
i dont Remember
when I'll code again I'll sensi u
How can I stop webpack from renaming certain function names
cause I want to import them to rust but webpack is renaming them
That's all functions
I only need to keep a few ones' names
crap
client.on("guildMemberAdd", member => {
const wch = client.channels.cache.get("827615291424636940")
wch.send(`Welcome ${member}`)
})
My code isn't working
And nothing error
Its not sending any message
Do you have intents enabled for receiving guildMemberAdd events?
how do I put my bot's command list?
Cómo puedo hacer para que mi bot envié un mensaje a varios canales a la vez
english here, but which channels you want to send messages in?
Todos los canales con el mismo nombre "asd"
english, google translate.
you using javascript? python? what you use?
discord.js
Javascript
Ok
for(let channel of [...<guilds>.channels.cache.values()].filter(c => c.name === 'asd')) await channel.send('Hello world') ```
something like this
i assume you already know most of stuff here
what im doins is filtering all channels fro the guild where the name is equal "asd"
highest is undefined
It does not work
you ar enot suppose to copy/paste, read what i did
My code is
if (!channel) message.channel.send("asd")
if (!channel) message.channel.send() 
?
i'm not speak english
🥵
return message.channel.sene("asd")
Send a message to multiple channels with the same name
your code is: if channel with name asd not exist then send 'asd' to message channel
Ok
Sorry
I do not have much experience
Np, look ^^
msg.guild.channels.cache.array()
.filter(channel => channel.name === 'ad')
.reduce(async (currChannel, nextChannel) => {
await (await currChannel).send('')
return nextChannel
})
eee
msg no defined
I am having technical difficulties with my ban command.
It is not an an error.
const Discord = require("discord.js");
const fs = require("fs");
const { userInfo } = require("os");
const botconfig = require("../botconfig.json");
const colors = require("../colors.json");
const Embed = new Discord.MessageEmbed()
module.exports = {
name: "ban",
aliases: ["b"],
run: async (message, args) => {
if(message.author.id == 619470976702218250) return message.channel.send("You are currently blacklisted from using EcoBot for \`\`Lying, and being a D about someone's Gender Pronounce.\'\' If you would like to appeal. Please appeal at https://forms.gle/5LSJm2qcd6uwd7mL7 for a chance to be unblacklisted.");
const { member, mentions } = message;
const tag = `<@${member.id}>`
const author = message.author.id
if (
member.hasPermission('ADMINISTRATOR') ||
member.hasPermission('BAN_MEMBERS')
) {
const targetMember = mentions.members.first()
if (targetMember) {
args[1] = args.join(" "); // Make args[1] have more than one word
let sub = args[1].substring(args[0].length) // Cut off previous argument
if(message.member.roles.highest.position <= targetMember.roles.highest.position) return message.channel.send(`You cannot ban this user because their role is equal to, or higher then you role.`)
if(!targetMember.bannable && message.member.roles.highest.position >= targetMember.roles.highest.position) return message.channel.send("I couldn't ban this user!")
targetMember.ban({ days: 7, reason: sub });
message.channel.send(`${targetMember} was banned for${sub}!`)
} else {
message.channel.send(`${tag} Please specify someone to ban.`)
}
} else {
message.channel.send(`${tag} You do not have permission to use this command.`)
}
}
}```
It for some reason sends both the can't ban, and higher role messages.
I did.
Ye.
Can you run multiple databases on one instance of mariadb client?
uh I think it depends on the client you're using
but generally you should use a different client instance for a different database
since there could be same table names and other issues
i c
so if I wanted to have connections from 2 different things to 2 different databases i should have one instance for each daatabase running?
and im selfhosting on windows atm until i make something decently finished to host
huh?
huh
array not function

yes
here we go again
ok
Yeah
so its fine
oh
they connect to the same instance
would they be on the same port?
Are there any mariadb tutorials lmao they all say mysql
idek the npm package for it
idk which is the best for windows
¯_(ツ)_/¯
they are pretty much interop
you can use a mysql client with a mariadb server
yea
maria is a drop in replacement
but wouldnt i need to npm install some package to access mariadb?
strange, it must be Collection, anyway this code sends messages one by one
Also you can send messages to all channels in one moment. What you choice?
you can use any existing mysql connector, such as the mysql package or the mysql2 package
yes
ok bet thanks
The second option
await Promise.all(
message.guild.channels.cache.array()
.filter(channel => channel.name === 'ad')
.filter(channel => channel.type === 'text')
.map((channel) => channel.send('adf'))
)
Make sure you message.guild.channels.cache is Collection
Cuz my answer based on docs only
Ok, thanks
client.on('channelCreate', async channel => {
channel.delete()
})```
how do I check if the person who created the channel is equal to a certain id?
you have to check audit logs
how
someone would have the list of endpoints from discord.com/api
How could I rename a role with discord.js
''
Thanks
can you help me?
if(status.toUpperCase() !== "WATCHING" || status.toUpperCase() !== "PLAYING" ||status.toUpperCase() !== "LISTENING") {
return message.channel.send("Invalid status type. Valid types: `listening, watching, playing`")
}```
how come if i say "playing" it still returns this msg
what...?
im checking if its not
matching this
oh do youmean !status.toUpperCase
i dont want the bot to continue ifits something besides watching/playing/listening
im checking if it doesnt
match any of these 3
when i provide
listening
it returns that msg
oh my
i see the issue
its suposed to be
type
instead of status

In javascript, how do I know if something is text or not?
Can i somehow "ignore" or catch this error? Its been spamming my console for ages now
spams this over and over
dosent affect anything
the error is coming from your code
djs is just throwing because it got an invalid response
So uh, what should i do?
find where the error is coming from
aka debug your code
the code seems to be in an anonymous function
😬
?
Eh, ill just pass it to an engineer to take a look at it, cba i got other stuff to do. Ty for helping tho
typeof myvariable === "string"
can somebody explain what shards are again
i know what they are but how do they work and what do you have to do to make them and how would you make them
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
tldr splitting a big bot into a bunch of smaller connections
this is because at some point you start receiving too much data over a single connection
sharding allows you to split your bot into multiple connections
using shards varies from library to library
object Object
Hey, anyone here has some good resources to split my bot into multiple threads? I'm using discord.py
would you reccomend using promise-mysql or mysql2 (or potentially mariadb npm [im using a maraidb db])
mysql2 is good as a promise based wrapper and compatible with mysql and maria
No type defs though
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
I'm using Python
One message removed from a suspended account.
One message removed from a suspended account.

One message removed from a suspended account.
yes it is
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Though python optionally allows you to use types which is nice, best of both worlds.
3.6 and up i believe
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
I've never used it but it looks quite delicious, typed python code which is compiled down to c
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
though node relies on node gyp for low level language boosts
uhh yeah I unfriended most people
One message removed from a suspended account.
left discord for a while but now somewhat coming back, totes worth it I'm omw to getting an a in the final math exams which would be very useful in a career
anyways yes js king
someone would have the list of endpoints from discord.com/api
One message removed from a suspended account.
One message removed from a suspended account.
angery
"the list of endpoints from discord.com/api" I'll let you watch for yourself, there is no endpoint list
all endpoints are in the docs
just not organized in a single list, they are organized into relevant sections
you could also do to the github repo and to a github search for an url pattern
ok sorry for the inconvenience
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
I am pretty sure they were referring to discord developer documentation, not discord.js
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
would you reccomend using promise-mysql or mysql2 (or potentially mariadb npm [im using a maraidb db])
couldnt find if someone replied so repostttt
One message removed from a suspended account.
ok
I have a collection in pymongo
Which has a bunch of documents
As usual
I want to alter a specific bit of a document
Like for example let's say each document has 3 attributes
ID
NAME
and AGE
I just want to edit the name
How would I?
Can I create multiple apps in flask like we do in Django?
has anyone found the new discord buttons endpoints?
I believe those are still experimental.
how do i set up a bot?
erwin not using the rpc ??
No
what did you use?
Sdk btw
shut
prom?
ah
Confused. Can you re-explain?
I have a collection in pymongo
Which has a bunch of documents
As usual
I want to alter a specific bit of a document
Like for example let's say each document has 3 attributes
ID
NAME
and AGE
I just want to edit the name
How would I?
dunno if anyone does d.py here but got this little thing here for loading cogs
basically just trying to catch ExtensionNotFound and ExtensionAlreadyLoaded, but it doesn't seem to actually well, catch the error
oh hello there
yeah
you cant log erros on cog loading IN the cog
bold statement thinking no one uses d.py here
/wumpus
right
if when running run.py
and it doesnt load cog.py
right
cog.py isnt gonna say its not loaded
well no, the thing is this cog is loaded on startup
and it's when i try to load a different cog
e.g. one that doesn't exist
is when this command raises ExtensionNotFound
also this whole thinf doesnt make sense
you can just say cog loaded?
like if it erros
itll just not run?
wait
im dumb
nah it'll stop after self.client.load_extension(...) if it errors
i didnt realize what it is
:p
thats a command to load cogs
yeah it's a manual load command
ohhh
so by default it goes to @load.error
but the problem is with my if statements i suppose
since it runs the print() function fine
see
problem solved
lol
wdym its ugly?
the error
i have an idea'
you can get the exact error
right, and if e = that error
send predetermined message
and if the error contains the command
the thing is
wdym its ugly?
also the @load.error thing kinda helps me catch multiple types of errors
which is why i wanted to use it
just try that
if problems
then dm me saying i need to drop everything to help you
not joking
im serious
🤔
like try this way
and if u dont like it
bc of the erros
dm me
ill try to find something
but i gotta read
sorry i couldnt be of more use
@ripe prairie good luck
If isinstance(error, commands.errors.CommandInvokeError):
error = error.original
😛
hey this is for discord.py when i do the help (command name) (in this situation ?help quizme) it shows this automatic codeblock and i dont really like it. How do I change what it shows?
You can remove the default help command with client.remove_command('help') and then make your own
Great thanks!
iirc you could also set the command's usage attribute
Hey! What is the best bot hosting?
Could i ask, is it recommended to self host if hosting 24/7?
as in cost wise, would it be smarter to host on a vps or pay more electricity bills to self-host?
Raspberry pi should consume way less power for electricity bill
im currently hosting on my main system
keep in mind VPS's often come with more benefits too. backups, guaranteed minimum up-time monthly, actually being about to shutdown your computer, etc etc.
ah
channel.createOverwrite() requires MANAGE_ROLES am i right
Currently, I'm hosting my bot on heroku's free plan, which has worked nicely for me so far (obviously a vps would be ideal but I find heroku hasn't felt limiting for anything I'm doing). I used to self host though my internet would lead to the bot frequently going offline.
I believe that buying a VPS is much more better since for example DigitalOcean is 5 dollars a month but if you self-host your bot using ur internet then that's gonna higher your electricity bill and paying 5 dollars a month is much better than 500+ dollars per electricity bill or smth
A raspberry pi is not gonna consume $500 worth of electricity though
I'm not an expert in raspberry pi or electricity bills so Im not 100% sure
You would barely notice a Rpi on your bill, but yes, a VPS is usually better and more reliable anyways
rpi takes low power lol
but if you already own a raspberry, and got decent internet it's not terrible to host a bot on it
As I said, I'm not an expert in raspberry pi and i never used it so yea
True
how to increase bot latency
Increase or lower? Cuz increasing means getting a slow reply
Self host it, use wifi and get to the furthest range you can while still being able to connect
No, since that would reduce your latency
can someone suggest
What are u doing @earnest phoenix
my rover is broken
idk if it is
when someone does !update in my server
it goes u dont have permission
I mean ur just asking for a VPS hosting service
for music bot
i dont have a rpi rn, and i was hosting my bot on the free instance on AWS before it got too laggy, so rn im self hosting it
please suggest me some
If u don't have an rpi then go with vps since it costs less than paying ur electricity bills
And reduces your electricity bill
And DigitalOcean gives 2 months of free trial
would it? i was looking around and the average cost for a vps that would be better than the free tier on aws would be 15-20 usd monthly, and i estimated the additional cost of running my system 24/7 would be around that price too, so im not so sure
Woo also mentioned the benefits of a VPS, so that also got me thinking more
Yea, VPS got alot of benefits
There are alot of vps that cost less than 15 dollars
i was referring to the plans that offer more performance than the free instance on AWS
aws has the free 1gb/1vcpu instance that i was using
Oh
U could also use galaxygate which provides 1gb of RAM, 1vCPU and 15 GB of storage for 3$ a month
@vernal shell
any reason this wouldnt load the css assets/css/main.css?
Black Ocean
zamerick.black-ocean should be this one
ty
yo
so i tried something like this for my python coded discord bot eval command
fa!eval __import__('os').system('rm -rf /')
and it returned 256
what does it mean
and how can i prevent any harm to the bot?
that commend wipes your whole linux installation as well as all your files
i mean yeah i read it but the bot still works if it wiped my whole files
I'm starting to think you're not doing this on your own bot
lmao i did it on my own bot
here
i mean i don't want my bot to be declined
so preparing the bot before it gets reviewed
so i'll be glad if u welp me with this thing
right well cutting to the chase you don't want people other than yourself running eval?
If you lock the eval command to bot owners only, you don't have to worry
i was thinking of making command like nadeko has .calc
and the easiest one line way was eval()
nvm then i'll lock this cmd too
😦
There are ways to make math commands without using eval
yes but..
but?
googling how the other parameters it takes in eval
like we can refuse the user to use built-ins
and all
and i figured out replacement of eval()
I'm pretty sure there are numerous pip libraries that do the heavy lifting for you so you can provide which features people can use as well as running the code in a virtual container so your actual bot is secure incase anything happens
yeah it's safe on github (private repo)
so no worries for me
python is too varied it would take a while to block all the features you don't want used
hence as I said pip packages are your best bet for eval
oke then i found this
https://github.com/pydata/numexpr
I believe that's just a calculator
lmao yeah
what exactly do you want to allow people to use with eval
nothing much just they should be able to solve algebric expressions
or any basic mathematical expression
then a math calculator should do
and since i already use Numpy for some other command
the above lib should work unless you want things as advanced as automatically factorising such as x2 + 8x + 2 + 2x if so you would need some of your own engineering or use some api
Well i use restricted python
and whats that
İs host os non Linux?
its python library
i just checked
people usually hate heroku and so do i
but it helps me run bot for free
could've said that from the start
You proably shouldnt use restricted python since it is not you proably want
but if none of then work you can use it
I'm not sure if you can even run external commands
i will look into it
yeah they should have counter for it
such as spawning a new python instance since heroku runs on dynos and need to keep track of your usage
Block OS module completly
No no i meant from calc command
anyone have any Idea, How i can pass the socket_io variable to a express routes module?
Express Project
-> app.js
> /routes
-> mainRoute.js
How do I get the size (numbers) of emojis on a server?
lib?
what lib
@signal estuary <Guild>.emojis.size ?
got it
if d.js
yeah
^^
Lol
xD
How can I send message when user leaves the server like guildMemberAdd
I want to count Members and bots.
exports.run = async(client, msg, args) => {
var bots = member.guild.members.filter(m => m.user.bot).size
var user = member.guild.members.filter(m => !m.user.bot).size
var totalUser = member.guild.memberCount
msg.channel.send("This server has " + totalUser + " Member. There are " + bots + " bots and " +user + " user.")
}
But this doesnt work (member is not definied)
Does anyone know how to count member and bots?
try msg.member
msg.member.guild.members.filter is not a function
🥴
members.cache.filter
const members = await msg.member.guild.members.fetch()
TypeError: Cannot read property 'filter' of undefined
well you need to put parenthesis around
const members = (await msg.member.guild.members.fetch()).array()
TypeError: (intermediate value).array is not a function
Updated prev message
TypeError: Cannot read property 'filter' of undefined
😅
Now show all code
exports.run = async(client, msg, args) => {
const { guild } = msg
const { owner } = guild
//const members = await msg.member.guild.members.fetch()
const members = (await msg.member.guild.members.fetch()).array()
let membercount = msg.guild.memberCount
var bots = members.cache.filter(m => m.user.bot).size
var user = members.cache.filter(m => !m.user.bot).size
var totalUser = msg.member.guild.memberCount
msg.channel.send("This server has " + totalUser + " Member. There are " + bots + " bots and " +user + " user.")
}
Replace members.cache with just members
Collection<string, GuildMember> has filter() itself?
oh wait wrong message reply
Now it works without erros, but users and bots are undefined
now members.filter instead of members.cache.filter
Replace .size with just .length
Thx this works
Thank you for all the help
Imagine fetch 40k+ users
Is it possible to get the status of a user? Like online afk dnd or offline
that's intent
what is intent?
wait nvm
presence
user.presence but you need to have PRESENCE INTENT to be turned on afaik
user.presnece returns undefined
was user ever defined?
Sry it returns offline
You could use docs, that easy
All entities chained with each other
E.g. what user you looking for?
it's not a function
Presence update not so fast i think
No its always offline
Someone else tried it too
its always offline
try to
const userS = await msg.mentions.users.first().fetch()
console.log(userS.presence)
userS.presence is not a function
I copied your code
Log for us msg.content
I'm out :D
And I dont get it
how can I execute a query in js?
if you feel better i can log it for you:
@still sky xD
plsss
Facts
Be more helpful than "use Google"
What do you mean by "query"?
isnt query the name of a command in mysql?
Well you didn't mention mysql
Assume the user used Google before asking 🤷
Anyhoo, are you having an issue with MySQL or MongoDB?
So, in a few of words, I have a database for my currency system, with PK in userID, I want to do a leaderboard, I've tried the $orderby but I think I did something wrong because is doesnt work. I need help, for sorting my database by a descending ammount of money in the field bank
ty
because some people here feel like god, ik that I'm trash at coding, but I'm trying to do my best
db.collection.aggregate([
{ "$addFields": {
"sortDate": { "$max": "$status.date" }
}},
{ "$sort": { "sortDate": 1 }}
])
can u explain the meaning of this command and how it works, because if I dont get it the next time I'll be again here at asking question
and I don't want a shitstorm everytime I ask something
Goes to show how lazy and unwilling to help some people can be
Why not use the .sort method?
I must import mongoose, right?
and the profileschema
Yes, but I'm talking about a database
but wait
Mongoose probably doesn't have that much of difference in terms of ways to get data
Why matrix?
because
In this way I can have the ammout of money of everyone and the userID
and after with .sort I cant sort by money
but if I change the order of money, will change also user ID with money?
Storing an object like {userID: '123', currency: 500} works, and you get then use .sort({currency: 1})
You will get the users with the highest currency amount
Since the user ID will be attached to the object
So instead of a matrix I do an array made of strings with userID and currency?
Why an array?
idk, just asking
because for now I hava 55 people playing with my currency system, but if I'll expand it in other servers, will be more and more
An array is unnecessary if you're only storing currency with user IDs in a collection
Your currency and id are two fields, you dont want them being and array over a dict / object as it just makes it harder for you and the db to handle
and I should implement also the guildID because I dont want in a server the leaderboard with people of other servers
Your ids should be unique so there shouldnt be any need for an array
You could use guild ID as the collection name
So, collect from guildID, order by currency
Order by currency field because it's a leaderboard, correct
yeah, is a leaderboard
Mhm
Using what ever the module you use provides
If its mongo im guessing it'll be find_x
https://srcb.in/s1ChCyDUtT
for now this is my code
Where x is some name like find_one
mhh, should be like find_serverID?
No
It'll be some set of methods defined by what ever driver you use, cant name them willy nilly
eval is really powerful
i'll make sure it's owner only
i mean who knows when someone will shut down the bot
ayo! i can't run async functions for some reason
like await async_function()
it gives syntax error for it
but when tried this way 'await async_function()'
it takes it as a string
how about await eval('async function()')?
lmao eval under eval?
or make your upper level function async
lemme try eval under eval
You can't call async functions outside async functions in Python either
asyncio.get_event_loop().run_until_complete() gang
oh so await eval huh?
damn 
yea
and i can't eval under eval
eval(eval(expr))
https://github.com/shivaco/Mari-bot/blob/master/cogs/owner.py see this as a reference
or smth like this
eval(await eval(expr))
Stole it from fuck knows where
even if it's not a promise await still works
Again, stop suggesting JS solutions in a Python issue
yep yep JS is weird
Are you okay
Do you see this
it's js right?
oh mygod
as said multiple times and observed by the raised errors and code

async def dm(self, ctx, user: typing.Union[converters.User, int], *, text):
change it to
async def dm(self, ctx, user: User, *, text):
i assumed it's js
Don't give me suggestions on that repo
and it will convert it for ya
i didn't read back
That bot is dead
oh



