#development

1 messages · Page 1764 of 1

slender thistle
#

I don't specifically care about that personally

quartz kindle
#

thats very personal and very specific

vivid fulcrum
#

straight out of a java app src

slender thistle
#

kekw

quartz kindle
vivid fulcrum
#

do i want to

quartz kindle
#

let me find it brb

slender thistle
#

Oh, hold on. So GuildApplicationCommandPermissions is for receiving perms and ApplicationCommandPermissions is for sending?

#

This is fun lol

quartz kindle
vivid fulcrum
#

oh my god

slender thistle
#

hahahaha

quartz kindle
slender thistle
#

xDDDDDDDDD

quartz kindle
cinder patio
#

Hey Erwin can you give me an example of how to use slash commands in dei3u3uhutgr? The search function in their docs does't help at all

#

actually nvm I guess I'll join their support server

opal plank
#

Wel then

cinder patio
#

you can still do it in the support server

opal plank
#

cake has a slashClient

#

but idk if he published it on stable

cinder patio
#

I guess they haven't 😩

#

I guess my bot will have to wait...

clear marlin
#

I don't understand why snake case and camel case are a thing

opal plank
#

i can help you implementing it like i did if u wish

#

until cake publishes it

#

but im pretty sure he's already done with his

clear marlin
#

cause like I can still use snake case in javascript

#

¯_(ツ)_/¯

#

so

vivid fulcrum
#

different people have different naming conventions they follow

opal plank
#

snake case is for the scrubs at java

#

we dont do that here

clear marlin
#

snake case is used in rust and python too

cinder patio
vivid fulcrum
#

which as you can see, multiple people contributing to the same thing and each of them following their own naming conventions creates the inconsistency of discord api docs

opal plank
#

more than 3 months

strange citrus
#

Man I want a good name to my bot that uses part of these three names: Miguel, Davi, Carlos. Any ideas or I will need to change my idea?

cinder patio
#

I started programming in Rust and now I prefer snake case

quartz kindle
#

midalos

opal plank
#

Midir

clear marlin
#

I prefer snake case too lol

quartz kindle
#

darlosguel

#

carloviel

clear marlin
#

what

opal plank
#

your preference is invalid in the sight of "Programming Standardization"

strange citrus
quartz kindle
#

davelos

opal plank
#

we are civilized people who follow standards and rules

opal plank
quartz kindle
#

micarguevi

opal plank
cinder patio
#

Carmida

opal plank
#

latifa

clear marlin
strange citrus
#

Thanks for the ideias people, think I have a direction to follow now

opal plank
quartz kindle
#

carviguel

opal plank
#

latoya

cinder patio
#

I don't like it when programming languages set a standard for naming conventions

#

Cargo screams at me when I name a variable with snakeCase

quartz kindle
#

car go

cinder patio
#

so now I'm used to snake case

opal plank
#

its not like you HAVE to or it wont work (cough cough, looking at you python)

quartz kindle
#

pythonk

opal plank
clear marlin
#

golang uses camel which is good

opal plank
#

wrong clipboard

cinder patio
#

yeah but it's an ugly warning in the console and in the IDE

quartz kindle
opal plank
#

probably

quartz kindle
#

ok 25 has to be a joke

opal plank
#

bet you theres on mf out there who named their kid that

#

just for shits n giggles

opal plank
quartz kindle
#

ok yeah from 25 on its all a joke

#

the first few ones are realistic tho

opal plank
#

watermelondria sounds like a name someone would give when drunk

quartz kindle
#

you seen those kids named ssst and abcdefghijkmnopqrstuvwxyz?

opal plank
#

but the one that im most reluctant to ask, "who in their right mind would give such name", is the last one

cinder patio
#

Why in the world are private fields in javascript prefixed with #??? who got that idea

#

why not private

opal plank
#

you can use private tho

quartz kindle
#

no idea

radiant charm
#

hi

opal plank
#

in classes at least

strange citrus
#

Anyone here uses the app "Bot designer For discord" to making bots, and knows a good way to make a giveaway comand?

cinder patio
#

if you're using typescript

#

in plain js you use #

opal plank
#

yeah

#

oh

opal plank
#

well, anotehr reason to use typescript

strange citrus
radiant charm
#

eae kk

opal plank
#

oh, battle royale

radiant charm
#

eu uso o bdd

strange citrus
opal plank
#

is that favela language?

radiant charm
#

yes

#

we are from favela

opal plank
#

good good

radiant charm
#

bruh

#

my inglish is very bad ;-;

strange citrus
#

Kk

cinder patio
#

Why are there so many people from Brazil here

opal plank
#

good question

radiant charm
#

bc Brazil is funny

strange citrus
opal plank
#

HUeHUe is taking over discord, slowly but steadily

radiant charm
#

we have funk

cinder patio
#

I dunno about that

radiant charm
#

and we have brigadeiro

strange citrus
opal plank
#

i'd recommend u guys go to #general-int before a mod screeches to you for speaking non portuguese

radiant charm
#

ok

radiant charm
#

wait a minute

quartz kindle
#

more br

#

lel

opal plank
radiant charm
#

where we need to talk about progammation

opal plank
#

here

quartz kindle
#

programming*

#

:)

cinder patio
#

You also have the cartel

opal plank
#

but the only channel you can speak non-english is #general-int

opal plank
#

i completely misunderstood the context at which u sent that

#

ignore my last msg

cinder patio
#

lmao

wheat mesa
#

I have a simple HTML website for image compression. Once I've resized the image itself, how do I send that back to a user to be downloaded by them, without having to download the image myself?

#

(Using sharp for nodejs btw)

cinder patio
#

Send the image as a buffer

quartz kindle
#

cleaning up my help command

#

before:

#

after:

cinder patio
#

cute

opal plank
quartz kindle
#

yes

#

rip

opal plank
#

its astrobot

opal plank
#

you shame of a human being

wheat mesa
#
<input type="file" id="fileUpload" accept=".jpg, .jpeg, .JPG, .png, .PNG">
``` If a user inserts an image, how would I convert that to a buffer of that image?
opal plank
pale vessel
#

sez you

#

ts-node man

opal plank
#

wot

quartz kindle
opal plank
quartz kindle
opal plank
#

thats prod

quartz kindle
#

its not

opal plank
#

prod token at least

quartz kindle
#

yes prod token

#

but not prod code

#

nor env

opal plank
#

reee

quartz kindle
#

only works on my guild

#

and only responds to me

opal plank
#

sounds like a crash waiting to happen

quartz kindle
#

how lol

opal plank
#

in case it randomly decides to reply on other methods

#

like dms

#

or new channels

#

like threads

quartz kindle
#

it cant

opal plank
#

thats what i thought too, until that whole mess happened

quartz kindle
#

now that i removed reactions, my only listener is message

quartz kindle
#

and i have this if(message.client.app.dev && message.author.id !== message.client.ownerID) { return; }

#

plus the dev instance is only on my server

#

like literally

#

it literally doesnt exist on other servers nor dms

opal plank
#

BuT WhAt IF

quartz kindle
#

what if wat

naive light
#

Is it really that hard, to have two separate environments, one for production and one for the development? With two different databases, discord clients and such? Lol

quartz kindle
#

yes

ember quarry
#

anyone having idea for this, I am owner of the server and my bot is having administrator permission but still I am having this error?

quartz kindle
#

who is your bot trying to kick?

ember quarry
#

a normal member

earnest phoenix
#

So i have a function in the BaseCommand class called getHelp which returns a help message for the command. My question is, would it be better to just have the function in one place (file) instead of duplicating it across all classes. Would that use less memory? Working in JS

quartz kindle
#

is the bot's highest role above the member's highest role?

ember quarry
quartz kindle
#

it still needs to be above the other person in roles

ember quarry
#

administrator is the highest permission right?

quartz kindle
#

yes but you cant affect roles above you

opal plank
ember quarry
#

yeah, member I am banning is not above bot's role

opal plank
#

here's example

earnest phoenix
earnest phoenix
opal plank
#

you wanted to know if u could avoid repetition

#

yes, using the keyword "extends"

earnest phoenix
#

I wanted to put the getHelp function in the base class. But wouldn't that take more memory than just having one function in a file? Or it just points to the same location in memory for all child classes?

opal plank
#

should be the latter

#

unless you doing some stupid stuff like

#
class test {
constructor() {
  myFunction: myFunction() {}
  }
}
#

which, you should know, is not how u declare functions in a class

#

that will cause a memory leak, had it happen before

quartz kindle
#

lel

earnest phoenix
#

Ah okay, so im safe adding a method in the base class. I'd assume it points to the same location in memory just wanted to make sure

opal plank
#

yup, should be fine if u do it properly

earnest phoenix
#

is this 'properly'?

opal plank
#

yes

#

apart from something

#

but yeah

earnest phoenix
#

just eslint screaming

opal plank
#

im aware

zinc wharf
#

poof

twilit rapids
zinc wharf
#

Actually no, I got the buttons working, hold 1

#

Let me screenshot

twilit rapids
#

You can see my buttons in #commands if you want btw

zinc wharf
twilit rapids
#

Posting the buttons isn't that hard

#

Listening and acting on them is

zinc wharf
#

Then in index.js I have the client.on('clickbutton event, which doesn't ping at all

twilit rapids
#

Try to follow the guide I linked and see if that fixes it

zinc wharf
#

I also tried to put it in my /events directory

#

All of that information there is exactly what I have

opal plank
twilit rapids
#

at what exactly?

opal plank
#

also buttons are the same as reactions in a very basic sense

#

at the normal payload you receieve

#

discord.js should have the interactions event exposed to the user

twilit rapids
#

well yeah

zinc wharf
#

Hold up. It might actually be because I haven't put it as a requirement in my index.js, although, does it need to be? I cant see anything on the docs saying that it needs to be there, it just needs to be where the buttons are being sent

quartz kindle
#

on stable you have to listen to raw

#

lel

opal plank
#

shit lib

quartz kindle
#

@opal plankhelp, my vsc is going crazy

opal plank
#

is it ts related?

quartz kindle
#

every time i type delete obj[somekey], it automatically adds this to the beginning of the file

#

what the hell

#

lmao

opal plank
#

oh sometimes it ass some typescript stuff when i tpye as

#

never figured how to make that shit stop

#

before i compile i just check for tree shaking

zinc wharf
#

I know the text is wrong OMEGAlul

twilit rapids
#

Hmm

#

Looks alright

zinc wharf
#

Thats my thought too, it just hates it

twilit rapids
#

You can see my file on my stream, but I have about the same

earnest phoenix
#
   const channel = newState.guild.channels.cache.get(newState.channelID.id || newState.channelID);

if(channel.type == 'stage' && newState.suppress) {
            setTimeout(() => {
                channel.guild.me.voice.setSuppressed(false);
                player.pause(false);
            }, 1000);
        }

is there a way to make it so when i make the bot into a audience in the stage channel it doesnt go back to a speaker?
also this is another error i get while i move the bot from voice channel to stage channel

 if (channel?.type !== 'stage') throw new Error('VOICE_NOT_STAGE_CHANNEL');
                                         ^

Error [VOICE_NOT_STAGE_CHANNEL]: You are only allowed to do this in stage channels.
manic gulch
#

guys go into python ad type

#

print("HI")

zinc wharf
#

It also knows that its there, so thats a good thing

formal gate
#

Guys

manic gulch
#

what language u guys using?

formal gate
#

What site do you use for make this bots?

earnest phoenix
manic gulch
#

OK cool

formal gate
#

I want to do a bot

manic gulch
#

i dont know that yet im learning it

formal gate
#

@earnest phoenix

#

Can i see your bot?

earnest phoenix
#

yes but... its Turkish

formal gate
#

Yes

#

Pls

opal plank
#

Typescript

twilit rapids
zinc wharf
#

Let me try something else, hold 1 moment

#

Yeah, it doesn't fire at all

#

I put a console log right before the if()else if() statement

#

And nothing comes up

regal jacinth
#
from google_images_search import GoogleImagesSearch
           _search_params = {
                'q': "lectures",
                'num': 10,
                'fileType': 'jpg|png',

            }

            # get first 123 images:
            googleImageSearch.search(search_params=_search_params)

            # take next 123 images from Google images search:
            #googleImageSearch.next_page()
            embed_dict = {}
            print(googleImageSearch)
            for image in googleImageSearch.results():

                print(image)

i use this to get 10 images from google image search
it prints some kind of objects but i can't get the image links, source and titles
is there any documentations about it?

zinc wharf
#

What are the objects

regal jacinth
slender thistle
#

That's an object

#

An image object specifically

#

Dig around the library documentation for GSImage

regal jacinth
#

alr

regal jacinth
lofty cedar
quartz kindle
#

your json file is broken

lofty cedar
#

{"820602827301847052": {"lang": "IT"}}
That’s what the json file contains

slender thistle
#

tf

lofty cedar
#

Oh I got it

regal jacinth
#

@slender thistlesorry for the ping but i can't seem to find anything
is there any thing you would recommend (if u know about it ofc) ?
all i can find is ways to download images from google but like i don't want that
i just want to get the image links and title (name)

regal jacinth
#

yeah tho it gets the output in an image object

slender thistle
#

Google's clusterfuck of Python APIs is something I'll never understand

regal jacinth
#

lol

slender thistle
regal jacinth
#

so in the end i will just download images?

slender thistle
#

I almost got aneurysm trying to work with YouTube API. What's even better is that I kept getting quota exhaustion with only like 3 requests sent ever

slender thistle
lofty cedar
regal jacinth
#

oh alr

sage bobcat
#

One message removed from a suspended account.

regal jacinth
lofty cedar
quartz kindle
#

missing a :

#

{"820602827301847052": {"lang": "IT"}}

lofty cedar
quartz kindle
#

show your full json file

regal jacinth
#

@slender thistle oh wait i tried that before coming here
it only allows for 10 images or less + the images are kinda off
feels like kids drawings

slender thistle
#

lmfao

regal jacinth
#

if i google butterflies i should see some photographs

#

but with the code i get some elementary school text books images

#

like this one lol

lofty cedar
quartz kindle
#

you showed only 1 line with less than 40 characters

#

so something is missing

lofty cedar
#

Oh wait

#

I maybe got the error

#

{
"noadmin":"ERRORE! Non sei admin"
"team1set":"✅Fatto, team 1 salvato :)"
}
Do you see any error there?

quartz kindle
#

yes, missing a comma

lofty cedar
#

Oh ok

#

It’s now working, ty

slender thistle
#
Traceback (most recent call last):
  File "slash_bot.py", line 6, in <module>
    import speedcord
  File "C:\Users\ezboo\AppData\Local\site-packages\speedcord\__init__.py", line 6, in <module>
    from .client import Client
  File "C:\Users\ezboo\AppData\Local\site-packages\speedcord\client.py", line 11, in <module>
    from .shard import DefaultShard
  File "C:\Users\ezboo\AppData\Local\site-packages\speedcord\shard.py", line 9, in <module>
    from asyncio.exceptions import TimeoutError
ModuleNotFoundError: No module named 'asyncio.exceptions'

Process finished with exit code 1

This is a fucking joke

opal plank
pale vessel
#

again

opal plank
#

i was taunted, not gonna let it pass

#

i eat the hooker, the line, the fishging rod, and your arm along with it

earnest phoenix
#

Not this again

sage bobcat
#

One message removed from a suspended account.

opal plank
prime mist
#

Cool kids write their own client lol.

opal plank
#

cool kids acknowledge that there are already way too many bloated "discord clients" and that we shouldnt trash the ecosystem any further

prime mist
#

Or they don't like the other clients so they make their own.

opal plank
#

cleraly havent tried detritus, but thats none of my business

prime mist
#

Not a big fan of the event emitter pattern

opal plank
prime mist
#

Tried it, it was ok

opal plank
#

wdym event emitter pattern

prime mist
#

.on("event", ...) etc

opal plank
#

how else would u use websocket?

#

thats literally how websockets work

opal plank
sudden geyser
#

How about the reactive paradigm

prime mist
#

Yeah I'm more a functional / reactive fan boy.

sudden geyser
#

the event emitter model sucks imo

opal plank
#

i pretty much love the emitter/websocket way

#

never even heard of someone actually using that in js

sudden geyser
#

You should try it out

#

It's a blessing when I use it in other languages (e.g. Swift's Combine framework)

quartz kindle
#

the entire js ecosystem is based on event emitters

#

not much you can do there

sudden geyser
#

sadly

prime mist
#

I was part of the original core node.js team back before 1.0.0, and we made API decisions based on the browser APIs.

But deno is rethinking some of those decisions, now that we have async iterators etc

quartz kindle
#

cool

#

how would a core module such as tcp sockets work without event emitters?

#

would you query the buffer yourself in an interval?

prime mist
#

And promises lol. Node was late to the party there hah.

quartz kindle
#

the closest thing i can think of is using the "readable" event to read the buffer, but its still an event

#

just not a data emitter

prime mist
#

Async iterators are a great fit for sockets, they support back pressure and everything

quartz kindle
#

arent they just syntatic sugar tho?

#

or do they work in a different way behind the scenes?

prime mist
quartz kindle
#

yes but i mean under the hood

#

for example classes are syntatic sugar for prototypes

#

are async iterators syntatic sugar for event emitters?

sudden geyser
#

They're basically higher-level forms of event emitters / loops, so yes

quartz kindle
#

basically the equivalent of callback -> promise

prime mist
split basin
#

how i can make a webhook for vote my bot

solemn latch
#

depends on the language

quartz kindle
#

for example, node uses the event loop, so on every iteration, it checks if there is new data in the buffer, if there is, slice the data and emit an event containing the data

#

does deno also use an event loop to read from a buffer?

prime mist
#

Oh right, you would need to implement a buffer of some kind. As data comes in put it in the buffer, and the iterators consumes it, remove it.

#

Event emitters are "push" based, so any buffering / back-pressure has to be implemented by the user.

quartz kindle
#

i see what you mean

#

but the push only happens if there is a reader

#

but i see what you mean, with async generator the reader has to pull

prime mist
#

Yeah, that is the fundamental difference. Push vs pull.

quartz kindle
#

there is still backpressure handling at cpp/rs level no? for example if the reader never reads and the buffer gets full

prime mist
#

Yes, there are TCP level things to tell the providers to stop sending stuff.

quartz kindle
#

lets see if i understand

#
// deno
async function* stream() {
  while(true) {
    if(buffer.hasNewData()) {
      yield buffer.getNewData();
    }
    await new Promise(resolve => setImmediate(resolve));
  }
}

for await (let data of stream) {}


// node
function read() {
  if(buffer.hasNewData()) {
    stream.emit("data", buffer.getNewData());
  }
  setImmediate(read);
}

stream.on("data", data => {})
#

replace setImmediate with the engine's actual event loop

austere nacelle
#

guys can any one help

#

me

drifting wedge
#

how do i check if someone has a permission in dpy?

#

this new update fucked stuff up

zinc wharf
austere nacelle
#

how to make commands in my bot

prime mist
#

You could simplify the deno stream to:

async function* stream() {
  while (true) {
    yield await getData();
  }
}
zinc wharf
austere nacelle
#

english

zinc wharf
#

I mean programming language

earnest phoenix
quartz kindle
austere nacelle
#

idk im just made it today so idk

zinc wharf
#

I'm guessing its discord.js

#

Since its the most common

prime mist
quartz kindle
#

yes but the promise has to actually do something asynchronously

austere nacelle
#

@zinc wharf ?

zinc wharf
# austere nacelle idk im just made it today so idk

There's a lot to go through when you first make a bot, so instead of me putting hundreds, possibly thousands of lines. Take a read of this guide here...

https://github.com/AnIdiotsGuide/discordjs-bot-guide/blob/master/first-bot/your-first-bot.md

Of course, feel free to ask for help to understand it.

To make commands in your index.js follow the section below, which is shown in the link above

  if (message.content.startsWith("ping")) {
    message.channel.send("pong!");
  } else
 
  if (message.content.startsWith("foo")) {
    message.channel.send("bar!");
  }
});```
prime mist
quartz kindle
#

yes thats what im getting into

drifting wedge
#

ctx.author.guild_permissions.manage_nickname is this correct?

#

for dpy

prime mist
quartz kindle
#

ye

#

one thing tho

#

i havent tested async generators

#

but i did test regular generators

#

and they were noticeably slower than alternatives

#

are there any benchmarks on async generators?

prime mist
#

Well, probably a bit. But TCP will run out of IO capacity way before CPU becomes an issue.

quartz kindle
#

ye in this case it should be pretty irrelevant

slender thistle
#

Fucking ENCODINGS

#
Traceback (most recent call last):
  File "slash_bot.py", line 11, in <module>
    print("\n".join(sys.path))
  File "C:\Users\ezboo\AppData\Local\pypy3.7-v7.3.5-win64\lib-python\3\encodings\utf_8.py", line 20, in encode
    return codecs.utf_8_encode(input, self.errors)[0]
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcd0' in position 24: surrogates not allowed
#

Why is everything wrong with PyPy

#

wtf

drifting wedge
#

wait

#

wdym

#

Permissions?

slender thistle
#

nicknames

drifting wedge
#

i got told its that in other servers

#

wdym

slender thistle
#

you change a nickname but you manage nicknames

drifting wedge
#

im confused

#

whats the correct thing to do this

vivid fulcrum
#

oh my god literally just add an s

drifting wedge
#

ooOOHOHOOH

#

ty

prime mist
# quartz kindle does getData() then call setImmediate? it has to tell the event loop to continue...

More extensive example:

const initStream = () => {
  const buffer = [];
  let resolve: (blob: Buffer) => void;

  setupEpollCallback((blob: Buffer) => {
    buffer.push(blob);

    if (resolve) {
      resolve(buffer.shift());
      resolve = undefined;
    }
  });

  return () =>
    new Promise<Buffer>((r) => {
      if (buffer.length > 0) {
        r(buffer.shift());
      } else {
        resolve = r;
      }
    });
};

async function* stream() {
  const getData = initStream();
  while (true) {
    yield await getData();
  }
}
quartz kindle
#

ah yes, a deferred promise in a closure

#

clever trick for tcp and ipc streams

#

but in the end, at the lowest of the low level, there is still an event emitter in the epoll callback xd

prime mist
#

Hah, well it more of a callback than a event emitter at that level.

#

it is*

quartz kindle
#

but it runs multiple times no? like an emitter of sorts

prime mist
#

But they are very similar, callbacks and event emitters.

green kestrel
#

finished tweaking my cpu graph 😄

#

i think it looks EPIC now

quartz kindle
#

nice

green kestrel
#

also breaking it down by cluster really shows how little cpu is being used

stiff lynx
#

how can I send a message after 5000 ms from the command starts?
discord.js

#

so I write .help and after 5.000 ms the bot sends the help list?

copper cradle
#

why would you wait so long

stiff lynx
#

Its for a minigame

#

help is an example

slender thistle
#
>>>> import os
>>>> os.listdir("C:\\Users\\ezboo\\OneDrive\\Рабочий стол\\asdasd\\something\\sakurai")
['.idea', 'bot.py', 'requirements.txt', 'settings.json', 'slash_bot.py', 'utils', '__pycache__']

But apparently

C:\Users>pypy3 "ezboo\OneDrive\Рабочий стол\asdasd\something\sakurai"
C:\Users\ezboo\AppData\Local\pypy3.7-v7.3.5-win64\pypy3.exe: can't open file ezboo\OneDrive\\udcd0\udce0\udce1\udcee\udcf7\udce8\udce9 \udcf1\udcf2\udcee\udceb\asdasd\something\sakurai: [Errno 2] No such file or directory
copper cradle
#

Just warp everything inside a timeout

prime mist
#

Ask your mate to start a stopwatch, then press enter when it reaches 5 seconds 🙂

slender thistle
#

because fuck you I guess

copper cradle
#

setTimeout(<func>, <timeout in ms>);

slender thistle
#

What's actually wrong with this sigh

copper cradle
#

the encoding

#

change the Cyrillic name to something in latin

#

or move the file

stiff lynx
slender thistle
#

Fucking-A, let me just change my Desktop name

copper cradle
prime mist
copper cradle
#

you gotta wrap it in a function that wil be executed once the timeout is over

slender thistle
#

Absolute bullshittery

stiff lynx
copper cradle
#

what

copper cradle
#

was that actually the problem?

slender thistle
#

K time to think where I can put this script without losing it

stiff lynx
copper cradle
#

why would u need to await that

prime mist
#

Well, if you are in an async function:

await new Promise(r => setTimeout(r, 5000))
await sendMessage()
slender thistle
#

yup

copper cradle
#

lmao

#

L

slender thistle
#

I'm fucking done

copper cradle
#

ezboo\OneDrive\\udcd0\udce0\udce1\udcee\udcf7\udce8\udce9 \udcf1\udcf2\udcee\udceb\asdasd\something\sakurai I thought about it when I saw this

slender thistle
#

It for some reason filled them with surrogates

#

which don't fall under UTF-8

stiff lynx
copper cradle
stiff lynx
#

srry if I look like the dumbest

prime mist
stiff lynx
#

but where I live is 00:30

#

I'm kinda stupid

prime mist
stiff lynx
copper cradle
#

el apocalipsis deja de ser un miedo y se convierte en una esperanza

stiff lynx
#

meglio l'italiano dello spagnolo lol

slender thistle
#

Did you forget to set type to 2 for the stats command itself?

#

@cursive dagger speedian.CommandContext.send needs interaction_id from interaction_create instead of client_id plzfixty

#

Literally just spent 30 minutes trying to debug 404s for interaction responses

lament rock
#

No more reactions necessary. Best 12h dev session I spent

#

too bad that'll go towards message patch buckets

prime mist
radiant charm
#

sup

cosmic forum
#

Anyone know a Nodejs package that allows you to get the content of a meta tag?

solemn leaf
#

for videos/

summer torrent
earnest phoenix
#

Hello any one say how update npm ytbl core

solemn leaf
#

npm update

#

actaully just npm i

earnest phoenix
#

in terminal

#

🤨

#

Tyx

#

Youtuber say always wtf

copper cradle
earnest phoenix
errant ferry
copper cradle
hasty mulch
#

Does Digital Ocean have Rasipban OS as a distro?

earnest phoenix
#

any one new disocrd bot button

#

i need help i need make to

calm raft
ripe prairie
#

have you tried googling how to do it first

earnest phoenix
ripe prairie
#

because like

#

that

earnest phoenix
#

discord new button feature

#

bro

#

Google is your friend

ripe prairie
#

first search result is discord's own article

#

which has a direct link to their documentation

#

on TOP of that

earnest phoenix
#

Sometimes searching a little bit will help you...

#

Not everything is given to you all the time in life, you gotta make your own research sometimes.

ripe prairie
#

put in the effort

#

if you have issues with buttons, not just "give code pls"

#

then people can help

south sinew
#

So upon trying out @discordjs/voice, I received TS errors about missing modules. I tried reinstalling modules with no luck. One thing to note, I'm not using discord.js, rather a different library, so my thought is that these missing modules could be normally installed with djs, and aren't with @discordjs/voice and thus is an oversight.

Here's a part of the error stack that goes with the screenshot below, I can't fit it all into Discord's 2000 character limit

node_modules/@discordjs/voice/dist/audio/AudioPlayer.d.ts:5:26 - error TS2307: Cannot find module 'typed-emitter' or its corresponding type declarations.
5 import TypedEmitter from 'typed-emitter';
ripe prairie
marble juniper
#

You can also use
// @ts-ignore

clear marlin
#

^^

marble juniper
#

just put it above wherever you import @discordjs/voice

#

and it should fix ur problems

clear marlin
#

oh wait doesn't @ts-ignore ignore the warnings?

#

those are errors

#

also, you could try installing the @discordjs/voice types

#

maybe that would fix the issues

south sinew
south sinew
south sinew
clear marlin
#

also, if that doesn't work npm i @types/tiny-typed-emitter

#

and if there are no type declarations for tiny typed emitter

#

well

south sinew
#

yeah my last resort is just installing them myself, I'm just trying to stay away from it

marble juniper
clear marlin
#

those are errors

#

not warnings

south sinew
clear marlin
#

so they aren't useful

marble juniper
#

errors whatever

#

you get my point

clear marlin
#

yeah

marble juniper
#

it still ignores those errors and still gives t y p i n g s

south sinew
#

You sure

#

I thought it was ignore warnings, not errors

clear marlin
#

ts-ignore doesn't ignore errors

marble juniper
#

smh do whatever you think is right then

#

im outta here

south sinew
#

I may just submit an issue on the repo, as I feel like I've tried everything reasonable without using workarounds

#

I'd prefer to be using dependencies that I don't have to hack with to make them work

clear marlin
#

you could declare typings for the package yk

#

if tiny-typed-emitter doesn't have any typings

south sinew
#

It's not that the package doesn't have typings; discordjs/voice is written in ts, it's that it uses other packages for it's typings, that for some reason aren't accessible during runtime

#

if you look in the error stack, you can see it's throwing errors because it cannot find the appropriate modules when importing them for it's compiled typing files

clear marlin
#

ahh

earnest phoenix
#

what should i try doing?

lusty quest
#

you propably have to build from source

earnest phoenix
#

rebuild it

#

hmm so are there any specific docs for it?

#

idk-

#

sad

#

still same error

earnest phoenix
#

apparently it is telling that i may have not properly installed canvacord

#

i did npm i canvacord and here is the error

proven lantern
#

run from git bash

earnest phoenix
#

what is that?

proven lantern
#

it pretends to be unix

#

you get it when you install git

earnest phoenix
#

yes

#

oh

#

i have never installed git

#

not aware about this

earnest phoenix
slender thistle
proven lantern
#

0.7.0 is the newest version

earnest phoenix
#

@proven lantern looks fine

proven lantern
#

try making a run script under the test script. node bot.js

#

then do npm run

earnest phoenix
earnest phoenix
#

ohk

#

ic

quartz kindle
#

did you try npm rebuild?

earnest phoenix
#

@quartz kindle

quartz kindle
#

try npm rebuild canvas --update-binary

earnest phoenix
#

hmm ok

#

error sad

quartz kindle
#

what is the output of the rebuild command?

open kiln
#

i would not use the users folder in windows as a development directory

instead id do C:/dev or anything, users folder is a bitch most of the times

#

especially when it comes to using package managers like npm

quartz kindle
#

it can cause issues when the username has spaces, but its not the case here so it should be fine

smoky kelp
quartz kindle
#

the connection took too long and you didnt catch the error

smoky kelp
quartz kindle
#

this error event comes from connection, not client

#

voiceconnection.on("error")

smoky kelp
quartz kindle
#

i just told you how?

smoky kelp
earnest phoenix
#

well

#

no or maybe idk

quartz kindle
#

you said you have an error event in your code, so i assumed you know how events work lol

slender thistle
#

I have GUILD_MEMBERS intent specified, but I still don't receive any members. What can cause this?

lusty quest
#

enabled in the dashboard?

slender thistle
#

Mhm, along with presences

#

Turned it on a few minutes ago, but I doubt there's a significant delay for it to actually take effect

lusty quest
#

i guess then its just discord doing its thing again

slender thistle
#

Oh wait

#

My dumb ass forgot to set the intents in my prod instance

earnest phoenix
#

hi

slender thistle
#

🤣

earnest phoenix
#

yo

#

i made my bot code without any command handler

#

now i want to change it in command handler

#

so how do i do it?

#

any docs for that?

#

imagine asking docs for stuff you make on your own

earnest phoenix
#

i never made one

#

i have 1 file

#

bot.js

#

i did all coding there

#

no meme.js

#

no user.js

#

etc

#

now i wish to do

#

becoz y not

#

this is what happens when you use discordjs.guide's if else thing to handle commands

earnest phoenix
#

to make a command handler you just need a way to read data from different files and execute methods from them based on the message

earnest phoenix
#

const fs

#

yes

#

module exports?

#

my friend telling is that right?

#

hmm ye i checked on discord.js

#

guide

#

the simplest command handler would be this:

// commands/user.js
module.exports = {
  name: "user",
  async run (message) {
    // do stuff
  }
}

// bot.js
bot.commands = new Map();
for (let data of fs.readdirSync("./commands")
.map(file => require(`./commands/${file}`))) {
  bot.commands.set(data.name, data.run);
}

bot.on("message", message => {
  const command = /* */;
  bot.commands.get(command)(message);
});
#

hmm tysm

tacit sequoia
#

That's an example

earnest phoenix
#

so i download const fs

#

make command folder

#

i can sense a ctrl + c coming

tacit sequoia
#

Don't copy & paste, lol

earnest phoenix
#

like modcmds folder inside commands

tacit sequoia
#

Then change it?

earnest phoenix
#

u decide what you do with your command handler

#

hmm

#

k

#

i can only give you an example

tacit sequoia
#

First understand what the above is doing

earnest phoenix
#

hmm

#

time to add some comments

tacit sequoia
#

Lol

earnest phoenix
#

commands/user.js

// Export an object with the command data
module.exports = {
  name: "user", // Name for the command
  async run (message) { // The function that runs when this command is called
    // do stuff
  }
}

bot.js

bot.commands = new Map(); // bot.commands is a Map that stores all the command info
// The keys are the command names and the values
// are the command run methods

// Read every file in the command folder
// and add it's data to bot.commands
for (let data of fs.readdirSync("./commands")
.map(file => require(`./commands/${file}`))) {
  bot.commands.set(data.name, data.run);
}

// When the bot recieves a message...
bot.on("message", message => {
  // ...get the command from the message...
  const command = /* */;

  // ...and execute the command
  bot.commands.get(command)(message);
});
#

@earnest phoenix

#

ohk

#

hmm

#

try to understand what this does and dont copy paste it

earnest phoenix
#

hmm trying to understand

#

light mode is hard

#

nvm

#

@earnest phoenix did you get it

earnest phoenix
#

i am watching tutorials about it

#

well ty for those xamples

#

🤦‍♂️

#

why are you watching youtube tutorials

#

99% of that shit is outdated

earnest phoenix
#

many

strange citrus
#

I am not understanding one thing and wanted help: When I change my bot name and image in the discord developer portal, in the aplication, it is not changing the name in discord. It is always remaining the old name and image of the bot, instead of changing to the new one that I put in the discord developer portal

#

any one knows the answer to that?

#

It changes in the developer portal, but not in discord

#

I don't know if my explanation was clear

earnest phoenix
#

Go to the bot tab and change its avatar there. You most likely changed the app icon

strange citrus
#

bot tab?

earnest phoenix
#

The tab you're getting the token from

strange citrus
#

oh

#

I changed in here:

#

in the aplication

earnest phoenix
#

Yeah those are app icons

strange citrus
#

ahhhhhhhhh

#

where do I click to go to the bot tab

#

I forgot it

earnest phoenix
#

Click one of the apps, and there'll be bot section you can click

strange citrus
#

omg

#

true

#

thx man

#

it worked

earnest phoenix
snow urchin
earnest phoenix
#

Is this channel only for help with development or would this channel be able to help me find the right bot for my issues? Thinking Trying to find the right channel to post my question in lol

woeful pike
#
import dotenv from "dotenv"
dotenv.config()

can be just

import "dotenv/config"
woeful pike
#

I know I don't have enough information to help you with your actual thing I just wanted to give a heads up

snow urchin
#

mk

woeful pike
#

don't even know what file the second screenshot is

snow urchin
#

yes

#

https://i.callumdev.xyz/ba14l.png
the shard manager creates a new client for each shard, ofc, which I have a custom client class for, but when that client class is imported, it imports the index file to get the database and config that were exported, causing it to loop

earnest phoenix
#

typescript

#

for dscord.js?

woeful pike
#

also I think the way you're doing this is pretty wrong. Your database is not statically available so it doesn't make sense to export it because you'll run into race condition. Pass it as a constructor argument to client instead and access it through there

visual goblet
#

what is sharding exactly?

snow urchin
#

but I cannot parse it as a constructor argument since its created before the shard is created and I cannot parse arguments to the shard

woeful pike
#

in that case each shard should be creating its own database connection and passing it to the client that way

earnest phoenix
snow urchin
#

wouldn't that be bad, a seperate connection for each client?

earnest phoenix
#

when a bot reach lot of guilds its efficiency is to be increased

woeful pike
#

are you sharing connections across processes now? that doesn't sound good either

earnest phoenix
#

to satifay users

#

rip english

drifting wedge
#

is there any way to make py file path relative?

earnest phoenix
#

path. relpath()

#

u can get a relative path

#

for python

#

i did coding in python earlier

drifting wedge
#

wdym?

earnest phoenix
#

now i forgot some things

earnest phoenix
drifting wedge
#

like this makes the file get other files relatively?

#

so 1.py gets others file relatively?

earnest phoenix
drifting wedge
#

for example

earnest phoenix
#

hm

drifting wedge
#

oh ok

#

cool

#

gotcha

#

ty

earnest phoenix
#

ye

#

yw

#

happy coding 😄

drifting wedge
#

thank

#

thanks

#

same

#

wait is path a default lib?

#

@earnest phoenix

earnest phoenix
#

no as far as i remember

#

why this happening

drifting wedge
#

uhhh

#

i know some js so bear with me

#

whats the error?

#

oh canvacord?

earnest phoenix
#

yes

#

maybe improper installation

drifting wedge
#

did you install it?

earnest phoenix
#

by npm i canvacord

drifting wedge
#

also require it in package.json

#

?

earnest phoenix
#

version 5.20

drifting wedge
#

did u install that version?

earnest phoenix
#

how do icheck the version of canvacord installation?

#

like for discord.js

#

there is y

#

v

#

something

drifting wedge
#

uhh

#

it says when u download?

#

Extension 'cogs.automod.automod' raised an error: TypeError: relpath() missing 1 required positional argument: 'path'

#

you can check tho

#

i think

#

@earnest phoenix

#

npm list --depth=0

#

there

earnest phoenix
drifting wedge
#

npm info YOUR_PACKAGE version

#

or this

earnest phoenix
#

kk

earnest phoenix
#

you need to supply path argument

earnest phoenix
keen sequoia
#

bruh

tribal siren
#

yo uh, i tried making the bot check if a user has no roles for something i don't wanna tell about and this is what i did for now

#
if(member.guild.members.cache.get(member.user.id).roles.cache.map(r => r.id).join("") === message.guild.roles.everyone.id) return;```
#

doesn't work for any reason

#

anyone know what im doing wrong?

vivid fulcrum
#

wtf

tribal siren
#

this is guildMemberAdd event so member is defined

earnest phoenix
#

no no not you

#

kk

#

i was saying to 0exe

#

oh

vivid fulcrum
earnest phoenix
#

when i install this error shows

earnest phoenix
#

sad

tribal siren
vivid fulcrum
#

comparing with the everyone role id will always return true though

tribal siren
#

i tried that too

vivid fulcrum
#

everyone has the everyone role regardless

#

so you'll always return out of the handler

tribal siren
#

yes so i mapped it by its id and it should work ig

earnest phoenix
#

yes my bot worked

#

but after deleting canvacord

#

xd

vivid fulcrum
#

but why are you mapping

#

it's unnecessary wasted processing power

tribal siren
#

oh i maybe know what's my problem LOL

#

im in guildMemberAdd event LOL

#

now it works perfectly thanks lol

earnest phoenix
#

how do i convert this into command handler

#

i can understand anything from those tutorial videos

#

half things dont even work

vivid fulcrum
#

because you're copypasting without understanding what you're doing

#

stop with whatever you're doing, take a deep breath, backtrack and learn javascript

#

then come back to discord bots

earnest phoenix
#

i know js it just that i am doing after a break ig 7 months

#

so yeah

vivid fulcrum
#

then you don't know it

earnest phoenix
#

the code was 1 yr old

vivid fulcrum
#

if you truly knew something, you wouldn't forget it

earnest phoenix
#

since exam etc i forgot this

#

discord bot

#

sad

#

now i started learning yesterday

#

along with my friend

narrow fractal
vivid fulcrum
#

we don't need a sob story

narrow fractal
#

😔

earnest phoenix
#

Need help I want only the info section of my bot to be background imaged in css ik how to do it i just getting issue the pic is getting repeated all over my page

earnest phoenix
earnest phoenix
narrow fractal
vivid fulcrum
#

it took me 5 seconds to find parts of your code on google

#

🙄

cinder patio
#

oof

earnest phoenix
#

ig ur right

#

since some things such as args

vivid fulcrum
#

mf you copypasted entire ass commands 😩

#

every 1/3 of your code follows a different style and naming conventions

drifting wedge
earnest phoenix
#

i copied the portion for args

#

and the ban kick

#

who tf told whole?

vivid fulcrum
earnest phoenix
#

and ban

vivid fulcrum
#

stop claiming that code is yours

earnest phoenix
#

mine and my friends

vivid fulcrum
#

80% of your codebase is copypasted and the rest is being held together by external libraries that do work for you

cinder patio
#

I wish I had this many friends

zinc wharf
drifting wedge
#

tbh like 99% of my code is not mine

#

cuz of libs

#

🧠

#

yo help me with file paths lmao

vivid fulcrum
#

i don't mind that, i mind people who keep claiming they kNoW javascript and that code they very clearly copypasted is theirs

sudden geyser
#

99.9% for the libraries and frameworks of your dependencies

quartz kindle
#

well if you include your runtime + compiler + operating system + everything else, your actual code is like 0.000001%

drifting wedge
#

oh dont worry about that with me, i hide my plagirism very well

#

ok well can u guys pls help me figure out python paths?

slender thistle
#

E

quartz kindle
#

a path is a path lol

#

no matter the language

drifting wedge
#

path.relpath()

earnest phoenix
drifting wedge
#

like how do i fixy fixy this

quartz kindle
#

the error said you are missing an argument

#

path is an argument

#

relpath(your path here)

earnest phoenix
#

well but yes mine and my friends fault

drifting wedge
#

example of a path?

earnest phoenix
#

@vivid fulcrum ty very much for realizing my flaw

drifting wedge
#

oh

#

i see

quartz kindle
#

C:/windows/system32.sys

drifting wedge
#

so absolute path?

#

fuck

earnest phoenix
#

i must learn and master the basics first

drifting wedge
#

this is the opposite of what i wanted

quartz kindle
#

i mean i dont know

drifting wedge
#

python is dumb with paths

#

how fix

quartz kindle
#

it didnt specify what kind of path

drifting wedge
#

with relative paths

slender thistle
#

What are you doing

quartz kindle
#

could be absolute or relative

drifting wedge
#

uhh opening a file

#

both bot.py folder and cog folder dont work

slender thistle
#

Open from where and what file

drifting wedge
#

open a txt

#

open in a cog

slender thistle
#

Where are the txt and cog stored?

drifting wedge
#

the txt wheverver works

#

prefferably in cog

slender thistle
#

Try going relative from the main file

drifting wedge
#

ok

#

willl do

#

what if i just put it in the main file?

slender thistle
#

If it doesn't look ugly and works... 4Shrug

drifting wedge
#

lemme try,,

#

fuck FileNotFoundError: [Errno 2] No such file or directory: 'cogs.automod.words.txt'

slender thistle
#

use slash not dot

#

kekw

drifting wedge
#

when use dog

#

dot

#

FileNotFoundError: [Errno 2] No such file or directory: '/cogs/automod/words.txt'

slender thistle
#

That's absolute path since you added a slash at the beginning

drifting wedge
#

OHOOHOHOHOHOH

#

WHAT

#

MY WORLD JUST TURNED UPSIDEDOWN

slender thistle
#

Sorry, had to flip it around because you don't live in Australia

drifting wedge
#

FileNotFoundError: [Errno 2] No such file or directory: 'cogs/automod/words.txt'

#

still no worky 😦

woeful pike
#

why not just use Path.resolve

pale vessel
#

oh python has that?

woeful pike
#

absolute_path = Path(relative_path).resolve()

drifting wedge
#

any imports?

woeful pike
#

pathlib

quartz kindle
#

sus

drifting wedge
#

kk

#

"relative_path" is not defined

#

oh

#

lmao

#

im dumb

#

all good

opal plank
#

thats some high iq plays there

#

i saw it live