#development

1 messages · Page 1717 of 1

toxic jolt
#

same cookies

earnest phoenix
#

Cookie \🍪?

#

¯\_(ツ)_/¯

pale vessel
#

I hope it's at least 8

#

8.1, I mean

spare badger
pale vessel
#

Oh never mind I noticed the aero glass theme

#

F, why are you using Windows 7

toxic jolt
#

yeah

#

I'm at work

#

have windows 7

spare badger
#

rip ahhaha

#

Okay so what are you exactly trying to achieve

#

Lets just start with that

toxic jolt
#

Are the cookies automatically cleared?

quartz kindle
#

well you're logging the cookies after you get them, so of course they are there every time you run the process

spare badger
#

@toxic jolt Cookies are not stored by default. So clearing is not even a thing.

spare badger
#

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

toxic jolt
spare badger
#

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

toxic jolt
#

im trying to

#

clear cookies on superagent module

true sable
#

what is going on here

umbral zealot
#

development

spare badger
#

@toxic jolt Stop trying

toxic jolt
spare badger
#

Its not the fix of the issue

#

Go look into using proxy's to work around the rate limit

toxic jolt
#

I do not understand how to fix this problem.

spare badger
#

You can use onion routing to get a new IP every time you send a request, it does however slow down you requests significantly.

toxic jolt
#

I LIKE IT

umbral zealot
#

I mean you shouldn't generally try to bypass rate limits on anything

spare badger
#

Sure but if you already chose to work around it you might aswell

umbral zealot
#

Because that's usually going to be against the terms of service.

quartz kindle
#

you GET the cookies first

#

you dont start with them

#

they are never saved

spare badger
#

He got it now Tim 😛

umbral zealot
#

yeah the SERVER sends the cookies lol

toxic jolt
#

no, i paid for it

spare badger
spare badger
crimson vapor
umbral zealot
#

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.

toxic jolt
#

I use it normally, but it gives rate limit for long periods of use.

umbral zealot
#

Just like you can't bypass Discord's API rate limits by using a different computer or VPS for your bot 😉

crimson vapor
#

welll

spare badger
#

@toxic jolt Yes maybe good to figure that out first. Are you using some kind of API key so send requests to the API?

crimson vapor
#

you can bypass rate limits using webhooks

#

thats what Brain does

umbral zealot
#

That wasn't my point, though.

crimson vapor
#

ik

spare badger
#

Not if you are linked with an API key

umbral zealot
#

Right, you can't.

#

If you have an API key, there is literally NOTHING you can do to bypass those limits

spare badger
#

@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

umbral zealot
#

the rate is limited for a long time.
...
it does not give api rate limit.

#

those are 2 conflicting statements

spare badger
#

Evie you are really not helping here go do something else

#

Just talking crap about him, try to help him

umbral zealot
#

I'm trying to understand and make them understand, thanks.

spare badger
#

@toxic jolt Thats not what it is doing

umbral zealot
#

The cookies aren't what is limiting you.

spare badger
#

@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

umbral zealot
#

You cannot bypass rate limits with IP changes.

spare badger
umbral zealot
#

Discord is based on an API key (your token), so using a different IP does not bypass Discord's rate limits either.

umbral zealot
#

Yes, that's exactly what I said.

spare badger
#

Hahahha turning the tables

umbral zealot
#

You can't bypass the sims' API any more than you can bypass Discord's

#

That's my point.

toxic jolt
#

Friends, thanks for your help

spare badger
#

No problem, good luck with fixing your problem

#

@stray warren 😂

#

Thats all we gonna get?

#

No works?

#

No error or anything

umbral zealot
#

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

crimson vapor
#

what

umbral zealot
#

you need the Server Members intent here

crimson vapor
#

man discord is not ok rn

balmy root
#

HOLD UP

#

THAT REQUIRES WITHLISTING

#

i cant have that

umbral zealot
#

Then you can't have guild member join events.

balmy root
#

but

#

i have ti white list things

umbral zealot
#

You'd have to request the intents to Discord if your bot is verified. That currently takes... 2-5 months.

balmy root
#

5 MOUTHS

#

!!!!!!!!!

boreal pewter
#

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

balmy root
#

lol

boreal pewter
balmy root
#

i have node.js'

boreal pewter
#

4k servers

#

4 shards

balmy root
#
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

crimson vapor
#

ive never seen that issue with any js libs, I also doubt its a d.py exclusive issue

balmy root
#

;-;

#

client.on("guildCreate", guild => {

crimson vapor
#

thats a really strange issue imo Bentzy

crimson vapor
balmy root
#

or just use .js Lol

lyric mountain
#

I wonder what happens if I click the X

crimson vapor
#

nothing

#

its the api request

#

so missing perms

balmy root
#

lol

#

reeeeee

earnest phoenix
#

How can I get her to recognize a live, instead of the numbers she adds LIVE

lyric mountain
#

lives dont have duration

boreal pewter
#

sorry its not on_server_join thats on issue, its anything that is related to intents

plain holly
crimson vapor
#

hmm

boreal pewter
#

why does it take an hour for intents to migrate, anyone knows?

umbral zealot
lyric mountain
#

and no video can have a length of 0 seconds

crimson vapor
#

ive never had that issue

boreal pewter
#

maybe im restarting it wrong?

lyric mountain
#

so, if the duration is 00:00:00 just write LIVE

crimson vapor
#

I mean I always just kill the process

balmy root
#

maybe do node stop and node index.js

plain holly
umbral zealot
# balmy root 5 mouths

no, 5 months is for new intents requests on existing bots, not for new verification requests

plain holly
#

oh

crimson vapor
plain holly
#

wtf

#

who is correct

umbral zealot
#

I am

lyric mountain
#

about 3-5

balmy root
earnest phoenix
umbral zealot
#

It's 1 month currently for new verification request. 2-5 months for Intents-only requests.

crimson vapor
umbral zealot
#

they are 2 separate queues

plain holly
#

oh

#

oof

crimson vapor
#

pain

lyric mountain
#

I forgot to request presences intent during verification

crimson vapor
#

im just gonna make a new bot to get intents

balmy root
lyric mountain
#

post-verif request took an eternity

balmy root
#

😄

balmy root
lyric mountain
#

there's no "recognize as a live"

#

unless youtube sends that data

balmy root
#

or u get the data with api

#

😄

lyric mountain
#

shes already doing it 🤦‍♂️

earnest phoenix
lyric mountain
#

dot dot dot

balmy root
#

use api

lyric mountain
#
let duration;
if (video.duration > 0) duration = `[${video.duration}]`;
else duration = "[LIVE]";
pale vessel
#

Oof

lyric mountain
#

how hard is to understand that NO video on youtube can have 0 length?

#

if it returns 0 then it's a live

#

simple

earnest phoenix
#

Understanding I understand, I just didn't know how to do it if you understand me

lyric mountain
#

vc é br né?

pale vessel
#

Si

pale vessel
#

oh waitt

earnest phoenix
#

kkk

earnest phoenix
pale vessel
#

p

lyric mountain
#

se a duração for 0 então é uma live

earnest phoenix
#

Ah sim

#

Então isso funcionará apenas para a LIVE

#

Certo ?

balmy root
#

how can i get new videos that are uploaded to a yt channel every secound

#

in discord.js'

#

or is that to hard

lyric mountain
#

sim, nenhum video pode ser postado no youtube com duração 0, nem tem como gravar

balmy root
#

👀

earnest phoenix
#

Entendo

lyric mountain
#

se retornou 0 é porque é uma live

balmy root
#

👀

earnest phoenix
#

Vou testar aqui

balmy root
#

O_O

#

i mean of a channel

#

one channel

#

not all of them

#

thou

#

that be cool

lyric mountain
#

it wouldn't

#

but of a single channel you can use websockets afaik

balmy root
#

streaming the crash channel for a youtube video xD

lyric mountain
#

don't know, research a bit

balmy root
#

👀

#

i been doin it for 3 weeks

#

;-;

#

:cri:

quartz kindle
#

i wonder how many layers of hash tables servers like google and youtube have

balmy root
lyric mountain
#

their hash tables aren't even 2D

balmy root
quartz kindle
#

they are 5d

#

lmao

oak cliff
#

-m 799415670147776573

gilded plankBOT
#

🤐 Muted Ashley / Ducky [✓BOT] ⭐#3674 (@balmy root)

mystic crane
#

hey anyone can help me in making my page dark mode

crimson vapor
still sky
#

wait, mb he found a client for you

earnest phoenix
#

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

still sky
#

show code

earnest phoenix
#

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)
}
})

still sky
#

after split add .join(' ')

earnest phoenix
#

ok

#

What is this command dafuq

sick fable
#

console.log('stupid thot');

quiet topaz
#

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])```
fresh verge
#

Yee.

quartz kindle
#

node 16 finally made performance global

#

no more having to require perf_hooks everywhere

cinder patio
#

why tho

long crow
#

Take a look brief on it last night, doesn't explore much

earnest phoenix
#

Why not

quartz kindle
#

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

earnest phoenix
#

There's some objects that should be global really

#

performance is one of the good ones that got into the globals

#

hi

tired panther
quartz kindle
#

i use it way too much

pale vessel
#

🤓

cinder patio
#

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

rough current
#

Is there I way I can count uptime, and print it out in a command though a variable?

stiff lynx
#

how can I code my leaderboard for the currency system, anyone can help me?

umbral zealot
stiff lynx
#

I have a bank for storing and coins for the wallet

umbral zealot
#

Ok so take your data, sort it by points, and show them in an embed

#

simple enough

stiff lynx
#

idk how... I'm sorry

umbral zealot
#

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

stiff lynx
#

idk how to sort it

#

because i'm prety sure that I have to sum coins and bank in a variable

umbral zealot
#

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.

stiff lynx
umbral zealot
#

Ok but easy doesn't mean we know.

#

Show us.

#

Every single bot is different.

stiff lynx
#

what do u want

#

the code?

umbral zealot
#

Code and your database format.

stiff lynx
#

this is the code for the table, this are my fields

#

and in particular this is for who joins the server

umbral zealot
#

that's how you sort with mongoose

stiff lynx
#

and i have a if(!profileData) in messages, because I added it in my message.js

umbral zealot
stiff lynx
#

I have to install the sql extension?

umbral zealot
#

... no?

#

you already have mongoose

#

did you even READ the link I sent? it's literally the mongoose docs

stiff lynx
umbral zealot
#

I'm not trying to talk down to you

#

I'm trying to give you the right information.

stiff lynx
#

It seems that u r doing it

umbral zealot
#

I don't even use mongoose. I just know how to google.

stiff lynx
#

so, you are telling me that I should sort with a qwery inside my database

#

but how can I do it with my code?

umbral zealot
#

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

stiff lynx
#

ty, I'll try

umbral zealot
cinder patio
#

hm... okay... I have no clue how to import javascript functions to rust when there's webpack... which changes the names of all functions

opaque acorn
#

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

earnest phoenix
# stiff lynx

this is a completely off topic question but do you use VS code?

#

and if yes which theme

umbral zealot
#

You're not, like, actually doing client.on("event") anywhere, @opaque acorn

umbral zealot
#

you need to actually register the event on the client

stiff lynx
earnest phoenix
#

oh LOL

#

because it looks really good

stiff lynx
#

when I'll code again I'll sensi u

earnest phoenix
#

ok

#

nvm I think I found it

cinder patio
#

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

lavish bramble
#
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

sudden geyser
#

Do you have intents enabled for receiving guildMemberAdd events?

lavish bramble
#

Where?

#

How can I do that?

#

Thnx

earnest phoenix
#

how do I put my bot's command list?

earnest phoenix
#

Cómo puedo hacer para que mi bot envié un mensaje a varios canales a la vez

opal plank
earnest phoenix
opal plank
earnest phoenix
#

Javascript

opal plank
# earnest phoenix discord.js
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"

fresh verge
#

highest is undefined

opal plank
earnest phoenix
#

My code is

if (!channel) message.channel.send("asd")
#

if (!channel) message.channel.send() Thonk

earnest phoenix
#

i'm not speak english

#

🥵

#

return message.channel.sene("asd")

#

Send a message to multiple channels with the same name

still sky
#

your code is: if channel with name asd not exist then send 'asd' to message channel

earnest phoenix
#

Ok

earnest phoenix
still sky
#

Np, look ^^

earnest phoenix
#

wtf

#

I do not understand

still sky
#
msg.guild.channels.cache.array()
  .filter(channel => channel.name === 'ad')
  .reduce(async (currChannel, nextChannel) => {
      await (await currChannel).send('')
      return nextChannel
  })

eee

fresh verge
#

I am having technical difficulties with my ban command.

fluid basin
#

show us your error or code

#

we cant help you if we dont know anything

fresh verge
#
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.

zenith knoll
#

Can you run multiple databases on one instance of mariadb client?

fluid basin
#

but generally you should use a different client instance for a different database

#

since there could be same table names and other issues

zenith knoll
#

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

fluid basin
#

huh?

zenith knoll
#

huh

fluid basin
#

you could just create 2 clients in your code

#

for accessing the db

zenith knoll
#

confuison lol

#

im new to databases i always used json for datastorage

lament rock
zenith knoll
#

yes

fluid basin
#

here we go again

zenith knoll
#

ok

fluid basin
#

anyways if its 2 different things

#

i doubt they use the same database anyways

zenith knoll
#

Yeah

fluid basin
#

so its fine

zenith knoll
#

so how would i run both at the same time

#

cause theyd be listening on diff ports

fluid basin
#

oh wat

#

you only need 1 mariadb server lol

zenith knoll
#

oh

fluid basin
#

they connect to the same instance

zenith knoll
#

would they be on the same port?

fluid basin
#

yes

#

you can have multiple databases in mariadb

#

you should get a database explorer

zenith knoll
#

Are there any mariadb tutorials lmao they all say mysql

#

idek the npm package for it

fluid basin
#

idk which is the best for windows

zenith knoll
#

¯_(ツ)_/¯

fluid basin
#

you can use a mysql client with a mariadb server

zenith knoll
#

yea

#

maria is a drop in replacement

#

but wouldnt i need to npm install some package to access mariadb?

still sky
# earnest phoenix array not function

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?

fluid basin
#

you can use any existing mysql connector, such as the mysql package or the mysql2 package

zenith knoll
#

really?

#

pog

fluid basin
#

yes

zenith knoll
#

ok bet thanks

zenith knoll
#

hi

#

why are you mass sending msgs to all channels anyway

still sky
# earnest phoenix 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'))
)
still sky
earnest phoenix
#
client.on('channelCreate', async channel => { 
  
channel.delete()
})```

how do I check if the person who created the channel is equal to a certain id?
summer torrent
#

you have to check audit logs

earnest phoenix
#

how

wicked pivot
earnest phoenix
#

How could I rename a role with discord.js

wicked pivot
earnest phoenix
#

Thanks

hollow rose
#

can you help me?

sterile lantern
#
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

earnest phoenix
#

In javascript, how do I know if something is text or not?

harsh blade
#

Can i somehow "ignore" or catch this error? Its been spamming my console for ages now

#

spams this over and over

#

dosent affect anything

vivid fulcrum
#

the error is coming from your code

#

djs is just throwing because it got an invalid response

harsh blade
#

So uh, what should i do?

vivid fulcrum
#

find where the error is coming from

#

aka debug your code

#

the code seems to be in an anonymous function

harsh blade
#

But i have distube

#

in package.json

vivid fulcrum
#

...but is it installed?

#

run npm i

harsh blade
#

I Cant run stuff

#

its pterodactyl

vivid fulcrum
#

😬

harsh blade
#

?

#

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

quartz kindle
patent light
#

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

vivid fulcrum
#

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

crimson vapor
#

true

sudden geyser
#

object Object

flat pelican
#

Hey, anyone here has some good resources to split my bot into multiple threads? I'm using discord.py

zenith knoll
#

would you reccomend using promise-mysql or mysql2 (or potentially mariadb npm [im using a maraidb db])

lament rock
#

mysql2 is good as a promise based wrapper and compatible with mysql and maria

#

No type defs though

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

flat pelican
#

what

sage bobcat
#

One message removed from a suspended account.

flat pelican
#

I'm using Python

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

flat pelican
toxic egret
#

.js is the best

#

#jsgang

sage bobcat
#

One message removed from a suspended account.

toxic egret
sage bobcat
#

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.

split hazel
#

Though python optionally allows you to use types which is nice, best of both worlds.

#

3.6 and up i believe

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

split hazel
#

I guess

#

Bit off topic but have you heard of cpython?

sage bobcat
#

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.

split hazel
#

I've never used it but it looks quite delicious, typed python code which is compiled down to c

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

dusky sundial
#

There are things like Numba that do that as well

#

but it's usually not necessary

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

split hazel
#

though node relies on node gyp for low level language boosts

#

uhh yeah I unfriended most people

sage bobcat
#

One message removed from a suspended account.

split hazel
#

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

quartz kindle
#

congrats :3

#

and welcome back

wicked pivot
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

quartz kindle
#

angery

wicked pivot
#

"the list of endpoints from discord.com/api" I'll let you watch for yourself, there is no endpoint list

quartz kindle
#

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

wicked pivot
#

ok sorry for the inconvenience

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

wicked pivot
#

""

#

yes.

split hazel
#

I am pretty sure they were referring to discord developer documentation, not discord.js

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

zenith knoll
#

would you reccomend using promise-mysql or mysql2 (or potentially mariadb npm [im using a maraidb db])

#

couldnt find if someone replied so repostttt

sage bobcat
zenith knoll
#

ok

drifting wedge
#

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?

worn sonnet
#

Can I create multiple apps in flask like we do in Django?

tidal sparrow
#

has anyone found the new discord buttons endpoints?

sudden geyser
#

I believe those are still experimental.

earnest phoenix
#

how do i set up a bot?

crimson vapor
#

@opal plank bonk

#

what did you do for grafana

#

did you use a time-series db?

zenith terrace
#

erwin not using the rpc ??

opal plank
crimson vapor
#

what did you use?

opal plank
zenith terrace
opal plank
#

Wdym what did i use?

#

Postgres and prom thats all i have

crimson vapor
#

prom?

opal plank
#

Prom client

#

Yes

#

Prometheus

crimson vapor
#

ah

earnest phoenix
#

hi

#

how can i invite and make stuart active

sudden geyser
#

Confused. Can you re-explain?

drifting wedge
#

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?

ripe prairie
#

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

drifting wedge
#

oh hello there

ripe prairie
#

hello there

#

even i need help sometimes KEK

drifting wedge
#

wdym

#

thats a cog tight

#

right*

ripe prairie
#

yeah

drifting wedge
#

you cant log erros on cog loading IN the cog

zenith terrace
earnest phoenix
#

/wumpus

drifting wedge
#

like for example if you dont load the cog

#

the cog isnt gonna check if it loaded'

ripe prairie
#

wdym?

#

like, this current cog that i'm on?

drifting wedge
#

so lets say

#

i have 2 files

ripe prairie
#

right

drifting wedge
#

right

#

cog.py isnt gonna say its not loaded

ripe prairie
#

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

drifting wedge
#

also this whole thinf doesnt make sense

#

you can just say cog loaded?

#

like if it erros

#

itll just not run?

#

wait

#

im dumb

ripe prairie
#

nah it'll stop after self.client.load_extension(...) if it errors

drifting wedge
#

i didnt realize what it is

ripe prairie
#

:p

drifting wedge
#

thats a command to load cogs

ripe prairie
#

yeah it's a manual load command

drifting wedge
#

ohhh

ripe prairie
#

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

drifting wedge
#

i mean you can do

#

try: LOAD COG
catch (or whatever it is) e
send e

#

ez

ripe prairie
#

i mean

#

yeah

#

try except always works

drifting wedge
#

see

ripe prairie
#

but like

#

iz uglee

drifting wedge
#

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

ripe prairie
#

the thing is

drifting wedge
#

the cog

#

you can replace it

ripe prairie
#

error != commands.ExtensionNotFound

#

for some reason

drifting wedge
#

oh im not sure

#

thats all i got

ripe prairie
#

anyways this works fine

#

but iz ugleeeeeeee

drifting wedge
#

wdym its ugly?

ripe prairie
#

also the @load.error thing kinda helps me catch multiple types of errors

#

which is why i wanted to use it

drifting wedge
#

i dont undertsand errors too much

#

sry

ripe prairie
#

np

drifting wedge
#

just try that

#

if problems

#

then dm me saying i need to drop everything to help you

#

not joking

#

im serious

ripe prairie
#

🤔

drifting wedge
#

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

ripe prairie
#

aye np

#

thanks

#

didnt even think of try/except tbh

slender thistle
#

If isinstance(error, commands.errors.CommandInvokeError):
error = error.original

#

😛

deep mantle
#

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?

dusky sundial
#

You can remove the default help command with client.remove_command('help') and then make your own

deep mantle
#

Great thanks!

slender thistle
#

iirc you could also set the command's usage attribute

waxen snow
#

Hey! What is the best bot hosting?

vernal shell
#

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?

long crow
#

Raspberry pi should consume way less power for electricity bill

vernal shell
solemn latch
#

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.

vernal shell
#

ah

waxen bough
#

channel.createOverwrite() requires MANAGE_ROLES am i right

shy stream
rotund vale
dusky sundial
#

A raspberry pi is not gonna consume $500 worth of electricity though

rotund vale
#

I'm not an expert in raspberry pi or electricity bills so Im not 100% sure

dusky sundial
#

You would barely notice a Rpi on your bill, but yes, a VPS is usually better and more reliable anyways

earnest phoenix
#

rpi takes low power lol

dusky sundial
#

but if you already own a raspberry, and got decent internet it's not terrible to host a bot on it

rotund vale
median iris
#

how to increase bot latency

rotund vale
#

Increase or lower? Cuz increasing means getting a slow reply

pale vessel
#

Self host it, use wifi and get to the furthest range you can while still being able to connect

median iris
#

O

#

i need best platform for music bot hosting

pale vessel
#

No, since that would reduce your latency

median iris
#

can someone suggest

pale vessel
#

You said you want a higher latency

median iris
#

O

#

plesae suggest me some best music bot hosting website

earnest phoenix
#

-support

#

-support server

#

!support

#

!support server

rotund vale
#

What are u doing @earnest phoenix

earnest phoenix
#

my rover is broken

#

idk if it is

#

when someone does !update in my server

#

it goes u dont have permission

rotund vale
median iris
vernal shell
median iris
#

please suggest me some

rotund vale
#

And reduces your electricity bill

#

And DigitalOcean gives 2 months of free trial

vernal shell
#

Woo also mentioned the benefits of a VPS, so that also got me thinking more

rotund vale
#

Yea, VPS got alot of benefits

rotund vale
vernal shell
#

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

rotund vale
#

Oh

#

U could also use galaxygate which provides 1gb of RAM, 1vCPU and 15 GB of storage for 3$ a month

#

@vernal shell

fierce ether
#

any reason this wouldnt load the css assets/css/main.css?

stiff lynx
earnest phoenix
#

ty

worn sonnet
#

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?

split hazel
#

that commend wipes your whole linux installation as well as all your files

worn sonnet
split hazel
#

I'm starting to think you're not doing this on your own bot

worn sonnet
#

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

split hazel
#

right well cutting to the chase you don't want people other than yourself running eval?

worn sonnet
#

no no

#

i mean how does this thing actually wreks the bot and how can i prevent it

dusky sundial
#

If you lock the eval command to bot owners only, you don't have to worry

worn sonnet
#

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

#

😦

dusky sundial
#

There are ways to make math commands without using eval

worn sonnet
#

yes but..

split hazel
#

but?

worn sonnet
#

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()

split hazel
#

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

worn sonnet
#

so no worries for me

split hazel
#

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

worn sonnet
split hazel
#

I believe that's just a calculator

worn sonnet
#

lmao yeah

split hazel
#

what exactly do you want to allow people to use with eval

worn sonnet
#

nothing much just they should be able to solve algebric expressions

#

or any basic mathematical expression

split hazel
#

then a math calculator should do

worn sonnet
#

and since i already use Numpy for some other command

split hazel
#

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

earnest phoenix
#

Well i use restricted python

worn sonnet
earnest phoenix
earnest phoenix
worn sonnet
worn sonnet
#

pls don't kill me

earnest phoenix
#

Oh

#

i wont

worn sonnet
#

people usually hate heroku and so do i
but it helps me run bot for free

split hazel
#

could've said that from the start

earnest phoenix
#

You proably shouldnt use restricted python since it is not you proably want

#

but if none of then work you can use it

split hazel
#

I'm not sure if you can even run external commands

worn sonnet
#

i will look into it

worn sonnet
split hazel
#

such as spawning a new python instance since heroku runs on dynos and need to keep track of your usage

worn sonnet
#

but soon i'm planning to host on raspberry pi

#

so i need to prevent all those things

earnest phoenix
#

Block OS module completly

worn sonnet
#

can't

#

using it for some other things

#

like importing files and saving them

earnest phoenix
#

No no i meant from calc command

willow mirage
#

anyone have any Idea, How i can pass the socket_io variable to a express routes module?

Express Project
-> app.js
> /routes
  -> mainRoute.js
signal estuary
#

How do I get the size (numbers) of emojis on a server?

earnest phoenix
#

lib?

cinder patio
#

what lib

willow mirage
#

@signal estuary <Guild>.emojis.size ?

signal estuary
#

got it

willow mirage
#

if d.js

signal estuary
#

emojiSize = msg.guild.emojis.cache.size

#

I got it myself but thx

willow mirage
#

yeah

signal estuary
#

^^

earnest phoenix
#

Lol

willow mirage
#

forgot the .cache

#

xD

signal estuary
#

xD

lavish bramble
#

How can I send message when user leaves the server like guildMemberAdd

waxen bough
#

it's guildMemberRemove

#

it is also emitted when user is kicked

#

says the docs

signal estuary
#

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?

waxen bough
#

try msg.member

signal estuary
waxen bough
#

members.cache.filter

still sky
#
const members = await msg.member.guild.members.fetch()
signal estuary
waxen bough
#

well you need to put parenthesis around

still sky
#
const members = (await msg.member.guild.members.fetch()).array()
signal estuary
still sky
signal estuary
still sky
#

Now show all code

signal estuary
#
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.")

}

still sky
#

Replace members.cache with just members

waxen bough
#

oh wait wrong message reply

signal estuary
waxen bough
still sky
#

Replace .size with just .length

signal estuary
#

Thank you for all the help

still sky
#

Imagine fetch 40k+ users

signal estuary
#

Is it possible to get the status of a user? Like online afk dnd or offline

waxen bough
#

that's intent

signal estuary
#

what is intent?

waxen bough
#

wait nvm

waxen bough
#

user.presence but you need to have PRESENCE INTENT to be turned on afaik

signal estuary
#

user.presnece returns undefined

waxen bough
signal estuary
#

Sry it returns offline

still sky
#

You could use docs, that easy
All entities chained with each other
E.g. what user you looking for?

signal estuary
#

var userS = msg.mentions.users.first()

#

console.log(userS.presence())

waxen bough
#

it's not a function

signal estuary
#

userS.presence.status

#

this returns only offline

still sky
signal estuary
#

Someone else tried it too

#

its always offline

still sky
#

try to

const userS = await msg.mentions.users.first().fetch()
console.log(userS.presence)
signal estuary
still sky
#

I copied your code

signal estuary
#

okay....

#

const userS = await msg.mentions.users.first().fetch()
still: offline

still sky
#

Log for us msg.content

signal estuary
#

msg content is +test @signal estuary

#

or what to you want to know?

still sky
signal estuary
stiff lynx
#

how can I execute a query in js?

signal estuary
#

if you feel better i can log it for you:
@still sky xD

stiff lynx
cobalt spruce
#

Facts

slender thistle
#

Be more helpful than "use Google"

slender thistle
stiff lynx
#

isnt query the name of a command in mysql?

slender thistle
#

Well you didn't mention mysql

stiff lynx
#

I already did, but I need more help

#

I tried the thing in the docs of mongodb

slender thistle
#

Assume the user used Google before asking 🤷

#

Anyhoo, are you having an issue with MySQL or MongoDB?

long crow
stiff lynx
#

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

stiff lynx
#

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

slender thistle
#

Goes to show how lazy and unwilling to help some people can be

#

Why not use the .sort method?

stiff lynx
#

I must import mongoose, right?

#

and the profileschema

#

Yes, but I'm talking about a database

#

but wait

slender thistle
#

Mongoose probably doesn't have that much of difference in terms of ways to get data

stiff lynx
#

can I create a matrix with userID and bank?

#

taking datas from the database?

slender thistle
#

Why matrix?

stiff lynx
#

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?

slender thistle
#

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

stiff lynx
#

So instead of a matrix I do an array made of strings with userID and currency?

slender thistle
#

Why an array?

stiff lynx
#

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

slender thistle
#

An array is unnecessary if you're only storing currency with user IDs in a collection

modest maple
#

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

stiff lynx
#

and I should implement also the guildID because I dont want in a server the leaderboard with people of other servers

modest maple
#

Your ids should be unique so there shouldnt be any need for an array

slender thistle
#

You could use guild ID as the collection name

stiff lynx
#

So, collect from guildID, order by currency

slender thistle
#

Order by currency field because it's a leaderboard, correct

stiff lynx
#

yeah, is a leaderboard

slender thistle
#

Mhm

stiff lynx
#

let's start from beginning

#

how I extract the data from database

modest maple
#

Using what ever the module you use provides

#

If its mongo im guessing it'll be find_x

stiff lynx
modest maple
#

Where x is some name like find_one

stiff lynx
modest maple
#

No

#

It'll be some set of methods defined by what ever driver you use, cant name them willy nilly

stiff lynx
#

I use mongodb

#

and tha table is named profilemodels

worn sonnet
#

eval is really powerful

#

i'll make sure it's owner only

#

i mean who knows when someone will shut down the bot

waxen bough
#

process.exit()

#

or while(true){};

worn sonnet
#

like await async_function()

#

it gives syntax error for it

#

but when tried this way 'await async_function()'
it takes it as a string

waxen bough
#

how about await eval('async function()')?

worn sonnet
#

lmao eval under eval?

waxen bough
#

or make your upper level function async

worn sonnet
#

lemme try eval under eval

waxen bough
vivid fulcrum
#

js does not work the same as py

#

lol

mild vortex
#

You can't call async functions outside async functions in Python either

waxen bough
slender thistle
#

asyncio.get_event_loop().run_until_complete() gang

worn sonnet
#

oh so await eval huh?

waxen bough
#

yea

worn sonnet
#

and i can't eval under eval
eval(eval(expr))

slender thistle
worn sonnet
#

or smth like this
eval(await eval(expr))

slender thistle
#

Stole it from fuck knows where

waxen bough
#

even if it's not a promise await still works

slender thistle
#

Again, stop suggesting JS solutions in a Python issue

worn sonnet
#

yep yep JS is weird

waxen bough
slender thistle
#

Are you okay

slender thistle
waxen bough
#

it's js right?

slender thistle
#

No

#

It's Python

waxen bough
#

oh mygod

slender thistle
#

as said multiple times and observed by the raised errors and code

mild vortex
worn sonnet
#

async def dm(self, ctx, user: typing.Union[converters.User, int], *, text):
change it to
async def dm(self, ctx, user: User, *, text):

waxen bough
#

i assumed it's js

slender thistle
#

Don't give me suggestions on that repo

worn sonnet
#

and it will convert it for ya

waxen bough
#

i didn't read back

slender thistle
#

That bot is dead

worn sonnet