#development

1 messages · Page 1613 of 1

fast edge
#

like

umbral zealot
#

yes, like everyone else

fast edge
#

As soon as the bot restarts

umbral zealot
#

add that, problem fixed.

fast edge
#

ooh

#

wait

#

It think I got the prob

umbral zealot
#

yes, a lot of people had the problem. Add the line, the problem goes away, it won't cause issues in the future either, so it's not harmful.

fast edge
#

Thanks

#

Yeaaa

#
    if(!guild.available) return;
    else{
        console.log(`I was kicked/banned from: "${guild.name}" :(`);
        client.users.fetch("601446917007736832").then((user) => {
        user.send(`I was kicked/banned from: "${guild.name}" :(`);
        });
    }

});```
#

Like this right?

umbral zealot
#

you don't need the else

#

just the first line, no other change.

fast edge
#

ook

silk mesa
#

is there a site where V11 and v12 embeds are written to pass the bot from v11 to v12?

solemn latch
#

you should do it manually

#

its really not hard

earnest phoenix
#

regex replace your code

#

vsc can do it easily

outer perch
#

what does git sync do?

solemn latch
#

it syncs with the remote repo

#

for example, if you commit an update on one computer and want to get it on another, you use sync

silk mesa
solemn latch
silk mesa
#

ben turkum site does not translate into Turkish

#

@solemn latch can be done with node

quiet topaz
#

why am I getting a nullpointer exception on doing ```csharp
System.Console.WriteLine("some string");

earnest phoenix
#

you aren't by doing just that

quiet topaz
#

but it says that its System.NullReferenceException:

#

like do i have to using System.Console ?

earnest phoenix
#

it's literally impossible to get a nullref on that line

#

no

quiet topaz
#

hmm you right... it is that part below it... but why does it then do nullref in wrong line?

#

oh nevermind

solemn latch
lament stump
#

okay, i have been struggling with this:

https://sourceb.in/riCs5KCvx3 - When I use IDs to ban someone, the response "Please specify a member!" returns. However, mentioning a user works just fine. Any ideas on how to fix this?

earnest phoenix
#

get is a cache lookup

#

so you should use fetch which does a cache lookup first -> if not found do a REST request

#

it's a promise so you should await it

lament stump
#

uh

#

please explain in dumb

earnest phoenix
#

user not exist in memory
should use fetch because fetch first try to find in memory, if fetch doesn't find user in memory, fetch is going to ask discord to give the user to you

lament stump
#

ah okay

solemn latch
#

cant you just use the member manager ban method with the id directly?

earnest phoenix
#

also this

lament stump
#

oh wait

lament stump
#

i did .-.

earnest phoenix
#

you'll still have to fetch if you want to access the details like the tag though

solemn latch
#

yeah, mb i didnt realize you where fetching the user

#

you should fetch the user before banning

#

ok your doing that

#

i should look at code before answering

earnest phoenix
#

they're... not fetching though?

#

everything in that snippet is cache reliant

solemn latch
#

yeah no i know, but the get is above the ban, so when they change it its already in the right spot

#

await it, but yeah 👀

lament stump
#

i tried awaiting it

solemn latch
#

the fetch?

lament stump
#

the message.guild.members.cache.get(args[0])

marble juniper
#

uh

earnest phoenix
#

get != fetch

marble juniper
#

yeah

#

you were supposed to use message.guild.members.fetch

#

not message.guild.members.cache.get

#

for the await

lament stump
#

okay

#

that worked!!

#

only the message thing doesn't, but I can fix that

left lake
#

attempting to see how many entries each user has in a database so i can find who has the most. this is the code i've got so far (that doesnt work) js let officers = await client.logdb.findAndCountAll({ attributes: [[sequelize.fn('COUNT', '*'), 'count']], where:{ guild: message.guild.id }, group:['user'], order:['count', 'ASC'], limit: 1 }) , with the error of SQLITE_ERROR: no such column: logdb.count now a working example would look like js let officers = await client.logdb.findAndCountAll({ where:{ guild: message.guild.id }, group:['user'], limit: 1 }) in which case this returns ```js
[
{ user: '252200781376258059', count: 1 },
{ user: '629841787720302593', count: 9 }
]

#

the code that doesnt work is supposed to make an alias(?) and i can order the database using that?

#

this is sequelize by the way

tulip ledge
#

how do u turn this 10h5m20s into milliseconds? I tried the npm package "ms" but that only converts it if it's 10h or 5m or 20s not all together

eternal osprey
#

Hey how do I actually add aliases to a command?

#

Such as !kick, but also !k is allowed.

solemn latch
tulip ledge
#

I want users to input liek this: !giveaway 10h5m20s

#

so it's not always the same

opal plank
#

joined?

tulip ledge
#

yes

opal plank
#

cant it be 10h 5m 20s

#

?

tulip ledge
#

Otherwise I could just split it and add individually

blissful coral
#

yes

tulip ledge
#

no

#

It needs to be joined

blissful coral
#

Can't you split them?

#

Use regex

opal plank
#

then no, i do not know a good way

blissful coral
#

Could use some good ol regex

#

just split that string into 3

#

then use ms() and add them together

opal plank
#

cuz i do have code that does exactly what you looking for

#

but it has to be split

odd stratus
#

That’s going to be hella complicated if you try converting while it’s all joined

tulip ledge
#

but it can also be 10h5m for example

blissful coral
#

That works?

opal plank
tulip ledge
#

sure I can make it split then ig

#

I wanted to have it all i narguments but Ican make a message collector

opal plank
#

split by space, slice(-1), check if last item is s/m/h/d/w, then parseInt the rest, if !isNaN add it to total in ms

tulip ledge
#

alright ty

solemn latch
#

why cant it all be in arguments if its split

#

!reminder 1d 1h 1m 1s
can all be in args

opal plank
#

the way i did it is by splitting everyhing, harcoding arguments is stupid imo

#

so even if i were to do this

#

it just takes the highest

#

i had it before to add it, but that seemed like an annoyance more than anything

solemn latch
tulip ledge
#

no

#

Cuz it'll be like

#

!giveaway 5h10m2s 2 discord nitro for example

opal plank
#

my method is exactly like that

tulip ledge
#

I need to find the 2 and discord nitro wich isn't possible when having 5h10m2s split

opal plank
#

but split

#

lçook

solemn latch
#

remove them from args when you find them

tulip ledge
#

OHHH

#

ok

#

ty

opal plank
#

it doesnt matter where they are, just that they are split

tulip ledge
#

alright ty

opal plank
#

now im gonna have some random ass pings in that server without knowing why they were there in the first place

#

noice

solemn latch
#

👀

#

always the best

opal plank
#

also isnt giveaway bots really flunking?

eternal osprey
#

Hey! I’ve got 2 questions. 1: how long does discord take to verify my bot? 2: how do I make a command alias?

opal plank
#

i recall some talk about it somewhere

opal plank
#
  1. depends on ur command handler
eternal osprey
#

okay thanks!

#

Just a regular if statement

opal plank
#

||

#

use the OR operator

eternal osprey
#

Logical or?

opal plank
#

OR

tulip ledge
#

if(command == "command" || command == "c") {}

eternal osprey
#

Aha ofc!

#

thank you guys

opal plank
#

np

#

highly recommend stop what you doing btw

#

and use a proper command handler

eternal osprey
#

Aha yup. Thanks!

#

I actually already know what’s in there, I will change it rn!

quartz kindle
#

you know whats damn satisfying about working with c++ on node.js?

#

seeing your memory usage reflect immediately on everything you do

#

allocate 1gb of random stuff in a c++ map, clean it, watch rss drop from 1gb to 50mb in 1 second

eternal osprey
#

Is the api issue already fixed?

pale vessel
#

no

hidden lynx
#

anybody worked with mysql in combination with js/ts before?

#

gotta build an api with mysql for a school project. does it work well with js?

quaint wasp
#

why..?

round cove
#

You didn't import/require Discord.

modest maple
hidden lynx
#

okay ty nice to hear that

uncut swallow
#

hi,sorry but mi pc all programs is with icone google chrome help!!! :c

opal plank
#

how do i spread that?

lyric mountain
quaint wasp
#

still..

opal plank
#

yikes requring inside function

lyric mountain
#

Why tf are you requiring it that many times?

round cove
#

Bruh

quaint wasp
#

wait

#

its inside

#

one sec

lyric mountain
#

No, one minute

#

You gotta require at the head of the file

#

Not in a function

quaint wasp
#

I did

#

Thats what I said one sec for

#

same thing tho..

#

wait

#

dang it

#

message embed

#

one sec again

lyric mountain
#

That's why I said one minute

#

You don't require in a function

uncut swallow
lyric mountain
#

Little cog icon on start menu

#

Ah wait, is that windows 7?

#

Click settings on start menu then

quaint wasp
#

I got this:

const Discord = require('discord.js')
const MessageEmbed = require('discord.js');

module.exports = {.....```
#

and it gives the same error

lyric mountain
#

After that search for something regarding default apps

#

Or something like that

opal plank
#

well.... i figured out

#

cursed? 100%

modest maple
#

yikesss

#

that is

#

just wtf

opal plank
#

lmao

#

@modest maple giving hugs for snippets to fix that mess

modest maple
#

sadly cant help

#

my js is just as horrific

round cove
#

Why

opal plank
#

cuz flat aparently isnt spreading the array inside

#

even though it should

#

the final is the one i wanted

#

the second last is without the filter

#

and first is just flat() after map()

#

which was supposedly to flatten with depth

#

but it aint

opal plank
earnest phoenix
#

can anyone help me? my bot by a command will create a role and a channel, how do I make it to where my bot creates a variable for each channel and role made?

lyric mountain
#

use a database

earnest phoenix
#

aight thanks

lyric mountain
#

long answer: choose a database, create a table (if relational) or a document (if not) and store the guild <---> channel/role relationships

earnest phoenix
#

thanks

#

is the database most wise to go with mongose

solemn latch
#

its perfectly fine

hexed citrus
opal plank
hexed citrus
#

ok

opal plank
#

@hexed citrus

light lava
#

Quick question, and I am sorry if it's been asked before.... How do I allow my recruiters the ability to approve or deny applications, instead of only myself as administration?

hollow saddle
rigid sandal
#
  File "bot.py", line 26, in <module>
    client.run(TOKEN)
  File "/home/matthan/.local/lib/python3.7/site-packages/discord/client.py", line 718, in run
    return future.result()
  File "/home/matthan/.local/lib/python3.7/site-packages/discord/client.py", line 697, in runner
    await self.start(*args, **kwargs)
  File "/home/matthan/.local/lib/python3.7/site-packages/discord/client.py", line 660, in start
    await self.login(*args, bot=bot)
  File "/home/matthan/.local/lib/python3.7/site-packages/discord/client.py", line 509, in login
    await self.http.static_login(token.strip(), bot=bot)
AttributeError: 'NoneType' object has no attribute 'strip'
#

I need help

hollow saddle
#

Yes

rigid sandal
#

This is in python btw

lyric hawk
rigid sandal
#

Its a .env file

#

Thats all I can think of without coffee

lyric hawk
#

It seems that your TOKEN variable is set to None

#

Can you try to set it to a string?

#

Containing your token

rigid sandal
#

instead of a .env

lyric hawk
#

Yeah

#

The argument must be a string

rigid sandal
#

So mystring=('token') where mystring is token?

rigid sandal
lyric hawk
#

Are you sure your token is correct?

#

Make sure it's not the client id you're passing

#

But the token

rigid sandal
#

yes I copied it from the discord bot token

#

on the developer portal

lyric hawk
#

And you're running client.run('Mm9888.blabla')

#

correct

#

client.run('token')

rigid sandal
#

yes

lyric hawk
#

Do you have a traceback

rigid sandal
#

whats that?

lyric hawk
#

The detailed error

rigid sandal
#

in logs?

lyric hawk
#
  File "bot.py", line 26, in <module>
    client.run(TOKEN)
  File "/home/matthan/.local/lib/python3.7/site-packages/discord/client.py", line 718, in run
    return future.result()
  File "/home/matthan/.local/lib/python3.7/site-packages/discord/client.py", line 697, in runner
    await self.start(*args, **kwargs)
  File "/home/matthan/.local/lib/python3.7/site-packages/discord/client.py", line 660, in start
    await self.login(*args, bot=bot)
  File "/home/matthan/.local/lib/python3.7/site-packages/discord/client.py", line 509, in login
    await self.http.static_login(token.strip(), bot=bot)
AttributeError: 'NoneType' object has no attribute 'strip'

@rigid sandal yeah same thing as thqt

#

that

rigid sandal
#
  File "/home/matthan/.local/lib/python3.7/site-packages/discord/http.py", line 293, in static_login
    data = await self.request(Route('GET', '/users/@me'))
  File "/home/matthan/.local/lib/python3.7/site-packages/discord/http.py", line 247, in request
    raise HTTPException(r, data)
discord.errors.HTTPException: 401 Unauthorized (error code: 0): 401: Unauthorized

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "bot.py", line 24, in <module>
    client.run('TOKEN')
  File "/home/matthan/.local/lib/python3.7/site-packages/discord/client.py", line 718, in run
    return future.result()
  File "/home/matthan/.local/lib/python3.7/site-packages/discord/client.py", line 697, in runner
    await self.start(*args, **kwargs)
  File "/home/matthan/.local/lib/python3.7/site-packages/discord/client.py", line 660, in start
    await self.login(*args, bot=bot)
  File "/home/matthan/.local/lib/python3.7/site-packages/discord/client.py", line 509, in login
    await self.http.static_login(token.strip(), bot=bot)
  File "/home/matthan/.local/lib/python3.7/site-packages/discord/http.py", line 297, in static_login
    raise LoginFailure('Improper token has been passed.') from exc
discord.errors.LoginFailure: Improper token has been passed.```
lyric hawk
#

You're executing client.run('TOKEN')

#

'TOKEN' is not your actual token

#

You need your token in the string

rigid sandal
#

Oh so my token goes there

#

and sorry i was eating supper

nova otter
#

Why live on a monthly paycheck when you can earn $3000 in just a week through Bitcoin mining and you do not send money to anyone. Ask me how?

mellow kelp
limber flume
#

Ok haha, Been searching for 2 hours. Is there any way to receive audio from a discord vc using python.

I already make speech to text just need discord voicechannel audio kek

lament rock
#

if Discord.py docs doesn't have anything, then you'd possibly have to create your own voice lib or use an external module similar to lavalink. Although, LavaLink is audio send only. Just need the reverse

limber flume
lament rock
#

If you end up having to make your own lib, then you get to become one of the cool kids who has to suffer with udp

limber flume
#

😔

lament rock
#

Well. I code in JS, so not much I can do to help other than suggest reading if dpy has receive

limber flume
#

Does Discord themselves support bots receiving audio?

icy skiff
#

Im 99% sure discord.py does not have any built in method to catch Voice audio

#

And tbh I don't even know how you would even begin to catch Voice audio

#

U will have a Lot of work lol

#

Good luck with that one

heady sable
#

wait no

#

nvm

earnest phoenix
#

how do I do this using mongodb? my bot by a command will create a role and a channel, how do I make it to where my bot creates a variable for each channel and role made?

rigid sandal
#
File "bot.py", line 24
    async def _list(ctx, arg): 
                              ^
IndentationError: unindent does not match any outer indentation level```
mellow kelp
#

curb your indentation

round cove
#

Heyo nerds, I'm trying to use canvas to draw images but it seems that the avatar from the user is blurry. I read online that imageSmoothing should be disabled but it didn't work regardless of trying. The height/width is set so it fits in the circle just right.

Any ideas?

mellow kelp
#

set the size to something like 512 in the avatar url function

round cove
#

Ah.

#

Pog that worked

#

Thanks a ton

mellow kelp
#

np

crimson vapor
#

pog

#

canvas is fun but anoying

mellow kelp
#

kinda

#

(fun - yes, annoying - kinda)

rigid sandal
#

what do you mean by that?

limber goblet
#

How do I use this bot

rigid sandal
limber goblet
#

Member counter bot

#

@rigid sandal

rigid sandal
#

is that the bot your referencing?

limber goblet
#

@rigid sandal

rigid sandal
#

firstly

#

m!help

#

that will pull up a list of commands

rigid sandal
limber goblet
#

Cheers mate

#

Not doing anything 😂😂 @rigid sandal

rustic nova
#

Ask in that bots support server

icy skiff
#

please, if you are having trouble with an specific bot, contact their support server

rigid sandal
mighty ember
#

is test webhooks broken?

oak cliff
#

yes

rigid sandal
mighty ember
#

yes

#

for servers

rigid sandal
#

As Sylvia said

#

yes

lyric mountain
#

Sylvia-san Sylvia-san, why does it feel like there's something poking me?

#

(sorry, couldn't lose the reference)

slim heart
#

e

trim saddle
#
if (ctx.guild) {
    let missingMemberPerms = []
    try {
        for (let i = 0; i < cmd.neededMemberPerms; i++) {
            // ctx.author is still assumed to be user
            if (!ctx.author.permissions.has(cmd.neededUserPerms[i])) throw new Errors.MissingMemberPerms("MISSING_MEMBER_PERMS")
        }
     } catch (e) {
           return this.emit("commandError", ctx, e)
     }
}
slim heart
#

whats the error?

trim saddle
#

Property 'permissions' does not exist on type 'Member | User'.
Property 'permissions' does not exist on type 'User'.

slim heart
#

ctx.member?

#

what is ctx

#

and how do u get the specific member object

#

message.author doesnt usually have permission data

trim saddle
#

so

#

ctx is command context and ctx.author is either a user or member

slim heart
#

user and member shouldn't interchangeable

#

they're two different objects

rigid sky
#

Is reaction role bot dead rn?

trim saddle
#

this isn't the reaction role support server

rigid sky
#

Mmmm can u point me in the direction in which it is

slim heart
#

@oak cliff -wrongserver pls

oak cliff
#

-wrongserver

gilded plankBOT
#

Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Support Server" button on the bot's page, not the "Join Top.gg Discord" button at the top of our website. If there isn't a button that says Support Server, then we can't help you. Sorry :(

lament rock
#

Channel overrides can be arbitrarily casted to User | GuildMember because the gateway only returns { id: "user id or role id", type: 0 | 1, allow: string, deny: string }

#

Keeping guild related stuff as GuildMembers is easier tho

#

To alleviate your problem, you can just get the GuildMember from cache based on user ID

slim heart
#

channel overrides arent the situation here

#

users are different from members

#

members will hold the permissions data

#

author, which is a user, doesnt hold permissions

trim saddle
#

isn't there a predicate i can use to check if there's a member in the type. idk how to describe it

lament rock
#

(thing instanceof GuildMember) // returns a boolean

slim heart
#

use the correct property

#

but

#

(ctx.author as GuildMember).permissions

#

if its intentional

#

but it really shouldn't be lol

trim saddle
#

oh.

blissful coral
#
<label for="voteRoles">Add a role to bulk list:</label>
          <select name="voteRoles" id="voteRoles" multiple>
            <option hidden value="">Choose a role...</option>
            <% guild.roles.cache.filter(r=> r.id !== guild.id).forEach(r => { %>
              <option style="display: block" value="<%=r.id%>">
                <p>
                  <%=r.name%>
                </p>
              </option>
              <% }) %>
          </select>
<script>
        var dropdown = document.getElementById('voteRoles');
        var i;

        for (i = 0; i < dropdown.length; i++) {
          dropdown[i].addEventListener("click", function () {
            this.classList.toggle("active");
            var dropdownContent = this.nextElementSibling;
            if (dropdownContent.style.display === "block") {
              dropdownContent.style.display = "none";
            } else {
              dropdownContent.style.display = "block";
            }
          });
        }
      </script>
#

So

#

This isn't really

slim heart
#

extreme smells

blissful coral
#

Working as a dropdown

#

Shush berry

slim heart
#

ok go on

blissful coral
#

So

#

I am attempting to be able to click on the "select role" (first option) and it shows a drop down of the rest.

#

But for some reason it doesn't display as a single and as just a normal scroll list/dropdown and when I click one it just removes the one below it

slim heart
#

u already have select and option

#

whats with the js

blissful coral
#

Making a dropdown

slim heart
#

to do what

blissful coral
#

dashboard

#

role selection

slim heart
#

why arent you just making it
<select>
<option>...</option>
etc...
</select>

blissful coral
#

I am

slim heart
#

oh u mean the name?

blissful coral
#

Yea

slim heart
#

just make it like none or something

#

thats what i do

blissful coral
#

Yeah Ik

trim saddle
#

oh no

blissful coral
#

Wait did you have to add css or js

#

for the dropdown

#

obv css

slim heart
#

its just an html dropdown lmfao

trim saddle
#

if (argument.required && (Number.isNaN(argg) || argg === "" || argg === "undefined" || ((argument.type === "member" || argument.type === "user") && !argg))) throw new Errors.InvalidArguments("INVALID_ARGS") what is this, why did i do this

blissful coral
slim heart
blissful coral
#

Yeah

lament rock
#

This is cursed, Skull

trim saddle
#

yeah

#

it's a long but effective way of make sure an arg isn't null

lament rock
#

I

#

wow

blissful coral
#

@slim heart

lament rock
#

Y'know. It really be like that sometimes

blissful coral
#

That is how I have mine setup

trim saddle
#

it really do be

blissful coral
#

Ignore the style part that is just me with the js stuff

slim heart
#

yeah that should just make a default dropdown thing]

blissful coral
#

Ity isn't

#

The only CSS I have on it is padding rn.

#

@slim heart

slim heart
#

idk this is the only stuff i have for select

#

and thats mostly just for the box look

#

i barely even edit it

blissful coral
#

Yeah

#

None of that is...

#

Going with a dropdown

#

hmmm

#

Are you using react?

slim heart
#

no

blissful coral
#

ejs?

slim heart
#

custom solution

blissful coral
#

oh

#

But that shouldn't have a effect on it?

slim heart
#

no

blissful coral
#

Let me go to your site rq and paste it into my thing and see what it does

#

not copying just seeing if I am dumb

slim heart
#

idc if u copy lol

blissful coral
#

wtf

#

thajt worked

#

Alright lets see what I did

slim heart
#

i mean even with all my css turned off its fine

blissful coral
#

Yeah that is what my result was

slim heart
#

so its probably something you added wrong that messed up ur thing

blissful coral
#

wait a second

#

I figured it out

#

LMAO

#

I had a multiple at the end of my select

slim heart
#

ah

limber flume
#

Ok. Is it possible to receive any Audio from a voice channel at all?

trim saddle
#

@limber flume it is possible for bots to listen

#

but it's not naturally supported by d.py because it's not documented by discord

limber flume
#

Well is it possible to hardcore?

#

Hardcode*

trim saddle
#

i mean, if you can find the undocumented section and make your own fork Shrug

turbid swallow
#

How to create a own Invite

ornate otter
#

Can we use <audio> tags on our page

summer torrent
#

why not. I don't see any reason

ornate otter
#

I'm trying

#

they show up in preview

#

disappear in main

safe creek
brittle hazel
#

How do you style a select option when it's hovered?

drifting shell
#

because selects aren't styleable, the plain ones look ugly as fuck

drifting shell
#

@blissful coral ^

earnest phoenix
#

Is it possible fetch Audit logs with many action like
type:"CHANNEL_OVERWRITE_CREATE","CHANNEL_UPDATE",

brittle hazel
#

Ty

boreal iron
#

Is the method hasPermission(string) buggy?

ornate otter
#

can someone help me add an Audio element to my page

boreal iron
#

always getting false for hasPermission("MANAGE_CHANNELS") for a random user who actually has the permission assigned and true for the guild owner (which has it assigned, too of course)

ornate otter
#

is the user cached

drifting shell
boreal iron
#

he should be, but I can test to fetch him

earnest phoenix
#

then i have to fetch and fetch

drifting shell
#

blame discord

#

¯_(ツ)_/¯

boreal iron
#

nope doesn't work

drifting shell
#

Did you check if the member is cached?

boreal iron
#

regarding the console log, he's already cached, but even fetching him doesn't change false

drifting shell
#

Are you doing has permission on a specific channel or on the member themselves

boreal iron
#

nope for the member itself on a message event

near stratus
drifting shell
#

Like hasPermission(channel, permission)

#

If you get their permissions what does it say they have

drifting shell
near stratus
ornate otter
near stratus
#

nvm

drifting shell
#

Not me, briish

near stratus
drifting shell
drifting shell
near stratus
boreal iron
#

weird

ornate otter
drifting shell
#

Does discordjs check the user or their highest roles permission

ornate otter
#

user

#

i think

drifting shell
#

That’s possibly why then KEKW

drifting shell
#

Checking docs would probably clear that up

ornate otter
#

dont quote me on that, im dumb

boreal iron
#

the property for permissions returns 0

#

means he has no permission for some reason

drifting shell
#

But the user themselves can perform those actions which do require perms yea?

boreal iron
#

yeah he can

drifting shell
#

So it does sound like what briish boi said is true and in which case try checking their highest role instead

boreal iron
#

second..

near stratus
ornate otter
#

Bruhhh rooood

drifting shell
#

According to mdn audio tag has decent support

near stratus
trail badge
#

Hi i created my server on top.gg and i click on submit and see this

boreal iron
#

all users have a role with the same id, name undefined etc.

near stratus
trail badge
#

Ok

boreal iron
#

guess it's fucked up however

near stratus
boreal iron
#

looking at the console.output, yes it is

drifting shell
lusty quest
#

is the role cached? bcs its sounds like a partial

near stratus
drifting shell
#

It's impossible for 2 roles to have the same ID

lusty quest
#

are you sure this are the same ids?

lusty quest
#

also did you get this as a answer from the API or from a database you host?

boreal iron
#

meh... nvm need to sleep at this point. as I said fetching results in the same issue like using the cache

#

might actually be an issue with the test discord server, idk...

#

thanks anyways, I'm tired as fuck

#

let me acutally try something else before going

#

gonna try to fetch the role, didn't do that so far

#

ok I see ... looks like it's my bad, doesn't seem to be cached for some reason

tardy hornet
#

"disk image is malformed"

boreal iron
#

ok giving up... permissions are cache now, after removing the permissions from the user it's still cached, even after clearing the cache and restarting the bot

#

god damn shit... no more words for that mess

old cliff
#

@summer acorn but in it you are responding to any packet

summer acorn
#

nope

old cliff
#

But how to do with specific name

summer acorn
#

you give it the packet that you approved in your slash command handler

#

you give the function the packet data

#

and then it'll send the response to that specific packet data

old cliff
summer acorn
#

it doesn't check for the command, it's simply just utilities to make it a bit easier

#

the sendMessage only responds to the slash command you wanted it to run

old cliff
#

Can you send some example code?

summer acorn
#

I'ma show you an example real quick

old cliff
#

With 2 or more commands

#

And different answer to different command ?

summer acorn
#

slash/index.js

module.exports = (client) => {
    client.on('raw', packet => {
        if (packet.t !== "INTERACTION_CREATE") return;
        var data = packet.d;
        try {
            require('./slashhandler.js').slashHandler(client,data);
        } catch (error) {
            throw new Error(error);
        }
    });
}

slash/slashhandler.js

async function slashHandler(client, data) {
    var command = client.slashCommands.get(data.data.name);
    if (!command) return;
    try {
        command.execute(client,data,sendMessage);
    } catch (error) {
        throw new Error(error);
    }
}

module.exports = { slashHandler }

slash/commands/help.js
https://pastebin.com/RhSR0pjN
slash/commands/botinfo.js
https://pastebin.com/8Y6GjEfa

#

@old cliff

#

the commands shows how the sendMessage functions works

old cliff
#

Thanks!

summer acorn
#

I didn't use the package in that because I made that before the package but the sendMessage function is the exact same

old cliff
#

Really helpful

summer acorn
#

pretty much, the way you execute commands is just the same way just a bit more tedious because you have to use args inside of the packet

#

and then you also have to do a lot more checks

#

put simply, normal message commands are a lot less tedious than plain discord slash command packets

wheat jolt
#

any way of fetching a large amount of users?

quartz kindle
#

If they are all from the same guild, you can fetch up to 100 at a time

old cliff
#

Juat fetch all from that guild
But must have intents

quartz kindle
#

Or more if you have the server members intent

wheat jolt
#

yeah, already doing that but I also have users that aren't on the guild anymore

old cliff
#

You can't access them

wheat jolt
#

well

quartz kindle
#

you will have to fetch those one at a time then

wheat jolt
#

ah okay

#

thanks

summer torrent
old cliff
#

Add __dirname

summer torrent
#

@mellow kelp are you here

cinder patio
#

that doesn't look like a problem with ts

pulsar bone
#

hey how that Slash thing community updayes are talking about works ?

near stratus
silk mesa
#

want to make the changeable prefix system

cinder patio
#

you need a database

eternal osprey
#

hey i tried to install topgg-autoposter on my ubuntu galaxygate vps, well always that fucking node-pre gyp that gives me fucking headache:

#

like what the fuck is its problem.

cinder patio
#

Permission denied

silk mesa
eternal osprey
#

i am literally using root access

silk mesa
#

ım a heykır

#

🙂

eternal osprey
silk mesa
#

what module do I need to make a changeable prefix system

cinder patio
#

If you already have a database then it shouldn't be hard... if you know what you're doing

eternal osprey
lusty quest
#

why did you use the root directory for the bot directory?

eternal osprey
#

becvause it's where my bots are

modest maple
lusty quest
#

this will probably cause your permission issues tho

eternal osprey
#

cf8, you use galaxygate right?

earnest phoenix
#

i have a problem i'm curious if anyone can solve r.e rotating bot statuses, now it should loop back to status 1 after but sometimes freezes/goes blank, any ideas? 🙂

    "status 1", 
    "status 2",
    "status 3",
]

client.once('ready', () => {
    let i = 0;
    return new Promise(resolve => {
        setInterval(() => {
            resolve(2);
            const index = Math.floor(i);
            client.user.setActivity(activity[index], {type: "WATCHING",});
            i = i + 1;
            if (1 === activity.length) i = i - activity.length;
        }, 10000);
    });
})```
modest maple
#

well use is a relative term

#

your issue isnt a galaxy gate issue though

eternal osprey
modest maple
#

no because its just a vps

eternal osprey
#

i've asked them multiple times, they never answered.

modest maple
#

because it's not their issue

eternal osprey
#

well atleast they can tell me that

#

but why is it my issue then?

modest maple
eternal osprey
#

hmm strange

#

i got the same thing with heroku a few months back

modest maple
#

running stuff in a protected area is a dum idea bloblul

eternal osprey
#

it worked fine tho

#

only node-pre gyp needs to make my life fucked up

modest maple
#

shrug Welcome to running shit in protected areas not everything is equal

eternal osprey
#

so should i migrate the folder to a unprotected area?

#

What's the best directory to run the bots from?

marble juniper
#

windows32

#

jk

safe creek
#

which db is best for an economy?

#

should i use mogo db or?

misty sigil
#

mogo

#

mongo works, I guess.

safe creek
#

mmmk ty

earnest phoenix
#

use a txt file as db

rustic nova
grizzled raven
#

use a css file as a db

slender thistle
#

Cache only

marble juniper
#

use json

earnest phoenix
#

should i move on to java !?

marble juniper
#

java is older than my grandma

earnest phoenix
marble juniper
#

maybe not older than my grandma

#

but older than my parents

earnest phoenix
#

should i !?

#

its better than python

marble juniper
#

java is 26 years old

#

lol

earnest phoenix
#

no

#

25

marble juniper
#

it is

earnest phoenix
#

i saw on its official web now

marble juniper
#

java was made in 1995

#

yeah

#

but 25 years

#

is still ooold as fuuuuuuuc

earnest phoenix
#

lol

#

ya

marble juniper
#

If you are gonna use java use at least kotlin

earnest phoenix
#

what is kotlin !?

marble juniper
#

kotlin is simmilar in concept to typescript

#

basically

earnest phoenix
#

ok

marble juniper
#

but in this case you can think of javascript as the java

#

and kotlin as the typescript

grizzled raven
#
const db = require("db.css")
const table = new db.Table("data")

await db.set("test", "value")
await db.set("json", { hello: "world" })
await table.set("hello", "world")
/* output in db.css file */
#root {
  test: "value",
  json: "{\"hello\":\"world\"}"
}
#data {
  hello: "world"
}
marble juniper
#

kotlin gives some extra functionallity and a lot of syntax sugar to java

earnest phoenix
#

i am gonna delete my full code in python 😁

marble juniper
#

lol

earnest phoenix
grizzled raven
#

i should make a "js library concept" for a db in every language

marble juniper
grizzled raven
#

what language is next

earnest phoenix
#

Spanish 🥵

modest maple
#

Big meme lul

earnest phoenix
#

😳

earnest phoenix
#

I started learning python is it wrong?

modest maple
#

no?

#

why would it be wrong?

earnest phoenix
#

Well nvm i took those personally

slender wagon
near stratus
# earnest phoenix I started learning python is it wrong?

Depends
If you ask a Clod-Blooded-C-Coder then YES you mad a mistake.
If you ask some ordinary ppl like CF8 said then it's not wrong
If you ask a web dev then "Anything is better than Javascript"
If you ask someone coding Python for 3+ years then "Fuq choose another language"

modest maple
#

If you ask someone coding Python for 3+ years then "Fuq choose another language"
pithink no?

empty bough
#

so how long do i have left to wait until i hear about my bot?

modest maple
#

weeks

empty bough
#

i see

earnest phoenix
#

Hmmm

lyric mountain
# marble juniper

google: shows modern high level language
also google: shows it being used in netbeans

whole warren
#

I have a botinfo command that uses client.users.cache.size to show how many useres are in all of our guilds but for some reason it is not working anymore

#

i am also using discord.js

cinder patio
#

How is it not working? Be more specific

#

If you're getting wrong numbers, it's because not all users are cached, in order to get the total amount of users, you'll have to loop through all guilds and sum theirmemberCount property

earnest phoenix
#

Hey, I have this:
(node:895) UnhandledPromiseRejectionWarning: TypeError: fields.flat is not a function
at Function.normalizeFields (/app/node_modules/discord.js/src/structures/MessageEmbed.js:450:8)
at MessageEmbed.addFields (/app/node_modules/discord.js/src/structures/MessageEmbed.js:266:42)
at Object.execute (/app/Commands/Debug/botinfo.js:16:8)

#

whats the problem?

cinder patio
#

You're using an old node.js version

earnest phoenix
#

oh

umbral zealot
#

update to node 12 or 14

earnest phoenix
#

wait

#

i'm using glitch to host my projects

#

oof

umbral zealot
#

You can set that in the package.json I think

cinder patio
#

yeah under "engines"

#

Thoughts on the login / register form design?

#

the background is lookin a little empty

earnest phoenix
#

.addField(`Çekilişi Kazanan`, `${message.guild.members.cache.random()}`, true)
how can i block bots in this code i am using d.js v12

cinder patio
#

use filter on the cache to filter out the bots

earnest phoenix
#

ah okay

earnest phoenix
#

i will try thanks

lyric mountain
#

and I'd suggest either using a monotype font or Ubuntu

#

maybe jetbrains mono would be perfect there

cinder patio
#

for all text?

#

Or just the nav

lyric mountain
#

only the important stuff

#

title in this case

cinder patio
#

I'll try it out

lyric mountain
#

ubuntu

cinder patio
#

ooo

#

I like that

earnest phoenix
lyric mountain
#

damn italic is perfect

#

thicc font + italic

cinder patio
earnest phoenix
#

Hmm

cinder patio
#

In order to filter them out you need to check if the m.user.bot property is true

icy skiff
#

how much RAM ur bots use on average

#

just curious

cinder patio
#

if it's true, they're a bot

#

so something like this: !m.user.bot

cinder patio
icy skiff
#

js?

cinder patio
#

And one in around 200 that used 110

#

yup

icy skiff
#

i see

cinder patio
icy skiff
#

python is not particularly good at managing memory

#

kek

#

mine is in 100+ish and uses 100+mb

cinder patio
icy skiff
#

i looked up and seemed normal for dpy

#

so i was wondering what it was like to others

earnest phoenix
#

Mine is about 200mb with 300k cached users and less than 100 guilds, d.py. No clue if that's low/high.

icy skiff
#

300k users with less than 100 guilds

#

wot

earnest phoenix
#

Actually, the sum of member count is about 250k-ish, but I cached old user objects so

modest maple
#

the base interpreter itself uses about 10 - 25MB idling, if you have lots of small objects or reference cycles you'll get an increase in Ram usage and no so much lowering because of the bump allocation, Python's memory management generally increases upto about 500MB before it starts to become more aggressive with it's memory management otherwise it keeps that allocation space and uses it for new objects, TL;DR your ram will keep increasing to a point so that your allocations are quicker in the long run

lyric mountain
#

why do you cache 300k members?

earnest phoenix
#

Not members, just users

lyric mountain
#

regardless

#

why?

earnest phoenix
#

For a message leaderboard command, to reduce requests, don't ask why I made such a command KEKW

modest maple
#

that doesnt require a member cache but sure mmLol

icy skiff
lyric mountain
#

why not a database smh

earnest phoenix
#

It's on redis

lyric mountain
#

actually, why even cache?

cinder patio
#

Also why store the entire object and not just the message count

icy skiff
#

good, then theres not a problem with my coding lol

#

ty for the info

earnest phoenix
#

I actually only need the username and the discriminator, but I also use that for presences, sometimes discord sends partial user, so I can get it from the cache instead. It's so trivial doe

icy skiff
#

i noticed that turning off presence intents decrease cpu usage by a considerable amount

cinder patio
#

yeah cause they happen very often

modest maple
#

because it accounts for a good 90% or so of all your WS events

icy skiff
#

yes, it went from 15%ish to 1-2%

lyric mountain
earnest phoenix
#

Probably, I might need to either decache it if they leave the guild or flush the redis regularly. Or just don't cache at all dboatsMmlol but I can't rely on discord's mentions.

lusty quest
lyric mountain
analog tinsel
#

how i can fetch url from req.params? i tryed app.get(path/:link) and const mylink = req.params.link but not work

lyric mountain
#

what?

#

language, library and code snippet plz

lusty quest
#

looks like express.js

analog tinsel
#

express

compact prairie
#

how do you remove a reaction from a message
lib: discord.js
im doing self-roles and the user reacts to get the role how do you remove that reaction that the user got the role with

compact prairie
#

ty

earnest phoenix
#

Is there a way to get the shared servers from a bot

#

like these

umbral zealot
#

Not from the UI, but the bot itself can filter the guilds cache by those where the member is present

#

That woudl, however, require you to cache all members which requires the member intent.

#

unless you loop through all the guilds, try to fetch the member, etc, which then takes time and spams the API.

#

So... basically, "technically yes, but no not really"

earnest phoenix
#

hmmmm slonk

dusky sundial
#

Without member intents it's gonna be hard, yeah

earnest phoenix
#

i have member intents

#

i guess is this right?

dusky sundial
#

Then yeah, you could loop through each guild's members and check if they contain the member you're looking for

#

Might be a pretty heavy load though, depending on how many guilds your bot is in

earnest phoenix
#

well

#

im on 2k guilds

umbral zealot
#

Personally I think it's a horrible idea to cache all members just to get common servers. It takes a huge amount of RAM to cache those members, for an extremely minimal and fairly pointless feature.

earnest phoenix
#

yeah i guess

dusky sundial
#

In what way did it not work?

quartz kindle
#

you can roll out your custom member cache

#

and cache only guild ids

icy skiff
#

hi Tim

compact prairie
#

not even an error

icy skiff
#

is there a known issue about not being able to open my own bot's page?

slender thistle
icy skiff
#

k thx

versed shoal
#

Does anyone use native MongoDB?

umbral zealot
#

Just ask your question instead of waiting for an expert, maybe we can help when we know what your question is.

versed shoal
#

it works

#

it doesn't work in different files but it works in same file

#

What should I do to use it in different files?

umbral zealot
#

well you could just export the db connection as a module that would make things simple

storm lark
tulip ledge
#

(await this.channel.messages.fetch(this.messageID)).edit.edit(embed)
error: (intermediate value).edit.edit is not a function how do I fix this?

umbral zealot
tulip ledge
#

🤦‍♂️

umbral zealot
versed shoal
#

oh thank you

umbral zealot
dusky sundial
storm lark
#

im ok

dusky sundial
#

Uh, alright? Cool

wanton dust
#

import discord

from discord.ext import commands

@client.event
async def on_ready():
await client.change_presence(activity=discord.Game('Sea of Thieves'))

#

Error coming in await

lyric mountain
#

no indentation at all

wanton dust
dusky sundial
#

Post the error as well, please

#

Also, using code blocks will make your code more readable

icy skiff
#

I mean u didnt set client at any point

#

client = blá blá blá

wanton dust
dusky sundial
#

First of all, it's not indented

#

And yeah, you didn't set client to anything

icy skiff
#

^

dusky sundial
#

also bot.run won't work if you call it client

#

I'd recommend learning Python before trying to make a bot ^^

icy skiff
#

U should take a better look at the docs bru

lusty quest
#

i think this page is quite important here

icy skiff
#

Win+shift+S

#

Gg

lyric mountain
#

or disable flash at least smh

dusky sundial
#

Gyazo ftw

icy skiff
#

Btw I know the website is having some issues rn

#

But im able to access literally any bot's page except my own

#

Is that like expected or smth

lyric mountain
icy skiff
#

Man thats an weird issue

lyric mountain
#

welcome to webdev

icy skiff
#

kappa

delicate shore
#

oi

icy skiff
#

Diga meu bom

dim tendon
#

Hey, why does my bot not show a servercoutn?

umbral zealot
dim tendon
#

ah okay ill look into it

wanton dust
#

import discord
from discord.ext import commands

client = commands.Bot(command_prefix= '*')

client = discord.client()

@client.event
async def on_ready():
await client.change_presence(status=discord.Status.idle, activity=discord.Game('Sea of Thieves'))

cinder patio
#

Wrong indentation

umbral zealot
#

I don't have a learnpython tag, but, you should consider learning python itself before trying to make bots in python. There are plenty of resources online to learn the language before trying to make a bot, which is not for beginners and requires a solid grasp of simple programming concepts at the very least.

#

pasting your unidented, broken code more than once doesn't help

#

go learn python

safe creek
#

did i do this right? ```py
import pymongo
from pymongo import MongoClient

cluster = MongoClient("mongo link here lol")
db = cluster["name here"]
collection = db["name here"]

post = {"_id": 0, "name": "timmy", "amount": 0}

collection.insert_one((post))``` as i got an error and nothing showed up inside my dbs collections also apparently 'import pymongo' isnt accesable and is greyed out?

gilded olive
#

choose one

#

also indent await ... after async def on_ready():

old cliff
#

while(NaN !== NaN) {console.log("$")}
This is how you nuke your pc

tiny gull
#

i cant invites botshttps://top.gg/invite

old cliff
umbral zealot
safe creek
cerulean ingot
cerulean ingot
misty sigil
#

postgres is good

cerulean ingot
#

^^^^^^^^^^^^^^^^^^^^^^^^^

old cliff
#

Why bad for windows ?

cerulean ingot
#

imagine using windows

old cliff
misty sigil
#

hosting mongo on windows?

cerulean ingot
#

ctrl shift printscr

cerulean ingot
old cliff
#

I use a hackintosh macos along with triple boot windows and kali linux

cerulean ingot
#

ok

#

thats overkill but ok

misty sigil
#

sounds good but it doesnt fuckin matter

old cliff
#

Yeah but it does to me

#

I codegame on windows

#

Code and edit videos on mac

misty sigil
#

code on windows

old cliff
#

And hack my friends on kali

cerulean ingot
#

i code on linux

cerulean ingot
misty sigil
#

hackintosh and hacking friends

#

sounds legal

cerulean ingot
#

yep

#

100%

#

what could be illegal about it?

misty sigil
#

i need to migrate my data to postgres

old cliff
#

Yeah

cerulean ingot
#

not really

old cliff
#

It is

cerulean ingot
#

hacking your friends

#

maybe in your country lmfao

old cliff
#

I am just starting ro learn hacking

cerulean ingot
#

ok

misty sigil
#

i wonder what i would do if i hacked one of my friends

#

nothing

#

because i wouldnt hack my friends

cerulean ingot
#

yeah

old cliff
#

My friends know hacking too

cerulean ingot
#

true

misty sigil
#

hacking war

old cliff
#

And we dont steal info

misty sigil
#

lmao

old cliff
#

We just play around

#

xD

cerulean ingot
#

ok nice

old cliff
#

And hackintosh is legal

cerulean ingot
#

have fun with that

cinder patio
#

found a skid

old cliff
#

Cause its just a normal pc running macos

#

Nothing sketchy

misty sigil
#

apart from its not apple hardware

old cliff
#

Yeah

misty sigil
#

which is well

old cliff
#

Fuck apple hardware

#

Too expensive

misty sigil
#

an entirely grey area

solemn latch
#

pretty sure its not legal, distributing software you dont have the right to distribute(apple's OS)

#

you may not be breaking any laws using it, but laws where broken to let you use it.

old cliff
#

We are not distributing it

#

We use original apple files downloaded from their appstore

#

Even linus tech tips has videos on this topic

#

Literally no laws broken

wanton dust
#

import discord
from discord.ext import commands

client = commands.Bot(command_prefix= '*')

@client.event
async def on_ready():
await client.change_presence(status=discord.Status.idle, activity=discord.Game('Sea of Thieves'))

near stratus
near stratus
#

@wanton dust

import discord
from discord.ext import commands

client = commands.Bot(command_prefix= '*')

@client.event
async def on_ready():
    await client.change_presence(status=discord.Status.idle, activity=discord.Game('Sea of Thieves'))
old cliff
near stratus
icy skiff
earnest phoenix
#

Who can help me, I have this:
(node:25585) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toString' of undefined
at Object.execute (/app/Commands/Info/help.js:29:67)
at module.exports (/app/Events/Messages/message.js:38:11)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use node --trace-warnings ... to show where the warning was created)
(node:25585) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:25585) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

umbral zealot
#

you're trying to do .toString() on something's that's undefined

earnest phoenix
#

yes

umbral zealot
#

show your help.js command, especially line 29.

earnest phoenix
#

I will send this with a hatebin

#

here

umbral zealot
#

{message.client.emojis.cache.get(infoEmojiId) is undefined. that emoji doesn't exist.

earnest phoenix
#

he exists

umbral zealot
#

Clearly it doesn't

#

because otherwise this would work

earnest phoenix
#

I put this on a config.js

#

you might've put the wrong id

#

the emoji is: 729353637985517568

wanton dust
#

But my bot is not showing any status with it

earnest phoenix
#

ℹ️ 729353637985517568

cinder patio
#

how do you get the emoji id

earnest phoenix
#

on a server

#

but I found

umbral zealot
#

is your bot on that server

earnest phoenix
#

no

#

O_O

#

but wait

wanton dust
#

ℹ️ 729353637985517568

#

Like this

wanton dust
umbral zealot
#

You cannot get an emoji from a server that you're not on.

umbral zealot
earnest phoenix
#

🛠️

#

yessss

wanton dust
umbral zealot
#

Don't roll your eyes at me kid, I already told you to go learn python.

#

That's all the help you get from me.

earnest phoenix
#

@umbral zealot its a good emoji

#

so its not a problem with emojis

umbral zealot
#

🛠️

#

yheah it is

#

that's not going to come from client.emojis at all

#

You want to send the unicode version: \🛠️

#

that'll work

obsidian tartan
#

hey i tried to add a avatar in the webhook when i create it but it gives out a error.
code:
web = await channel.create_webhook(name='xyz', avatar=self.bot.user.avatar)
error:
startswith first arg must be str or a tuple of str, not bytes

How do i fix it any idea?

earnest phoenix
#

@umbral zealot its a problem with tostring but tostring is not definied?

umbral zealot
#

no

#

the problem is that's not an emoji you get by ID

#

that ID is probably one from a message, not from the emoji

#

Literally just send \🛠️ instead of trying to "Get" the emoji, it'll work fine

obsidian tartan
#

that gives this error:
'Asset' object has no attribute 'startswith'

earnest phoenix
#

but how to take emoji id?

obsidian tartan
#

when i use self.bot.user.avatar_url

umbral zealot
#

it's a unicode character

#

Emoji IDs are exclusively for custom emojis added to servers, not for default unicode emojis

earnest phoenix
#

oh

pale vessel
#

try str(self.bot.user.avatar_url)

earnest phoenix
#

what is the website to take emojis like this?

obsidian tartan