#development

1 messages · Page 1153 of 1

faint prism
#

Rate limit

earnest phoenix
#

you got ratelimited

faint prism
#

The user has sent too many requests in a given amount of time ("rate limiting"). The response representations SHOULD include details explaining the condition, and MAY include a Retry-After header indicating how long to wait before making a new request.

drifting wedge
#

its giving me errors on total guilds

#

im on py

earnest phoenix
#

if you're scraping youtube you need to shuffle through proxies, youtube became much much more stricter with scraping

drifting wedge
#

serverCount = client.guilds

earnest phoenix
#

how are you still stuck on this

#

read the docs

faint prism
#

len

#

serverCount = client.guilds
@drifting wedge You're missing len()

#

And I don't mean just append it

earnest phoenix
#

How could I resolve this error? Changing the vps to change the ip?

#

if you're scraping youtube you need to shuffle through proxies, youtube became much much more stricter with scraping
@earnest phoenix

faint prism
#

How could I resolve this error? Changing the vps to change the ip?
@earnest phoenix Stop abusing an API lol

earnest phoenix
#

it's a youtube ratelimit

quartz kindle
#

literally every single music bot out there abuses the youtube api lol

earnest phoenix
#

@faint prism Music Bot

restive pebble
#

rip youtube

faint prism
#

Does yt rate limit selenium? Ik that's a slower solution

earnest phoenix
#

I never had this problem with blocks to something like

restive pebble
#

429 epic

quartz kindle
#

rate limits are applied according to some internal algorithm they have

#

the block is usually per ip

drifting wedge
#

how would i get the online offline members in a server?

#

i checked the docs

restive pebble
#

some can bypass it

drifting wedge
#

i only could find bot wide

quartz kindle
#

guilds have a .memberCount property

earnest phoenix
#

I'll do a little thing here so to remove the block from this IP

quartz kindle
#

which is a number of total members

earnest phoenix
#

rythm was broken for a good week because of this change, a work around is just to shuffle through a list of proxies whenever you get ratelimited

drifting wedge
#

which is a number of total members
@quartz kindle but is there online offline?

quartz kindle
#

no, only total

restive pebble
#

no

drifting wedge
#

but there is bot wide?

restive pebble
#

GWjianWut cache thing has that

quartz kindle
#

if you want to separate online and offline, you have to fetch all members

faint prism
#

if you want to separate online and offline, you have to fetch all members
@quartz kindle Made a logic error once regarding that behavior lol. That was a painful mistake.

drifting wedge
#

and im adding a stats command

faint prism
#

In my lib it returns null for offline, which I thought meant they didn't exist

quartz kindle
#

lmao

drifting wedge
#

and how do i check the users in guilds with the bot and number of guilds with the bot?

#

i tried but it gives me server stats

#

not bot stats

faint prism
#

"Oh yeah, I'll just delete them from the DB, since I must no longer share a common guild"

#

rip

solemn latch
#

len(client.guilds)
Or something right?

faint prism
#

lgtm

drifting wedge
#

bo

solemn latch
#

The user one is a bit different iirc

drifting wedge
#

no

#

that gives server stats

faint prism
#

equivalent to client.guilds.Count or client.guilds.Length in other language

drifting wedge
#

itll just say 1

quartz kindle
#

once again, if you want a number of ALL users, including duplicates that share guilds and offlines and bots and everything, use guild.memberCount, its cheap and easy to use
if you want to separate offlines, onlines, bots, remove duplicates and all that stuff, the only way to do that is to fetch all members, which uses a lot of memory so its not recommended

#

so which one is it?

solemn latch
#

Client isn't guild specific btw

faint prism
#

It's the bot's session

solemn latch
#

Unless your sharding every single guild?

quartz kindle
#

shard every single guild

#

yes pls

drifting wedge
#

client.guilds.Count this tells me guild count bot is in?

faint prism
#

client.guilds.Count this tells me guild count bot is in?
@drifting wedge That's not python dude. len(array) is the length in python

solemn latch
#

len(list)
Is the python equivalent

drifting wedge
#

ok

quartz kindle
#

and client.guilds is a list

drifting wedge
#

oh ok

quartz kindle
drifting wedge
#

and for users? is it len(client.users)

quartz kindle
#

yes

#

but

#

refer to the message i posted before about the differences between ALL users and separated users

#

if you dont fetch all members, client.users will only contain online users, not offlines

drifting wedge
#

well rn its sending for the server

#

not for bot total

#

oooh

#

wait

#

it might

quartz kindle
#

its not per server

drifting wedge
#

1 sed

quartz kindle
#

client.users is for all servers

#

but only online users

#

not offlines

restive pebble
#

sed

viscid fulcrum
#

I think you can do

guilds = client.guilds
print("Servers including offline members")
for guild in guilds
  if not guild.large:
    members = guild.members
    for member in members:
      print(member)

but not sure about that tho

#

@drifting wedge

quartz kindle
#

guild.members doesnt include offlines either

#

unless you explicitly fetch all members first

drifting wedge
#

well it works

viscid fulcrum
#

oh i thought if it wasnt a large guild it did

drifting wedge
#

it gets all members from 1 server

#

but its not "bot wide"

quartz kindle
#

show code

drifting wedge
#

1 sec

#
async def stats(ctx):
    serverCount = len(list)
    memberCount = len(users)

    embed = discord.Embed(
        colour = discord.Colour.blue()
    )

    embed.set_author(name='Arch | Stats', icon_url=f"{client.user.avatar_url}")
    embed.add_field(name="Total Servers:", value=serverCount)
    embed.add_field(name="Total Users:", value=memberCount)```
solemn latch
#

Can't you just map the client.guilds member_count
And then just add them

drifting wedge
#

it works on the server list

#

but not the membercount

quartz kindle
#

can you use undefined variables like that in py? or is list and users defined elsewhere?

drifting wedge
#

i think not used elsewhere

#

so should be fome

quartz kindle
#

should be len(client.guilds) and len(client.users)

drifting wedge
#

fine

#

serverCount = len(client.list)
memberCount = len(client.users)

earnest phoenix
#

Yo sup guys listen i need good bots (moderation,levels,stuff like that) for my server

drifting wedge
#

dm me

#

@earnest phoenix

quartz kindle
#

what is client.list supposed to be?

#

its client.guilds

drifting wedge
#

i just want a nmber

#

ok ill try

#

but the server count works

#

so i dont see why change it

quartz kindle
#

because its wrong? lmao

#

if it works for some reason its just coincidence

drifting wedge
#

ok

#
    memberCount = len(client.users)```
solemn latch
#

count = map(lambda c: c.member_count, client.guilds)
Total = sum(count, 0)

drifting wedge
#

so this is gooood?

solemn latch
#

🤔

quartz kindle
#

yes, but once again, it will not show offline users from large guilds

#

only for small guilds

#

but go ahead and try it

drifting wedge
#

i mean how would i do it then?

#

if it has large guilds?

quartz kindle
#

what Woo said, you have to get the member_count property from each guild and sum all of them

drifting wedge
#

count = map(lambda c: c.member_count, client.guilds)
Total = sum(count, 0)

#

so add this?

solemn latch
#

It might not be copy paste. I tried my best, but not a python dev

quartz kindle
#

im not a python dev either, i dont know the exact syntax, but thats the idea you have to follow

#

for each guild, get the member_count number and add it to a total

solemn latch
#

Iirc theres a more efficent way to do it aswell I just don't remember it

pine aspen
#

Hey. How could I remove smthg from an array mongoose.

#

I've been using the pull method.

#
const g = require('../../models/guilds'); 
g.updateOne({ id: message.channel.guild.id }, { $pull: { autoRole: '739887331796058162' } });

MongoError: '$set' is empty. You must specify a field like so: {$set: {<field>: ...}}

#

This is my current code.

#

I don't understand this issue though.

earnest phoenix
#

I don't think updateOne is the correct method to remove something from the collection?

pale vessel
#

it's not removing

#

what does the model look like?

slate oyster
quartz kindle
#

out of memory lol

sinful belfry
#

hey, anyone know what might be causing a 'SHARDING_READY_TIMEOUT' issue whenever i start up my bot? it still starts up eventually, but if i try spawning multiple shards then only the first shard ever seems to spawn (idk if this is a related issue), anyone have any suggestions? (using discord.js-light)

pale vessel
#

that man above you can definitely help you mmLol

quartz kindle
#

@_@

#

the sharding manager is weird af

faint prism
#

You're the best in the business Tim

quartz kindle
#

i dont even use it

sinful belfry
#

oh what do u use lol

quartz kindle
#

internal sharding lol

#

who needs multi-core when your bot uses 1% cpu on idle

sinful belfry
#

true

quartz kindle
#

anyway did that issue start recently? out of nowhere or after some update?

sinful belfry
#

it's been there for quite some time, it isn't new

#

it's just i started trying to add more shards but then the other shards didn't seem to spawn

faint prism
#

So you manage your own sharded client threads from the host process?

sinful belfry
#

not sure if the issue is related

quartz kindle
#

i dont use threads

#

its all in the same process & thread

#

well i'll test if djslight has any issues with the sharding manager

faint prism
#

I need to read up on shards then

sinful belfry
#

ok thanks

solemn latch
#

I have a huge list of things I need to read up on

faint prism
#

We all do lol. I think it's a dev thing

dusty shale
#

So I have an HTML website and a js bot.
I want to show the number of servers and the number of users that use my bot on my website.
Can anyone help me out in doing so?

#

(Basic dev, just started a while back)

earnest phoenix
#

you cannot do that without a backend server serving the data

dusty shale
#

Can you show me the way?

#

LIke any resources i can look at

#

to do so

#

well well he left the server

wary flame
#

You could use an expressjs server with a route that responds with your server count, in your html webpage make a request to your server and show the results in your webpage

#

@dusty shale

earnest phoenix
#

^

dusty shale
#

Do you know any vid or site I can visit to learn more?

earnest phoenix
#

you need a way to communicate with your bot, either with REST requests or a WS server (which is just overcomplicated if you don't want realtime updates)

#

not really

#

this is in a scope of full stack development

solemn latch
#

Really haven't read it

dusty shale
#

Thank you guys

#

I'll have a look

wary flame
#

I would use a REST request, it is easier you could even set a timeout on your webpage to send a request every once in a while to keep updating the server count

dusty shale
#

hmm

solemn latch
ionic dawn
#

Well @dusty shale in a simple and primitive way you could manipulate a file everytime your bot is added or removed and track that file in your html

solemn latch
#

^ template engines

dusty shale
#

Would it work with a static website?

ionic dawn
#

Yes

#

You just call the json when someones join and print the value

#

I mean, when someones join the web

earnest phoenix
#

not suggested

solemn latch
#

Honestly, theres more than just what we have listed here that you could do.

wary flame
solemn latch
#

Such a wide range of options

dusty shale
#

yup

#

but no idea lol

ionic dawn
#

@earnest phoenix i know, i said is primitive

dusty shale
#

I am ultra primitive

ionic dawn
#

But it works

earnest phoenix
#

you shouldn't rely on serving a file due to browser level caching, router side caching and ISP side caching but it could work

#

granted you can always append a cache breaker

ionic dawn
#

You can add the 3 events on the bot start, to get the actual guilds and write them, and then rewrite when some guild os added or removed 7210_jebaited

#

How bad is my english

solemn latch
#

7/10 didn't notice

dusty shale
#

all my files are hosted on github

ionic dawn
#

So?

dusty shale
#

Want to make sure it works

#

my discord is lagging

solemn latch
#

Even your bot? oliythink

dusty shale
#

no

#

not the bot

ionic dawn
#

Lol

dusty shale
#

website files

earnest phoenix
#

periodically hosting your bot with github actions :wesmart:

ionic dawn
dusty shale
#

so the express js will be in the bot files right?

ionic dawn
#

I make a dummy command yesterday, can I show?

dusty shale
#

sure

#

its still lagging

solemn latch
#

Yeah discord doing discord things

dusty shale
#

so the express js will be in the bot files right?
@dusty shale anyone ^

ionic dawn
earnest phoenix
#

isn't that just using that api for it

dusty shale
#

cool

#

minecraft

ionic dawn
#

Cant

#

The thing is writen on php

pale vessel
#

stinky

wary flame
#

@dusty shale anyone ^
@dusty shale yes

ionic dawn
#

I find 1 closed api and 2 deprecated npm rp

dusty shale
#

how will i call for it in website

earnest phoenix
#

yuh but there's apis that will literally just serve the image based on the url

wary flame
#

Make a request to your server

dusty shale
#

this all will sound very stupid but i cant help it cuz I am a newbie sry

earnest phoenix
wary flame
#

Using javascript

dusty shale
#

@wary flame could you give me an example of usage

solemn latch
#

The tutorial I linked earlier covers it iirc

dusty shale
#

ok sir

ionic dawn
#

Thats the thing that I use to generate them

#

But you cant use the link to give the image

solemn latch
#

Couldn't you just put it in an embed and call it a day?

#

Let the user load it

ionic dawn
#

It provides a php thingy that cant be send as a file, but you can download the image using fs(what i did)

earnest phoenix
#

if you send the raw url the discord client will hide it

#

and leave the image

quartz kindle
#

@sinful belfry i tested with a barebones setup and it seems to work

pine aspen
#

@pale vessel it’s autoRole: []

quartz kindle
pale vessel
#

what could be inside?

ionic dawn
#

I dont want it to be a link

#

Mod bots could get rip of them

wary flame
#

If you have jquery:

$.ajax({
method: 'request method',
host: 'your server ip',
url: 'request url'
}).done(count => console.log(count))

@dusty shale

ionic dawn
#

Perhaps idk

sinful belfry
#

@quartz kindle it could be the fetchAllMembers option, because that takes a couple minutes to complete

solemn latch
#

🤔 most mod bots ignore other bots dont they?

dusty shale
#

i do

quartz kindle
#

let me test with it

ionic dawn
#

Im sure they do

solemn latch
#

Also, if its in embed, mod bots probably won't check anyway

ionic dawn
#

But I wanted to send a file

pine aspen
#

@pale vessel I’m tagging so the message doesn’t get lost. It’s just strings inside []

ionic dawn
pine aspen
#

I’m looking to delete or pop the string out of the array

#

The one they specify

dusty shale
#

If you have jquery:

$.ajax({
method: 'request method',
host: 'your server ip',
url: 'request url'
}).done(count => console.log(count))

@dusty shale
@wary flame so i just have to replace them?

earnest phoenix
#

jquery 🤢

#

i thought we left that behind

wary flame
#

What else would you use?

#

This isnt nodejs

solemn latch
#

Pretty sure you can just use request anyway.

earnest phoenix
#

node-fetch

wary flame
#

This isnt nodejs
You cant install modules in browser

earnest phoenix
#

webpack

quartz kindle
#

@sinful belfry still works for me, but try increasing the spawn timeout: manager.spawn("auto",6000,60000) for example

wary flame
#

Okay you can using webpack

#

I am too lazy though

sinful belfry
#

ah ok lemme give that a go real quick

earnest phoenix
#

it's common practice to use node-fetch with SPA apps like react

wary flame
#

SPA?

earnest phoenix
#

single page application

wary flame
#

Ah

earnest phoenix
#

facebook is SPA

#

specifically react

#

they made react

wary flame
#

I knew that

quartz kindle
#

facebook is shit

pine aspen
#

When’s a good number of server to share?

earnest phoenix
#

when?

solemn latch
#

7

earnest phoenix
#

idk around dinner time

pine aspen
#

What*

earnest phoenix
#

your accurate amount

#

lol

wary flame
#

But since I am not much of a front end dev I havent really looked into react and other web frameworks

earnest phoenix
#

you really should

wary flame
#

Discord is laggin jeez

earnest phoenix
#

it's amazing to work with

#

i would never ever go back to regular html + css + vanilla js

wary flame
#

I have no need to though, I barely develop front end

#

Actually

#

I am working on a front end project atm, is it worth it to switch to react?

earnest phoenix
#

deep into the project? probably not, if you're still starting out i would suggest so

wary flame
#

If I would switch to react would I be able to make use of react native?

earnest phoenix
#

nope

#

react and react native are two different things

wary flame
#

Oh?

earnest phoenix
#

react is javascript based, it depends on HTML rendering

#

meant for the web

drifting wedge
#

im getting this error when i put it on heroku discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Bot' object has no attribute 'list'

#

ill send code 1 sec

earnest phoenix
#

react native is meant for android and ios apps but there has been some talk about react native working on windows and mac

cinder patio
#

You can use the fetch function in JS

#

to make HTTP requests without jquery

drifting wedge
#

how do i get membercount for ONE server

#

cuz im getting membercounbt for all servers

#

guild.membercount?

#

memberCount = len(client.users)

cinder patio
#

you can get the server with the <Client>.guilds.get function

drifting wedge
#

this should be the command

cinder patio
#

If you have only an id

drifting wedge
#

but its not working

#

just for one server

#

not all servers bot is in

#

and for server list?

#

serverCount = len(client.list)

slender thistle
#

client.guilds, not client.list

drifting wedge
#

sure

#

im bad

#

but i can help a bit

slender thistle
#

Or just ask here

earnest phoenix
#

Yo guys

#

Im making this bot

#

with a math command

#

can someone gimme the script?

#

codE*

wary flame
#

We dont spoonfeed

floral mulch
#

Hey

#

How to use command?

slender thistle
#

That traceback doesn't look pythonic

wary flame
#

How to use command?
@floral mulch what command

earnest phoenix
#

@fleet hornet npm i http-proxy-middleware

floral mulch
#

Like I have to use kiss command

earnest phoenix
#

add --save to end

#

eval(MATHEXPRESSION) @dire mica this works

floral mulch
#

Jo how can I give command to bot

earnest phoenix
#

@floral mulch we won't make you commands

floral mulch
#

Like

sudden geyser
#

you give command to bot by making command

solemn latch
#

"Pythonic"

#

🤔

#

Pythiccc

sudden geyser
#

Might get bitten

floral mulch
#

Dyno reply when I add ? Before next command

#

So any word or symbol?

wary flame
#

Its looks more "node-ish" to me

#

Thats called a prefix?

floral mulch
#

Yes

#

Exactly

wary flame
earnest phoenix
#

Is it possible to await while doing an iteration? For example, iterating through an array that it's elements are IDs, fetch them one by one

floral mulch
#

@wary flame so me

#

Angry command

#

Use it upon me

#

@wary flame

wary flame
#

Improve your english please

earnest phoenix
#

@earnest phoenix I think so

#

How so

slender thistle
#

eval(MATHEXPRESSION) 733652228434296872 this works
@earnest phoenix Generally, evaling math expressions is just not a good idea

earnest phoenix
#

ik

#

he wanted to be spoonfed he got it

slender thistle
#

There's math expression packages for that

earnest phoenix
#

ik

floral mulch
#

Improve your english please
@wary flame can you plz tell me how to give command to your bot? Show me one example

wary flame
#

We dont spoonfeed

slender thistle
#

They're asking how to

#

where exactly did they ask to be spoonfed

wary flame
#

They asked to make commands kinda

floral mulch
#

They're asking how to
@slender thistle exactly

#

They asked to make commands kinda
@wary flame no

solemn latch
#

what library 🤔

wary flame
#

Or his english is just hard to understand correctly

#

Might be me

solemn latch
#

sometimes you have to understand what is meant, not what is said - woo

slender thistle
#

Me understanding it might say it's just you

#

Could you please elaborate though? Add a command to your bot through your code? @floral mulch

floral mulch
#

Or his english is just hard to understand correctly
@wary flame I'm asking how to give command so bot will react

#

Could you please elaborate though? Add a command to your bot through your code? @floral mulch
@slender thistle show me a example please

#

😒

wary flame
#
<Client>.on('message', msg => {
if(msg.content === '!ping') {
msg.channel.send('pong')
}
})

@floral mulch simple ping cmd

#

In d.js

floral mulch
#

😐

slender thistle
#

What's the library your bot is written in?

drifting wedge
#

serverCount = len(client.guilds)

#

this works

drifting wedge
#

memberserver = len(client.users)

#

for a server?

#

or is it something else?

wary flame
#

Hmm? Are you asking for support on that bot?

floral mulch
#

You know prefix of this bot?

drifting wedge
#

owo

slender thistle
#

You'll have to ask the bot's support server

drifting wedge
#

shivaco, is memberserver = len(client.users) correct?

#

this sends for all servers

earnest phoenix
#

@slender thistle Just pull the -wrongserver card

drifting wedge
#

how can i do it for only 1 server

floral mulch
#

You'll have to ask the bot's support server
@slender thistle oh ok..
Thank you so much

solemn latch
#

0exe, tim and i gave you how to do for one guild and for all guilds earlier

slender thistle
#

shivaco, is memberserver = len(client.users) correct?
@drifting wedge Do you want to get all users cached or members of a server?

drifting wedge
#

members of a server @slender thistle

#

like for a server

#

not all users

slender thistle
#

len(guild.members) where guild is a Guild object

solemn latch
#

wouldnt
guild.member_count be more correct?

slender thistle
#

... yup, I'm just too used to caching everything

drifting wedge
#

ty

quartz kindle
#

stop torturing your server shiv

#

meanie

slender thistle
#

My private bots are fine ok

quartz kindle
#

ok

drifting wedge
#

i need to define guilds

#

guild

quartz kindle
#

dpy probably has message.guild no?

#

if not, it surely has message.channel.guild

drifting wedge
#

but

#

like where do i define guild?

#

get_guild?

solemn latch
slender thistle
#

message.guild works yeah

quartz kindle
#

if you're doing this for a command, then you should get the guild from the message, in order to get the guild where the command was used in

drifting wedge
#
async def membercount(ctx):
    memberserver = guild.member_count

    embed = discord.Embed(
        colour = discord.Colour.blue()
    )

    embed.set_author(name='Arch | Membercount', icon_url=f"{client.user.avatar_url}")
    embed.add_field(name="Server Members:", value=memberserver)
    embed.set_thumbnail(url=f"https://imgur.com/kmtYlLV.jpg")

    embed.set_footer(text=f"{ctx.guild.name}", icon_url=f"{ctx.guild.icon_url}")
    embed.timestamp = datetime.datetime.utcnow()

    await ctx.send(embed=embed)```
#

where thp

slender thistle
#

ctx.message

drifting wedge
#

im retard if you dont know

#

ok

quartz kindle
#

unless you want to make a command that gets information from a different guild

slender thistle
#

No wait

#

Easier way is ctx.guild

earnest phoenix
#

:kittyNotLikeThis:
@slender thistle Can you send this emoji's url?

drifting wedge
#

no

slender thistle
#

On phone, can't

drifting wedge
#

you use ids

earnest phoenix
#

Thx

solemn latch
#

you can right click any emoji

quartz kindle
#

@drifting wedge you're literally already doing it

solemn latch
#

and do "copy link"

earnest phoenix
#

I am on phone

solemn latch
#

ah

earnest phoenix
#

:ddd

slender thistle
#

Just get ctx.guild.member_count

quartz kindle
drifting wedge
#

?

#

?

quartz kindle
#

you're literally already doing the right thing

solemn latch
#

thats your code

quartz kindle
#

just do the same thing as that

#

but with member_count

#

instead of name or icon_url

drifting wedge
#

in the messgage?

solemn latch
#

🤔

quartz kindle
#

you want to get the member_count from a guild

#

ctx.guild is your guild

#

just use it, the same way you used it in the embed

solemn latch
#

you already used ctx.guild
his point was you probably should know how to get a guild since you already did it twice

quartz kindle
#

^

drifting wedge
#

this is what i have then ```@client.command(aliases=['members'])
async def membercount(ctx):

embed = discord.Embed(
    colour = discord.Colour.blue()
)

embed.set_author(name='Arch | Membercount', icon_url=f"{client.user.avatar_url}")
embed.add_field(name="Server Members:", value=f'{ctx.guild.member_count}')
embed.set_thumbnail(url=f"https://imgur.com/kmtYlLV.jpg")

embed.set_footer(text=f"{ctx.guild.name}", icon_url=f"{ctx.guild.icon_url}")
embed.timestamp = datetime.datetime.utcnow()

await ctx.send(embed=embed)```
#

imma try it

slender thistle
#

Could just

#

you know

#

str() everything

#

Not everything has to be an f-string

pale vessel
#

can't you icon_url=client.user.avatar_url?

#

or is that not how it works lul

solemn latch
#

f strings are like `${thingy}` in js?

pale vessel
#

yeah

viral iris
pale vessel
#

the problem isn't what you defined it as

#

the module is missing

viral iris
#

?

pale vessel
#

you most likely didn't include that module in your package.json file

#

which what heroku relies on

viral iris
#

i did

pale vessel
#

can you show the file?

viral iris
#
{
  "name": "code",
  "version": "1.0.0",
  "description": "",
  "main": "server.js",
  "dependencies": {
    "common-tags": "^1.8.0",
    "discord.js": "^12.2.0",
    "fs": "^0.0.2",
    "mongoose": "^5.9.29",
    "i": "^0.3.6",
    "moment": "^2.26.0",
    "npm": "^6.14.7",
    "quick.db": "^7.1.1",
    "request": "^2.88.2",
    "response": "^0.18.0",
    "stream-browserify": "^3.0.0"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}
pale vessel
#

did you redeploy

viral iris
#

line 10

#

yes

earnest phoenix
#

author: ""

viral iris
#

?

earnest phoenix
#

nothing

viral iris
#

"author": "", ?

pale vessel
#

show your build logs

viral iris
#

`-----> Node.js app detected

-----> Creating runtime environment

   NPM_CONFIG_LOGLEVEL=error
   NODE_ENV=production
   NODE_MODULES_CACHE=true
   NODE_VERBOSE=false

-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)

   Resolving node version 12.x...
   Downloading and installing node 12.18.3...
   Using default npm version: 6.14.6

-----> Restoring cache
- node_modules

-----> Installing dependencies
Installing node modules
npm ERR! cipm can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with npm install before continuing.
npm ERR!
npm ERR!
npm ERR! Missing: mongoose@^5.9.29
npm ERR!

   npm ERR! A complete log of this run can be found in:
   npm ERR!     /tmp/npmcache.LnjrR/_logs/2020-08-14T15_14_57_580Z-debug.log

-----> Build failed

   We're sorry this build is failing! You can troubleshoot common issues here:
   https://devcenter.heroku.com/articles/troubleshooting-node-deploys
   
   Some possible problems:
   
   - Node version not specified in package.json
     https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version`
#

node prob ?

#

plus

#

should i remove package-lock.json ?

solemn latch
#

cipm can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with npm install before continuing.

#

looks like it just wants you to run npm install

viral iris
#

so remove all packages?

pale vessel
#

like just delete your package-lock.json

trail forge
#

how to make that if the red thing is not set then its going to be other specified vc [ 743655540047085578 ]

viral iris
#

like just delete your package-lock.json
@pale vessel fixed

#

thx ❤️

slender thistle
#

@pale vessel avatar_url returns an Attachment object but d.py implicitly stringifies everything in embeds

#

so yes it's possible but not as explicit

stable eagle
#

let pref = db.get(prefix.${message.guild.id}); I get this error? ReferenceError: message is not defined

sterile thicket
#

let pref = db.get(prefix.${message.guild.id}); I get this error? ReferenceError: message is not defined
@stable eagle you must put that code in a OnMessage event with 'message' defined on it

earnest phoenix
#

If a file is in the directory /hygenx/commands/general/help.js, How would I get the directory name, aka general? Ping me

wary flame
#

@earnest phoenix __dirname

earnest phoenix
#

ok

viral iris
still badge
#

is it possible to make it wen a member bans a certain amout of people it takes their roles or gives them roles?

viral iris
#

how to fix this ?

still badge
#

is it heroku?

viral iris
#

yea

still badge
#

u have required an npm package in ur code but not installed it

#

it cant find collection

viral iris
#
{
   "name": "code",
   "version": "1.0.0",
   "description": "",
   "main": "server.js",
   "dependencies": {
    "common-tags": "^1.8.0",
    "discord.js": "^12.2.0",
    "fs": "^0.0.2",
    "mongoose": "^5.9.29",
    "collection": "^0.1.6",
    "i": "^0.3.6",
    "moment": "^2.26.0",
    "npm": "^6.14.7",
    "quick.db": "^7.1.1",
    "request": "^2.88.2",
    "response": "^0.18.0",
    "stream-browserify": "^3.0.0"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}
still badge
#

u havent made a new map or collection for it to find

#

im kinda new to this aswell

viral iris
#

i didi

still badge
#

just do npm i collection again then

viral iris
#

"collection": "^0.1.6",

#

not working

still badge
#

im not sure

#

sry

sterile thicket
#

is it possible to make it wen a member bans a certain amout of people it takes their roles or gives them roles?
@still badge yes

still badge
#

any tips to make it?

tulip ledge
#

how much ping will compressing and decompressing data add

sterile thicket
#

You can fetch audit logs

tulip ledge
#

As I store alot of things for a user and was thinking of maybe compressing it

still badge
#

@sterile thicket ban 5 ppl within a time limit

sand condor
#

what library

still badge
#

or a certain amount of people in a certain time

sand condor
#

library?

viral iris
#

You can fetch audit logs
@sterile thicket 1sec

sterile thicket
#

You need to fetch it from audit logs

still badge
#

im using discord.js

sick cloud
#

using express, can i reroute requests roughly, ie if my endpoint is on /v1/user but the request is just made to /user, can i reroute it without losing anything (data)

drifting wedge
#

@coral lichen @earnest phoenix fake mee6s

sand condor
#

you can listen to the guildBanAdd event

viral iris
sand condor
#

and store results in a database or something

tulip ledge
#

will compressing and decompressing my data for my database slow down my stuff?

viral iris
still badge
#

@sand condor do u need a db?

#

to do it?

sand condor
#

there could be a different way

sterile thicket
#

Oh I was trying to help Pickle here

still badge
#

yeah i need a different way

sand condor
#

but there's not like a ban collector in d.js

sterile thicket
#

I'm not sure about your error, sorry

viral iris
#

@pale vessel can u help ?

drifting wedge
#

do you guys add the bots here?

#

like if i make a bot and it gets added

#

does it stay here?

tulip ledge
#

yes

sterile thicket
#

@still badge you will need to fetch the executor from audit logs then set a timer I guess

drifting wedge
#

thats helpful

tulip ledge
drifting wedge
#

its like free 100k members

harsh badge
#

lol

tulip ledge
#

Members sais nothing

#

It's guilds that s ay alot lol

still badge
#

@still badge you will need to fetch the executor details from audit logs then set a timer I guess
@sterile thicket ok ty

slow ether
#

what's the best language to use for bot coding, i use pyton but it be mean to me

misty sigil
#

there is no best lang

#

just depends what u need lmao

slow ether
#

the easiest

misty sigil
#

js then

slow ether
#

o

misty sigil
#

but watch out for memory leaks and shite

slow ether
#

...

misty sigil
#

its hard to leak memory

#

but you can still do it

slow ether
#

idk how to use java at all

misty sigil
#

its java script

#

not java

slow ether
#

uhuh

#

ik

misty sigil
#

there is a difference

slow ether
#

idk how to use it tho

misty sigil
#

well just stick with python?

#

you're obviously know it if you're using it for a bot

slow ether
#

ok

sacred pewter
#

How can I do coding in a mobile?

regal jacinth
#

hey so i made a dashboard (not completed yet) which is connected to my bot and i want the user who enters it to login with his/er discord acc
i searched and found that i need to do something with oAth or something
but idk how
can someone pls tell me?
ping me if u can

#

@sacred pewter with an app

sacred pewter
#

Which one?

regal jacinth
#

depends on the long ig

sacred pewter
#

And what library it is....

regal jacinth
#

lang*

slender thistle
#
First you are supposed to redirect the user to /api/oauth2/authorize with the required url parameters (client_id, redirect_uri, response_type, scope). redirect_uri must be a value which exists in your app's redirect uri list. If and when the authorization process is done it will redirect the user to your redirect url with a url parameter named code e.g https://domain.com?code=x.

In order to exchange for an access token you need to make a POST call to /api/oauth2/token with these values in the body; grant_type, client_id, client_secret, redirect_uri, code. They need to match the values that were used in /api/oauth2/authorize (first request you made) and for code you use the code you got in the url parameter (?code=).

If the request was successful, you'll get a JSON response which contains a access_token and a refresh_token field. You need to cache it. Cache the refresh_token too if you want to do automatic token refreshes. Access tokens usually last for a week so you can choose whether you want to make your sessions last a week or if you want to do automatic token refreshes.

Skip this paragraph if you don't want automatic token refreshes
When you've made your request to /api/oauth2/authorize (request above) the JSON response will also contain a expires_in field. It's saying how long until the token expires in seconds. You can cache it or put it in a database, however don't lose it. Once the token is expired, you want to exchange the expired token for a refreshed one. Repeat the process above and make a POST call to /api/oauth2/authorize except you're going to throw out code out of the body and replace it with refresh_token which you should have cached as said above. 

Anyways, you use that access token in authorization headers now. For e.g to get info about your logged in user you call /api/users/@me with the Authorization header set to Bearer token
regal jacinth
#

holy

slender thistle
#

Once you get a hang of it, it's not that complicated catshrug

quartz kindle
#

do the implicit grant flow, its easier

#

the only downside is that your users will need to login again every time it expires

sacred pewter
#

Which library does Bot designer for discord in mobile uses?

slender thistle
#

Most likely discord.js

quartz kindle
#

pretty sure its discord.js

sacred pewter
#

Thx

viral iris
#

guys need help

#

this is the build log

wary flame
#

That means the module collection is not installed (correctly)

viral iris
#

but i did it in the package.json

#
{
   "name": "code",
   "version": "1.0.0",
   "description": "",
   "main": "server.js",
   "dependencies": {
    "common-tags": "^1.8.0",
    "discord.js": "^12.2.0",
    "fs": "^0.0.2",
    "mongoose": "^5.9.29",
    "collection": "^0.1.6",
    "i": "^0.3.6",
    "moment": "^2.26.0",
    "npm": "^6.14.7",
    "quick.db": "^7.1.1",
    "request": "^2.88.2",
    "response": "^0.18.0",
    "stream-browserify": "^3.0.0"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}
wary flame
#

I saw it was installing, then my browser crashed (big hastebin on mobile dont work), I am guessing it failed to install,
Could you maybe upload the log to a txt file

viral iris
#

yea sure

#

1min

wary flame
#

Thx

viral iris
#

i didn't do that cuz some of them don't download files thats why

wary flame
#

Most of the time hastebin is better

viral iris
#

Thx
@wary flame no thank u for help ❤️

wary flame
#

Mobile just hates hastebin

#

It indeed failed at the collection install (compiling trough node-gyp)

viral iris
#

so what to do ?

quartz kindle
#

do you actually need this collection package?

#

what are you using it for?

viral iris
#

yes for the mongo.db

quartz kindle
#

why does mongo.db need it?

viral iris
#

to collect the files/ folders

#
bot.commands = new Collection();
bot.aliases = new Collection();
bot.mongoose = require('./utils/mongoose.js');


///
bot.commands = new Discord.Collection();
bot.aliases = new Discord.Collection();
wary flame
#

@viral iris the package was last updated 6 years ago and already failed to build with node 4 (when looking tough issues on github),
I wouldnt expect it to build correctly on node 12 (your version) use collections (still developed)

sacred pewter
#

How to do a auto delete a command after 5 seconds in Bit designer for discord (mobile)?

wary flame
#

But why are you not using discord collections?

#

How to do a auto delete a command after 5 seconds in Bit designer for discord (mobile)?
@sacred pewter They have a support server ask there

viral iris
#

But why are you not using discord collections?
@wary flame is it better ?

#

idk i got it from source code

restive furnace
#

dont copy paste, OK.

wary flame
#

At least it installs...

quartz kindle
#

@viral iris thats a completely different thing

viral iris
#

dont copy paste, OK.
@restive furnace shut up

quartz kindle
#

those have nothing to do with the collection.js module

wary flame
#

idk i got it from source code
@viral iris source code probably was made for node 0.something (the version in wich the module did work)

restive furnace
#

why would I, and no. I am just helping you. 😂.

viral iris
#

i not asking for help from u

restive furnace
#

Well, why you did ask a question in this channel then?? 🤔

viral iris
#

@viral iris source code probably was made for node 0.something (the version in wich the module did work)
@wary flame so use discord collections or change node version ?

wary flame
#

Use discord collections

restive furnace
#

you can literally use Map.

wary flame
#

Or maps indeed

quartz kindle
#

delete the collection.js package, you dont need it

#

its a completely different thing

feral aspen
#

.map()

wary flame
#

No

#

Thats for arrays

feral aspen
#

oh woops,, sorry

restive furnace
#
let brandNewMap = new Map();
brandNewMap.set("hello", "bye");```
#

thats how do you use Maps.

feral aspen
#

Hello, just a question

viral iris
#

@wary flame @discordjs/collection 0.1.6 this right ?

restive furnace
#

you dont need any

#

just literally use Discord#Collection.

wary flame
#

Just use Discord.Collection

viral iris
#

what's the version ?

wary flame
#

You already have d.js

restive furnace
#

you dont need package

quartz kindle
#

discordjs/collection is included inside discord.js

#

you dont need to install it separately

wary flame
#

^

viral iris
#

only ```js
require("Discord.Collection");

wary flame
#

No

#

You already require discord.js somewhere right?

viral iris
#

i mena ```js
const Collection = require("Discord.Collection");

quartz kindle
#

no

viral iris
#

You already require discord.js somewhere right?
@wary flame yws

wary flame
#

No

viral iris
#

yes*

tight plinth
#

@viral iris nah

viral iris
#

server.js

wary flame
#

Just use Discord.Collection

tight plinth
#

first you require discord.js

#

then you store the collection property of it

wary flame
#

No requiring it, you already required d.js

tight plinth
#

No requring it, you already required d.js
@wary flame or not who knows

feral aspen
#

I am now making a loop to show the command category and the list of it's commands, ```const categories = readdirSync("./commands/")

    let embed = new Discord.MessageEmbed()
    .setTitle('Attitude Help Center')
    .setDescription(`These are the list of commands you could use! you can get more information about a specific command by using **\`!help <command>\`**. **(Example: \`!help donate\`)**.\n\nFor arguments in commands:\n\`<>\` means it's required\n\`()\` means it's optional\n\`[]\` means you have to choose one of the following\n**Do not actually include the <>, (), or {} symbols in the command.**`)
    .setColor(colors.cyan)
    .setFooter(`${message.guild.me.displayName} | Total Commandds: ${bot.commands.size}`, bot.user.displayAvatarURL())

    categories.forEach(category => {
        const dir = bot.commands.filter(c => c.config.category === category)
        const capitalise = category.slice(0, 1).toUpperCase() + category.slice(1)
        try {
            embed.addField(`${capitalise} [${dir.size}]:`, dir.map(c => `\`${c.config.name}\``).join(" "), true)
        } catch(e) {
            console.log(e)
        }
    })

return message.channel.send(embed)```

Now it is made by a loop, and I dont want that tbh, I just want to make a field, show it's title, its description, now the question is. If I want to show the total number of commands in a SPECIFIC category, how can I do that? The loop on it is dir.size, how can I do it for specific

viral iris
#

const Discord = require("discord.js");

quartz kindle
#
const { Collection } = require("discord.js")
a = new Collection();

or

const Discord = require("discord.js")
a = new Discord.Collection();
viral iris
#

thx ❤️

wary flame
tight plinth
#

o

feral aspen
#

any help for above, please?

tight plinth
#

@feral aspen you better store your bot commands somewhere in your client object when booting up the bot to be able to look at them more easily when executing commands

feral aspen
#

I did that.

#

I store them in a file

tight plinth
#

in a... file?

feral aspen
#

File> list of files (eg, moderation, economy

#

then etc.

tight plinth
#

i mean, thats an idea

#

not an optimal one, but an idea

feral aspen
#

@tight plinth

tight plinth
#

you should make every command an object with properties like name, category, description, code... so you can easily filter them later

#

@feral aspen

feral aspen
#

Yes

#

I did that

#

@tight plinth

#

Do you see my code above?

tight plinth
#

stop pinging for no reason im still here bud

#

yes ofc

feral aspen
#

This is the result

#

stop pinging for no reason im still here bud
@tight plinth Sorry

#

Now

#

That is the result, and it is pretty much not good for me,

tight plinth
#

if you just want to have the commands in a specific category, you can use .filter

feral aspen
#

I want it all to be seperate .addfield

tight plinth
#

you can only add up to 25 fields per embed

feral aspen
#

Yup

#

Ik

#

But like

tight plinth
#

so that might not be a good idea

feral aspen
#

a Field for economy and its command

#

a field for information and its commands

#

a field

#

BUT

dreamy cedar
#

just make every category in a embed

tight plinth
#

@dreamy cedar no

feral aspen
#

no

tight plinth
#

api abuse

feral aspen
#

that is BORING

tight plinth
#

ratelimit

feral aspen
#

and api abuse

tight plinth
#

if you want to get commands from a category, you can do commands.filter(c => c.category === "category name").forEach(c => ...)

feral aspen
#

Ok one sec.

tight plinth
#

@fleet hornet wrong server

#

and?

#

go to their support server

misty sigil
#

How do I fetch all emojis in discord.js

tight plinth
#

in this case we cant help u

feral aspen
#

Why is it like this...

earnest phoenix
#

Shut

tight plinth
#

what you want to do exactly

#

@earnest phoenix no

feral aspen
#

.addfield(The category name, its description, the size of the commandsin that category)

misty sigil
#

Nah I'm not gonna shut

feral aspen
#
        const categories = readdirSync("./commands/")

        let embed = new Discord.MessageEmbed()
        .setTitle('Attitude Help Center')
        .setDescription(`These are the list of commands you could use! you can get more information about a specific command by using **\`!help <command>\`**. **(Example: \`!help donate\`)**.\n\nFor arguments in commands:\n\`<>\` means it's required\n\`()\` means it's optional\n\`[]\` means you have to choose one of the following\n**Do not actually include the <>, (), or {} symbols in the command.**`)
        .setColor(colors.cyan)
        .setFooter(`${message.guild.me.displayName} | Total Commandds: ${bot.commands.size}`, bot.user.displayAvatarURL())

        categories.forEach(category => {
            const dir = bot.commands.filter(c => c.config.category === "economy")
            const capitalise = category.slice(0, 1).toUpperCase() + category.slice(1)
            try {
                embed.addField(`${capitalise} [${dir.size}]:`, dir.map(c => `\`${c.config.name}\``).join(" "), true)
            } catch(e) {
                console.log(e)
            }
        })

        return message.channel.send(embed)```
tight plinth
#

@feral aspen learn hod addfield works k thx

still badge
#

how do i check audit log perms

#

if(!message.guild.me.actionType("MEMBER_BAN_ADD")) return('Sorry i dont have permissons!');

#

like that?

tight plinth
#

learn how to use discord.js guys

#

docs exists for a reason

still badge
#

-_-

slender thistle
#

Do I go on about how people learn differently

still badge
#

ik

#

its called development for a reason

slender thistle
#

and that if you don't feel like helping, why you should even say anything in the first place nekothinking

feral aspen
#

Don't be like that..

#

shivaco

#

question?

slender thistle
#

Possible answer?

feral aspen
#

I am making addfields, the field contains the category name, the category description (which is from my own), and the size of the category

#
            const dir = bot.commands.filter(c => c.config.category === "economy")
            const capitalise = category.slice(0, 1).toUpperCase() + category.slice(1)
            try {
                embed.addField(`${capitalise} [${dir.size}]:`, dir.map(c => `\`${c.config.name}\``).join(" "), true)
            } catch(e) {
                console.log(e)
            }
        })```
#

I did this

#

I made a SINGLE category ONLY for economy, but the above happened.. 😛

#

How can I make it only one time instead of a loop

slender thistle
#

Sorry, I'm mostly a Python person

#

You'll have to wait for someone who's more familiar with discord.js

tight plinth
#

don't do that in the categories for each loop

#

try using a different approach

feral aspen
#

do I public the const stuff?

#

but that will get rid of category as a variable

amber fractal
#

You should get the commands in the category instead of all commands

tight plinth
#

^

amber fractal
feral aspen
#

Yes.

amber fractal
#

You have the right idea

#

you're just doing it in a for loop

feral aspen
#

Yes, and I want to prevent that

amber fractal
#

actually if you just remove the foreach loop and keep what's inside it, it should work

#

Because you're getting the same repeating category over and over again

tight plinth
#

you know what to do right? check for args, if args check if args = category name, if true send specific embed if no args send normal embed

#

like that

feral aspen
#

Yup

#

I will do that after I do the BASIC EMBED FOR HELP

#

caps

#

oof

amber fractal
tight plinth
#

that should work

feral aspen
#

Ok

#

Ill tyr

#

try

#

one sec

#

But no

#

It got rid of the category variable

tight plinth
#

and?

feral aspen
#

category not defined

amber fractal
#

You'll have the category in the args

tight plinth
#

if there is args

amber fractal
feral aspen
#

Yup

amber fractal
#

you hard coded this one, that's why it works there

feral aspen
#

And I want to make a field, containing the category name, description, and total commands in that category

fluid sonnet
#

guys i have a question

#

how save a console.log to a txt file?

tight plinth
#

@fluid sonnet if youre using pm2 it does it automatically for u

amber fractal
#

Wait are you trying to get all commands or just economy commands

feral aspen
#

Wait are you trying to get all commands or just economy commands
@amber fractal just economy commands,

fluid sonnet
#

@fluid sonnet if youre using pm2 it does it automaticly for u
@tight plinth pm2 🤔

#

i search

feral aspen
#

then I will keep repeating it for the other categories..

fluid sonnet
#

thx @tight plinth

amber fractal
#

Well, you can generalize it...

tight plinth
#

,p

feral aspen
#

with different defenitions.

tight plinth
#

@feral aspen you know you can make it somehow automatized

#

if my english is correct

feral aspen
#

yes.

fluid sonnet
#

but @tight plinth y don't use pm2

tight plinth
#

?

amber fractal
#

I could use filter as well, but I didnt think about that at the time

feral aspen
#

what can I do in my case.

fluid sonnet
#

how save a console.log to a txt file?
a module don't exist for this ?

feral aspen
#

I have that.

#

and removing the foreach loop removes the category variable

amber fractal
#

Well, economy is hard coded in at one point, so you'd have to hard code it at the other points if you want it to be defined when you remove the foreach

tight plinth
#

@feral aspen first thing first: do you know what each line of your code exactly does?

feral aspen
#

@feral aspen first thing first: do you know what each line of your code exactly does?
@tight plinth Yes man, wtf.

tight plinth
#

apparently it doesnt seems to

#

re analyze your code line per line you try to found the error

feral aspen
#

should I make a variable for the category

#

?

tight plinth
#

wdym

viral iris
#

how to set the prefix in command handler ?

tight plinth
#

show your current code

#

@viral iris depends whats ur command handler

amber fractal
feral aspen
#

This is my current code

#
        const categories = readdirSync("./commands/")

        let embed = new Discord.MessageEmbed()
        .setTitle('Attitude Help Center')
        .setDescription(`These are the list of commands you could use! you can get more information about a specific command by using **\`!help <command>\`**. **(Example: \`!help donate\`)**.\n\nFor arguments in commands:\n\`<>\` means it's required\n\`()\` means it's optional\n\`[]\` means you have to choose one of the following\n**Do not actually include the <>, (), or {} symbols in the command.**`)
        .setColor(colors.cyan)
        .setFooter(`${message.guild.me.displayName} | Total Commandds: ${bot.commands.size}`, bot.user.displayAvatarURL())


        
            const dir = bot.commands.filter(c => c.config.category === "economy")
            const capitalise = category.slice(0, 1).toUpperCase() + category.slice(1)
            try {
                embed.addField(`${capitalise} [${dir.size}]:`, dir.map(c => `\`${c.config.name}\``).join(" "), true)
            } catch(e) {
                console.log(e)
            }

        return message.channel.send(embed)```
still badge
#

if(!message.guild.me.actionType("MEMBER_BAN_ADD")) return('Sorry i dont have permissons!');

is this how to check audit?

tight plinth
#

if there is no args

viral iris
#

@viral iris depends whats ur command handler
@tight plinth wdym ?

amber fractal
#

your category in this case is always economy because of the previous hard coded statement.

tight plinth
#

@still badge ist there a view audit log perm?

#

@viral iris did you made your command handler

viral iris
#

yes

still badge
#

yeah but i need to check audit for my comand

#

command

tight plinth
#

i bet VIEW_AUDIT_LOGS is a thing

still badge
#

thats the actual perm

tight plinth
#

yes
@viral iris in this case you should kno whow it works

still badge
#

i need to view the actual logs

tight plinth
#

?

still badge
#

and a certain thing in the log

tight plinth
#

wdym

#

also having ban perms doesnt give you audit log perms, you need to have audit logs perms

still badge
#

yes i k

#

ik

viral iris
#

@viral iris in this case you should kno whow it works
@tight plinth idk where

still badge
#

idk how to explain it

tight plinth
#

are you 100% sure you made your command handler @viral iris

viral iris
#

my friend did

tight plinth
#

make your own

#

having someone else coding something for you is generally not a good idea unless you know what youre doing

faint prism
#

ie. trustworthy and competent

sudden geyser
#

internet escapist

feral aspen
#

            const generaldir = bot.commands.filter(c => c.config.generalcategory === "general")
            try {
                embed.addField(`🎲 General [${generaldir.size}]:`, `*Attitude's general commands you could use to check out pings, and more.*`, true)
            } catch(e) {
                console.log(e)
            }```
#

why does it say 0

#

it should count the number of commands in that specific category

sudden geyser
#

because nothing passed the filter. You could log c.config.generalcategory to see what you're getting.

feral aspen
#

ok

sudden geyser
#

By the way, since I assume you store the categories in memory such as a property, do you really need to read the ./commands/general directory?

dusky mason
#

wat u need help wit

acoustic bridge
#

Greetings,
I'm looking for some advice on how to send a Message via Bot to a specific Channel (via ID of the channel)

@client.command()
async def send(ctx, channel, *, content):
    channel = client.get_channel(id)
    await message.channel.send(content)

This is how my code looks right now - but obviously it's not working - Written in Discord Py by the way

slender thistle
#

get_channel accepts an ID in integer datatype

acoustic bridge
#

So the id in the () is useless?

slender thistle
#

You will need to replace it with an actual ID of a channel your bot has access to

#

Also, you do channel.send, not message.channel.send

acoustic bridge
#

I see - but my intentions are to send it to any channel it has access to

#

For example I will need to post it either in a suggestion channel or an announcement channel

faint prism
#

get_channel accepts an ID in integer datatype
@slender thistle isn't it a ulong?

#

or does JS python not specify that

slender thistle
#

py doesn't have a separate datatype for that

faint prism
#

how convenient, ty lol

slender thistle
#
>>> 128**128
528294531135665246352339784916516606518847326036121522127960709026673902556724859474417255887657187894674394993257128678882347559502685537250538978462939576908386683999005084168731517676426441053024232908211188404148028292751561738838396898767036476489538580897737998336
>>> type(128**128)
<class 'int'>
faint prism
#

l0l

slender thistle
#

For example I will need to post it either in a suggestion channel or an announcement channel
@acoustic bridge oh, user input

faint prism
#

one number type to rule them all

slender thistle
#

You can do channel: int and then channel = client.get_channel(channel)

#

I'd suggest renaming the function parameter to channel_id to avoid confusion though

acoustic bridge
#

I see - I'll try that. And yes I often worked with channel_id

faint prism
#

descriptive variable names are good practice

acoustic bridge
#

Got confused on some parts. Thanks a lot

olive narwhal
#

boys i just switched servers for my discord bot, and when i uploaded it to top.gg i put a diffrent support server link, how do i update it?>????

#
>>> 128**128
528294531135665246352339784916516606518847326036121522127960709026673902556724859474417255887657187894674394993257128678882347559502685537250538978462939576908386683999005084168731517676426441053024232908211188404148028292751561738838396898767036476489538580897737998336
>>> type(128**128)
<class 'int'>

@slender thistle damn

sudden geyser
#

I think you can still edit the bot (at least an edit button or something)

olive narwhal
#

ik

#

i just did 🙂

sudden geyser
#

nice

#

and yes python good at handling numbers

knotty steeple
sudden geyser
#

javascript

knotty steeple
#

u have to make it a bigint

slender thistle
#

Python handles numbers quite well for the most part

#

Float precision still being a small issue though

faint prism
#

lel

knotty steeple
#

y not just do **

#

man

faint prism
#

Because C# supports carots

slender thistle
#

^ happens to be power in C#?

faint prism
#

yep

#

** is something for pointers

knotty steeple
#

thonk

slender thistle
#

Ah right

faint prism
#

I really like how I can eval C# with my bot

knotty steeple
faint prism
#

Since there really isn't a quick way to interpret C#

knotty steeple
#

use a lua interpreter mmLol

faint prism
#

Nah CSharpScript via Roslyn api is low-key sick af

acoustic bridge
#
async def send(ctx, channel, *, content):
    channel: int
    channel = channel.get_channel(channel_id)
    await channel.send(content)
#

Still not working - although

modest crane
#

Nah CSharpScript via Roslyn api is low-key sick af
i don't think there's another way afaik

acoustic bridge
#

"NameError: "name 'channel' is not defined"

faint prism
#

i don't think there's another way afaik
@modest crane ?

slender thistle
#

@acoustic bridge Are you familiar with function parameters?

#

Or, well, arguments

acoustic bridge
#

Can you give me an example?

faint prism
#

def myFunction(parameters) {}

myFunction(arguments);

acoustic bridge
#

I see

faint prism
#

CSharpScript is the only way currently implemented to use interpreted code I think

acoustic bridge
#

So I guess the parameter channel is the issue

faint prism
#

what is , *, is that just a generic object in python?

slender thistle
#

Mhm

#

Rename it to channel_id

acoustic bridge
#

do I have to change the rest of the channel to channel_id too?

slender thistle
#

Nah, just the param

faint prism
#

and any references within the function to the renamed variable

slender thistle
#

@faint prism in vanilla Python it's to make an arg only to be used as kwarg

acoustic bridge
#

local variable 'channel' referenced before assignment
Means I basically already defined channel somehere?

slender thistle
#

aka

def test(var, *, yeet):
    print(yeet)

# will work
test(2, yeet=5)

# won't work
test(2, 5)```
faint prism
#

ah

#

an optional param

slender thistle
#

No, that means the variable doesn't have a value at the time of usage

#

well, no

#

Optional param is a param with a default value (arg = 5)

#

That's just keyword-only argument

faint prism
#

in C# we can do:

if (object obj1, object obj2 = null)  // Second one has default value and is optionally specified when referenced
slender thistle
#

Yeah, same in Python

faint prism
#

and chaining them is interesting

slender thistle
#

How come?

faint prism
#
void Function(object obj1, object obj2 = null, object obj3 = null)
{
  // code
}

Function("", obj3: "")
#

You can specify the third, and skip the second if you're explicit

#

assuming the last 2 are optional

#

Shiv, you gotta let me teach you C# some time

timber plume
#

What are some good, free hosts to use?

tight plinth
#

good and free doesn't exist

timber plume
#

i mean

tight plinth
#

good and for less than 5$ a month yeah that's possible

timber plume
#

i used heroku

#

that was ok

#

any thing that works

#

and is easy to naviagter

#

is good for me

solemn latch
#

heroku isnt a good host. nor is it intended to be used for bots

dull sluice
#

make a map instead so that you can set a value
const talkedRecently = new Map();
// bunch of other code
talkedRecently.set(message.author.id, Date.now())

#

and then when you check for message.author.id in talkedRecently you can check if it's been 10 seconds or whatever

#

ok so you would do like

message.reply('You have to wait 10 seconds!')
return
}
#

sorry about the bad indenting

#

but anyway that would check if it has been 10 seconds, and if it hasnt, it returns the message

#

k

misty sigil
#

you're forgetting a bracket

dull sluice
#

ok here is what mine looks like that works

            message.channel.send("This command has a 10 second cooldown!")
            return;
        }
        message.delete()
        talkedRecently.set(message.author.id, Date.now())
}```
#

did you make it a map

#

talkedRecently = new Map()

#

talkedRecently = new Set()
needs to be
talkedRecently = new Map()

#

np

#

also @earnest phoenix i see in your error message that you have Date.now() - talkedRecently.get(message.author.id) <= 10
the Date.now() function gives you the time in milliseconds, so you need to make that 10000, not 10

#

ok 👍

slender thistle
earnest phoenix
#

let randomvalue = test[Math.floor(Math.random() *test.length)], you can thank me later.

digital ibex
#

y do people use let when u aint reassigning it to smthing, use const

slender thistle
#

What does it matter tbh

digital ibex
#

it defies the point of const

earnest phoenix
#

linter would be pissed

digital ibex
#

i find it annnoying

misty sigil
#

const = single thing u dont reassign
let = movey thing that changes
var = ???

earnest phoenix
#

Python looks much cleaner though, agreed? @slender thistle

import random

list = ['shvaco', 'is', 'a', 'weeb']
print(random.choice(list))
misty sigil
#

who is shvaco