#development

1 messages ยท Page 1583 of 1

astral forge
#

wow

opal plank
#

i'll take a look at it soon, i got a few things to do today

slim heart
#

kk

opal plank
#

gotta do a WHOLE lot of shit today too

#

code-wise

astral forge
#

Who knows python here?

opal plank
#

@slender thistle theres a lost sheep here

#

also hi qt

slender thistle
#

ok what's going on

#

what's the issue @astral forge

astral forge
#

my banlist command needs len()

#

but i dont knwo where to add it

copper cradle
#

genshin's pretty good

#

omg my fucking internet won't connect wtf

#

how am I even supposed to send messages here kf my god damn texts won't send

astral forge
#
@client.command()
async def banlist(ctx):
    await ctx.send(f'Here Are The Users Who Have Been Banned! {ctx.guild.bans}')
slender thistle
#

Long story short, len accepts an argument that must have a __len__ method implemented

#

ctx.guild.bans does, therefore you can provide it to len as an argument

earnest phoenix
#

bans method is a coroutine doe

astral forge
#

so where do i put it

slender thistle
#

oh right

#

first await the .bans and actually call it

astral forge
#

?

#

wait

#

like this?

#

im so confused

#

lol

slender thistle
#

No

astral forge
#

?

slender thistle
#

In {} you need to await what you had before

#

aka ctx.guild.bans

astral forge
#

yea?

#

so {await ctx.guild.bans}

#

?

slender thistle
#

but, you would also need to add parentheses to .bans because it's a function and you need to call it

astral forge
#

what

slender thistle
#

yes

#

almost there

#

Now call the function with ()

astral forge
#

{await ctx.guild.bans}()

#

??

slender thistle
#

Inside the brackets

astral forge
#

oops

#

yea

#

ik

slender thistle
#

Now wrap it all with parentheses and prepend len to it

astral forge
#

like this?

slender thistle
#

aka accept the returned value from await ctx.guild.bans() an argument to len()

astral forge
#

hm

#

like this?

slender thistle
#

len(await ctx.guild.bans())

astral forge
#

ohh

pale vessel
#

shiv just gave up

slender thistle
#

aka length of the returned value from .bans() will be calculated

earnest phoenix
#

Lmao

astral forge
#

is this it

#

hopefully lmao

earnest phoenix
#

No

astral forge
#

wait what did i do wrong

#

?

#

is that right?

earnest phoenix
#

Try it and see, that's the fastest way to find out

#

i'm translating a bit of python code and i don't understand what [1:] does
parsed[...][...] returns an array and ranges is a 2d array

astral forge
#

here when it puts out now lmao

#

how do i get the names

earnest phoenix
#

[1:] is slicing basically, it removes the first element

#

ah

#

got it

#

thanks

faint prism
#

Can someone recommend me a dashboard server that I can use as a SeriLog sink or in general to consume metrics? I plan on having a ton of metrics pass into it. Ideally, I'm looking for something that is standalone and can be hosted from the server that will run the application generating the metrics.
I was looking at options like Seq or Stackify. Ideally free.

#

Figured you all would know all about dashboards here lol

astral forge
#

hmm

#

how do i return the names

earnest phoenix
#

If you wanna return the names, assign it to a variable instead of doing it inside f string, you don't want to make multiple requests. And basically you can do ', '.join(entry.user.name for entry in iterable). iterable is what you have assigned. And to get the length, do len(iterable)

astral forge
#

like this?

pale vessel
#

pog

#

yes

astral forge
#

mhm now what

pale vessel
#

it returns a list of ban entry

astral forge
#

?

earnest phoenix
#

Oh yeah

#

So, i.user.name for i in iterable

astral forge
#

wait what?

earnest phoenix
#

You can also do that, concatenating the string with for loop, but I personally would go for join

astral forge
#

ok

#

what do i do after that

pale vessel
#

join the names?

astral forge
#

what?

#

no but what do i put here

earnest phoenix
astral forge
#

yea but

crystal wigeon
#

hey umm, how would i get the avatar image from like a code thing that discord provides in the user object something like this "ae3e4ee180bc1d41db1ae2c06eaf"

astral forge
#

didnt i already do that

crystal wigeon
#

im using discord oauth and they dont give the displayAvatarURL

#

in the obj

earnest phoenix
earnest phoenix
crystal wigeon
#

thanks

gilded olive
#

Wassup

zenith knoll
#

node:6364) UnhandledPromiseRejectionWarning: TypeError: Cannot create property 'presence' on number '32767'

astral forge
#

this is what i got

#

but it dont work for some reason

earnest phoenix
#

Don't copy paste code if you don't know what you're doing

astral forge
#

lmao

gilded olive
pale vessel
#

you're just declaring user over and over

#

huh

astral forge
#

ik

pale vessel
#

why

gilded olive
#

Lemme jsk something rq

astral forge
#

i deleted that code lmao

#

dont worry

#

but

#

i need help making a banlist that returns usernames

pale vessel
#

ah

#

but norizon told you what to do

astral forge
#

ik

#

but i didnt understand he like dissapeared

pale vessel
#

iterate through banned_users and map them by username and join the list

astral forge
#

omg yes but like where do i put all that

#

its so confusing

#

lmao

pale vessel
#

in your fstring ig

earnest phoenix
pale vessel
#

like what you did with that len()

astral forge
zenith knoll
#

Hey im trying to make a bot run since its like impossible and uh UnhandledPromiseRejectionWarning: TypeError: Cannot create property 'presence' on number '32767'

gilded olive
#

You know

#

You can just run len() on ctx.guild.bans

zenith knoll
#

Ive made bots before but its first time with that error

astral forge
#

shouldnt this work

gilded olive
#

What the

zenith knoll
astral forge
#

with the len*

earnest phoenix
#

ctx.guild.bans is a method think

zenith knoll
#

lol

pale vessel
#

but they also want the names

zenith knoll
#

here is spoonfeed code

gilded olive
#
banned_users = await ctx.guild.bans()
print(len(banned_users)
>>> # some int```
#

i missed a )

pale vessel
#

nice

gilded olive
#

But you get the point

astral forge
#

nah i want it in the chat not cmd

gilded olive
#

Then just send it

earnest phoenix
#

Bruh

astral forge
pale vessel
#

i think they're stuck on where to put the x for x in iterable

astral forge
#

damn

zenith knoll
#

dude

#

that sends amt of banned

#

if u want the entire list

astral forge
#

yes?

zenith knoll
#

ya needa iterate them

#

and put em in a string

earnest phoenix
#

For the sake of humanity, I'd tell you that you're supposed to replace iterable with banned_users

#

From what I've sent

zenith knoll
#

??

#

you talkin to me?

#

or him

#

/her

astral forge
#

lmao

zenith knoll
#

no spoonfeeding

#

read the docs

astral forge
#

im joking

pale vessel
#

why would he do that, you won't learn anything

zenith knoll
astral forge
#

i dont actually want him to

earnest phoenix
#

In fact, I've spoonfed you enough

zenith knoll
astral forge
#

yea you have

pale vessel
zenith knoll
#

idk

#

if he wants it ez then bring him to the ctx.guild.bans() api reference

gilded olive
#

List comp? @earnest phoenix

earnest phoenix
#

Not needed actually

zenith knoll
#

so uh can someone help meh lol

earnest phoenix
#

Join takes iterable

astral forge
#

like this?!

zenith knoll
#

;-;

gilded olive
#

That would print the number of bans yes

pale vessel
#

and for returns a generator object which is iterable

astral forge
#

okay so if thats what i have

earnest phoenix
#

And I'm not sure, but I think what I did does return a generator

astral forge
#

what do i do now

gilded olive
#

What do you want now

zenith knoll
#

I wouldnt reccomend sending EVERYONE banned since u got a char limit

#

but you can send the amt of ppl banned

#

which is what ur code will do rn

astral forge
#

to return the names of the recent people banned

earnest phoenix
#

Paginate it 0_WeSmartGif

zenith knoll
astral forge
#

recent

pale vessel
#

slice then

zenith knoll
zenith knoll
#

recent

#

recent

astral forge
#

the last hmm

pale vessel
#

not sure if ban entries are sorted by date though

zenith knoll
#

no tinthe API

astral forge
#

the last 10 or 15

zenith knoll
#

only if ur a user lookin at the audit

astral forge
#

idk

zenith knoll
#

then get all bans

#

then fetch the latest 10

#

or 15

astral forge
#

mhm

pale vessel
#

then pagination is the only option

nova bobcat
#

(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[+!+[]+[!+[]+!+[]+!+[]]]+[+!+[]]+([+[]]+![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[!+[]+!+[]+[+[]]]

astral forge
#

so how exactly do i do tha-

nova bobcat
#

jsfuck

pale vessel
#

where's pyfuck

#

if that even exists

earnest phoenix
#

python already fucks you in the ass enough mmLol

pale vessel
#

hot

astral forge
#

hmm

stable nimbus
#

How would you push (or Checkout to) a different branch using git in VSC? Nothing I have found has really helped.

zenith knoll
#

UnhandledPromiseRejectionWarning: TypeError: Cannot create property 'presence' on number '32767' halp me jsut tryna make a bot

pale vessel
#

need more context

zenith knoll
#

okl

#

well

#

Im doing client.login("TOKEN HERE")

#

with a ; lol

#

and uh

#

i get that error

pale vessel
#

check your stack trace

zenith knoll
#

how uh

pale vessel
#

look what file the error came from

zenith knoll
#

oh that

pale vessel
astral forge
#

fuck it i dont need a banlist

zenith knoll
#

(node:872) UnhandledPromiseRejectionWarning: TypeError: Cannot create property 'presence' on number '32767'
at Client.login (D:\dbots\Gemini\node_modules\discord.js\src\client\Client.js:217:32)
at processTicksAndRejections (internal/process/task_queues.js:97:5)

zenith knoll
pale vessel
#

what version of discord.js?

zenith knoll
#

but whatevs

earnest phoenix
zenith knoll
astral forge
#

just thought it would be cool

zenith knoll
#

eh

#

define app

zenith knoll
# pale vessel the error itself

(node:872) UnhandledPromiseRejectionWarning: TypeError: Cannot create property 'presence' on number '32767'
at Client.login (D:\dbots\Gemini\node_modules\discord.js\src\client\Client.js:217:32)
at processTicksAndRejections (internal/process/task_queues.js:97:5)

nova bobcat
#

show code

pale vessel
zenith knoll
#

suurre

#

sure

nova bobcat
#

show code

zenith knoll
#

const client = new Discord.Client({ ws: Discord.Intents.ALL, fetchAllMembers: true });

nova bobcat
#

try console.log(app)

zenith knoll
#

gotta love intents

nova bobcat
#

see if it outputs anything

pale vessel
#

you need to provide an object to ws

zenith knoll
#

oh yea

pale vessel
#

Discord.Intents.ALL is a bitfield/number

nova bobcat
#

yes

pale vessel
#

that's where the error came from

zenith knoll
#

i have syntax error now

pale vessel
#

ws: { intents: <here> }

#

that's how you provide intents

zenith knoll
#

oh wait i didnt give it a key

#

only a value

#

obj arent arrays

#

LOOOOOL

pale vessel
#

arrays are objects though mmLol

zenith knoll
#

gotta love js

#

thanks

pale vessel
#

yeah all good

exotic portal
pale vessel
#

the string you're trying to decode is not a valid JSON

astral forge
#

just made my help menu so much better

outer zenith
#

i know this isnt a discord.py specific question, but i was wondering how to extract json files from websites using python?

#

well its one specific website so

pale vessel
#

extract? scrape or using APIs?

outer zenith
#

no like i just need like a link that has the json

#

cause like this website has diff users

#

and u can view the diff users by just changing the user part of the link

zenith knoll
outer zenith
#

and like if i can find the json file link, then i can get the data for any user

#

like for example for myanimelist the json file link is

earnest phoenix
pale vessel
#

ah yes mal api

earnest phoenix
#

here it is guide

#

its the same for everything

#

that haves json

outer zenith
pale vessel
#

cool

outer zenith
#

see the thing is i know how to parse json

#

its just that

#

i cant find the json for anilist

earnest phoenix
#

uh

pale vessel
#

i just use Jikan, but that endpoint seems more reliable since it won't be affected by Jikan's caching (well, it's the source)

#

can you get anime info without using MAL's official API?

outer zenith
#

yes

pale vessel
#

other than Jikan

outer zenith
#

yea i just webscrape

#

ive already done that for mal

pale vessel
#

ah

earnest phoenix
pale vessel
#

AniList's GraphQL API is good too

#

But MAL just has more info in general

#

They even have anime openings

outer zenith
#

yea i know but like ive already had bunch of mal commands

pale vessel
#

ah so you wanted AniList

#

i didn't see that

#

use their GraphQL API

exotic portal
pale vessel
pale vessel
#

but aren't you using Heroku? the prefixes will reset the next time you restart/redeploy your bot

exotic portal
pale vessel
exotic portal
#

๐Ÿ˜ญ

exotic portal
pale vessel
#

you need a proper database, because right now it's the same as storing the prefixes in memory

pale vessel
#

JSON database is not ideal anyway, so it's a good opportunity to use a real database

exotic portal
#

๐Ÿ‘

indigo folio
#

wtf i have a fan

quartz kindle
#

you have a wtf

#

what the fan

jolly mortar
#

i have a problem with my bot and permissions, when somone invites it and they check off the admin perm and invite it, then run a comamnd it breaks the whole bot

#

and makes it go offline

#

how can i fix it

#

im at 98% in the queue and i cant get it to stay online anymore pepowot

#

it got into a couple big servers

#

but they unchecked the admin perm for it

#

and when they run the command its returning an error

#

then shuts off

umbral zealot
#

The answer is: code your bot so it doesn't require the Admin permission

#

because we're going to invite it without Admin to test it.

jolly mortar
#

its gunna break

#

welp

umbral zealot
#

So fix it quickly

jolly mortar
#

it has ban and kick stuff

quaint wasp
#

bruh

#

MH10

#

werent u verifyed bot dev?

jolly mortar
#

and wont work without the admin KEKW

umbral zealot
#

ban and kick require the BAN_MEMBERS and KICK_MEMBERS permissions, not the admin permission.

jolly mortar
#

ohhh

umbral zealot
#

NOTHING require admin permission.

jolly mortar
#

ok lemmi fix it rq

#

so in the dev portal do i just check the ones it needs

#

then re code it

#

and it should work?

quartz kindle
#

you need to code it to check for permissions

umbral zealot
#

that has nothing to do with the dev portal, and everything to do with your code

jolly mortar
umbral zealot
#

it doesn't matter, we don't use your bot's invite

#

we literally invite all bots with permissions=0

#

I mean they have the basic everyone perms like sending a message, but they get invited with no admin/moderation perms

quaint wasp
jolly mortar
#

if they get invited with no perms would the commands that need the permission still work?

quaint wasp
#

how Do I make a privet config file

umbral zealot
#

They would if you ask for the proper missing perms

umbral zealot
quaint wasp
#

but I code with .js

umbral zealot
#

yes

#

.env file

quaint wasp
#

wait

umbral zealot
quaint wasp
#

I run that in terminal?

umbral zealot
#

Read the link it'll explain everything

jolly mortar
#

yea im not going to be able to fix it in time KEKW

quaint wasp
umbral zealot
#

Read. The. Link.

#

Don't button mash like a trained monkey. Read the page I Sent.

quaint wasp
umbral zealot
#

read the whole page

#

No one wants to guide you through the exact same thing the page already guides you through every step of the way

quaint wasp
#

bruh

#

it read the part says env files.

#

says name it just .env

#

no file name..

umbral zealot
#

ok and then what does it say?

#

what's next on that page written to help you?

quaint wasp
#

oh

#

bot

#

hosting

umbral zealot
#

You can use it for other things too, but I assumed bot hosting because you're literally on top.gg's discord server, so, y'know, easy assumption to make.

quaint wasp
#

alr.

jolly mortar
#

i have no clue what im doing KEKW

earnest phoenix
#

my man evie.codes is still helping da people

#

been years still does

umbral zealot
#

yah ur gurl evie still doin' it

earnest phoenix
#

i learned how to code when first met evie and still helping ppl

#

i remember asking stupid questions in discord.js server

umbral zealot
#

you and a thousand other noobs ๐Ÿ˜›

earnest phoenix
#

u

#

what do you think, when it's best time to start making something like premium version of the bot

#

i have bot with 1.3k servers

jolly mortar
#

thanks evie

earnest phoenix
#

i want to somehow monetize it and maybe buy ads or something

#

still got $0 from this huge project i've been working on for a long time

jolly mortar
#

my bot is 100% going to get denied all of my commands broke KEKW

umbral zealot
#

My suggestion would be to not try to monetise bots

earnest phoenix
#

why

#

i'm poor as hell, living in 3rd world country, and this bot is my key to get out of the shit, if i'll start getting money from it and making it bigger and bigger

past nova
#

yo

#

my bot's page design broke itself

#

i didnt touch the css and its now just yeeted

#

anyone has any idea of what happened

umbral zealot
#

top.gg does regular updates on the pages

#

I don't even see what's broken here.

#

looks pretty good to me

past nova
#

well

#

lemme show u

#

that aint looking good

#

ngl

umbral zealot
#

maybe if you do'nt like grey, but otherwise, it looks fine

past nova
#

lemme find the screenshots

outer perch
#

fast question, can I parseInt() timestamps?

past nova
#

of the proper design

umbral zealot
outer perch
#

but in firebase is an object

umbral zealot
#

but if you get a string, yes you can use parseInt

quartz kindle
umbral zealot
#

If it's an object then it's not a timestamp

#

maybe it's a date object?

earnest phoenix
#

but it's not getting much popularity

#

slowly growing

quartz kindle
#

yeah same here

earnest phoenix
umbral zealot
#

the problem with making money from bots is that you need to spend money to make money

earnest phoenix
outer perch
umbral zealot
#

if you're not using advertising and marketing you'll never be able to actually get money from premium features

quartz kindle
#

you need to give some sort of incentive for people who donate

umbral zealot
quartz kindle
#

either a special command, or a special version of a command

earnest phoenix
#

i really don't want to limit the commands but yeah yufhsdfsd

#

idk

#

prob gotta get even more servers

quartz kindle
#

not limiting, just enhancing somehow

#

im also against limiting

#

what i did with my bot was to give donators the ability to customize colors and certain values

#

but in my case its easier because the entire bot is about posting images and graphical charts

#

so donators get to change the colors of the graphics

earnest phoenix
#

what the-

#

you're creator of discord.js-light

#

i use that

quartz kindle
#

ye

#

lmao

past nova
earnest phoenix
#

i think i once even contributed

#

to ur repo

quartz kindle
#

oh? thanks haha

past nova
earnest phoenix
#

very unexpected

#

just checked patreon and saw discord.js-light

quartz kindle
#

another interesting thing

#

nobody ever donated to my bot through patreon

#

they all ask for paypal instead

past nova
#

@umbral zealot u see what i meant

umbral zealot
#

alright well, as Odin said, the CSS has changed , you'll need to adjust it

earnest phoenix
#

i wish paypal even worked here

umbral zealot
#

Stuff that happens when you don't control an entire website

#

ยฏ_(ใƒ„)_/ยฏ

earnest phoenix
#

me when born in hell and now have to somehow get out

quartz kindle
#

rip

#

from what i've seen, the only way to make money with bots is to use the same micro-transactions model that mobile games use

#

which is pretty much brainwashing people

mellow kelp
#

ew

tired panther
#

I am having errors connecting my account to youtube, can somebody help me?

earnest phoenix
#

fucky

quartz kindle
#

game bots with microtransactions make good money

outer perch
#

@umbral zealot when I get a certain timestamp from Firebase, I get this in the logs

Timestamp { _seconds: 1613160000, _nanoseconds: 0 }
umbral zealot
#

I'm guessing that's a proper timestamp then

#

and it's literally a nice little integer already

outer perch
#

but

quartz kindle
#

looks like the same format used in process.hrtime()

#

in node

outer perch
#
const snapshot = await refV.where('until', '<', (Date.now() + 86400000)).get();
#

this doesn't work

umbral zealot
#

sounds like a specific issue with Firebase then

outer perch
#

like it can't compare a timestamp with an integer

quartz kindle
#

when in doubt, just google it

outer perch
#

I tried

#

but I guess I did it wrong

#

so how do I filter that in where???

zenith terrace
#

When in doubt, ping tim

#

@quartz kindle

quartz kindle
#

what about this

outer perch
umbral zealot
#

well it shjouldn't "go online" without any error

#

so... what's the error?

jolly mortar
#

there are no errors..

#

i checked and got nothing in the terminal

umbral zealot
#

uhhhhhh well that's not normal.

jolly mortar
#

it was working yesterday when i was testing it

#

but idk wha happened

quartz kindle
#

how are you running your bot?

#

node index.js?

jolly mortar
#

with sq

quartz kindle
#

sq?

jolly mortar
#

sqlite

quartz kindle
#

that doesnt matter

#

you run it from cmd or from powershell? or from visual studio code's terminal?

#

or where from?

jolly mortar
#

i started with visual studio code but it didnt work out well so i moved onto repl

#

and it works from there

glossy spoke
#

Bruh

quartz kindle
jolly mortar
#

yea

glossy spoke
#

God

quartz kindle
#

so you dont need to run node there

#

repl.it automatically runs your code

umbral zealot
#

Your commentary isn't useful or constructive to this discussion.

jolly mortar
quartz kindle
#

can you show a pic of your repl.it window?

glossy spoke
jolly mortar
#

yea i hit run

astral forge
#

Bruh all i said was โ€œtime to make a mute commandโ€

#

How tf-

quartz kindle
#

show the full window, i want to see the console area

tired panther
astral forge
#

Oh

jolly mortar
astral forge
#

Mb g

umbral zealot
jolly mortar
#

admin perms

quartz kindle
#

there you go

astral forge
quartz kindle
#

so there is an error

#

what is the error?

umbral zealot
#

Not everything is about you, Andrew.

jolly mortar
#

its missing permissions

quartz kindle
#

no its not

astral forge
umbral zealot
#

It's missing a member ๐Ÿ˜„

quartz kindle
#

its trying to read the property "hasPermission" of null

tired panther
glossy spoke
#

Show the full code

quartz kindle
#

meaning you got a message with no member

umbral zealot
outer perch
astral forge
#

Its because i got doxxed by scary ppl

#

Lmao

glossy spoke
umbral zealot
#

Ok well don't get upset because someone calls you by the actual username you have on Discord. People tend to, y'know, call you by the thing you name yourself.

tired panther
tired panther
umbral zealot
#

smh obnoxious people be so toxic.

astral forge
glossy spoke
#

no

astral forge
#

Oh

#

Bruh

umbral zealot
#

Let's not discuss illegal actions @glossy spoke

glossy spoke
#

Ok.

astral forge
#

Nice teling everyone your gonna commit a federal crime ๐Ÿ˜˜๐Ÿ‘๐Ÿป

umbral zealot
#

Love how this went from bad to worse and keeps getting further off topic because people are so entitled and selfish.

earnest phoenix
tired panther
astral forge
pale vessel
#

don't "eh" smh

quaint wasp
#

Is there a way to make a command that will clear the terminal in VSC?

#

in .js yes... but in .py idk. I dont use d.py.

mellow kelp
#

why would you want to do it with a command though

quaint wasp
#

I wanna clear it sometimes without stoping my bot.

mellow kelp
#

um ok

quaint wasp
#

it didnt clear..

outer perch
#
const officialServer = bot.guilds.cache.get('738540548305977366');
const memberToVIP = officialServer.member('235148962103951360');

console.log(memberToVIP);
```doing this on 'ready', logs null. does the bot have time to cache the user?
sudden geyser
#

A Guild has a member_count property representing the number of members in a server. You can iterate over every guild your bot is in and add up the member count properties to get the total.

mellow kelp
#

it's just void

sudden geyser
#

member_count doesn't rely on intents and I'm pretty sure getting the guild list from the gateway won't be affected

quaint wasp
#

nvm

mellow kelp
#

wat

outer perch
#

read again

sudden geyser
#

Will it be enough to affect the number in the end

quartz kindle
#

you will always receive member_count, but without the intent, your member_count wont be auto-updated over the course of your bot's uptime

mellow kelp
#

well i think the bot has to cache the user

#

by that i mean, it needs the user to be cached

earnest phoenix
#

do you ever feel retarded

mellow kelp
#

yes

#

every day

compact prairie
#

question if im using ms (which i am) how would you implement "durations into it"

outer perch
compact prairie
#

const {Message, MessageEmbed} = require('discord.js')
const db = require('quick.db')
const ms = require('ms')

module.exports = {
info: {
name: "mute",
description: "Mute a User in your Server",
usage: "<user mention>",
aliases: [],
category: 'Moderation',
},

run: async function(client, message, args){
    if (!message.member.hasPermission('MUTE_MEMBERS')) return message.channel.send('You don\'t have the `Mute Members` permission needed to run this command.')
    const muteMember = message.mentions.members.first() || message.guild.members.cache.get(args[0])
    if(!muteMember) return message.channel.send('Cound not find the member specified.')
    const time = args[1]
    const role = message.guild.roles.cache.find(role => role.name.toLowerCase() === 'muted')
    if(!role) {
        try {
            message.channel.send('The muted role was not found, attempting to create one...')

            let muterole = await message.guild.roles.create({
                data : {
                    name : 'Muted',
                    permissions: []
                }
            });
            message.guild.channels.cache.filter(c => c.type === 'text').forEach(async (channel, id) => {
                await channel.createOverwrite(muterole, {
                    SEND_MESSAGES: false,
#

ADD_REACTIONS: false
})
});
message.channel.send( Muted role has successfully been created.)
} catch (error) {
console.log(error)
message.channel.send('Muted role could not be created.')
}
};
let role2 = message.guild.roles.cache.find(r => r.name.toLowerCase() === 'muted')
if(muteMember.roles.cache.has(role2.id)) return message.channel.send(${muteMember.displayName} has already been muted.)
await muteMember.roles.add(role2)

    const durations = {
        s: 1,
        m: 60,
        h: 60 * 60,
        d: 60 * 60 * 24,
        w: 60 * 60 * 24 * 7,
    }

    if (time) {
        setTimeout(function () {
            muteMember.roles.remove(role.id)

        }, ms(time))
    }
}

}

earnest phoenix
# mellow kelp every day

whelp thats where i am rn. i saved the amount of invites the inviter has to the data on the member that joined

misty sigil
#

fuuuuuuuck me

earnest phoenix
#

๐Ÿคฆโ€โ™‚๏ธ

misty sigil
#

oh fuck me

#

settimeout for timed mutes

compact prairie
#

yeah

#

how would i

misty sigil
#

store it in db

misty sigil
#

then check db

compact prairie
#

rn i have to do it in ms

earnest phoenix
outer perch
earnest phoenix
#

you have to do await guild.members.fetch() to get them all

earnest phoenix
#

maybe only a portion of online members?

outer perch
earnest phoenix
#

you gotta fetch either way so

earnest phoenix
outer perch
#

cuz, I don't have that intent

earnest phoenix
#

oh yea

#

and presence

outer perch
#

๐Ÿ˜ญ

#

both!?

earnest phoenix
#

members = join event
presence = member list

earnest phoenix
#

why wats wrong witht hat

outer perch
#

I have none

#

and after requesting gonna take a while for an answer

mellow kelp
#

well

earnest phoenix
#

and you have the intents

outer perch
earnest phoenix
mellow kelp
#

you don't need those for individual members

outer perch
#

my bot is in 104 servers

earnest phoenix
#

Any askers

mellow kelp
#

just fetch the user first

#

and then use guild.member(<User>)

earnest phoenix
#

Lol, joke @outer perch

quartz kindle
#

why do you need all members?

glossy spoke
#

who has the link for the express's docs?

outer perch
#

I don't

#

just a misunderstanding

earnest phoenix
#

anyone here use akairo?

outer perch
glossy spoke
outer perch
#

I guess I did it wrong

#

maybe I should do member.fetch

quartz kindle
outer perch
#

Tim's way is working

#

but let me try yours

quartz kindle
#

his way wont work

#

it does the same as server.member(id)

outer perch
#

yeah, undefined

glossy spoke
#

o

outer perch
#

well, ty

astral forge
#

Got any song suggestions while coding?

mellow kelp
glossy spoke
#

OMI- cheerleader

astral forge
#

Rick roll^^

quaint wasp
#

I got this:

    name: 'data',
    execute(client, message, args) {
  
        const Discord = require('discord.js')
        const data = new Discord.MessageEmbed()
        
        .setTitle(`DATA OF SMUGY FUGY`)
        .addFields(
          { name: 'Ram', value: process.memoryUsage, inline:false},
        )
          message.channel.send(data);
      console.log("DATA command had been ran..")
  }
  }``` And what I get in responce is this:
#

How do I specify what I need it to show?

tired panther
#

@quaint wasp .memoryUsage gives an array object, like in your array

quaint wasp
#

so its for like this... const (stuff here) = process.memoryUsage?

tired panther
#
module.exports = {
    name: 'data',
    execute(client, message, args) {
        const Discord = require('discord.js')
        let ram = process.memoryUsage().rss/1024/1024
        const data = new Discord.MessageEmbed() 
        .setTitle(`DATA OF SMUGY FUGY`)
        .addFields({ name: 'Ram', value: ram.toFixed(2), inline:false},)
          message.channel.send(data);
      console.log("DATA command had been ran..")
  }
  }
#

@quaint wasp try this

quaint wasp
#

oh

#

wow..

#

dang

#

your a fast typer

#

also

#

it worked.

tired panther
quaint wasp
#

can I colculate something more then just ram? Like space, ect?

tired panther
quaint wasp
#

Like how much space the bot is self takes.

#

whats rss?

tired panther
quaint wasp
#

oh.. alr.

tired panther
#

rss is all 4 boxes

glossy spoke
#

i readed the docs of express and i still can't understand how to use it to make my web page

tired panther
glossy spoke
#

a site like a blog

#

but

#

how can i make it to appear the index instead of a message like
res.send("Hmm");

tired panther
#

read the docs ablobshrug

pale vessel
#

you can use ejs with express

past nova
#

its not only the background tho odin

#

check the buttons

unkempt ocean
#

just send it here, maybe I can help

past nova
#
body {
  background-image: url(https://i.ibb.co/rHqvpg0/imgonline-com-ua-Texture-Seamless-LZgtn-Ed-IQmpw-OFI.png) !important;
    -webkit-animation: scrolling 50s linear infinite;
    -moz-animation: scrolling 50s linear infinite;
    -o-animation: scrolling 50s linear infinite;
    animation: scrolling 50s linear infinite;
}
@-webkit-keyframes scrolling {
  from{
      background-position: 0 0;
  }
  to{
      background-position: 0 105%;
  }
} ```
unkempt ocean
#

I suggest you that you should use .entity-wrapper instead of body

past nova
#

yah that worked

#

theres still things broken

#

but the background now shows up

#

thx

#

it does not move tho-

#

actually

#

no i wanted it in body

unkempt ocean
#

hmm

slender wagon
#

Does anyone have any idea how prefilled message links work on whatsapp

quaint wasp
#

and I get this

quick ridge
#

its v12 ?

earnest phoenix
#

roles.cache.find()

slender wagon
#

https://web.whatsapp.com/send?phone=phonenumberhere&text=test
like i can do this a phone number but i want to do it with a whatsapp group, does anyone have a clue? Google doesn't seem to know anything lol

lyric mountain
quaint wasp
#

alr.

#

how

#

?

outer perch
#

a question, setInterval() will run it's code after some time. But if the bot has just started up, I'd like that code to be run first, and then each interval. How do I do that without copying the code to 'ready'?

quaint wasp
#

I havent done that in months.

outer perch
#

remember the auto VIP sys, @quartz kindle? imagine if the bot restarts when a VIP is ending in less than 24h

quartz kindle
#

put the code in a function and run it once outside the interval

outer perch
#

and then call the function inside it

#

๐Ÿ‘Œ๐Ÿป seems the best way

earnest phoenix
#

Did you just entirely replaced the code with roles.cache.find()

#

message.guild.roles.cache.find() this is what it's supposed to be

quaint wasp
#

like so?

pale vessel
#

oles

earnest phoenix
#

๐Ÿ—ฟ Bruh

cinder sandal
#

oles

copper cradle
astral forge
#

Anyone making a bot in python?

pale vessel
#

do you need any help?

astral forge
#

Nope

#

Just asking

#

Thank you flaz for being so supportive and helpful through my bot development thought!

pale vessel
#

i c

astral forge
#

?

grizzled raven
#

i c means i see

astral forge
#

Ik that

#

But

#

Like

quartz kindle
#

ex dee

astral forge
#

so what should i use instead

mellow kelp
#

wait what

opal plank
#

everytime i see deno im reminded of that one guy who's really annoying

#

not gonna name names

quartz kindle
#

xD

opal plank
#

but theres a guy i dont really like that specialises in deno lib

#

"specialises"

past nova
opal plank
#

""""""""specialises"""""""""

quartz kindle
#

xD

#

check out this comment

earnest phoenix
#

written by someone who spends 4 hours fixing a bug on a production website mmLol

quartz kindle
#

apparently this thing blew out of proportion and the deno team had to make a statement

earnest phoenix
#

deno was and always will be ๐Ÿšฎ

quartz kindle
#

^ like ts :^)

#

jk jk

hidden lynx
#

another reason for me to not use deno

quartz kindle
#

however i agree with one thing: if you're gonna make a big thing thats gonna be used by the masses, its better if the internal code is pure js

#

compile times are a huge thing when developing big projects, plus you have more control over performance details and nitpicks

grizzled raven
#

ts wack

hidden lynx
#

idk why but whenever I write pure js I feel bad

grizzled raven
#

deno is cool but i dislike the extra things you need to configure to run like how node does out of the box, e.g. connecting to the web iirc

mellow kelp
#

but can't deno compile ts to js before shipping?

#

or is it so big that even that takes too long

quartz kindle
#

the article explains it

mellow kelp
#

hmm aighti

quartz kindle
#

the deno team had to wait 2 minutes to recomplie every single change

mellow kelp
#

ima go read

#

wack

grizzled raven
#

and compiled code looked stinky

quartz kindle
#

ye

mellow kelp
#

well yeah

#

compiled ts looks wack

grizzled raven
#

const deno_1 = require("../")

quartz kindle
#

plus they had issues with class inheritance and shit

#

they ended up having to maintain two copies of similar things because they couldnt get it to work

mellow kelp
#

but doesn't js have less support for classes tho

#

i can't see the advantage there

mossy reef
#

i have developed a botttt

#

i never thought i cud

hidden lynx
#

less support than what?

mossy reef
#

but i did it

mellow kelp
#

i mean

mossy reef
mellow kelp
#

js doesn't have abstract classes

quartz kindle
mellow kelp
#

private, protected

#

o

hidden lynx
#

js is js. nothing to do with deno?

mossy reef
#

???????

mellow kelp
#

oh wait

#

nvm

quartz kindle
#

yes typescript is more flexible and more feature-full

#

but if you think about it, none of that is native

mellow kelp
#

yeah

quartz kindle
#

everything is polyfills

mellow kelp
#

it all gets compiled down to js anyways

quartz kindle
#

ye

hidden lynx
#

wdym nothing is native?

mellow kelp
#

ts doesn't run natively with anything

#

it's compiled to js

quartz kindle
#

so not only you have to rely on node.js making good optimizations, you also have to rely on ts itself to make good optimizations

hidden lynx
#

oh yeah sure

quartz kindle
#

or you get shit performance

placid iron
#

I just use whatever the browser runs the js files on my website with

quartz kindle
#

xd

midnight blaze
#

How would you build the collector,if it should scan all the channels in the guild?

    let filter = m => true;
    let collector = new Discord.MessageCollector(message.channel, filter, { time: parseInt(args[0]) });

I use this collector for one message channel

placid iron
#

Monke.js sounds OP

mellow kelp
#

hm yes

#

monke

#

reject v8, return to monke

silk mesa
#

bota fbi komutu yapcam 2-3 tane gif koycam her seferinde onlardan birini rastgele atmasฤฑnฤฑ istiyom onu nasฤฑl ayarlฤฑcam birden รงok .setImage yapฤฑnca en alttakini atฤฑyor

hidden lynx
#

exactly

modest maple
#

it's actual name is SpiderMonkey

#

but

#

i call it monke

hidden lynx
#

imagine playing Microsoft edge xD

midnight blaze
#

@quartz kindle can you maybe help me with this one?

silk mesa
#

I'll do the FBI command on the boat, put 2-3 GIFs, and I want him to throw one of them at random every time, how to set it up more than once .when he does setImage, he throws the one at the bottom
how do I want rando to throw it away?
I'll bring a few more commands, but what do I have to write to throw random

quartz kindle
midnight blaze
#

I want to create a command where a user can scan all the message of his guild for a certain purpose

quartz kindle
#

returning results in real time, or returning results after the time ends?

silk mesa
#

I need code that I want to set the adjustable prefix system

blissful coral
#

Code it

#

We aren't going to just give it to you

quartz kindle
placid iron
#

I need code that I want me too, me too

silk mesa
unkempt ocean
silk mesa
quartz kindle
#

create a prefix command, when someone uses the command, add the prefix in your database

unkempt ocean
# silk mesa matematik nesnesi derken
silk mesa
midnight blaze
#

sorry Tim, didnt see you replied

silk mesa
#

nereye koycam

quartz kindle
midnight blaze
#

but will that work for all the channels?

#

in the guild

quartz kindle
#

you want all channels in the guild?

midnight blaze
#

yes

quartz kindle
#

oh

midnight blaze
#

exactly!

quartz kindle
#

then you need to use the message event

silk mesa
#

help me

midnight blaze
#

can I stop the message event?

quartz kindle
#

yes

midnight blaze
#

hmm, I see

unkempt ocean
#

once you have the random number, just get the link from array; like let randomGif = myArray[<your random number in here>]

silk mesa
midnight blaze
#

but you can not really limit a message event for one certain guild

pale vessel
#

Nonce

midnight blaze
#

hmm, maybe you can I guess I have to test it out

pale vessel
#

you can use nonce

midnight blaze
#

nonce

#

O:

#

thanks

pale vessel
#

wait I don't think you even need it

#

oh nm

quartz kindle
# midnight blaze can I stop the message event?
const results = new Map();
const handler = m => {
  if(!m.guild || m.guild.id !== message.guild.id) return
  results.set(m.id, m.content);
}
client.incrementMaxListeners();
client.on("message", handler);
setTimeout(() => {
  client.removeListener("message", handler);
  client.decrementMaxListeners();
  message.channel.send(results.size)
}, 60000)
midnight blaze
#

dude O; thank you

#

@quartz kindle

quartz kindle
#

you can also use incrementMaxListener to avoid listener warnings

#

client.incrementMaxListeners();
client.decrementMaxListeners();

#

edited to include them

copper cradle
#

fuck it I'm switching to V

lyric mountain
crimson vapor
#

in ts is there a way for me to say that a property of my class is there, but shouldn't really be used?

placid iron
#

NOTTOBEUSEDfunctionName()

#

Am I stupid? Yes

lyric mountain
#

or make it private

#

or write some javadocs for it

crimson vapor
#

o

#

if I make it private it should error, no?

lyric mountain
#

you'll need to make getters 'n setters for it

#

private can only be accessed within its own class

crimson vapor
#

ik that

#

I kinda just want it to be able to be used

#

but like yell at me if I do

lyric mountain
#

what lang?

crimson vapor
#

ts

mellow kelp
#

how about making the property private with a _

#
class Example {
  private _num: number = 4;
  
  public doSomethingWithNum() {
    // You can use _num here
  }
  
  public get num() {
    return _num;
  }
}
crimson vapor
#

I don't need to make it unable to be accessed directly, I just want ts to yell at me when I use it

mellow kelp
#

o

#

then throw an error or something

#

in the getter

crimson vapor
#

hmm

icy skiff
#

is it possible to make the title of an Embed colored?

crimson vapor
#

no

icy skiff
#

rip

crimson vapor
#

you could use canvas or something to do that in a sketch way

eternal osprey
#

hey

crimson vapor
#

wait ```js
class Class {
private _value: number = 1;

public get num() {
return this._value;
}

public set num(value: number) {
this._value = value;
return true;
}

} js
<Class>.num``` would return _value?

#

without a function

eternal osprey
#

i have a json file that contains: "808344263598669874":{"name":"pea hancock","mons":[5370724],"currentBalls":3,"spawnIds":[7011973],"catching":false}} objects like these. I have a defined variable that contains an id like: 53939. How would i change the id within mons to that saved variable?

crimson vapor
mellow kelp
crimson vapor
#

o

#

I didn't know that

mellow kelp
#

getters and setters are pretty cool for secondary effects

opal plank
crimson vapor
#

even if a getter does some calculations, its still not a function?

mellow kelp
#

nope

#

well

#

i guess technically yes

#

but you don't exactly "call" it with ()

#

oh no

mellow kelp
opal plank
#

so what?

#

i do that sometimes too

#

you just havent seen me tilted enough to do such

mellow kelp
#

wait it was a joke

crimson vapor
opal plank
#

i didnt start talking in spanish

#

so , no

crimson vapor
#

but

opal plank
#

not quite there yet

mellow kelp
#

moon's code kekw

crimson vapor
#

you were tilted

opal plank
#

i triggered

#

its different

#

any embed builder code will make me call you a hoe, its different frmo me being so angry that i simply cant find enough words in english to curse at you

#

@crimson vapor

crimson vapor
#

you didn't notice that I use 2 different embed builders?

opal plank
#

i did

crimson vapor
#

ah

opal plank
#

not only 2

mellow kelp
#

wait yes i forgot about the embed builders discussion

crimson vapor
#

no

#

like

#

2 different

opal plank
#

that shit was everwhere

crimson vapor
#

ctx.embed

#

AND

#

lib/Embed.ts

opal plank
#

see? mathew gets it

#

very rarely you see some code thats so shit you cant curse enough in english

misty sigil
#

actually sometimes i do run out of words to use

opal plank
#

the english lexicon does not provide enough means to curse at someone at that level

mellow kelp
#

want me to list some curses in spanish

opal plank
#

no thanks

mellow kelp
#

understandable

crimson vapor
#

erwin

#

help

#

what do I do to make my code better

#

other than rm ./ -rf

lyric mountain
#

chmod 777 -R /

crimson vapor
#

whats chmod 777 do

eternal osprey
#

have a json file that contains:
"808344263598669874":{"name":"pea hancock","mons":[5370724],"currentBalls":3,"spawnIds":[7011973],"catching":false}}

objects like these. I have a defined variable that contains an id like: 53939. How would i change the id within mons to that saved variable?