#development

1 messages · Page 1723 of 1

analog imp
#

all my projects went offline for like a solid 5 minutes and was refusing to reconnect, i literally moved the dongle like an inch and boom, back on TESfacepalm

#

worst part is, it's like 3 ft away from the router

solemn latch
#

you dont need a hub even then, just a ethernet cable

proven lantern
#

when my bot gets to 2500 servers will it auto shard or do i need to do something?

proven lantern
#

like if i were to keep all my state in memory like a noob?

solemn latch
#

still depends.
if you have auto sharder enabled, or things like a webserver outside your sharder, etc.

#

tons of things can potentially break from a non sharded bot to a sharded bot.

#

If you want to be sure make a second bot for testing and put it on like 2 guilds and shard.

proven lantern
#

okay, probably a good idea so i dont break my current bot

#

thanks

#

is there a setting in discord.js-light to force it to use 2 shards?

opaque hawk
#

Is there a way to make a role using permission integers?

opaque hawk
#

Nevermind found it

proven lantern
#

will sharding on my localhost break my bot that is deployed on my vps?

#

i have my bot setup so it normally doesn't interfere with prod when i run it in test mode.

umbral zealot
#

Nah it won't affect your prod bot

lyric mountain
#

@sacred vapor no

summer torrent
#

@ripe prairie

delicate shore
#

I uploaded my api docs on Swagger UI

#

how can I use it on my site

#

like people go api.............com/v3/docs
I want that to be there

hallow shell
#

is there a way in regex to make something like a negative lookbehind but just for a group (and not the entire expression)?

#

[^abc] won't work, because it actually matches the characters

vale garden
#

hi i have a question

#

i have a bot which is similar to yggdrasil's userphone

#

and i have a channel on my friends server of like 70 members where theres a channel #comms

#

where the userphone messages are sent

#

to allow them to be moderated easily

#

is any of that against tos?

solemn latch
#

only moderators can see this channel?

#

ie no users.

vale garden
#

nope everyone can

solemn latch
#

could be a privacy concern, users expecting their conversations to be private, but its not.

vale garden
#

so is it fine if i make the channel restricted to admins

solemn latch
#

probably.
I would also let users know admins can see it, but I dont think thats strictly required.

vale garden
#

since i think even yggdrasil tracks the messages, cuz my friends got the owner joining their server and warning them

earnest phoenix
#

anyone smart w mysql & py

soft glade
#

im trying to make my bot dm users when they join my discord server for some reason its not working
here is my code discord.py

stored_guild_ids = [834635134388535327]

@client.event
async def on_member_join(member: discord.Member):
    if member.guild.id in stored_guild_ids:
        await member.send(f"Welcome To The Server!!")
last tapir
#

hello

#
function hello() {
    const array = [];

    for (let i = 0; i < 2; i++) {
        array.push("Hi");
    };

    console.log(array)
}

hello()

What happens if I add a return before array.push(...)?

quasi forge
quasi forge
last tapir
#

make it not work?

quasi forge
#

Yes

last tapir
#

thanks!

quasi forge
#

Np

opal plank
#

is there a nifty trick to ignore indentation to finish a function? imagine this scenario ```ts
MyFunc(foo:string) {
if(foo == 'hello') {
console.log('hello');
return true;
} else return false;
}


There are some things in js that i could use to bypass that like this
```ts
MyFunc*(foof:string) {
  if(foo === 'hello') {
    console.log('hello');
    yield true;
  } else yield false;
}

is there something i can use to call a function return or closure from within a blocked scope?

earnest phoenix
#

how do i make a really good help command?

quasi forge
earnest phoenix
quasi forge
#

Something I personally prefer is you first list all the categories and depending on what people react with, display appropriate categories and add a reaction to go back to the menu and continue navigating

still sky
opal plank
#

how is it confusing?

#

im using generators to bypass blocked scopes for returns for a function closure

#

@still sky ?

lusty quest
#

lol this confused him even more

opal plank
#

probably shouldnt even try to help with this then KEK

#

generates arent widely used, not really suprised many people dont know about it, but the explanation should suffice

#

its basically bypassing blocked scopes to return something to the function

#

generators provide that handy feature, but i cant seem to find an alternative for standard functions

#

@lusty quest you got any ideas?

lusty quest
#

wait nvm its deprecated

cinder patio
#

I know what generators are ans your question confused me

opal plank
#

seen that before yeah

#

how so?

#

the return inside the scope is blocked, i want to return true on MyFunc(), thats about it, as it is it wouldnt return anything

#

those are the 2 important bits

#

the return is scope blocked

#

the yield isnt

cinder patio
#

So you don't want that return to be inside the if block??

opal plank
#

technically i shouldnt be using generators here, but i think its a fair example

#

this is a very simplified example, but lets just assume its there

#

period

#

now what?

cinder patio
#

What's wrong with the first example though? Why don't you want it to be like that

opal plank
#

wdym? it wouldnt return true for the function tho

lusty quest
#

for me it works

cinder patio
#

It would

#

Erwin are you ok

opal plank
#

actually it would

#

still

#

returns dont work when scoped

cinder patio
#

they do unless they are in a closure

#

or another fn o

opal plank
#

oh i see what i did there

#

well yeah that would be the issue

cinder patio
#

Mmm what do you do with the closure

#

is it immediatly invoked

opal plank
#

there are quite a few times my returns are blocked, was wondering how i could yield on the function instead

#

the worst part is that its been 2h already and i forgot the specific case use for this

cinder patio
#

Can you give an example from your code

opal plank
#

just what i said, i completely forgot what i needed it for

cinder patio
#

You could return a promise if the closure is passed as a callback...

opal plank
#

needed that so i wouldnt have to rearrange a big snippet frmo my code somewhere

opal plank
#

thats a solution too

#

completely forgot about callbacks

#

ty

cinder patio
#

👍

earnest phoenix
grim lark
#

space gives error

#

pls help

dusky sundial
#

Why do you need a space?

grim lark
#

I don't need the space I wrote a code and this error occurred even though I deleted the code it doesn't go away (translate 😢 )

#

oh just appearance error bot is running

drowsy epoch
slender thistle
#

Zendesk iirc

drowsy epoch
slender thistle
drowsy epoch
#

thanks

crystal wigeon
#

hey umm

#

anyone know how to load file in req.file on to canvas nodejs?

quartz kindle
#

do you have the multer middleware?

stuck pike
#
 message.author.roles.add(Bunch);```
#

this says
TypeError: Cannot read property 'add' of undefined

#

anyone knows the fix

quartz kindle
#

author is a user not a member

#

users have no roles

#

members have

#

message.member

stuck pike
#

thx

signal estuary
#

Is it possible to delete messages from a certain user?

quartz kindle
#

if you have permissions, yes

stiff lynx
#

There is a way to make mongo db autosort the datas?

harsh blade
#

How do i give someone a role (mute role) inside a
"Client.on" block? its different from the actual command right?

crystal wigeon
#

anyway, is there a way to save canvas as webp?

#

or atleast get the stream

#

or something

cinder patio
#

Automatically put everyhing in memory?

stiff lynx
#

no, I wrote autosort not autostart, lol

cinder patio
#

lmao sorry

stiff lynx
#

but aggregate give me undefined

#

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'aggregate' of undefined

earnest phoenix
#

Can anyone teach me how to code a webhook?

stiff lynx
#

what is a webhook?

earnest phoenix
cinder patio
#

I'm not sure aggregate is the right method to use

stiff lynx
cinder patio
#

try .find().sort({bank: -1 }).toArray()

#

Actually...

stiff lynx
#

and after that I sort the data how can I output the first 10?

cinder patio
#

sort(...).limit(10)

stiff lynx
cinder patio
#

await db.profilemodels.find...

#

Also it doesn't sort them in place, it returns the sorted arr

stiff lynx
#

So it create an array and I can do for(i=0; i<10; i++){message.channel.send(array[i])}

stiff lynx
earnest phoenix
#

Can anyone teach me how to code a webhook?

stuck pike
#

guys i was checking my kick command

#

i kicked my one friend

#

now he cant join back

#

and shows he is banned

#

but he isnt banned

stiff lynx
cinder patio
#

and then you can so whatever you want

stiff lynx
#

it still doesent work

cinder patio
#

any errors?

stiff lynx
#

I hate trying to do this

stiff lynx
earnest phoenix
#

Can anyone teach me how to code a webhook?

dusky sundial
#

In what lang?

earnest phoenix
slender wagon
tacit sequoia
#

Cant you edit webhooks now?

earnest phoenix
stiff lynx
stiff lynx
green kestrel
#

lol, i put some really aggressive memory management into my lib

#

its currently hovering at 441mb, caching about a million users across 7700 guilds... and every time it tries to add on a few more megs to the cache, the GC kicks in and WHACK, back down again lol

#

quite fun to watch

winter oriole
pale vessel
#

¯\_(ツ)_/¯

#

If you're more familiar with python, then use discord.py

#

Else use discord.js

green kestrel
winter oriole
green kestrel
#

i misread your nickname as diesel cow, btw

winter oriole
winter oriole
wicked pivot
#

how to suppress the reaction of a message except that of a user?

pale vessel
#

Member/role permission overwrites

#

You could give a member temporary role that lets them react while others can't

astral dagger
#

Hello

drifting wedge
#

since when do developer's opinions matter? its all about exe's opinion

royal herald
#

How do you split a String on Java?

pale vessel
#

Definitely not explode()

#

It's string.split(delimiter)

royal herald
#

thx qt

lyric mountain
# royal herald thx qt

do note that, depending on what character you want to split you might need to use Pattern.quote(delimiter)

earnest phoenix
#

client.channels.cache.get("828985803178901544").send(`I have been removed from: ${guild.name} (id: ${guild.id})`);

TypeError: Cannot read property 'send' of undefined

lyric mountain
#

the channel you're trying to retrieve is nonexistent

drifting wedge
#

how do i do try except?

#

like i have the erro

#

but idk what the proper like error is

#

and how do i do like if this is the error do this etc

#

python

earnest phoenix
lyric mountain
tired panther
#
Model.deleteMany({ "guildid":  { $regex: `^${guildid}$`, $options: 's' } })

I am trying to delete many in mongoose, but it is not working...

lyric mountain
#

arent you supposed to use regex with //g?

tired panther
lyric mountain
#

I keep what I said

tired panther
#

const reg = /`^` + guildid + `$`/;
Will this work?

lyric mountain
#

I said //g not //

tired panther
lyric mountain
tired panther
#

super confusion lol

lyric mountain
#

look at the fckin G

tired panther
lyric mountain
#

boi

tired panther
#

that does not make sense lol

lyric mountain
#

are you even trying to read the screenshot?

tired panther
#

/`^` + guildid + `$`/g?

lyric mountain
#

g

#

not G

green kestrel
lyric mountain
#

and you don't need ^ nor $

green kestrel
#

if youre an exe file, im a com file. older and wiser

#

😄

tired panther
lyric mountain
#

you still need to treat guildid as a string

#

else you'll be matching EXACTLY the word guildid

slim umbra
#

uhm

#

if thats mongo

#

why are u searching for guilds with regex?

lyric mountain
#

he's searching for docs that contains the id

tired panther
slim umbra
#

just

lyric mountain
#

also, + is a regex symbol, not concat operator

slim umbra
#

db.collection('whatever').remove({guildId: guildid})

summer torrent
tired panther
slim umbra
#

db.collection('whatever').deleteMany({guildId: guildid})

#

?

tired panther
tired panther
slim umbra
#

doubt

lyric mountain
#

he wants to delete anything that contains the id

#

not necessarily being in a field called guildId

summer torrent
#
findOneAndDelete({ guildId })```
slim umbra
#

no

#

thats wrong in many ways

summer torrent
#

you don't need to write guildId twice btw

slim umbra
slim umbra
#

I vs i

summer torrent
#

oh

#

just change variable and its done

tired panther
#

my I was small

lyric mountain
#

they're talking about another thing

slim umbra
#

but tbh

#

your db structure is bad if your forced to use regex to remove everything relating to a guild

tired panther
vivid fulcrum
#

your db is bad period

lyric mountain
#

you're supposed to have id columns for that matter

slim umbra
#

this is nto the time to shit on somebody for using mongo vs postgres

#

thats another discussion for another time

lyric mountain
#

who is shitting?

vivid fulcrum
#

i was getting to the fact that they're storing relational data in a non relational database

tired panther
#

lol, I am sitting since 1 hour on this problem, to delete some stuffs

tired panther
green kestrel
slim umbra
#

everyone uses mongo for relational data 😩

lyric mountain
#

read the first 5 messages after that one

green kestrel
#

its all about mysql. mysql for life, yo.

slim umbra
#

disgusting

lyric mountain
green kestrel
#

postgres is for open source weenies ducks and runs for cover

lyric mountain
#

or a sausage in a cheeseburguer

slim umbra
#

truck for f1

#

wut

lyric mountain
#

or lemon in orange juice

slim umbra
#

oh wait

#

brain

#

but anyways

#

him making bad db choices isnt going to solve his issue

vivid fulcrum
#

postgres >>>

tired panther
vivid fulcrum
#

native unsigned long support

#

yum

lyric mountain
green kestrel
#

i think people are drawn to mongo because of its very flexible and mature codebase in node

slim umbra
#

so u probs should first add a guild id field to all mod actions since i hope they all happen in a guild

green kestrel
#

doesnt make it the swiss army knife people use it as

slim umbra
#

well mongo is easy to use esp if ur a js skid

lyric mountain
#

look, in regex guildid means guildid

#

not the variable

#

exactly the word

green kestrel
#

ive always used mysql, never really given postgres a second look

lyric mountain
#

oh wait you actually used replace

#

nvm then

#

give it a try

green kestrel
#

but thats for the same reason js people like mongo... the C apis for mysql are far better than the postgres ones

slim umbra
#

yeah

lyric mountain
#

no

slim umbra
#

had to do something in mongo with rust for work and god

#

it has terrible driver support out of js and py like jeez

steady raven
#

ok

green kestrel
#

tell you what is equally nice in C++ as it is in everything else, redis libs

slim umbra
#

redis ioswoozy

tired panther
lyric mountain
#

then see if the regex match

tired panther
lyric mountain
#

maybe you're not replacing properly

tired panther
#
(`/guildid/g`).replace('guildid', guildid)
lyric mountain
#

try without anything, just guildid

#

like, regex: guildid

pale vessel
#

What are you doing

tired panther
lyric mountain
#

not necessarily being in a field named guildid

pale vessel
#

hmm?

#

why regex

lyric mountain
#

basically if guildid is 123 delete everything that contains 123

tired panther
pale vessel
#

"Everything" as in? Properties?

pale vessel
#

What did you store the guild id as

lyric mountain
tired panther
tired panther
lyric mountain
#

that doc would be deleted

pale vessel
#

Did you await it/use .then()?

#

You need to

lyric mountain
#

because the guildid is there

tired panther
pale vessel
#

Then it should have worked

tired panther
pale vessel
#

Hmm

lyric mountain
#

like, he wants to delete anything that contains the guildid independently on property name

tired panther
#

wrong mark

#

have to run to school run

#

bb

stiff lynx
#

module.exports = {

name: "leaderboard",
aliases: ["lb"],
permissions: [],
description : "comando per vedere la classifica dei soldi di novabot",
run: async(client, message, args, Discord, cmd, profileData) => {
    const collection = new Collection();

    await Promise.all(
        message.guild.members.cache.map(async(member) =>  {
            const id = member.id;
            const bal = await client.bal(id);
            console.log(`${member.user.tag} -> ${bal}`)
            return bal !== 0 ? collection.set(id,{
                id,
                bal,
            })
            : null
        })
    )
    const data = collection.sort((a,b) => b.bal - a.bal).first(10);
    message.channel.send(
        new MessageEmbed()
        .setTitle(`Classifica del sistema di monete di ${message.guild.name}`)
        .setDescription(
            data.map((v,i) => {
                return `${i+1}) ${client.user.cache.get(v.id).tag} => ${v.bal} monete`
            })
        )
    )
}

}

#

I've found this code for the leaderboard, but idk how to change it for make it work

#

PLS HELP

dusky sundial
#

It's probably not a good idea to copy code that you don't understand

hasty grove
#

(and my pip is up to date)

lavish bramble
#

Can I do like when my bot joins a server then he automatically gives server name to my server channel?

gritty lintel
#

can i know how can i create a !ping command??

still sky
gritty lintel
still sky
#

Depends on library
Mb library guide have it?

gritty lintel
still sky
#

What language?

cinder patio
gritty lintel
stiff lynx
#

I'm trying all the things that I have online

still sky
gritty lintel
cinder patio
#

I feel bad for you so I'm just going to give you this:

const array = await novabase.profilemodels.find().sort({bank: -1 }).toArray();
for (let i=0; i < 10; i++) {
  // i is your index
  // array[i] is your object
}
#

and if it doesn't work don't just say it doesn't work, give us the error you're getting

cinder patio
#

@stiff lynx

cinder patio
#

Most likely, haven't tested it

stiff lynx
#

index Is the id? or what

cinder patio
#

index is the current index of the array

#

like

#

0, 1, 2, 3, 4, 5, 6 and so on until 9

stiff lynx
#

yes I know

cinder patio
#

do i + 1 to get the actual rank of the user

stiff lynx
#

but my question Is how I output the leaderbord

#

with another for?

cinder patio
#

Well what do you store in novabase.profilemodels.? How's the object structured? You definitely do not need another for loop

gritty lintel
#

sorry i need a direct answer

sage bobcat
#

One message removed from a suspended account.

gritty lintel
#

can i know how u made ping pong command @earnest phoenix

scenic kelp
#

wdym return the letter

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

cinder patio
#
message.channel.send(`Rank ${i + 1}: ${array[i]})` 

COULD be good enough but it depends on what array[i] is

sage bobcat
#

One message removed from a suspended account.

gritty lintel
scenic kelp
#

does linq have a count function

#

probably does

sage bobcat
#

One message removed from a suspended account.

gritty lintel
#

okay

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

gritty lintel
sage bobcat
scenic kelp
#

it is yes

#

but linq is cool

sage bobcat
#

One message removed from a suspended account.

scenic kelp
#

linq just implements methods like you have in js

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

gritty lintel
#

how can i create a prefix for bot??

sage bobcat
#

One message removed from a suspended account.

scenic kelp
#

split the character?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

gritty lintel
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

scenic kelp
#

yes there is

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

eternal osprey
#

hey

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

eternal osprey
#

can someone tell me why my unicode emojis keep getting changed in my vps

pale vessel
#

What do you mean

sage bobcat
#

One message removed from a suspended account.

eternal osprey
#

so i inserted the unicode of this emoji: 💀

#

in the vps

#

but it keeps giving me emoji errors. When i searched the function in the code running on my vps, i saw that all unicodes were turned into ??

pale vessel
#

That's just because your console has limited unicode support

eternal osprey
#

how would i fix it?

pale vessel
#

There's nothing to fix

eternal osprey
#

well there is

#

as it throws me unknown emoji errors

#
Emojipedia

Emoji Meaning A whitish-gray, cartoon-styled human skull with large, black eye sockets. Commonly expresses figurative death, e.g., dying from extreme laughter, frustration, or…

#

i copied it from this site

scenic kelp
#

@sage bobcat this is what i threw together real quickly

Console.Write("Enter a string: ");
string input = Console.ReadLine();
Dictionary<char, int> counts = new Dictionary<char, int>();

foreach (char i in input) {
  if (!counts.ContainsKey(i)) {
    counts[i] = 1;
  } else {
    counts[i] += 1;
  }
}

foreach (KeyValuePair<char, int> kvp in counts) {
  Console.WriteLine($"{kvp.Key}: {kvp.Value}");
}```
sage bobcat
#

One message removed from a suspended account.

scenic kelp
#

so you can store what each character's count is

#

otherwise you can just store a character or a count

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

scenic kelp
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

clear harbor
#

I have created webhooks. It works. But how do I make a vote required command?

sage bobcat
#

One message removed from a suspended account.

scenic kelp
#

also the dotnet-script tool is awesome cause i can just do it all in vscode 😎

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

scenic kelp
#

csx is the technical scripting language extension i believe

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

scenic kelp
#

you could ig

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

scenic kelp
#

nothing with the tool i'm using

#

i'm sure i could name it .js and it'd still compile fine

sage bobcat
#

One message removed from a suspended account.

scenic kelp
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

scenic kelp
#

nah it's an external tool

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

scenic kelp
#

yeah ik

#

dotnet tool install -g dotnet-script

solemn latch
#

Fake name parm is his real name

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

scenic kelp
#

nah

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

scenic kelp
#

any builds i just do in vs

sage bobcat
#

One message removed from a suspended account.

eternal osprey
#

how do i escape a unicode?

clear harbor
#

Where can I find out about custom events?

umbral zealot
#

what do you mean by "escape a unicode"

#

you don't... need to? unicode is just characters.

eternal osprey
#

so instead of an emoji

#

i get a unicode string

umbral zealot
#

backspace

#

\:poop: for example

eternal osprey
#

\💀

#

aha

#

but i actually tried this on my vps already

umbral zealot
granite hornet
#

@ocean wave

eternal osprey
#

but it still turned them into ??

granite hornet
#

can i find uptime bot?

umbral zealot
#

if you get ?? with unicode it means whatever you're looking at doesn't support that unicode range

solemn latch
eternal osprey
#

hmm really? i was just trying to fetch this emoji: 💀

umbral zealot
#

right

#

the problem isn't the emoji, you got that one

eternal osprey
#

yeah i know

umbral zealot
#

the problem is your VPS, what you're using to look at the vps, doesn't show it

umbral zealot
# clear harbor

I got absolutely no idea what that is or what that refers to

eternal osprey
#

owh so it is there, it just doesn't show. Strange. I can bet that it still gave me unknown emoji issues

umbral zealot
#

yeh

earnest phoenix
#

what is normal ram usage for a bot with 2k guilds?

umbral zealot
#

There's no "normal usage"

clear harbor
umbral zealot
#

usage depends on what your bot does

umbral zealot
#

Otherwise a webhook is literally just an HTTP POST query to a specific URL

#

the words "custom event" don't have any meaning in webhooks.

clear harbor
#

I'm trying to make a voting command on my top.gg bot.

umbral zealot
#

uhm you can't programatically vote with a bot

sage bobcat
#

One message removed from a suspended account.

umbral zealot
clear harbor
umbral zealot
#

I mean you could technically create that process.on and then just call it with process.emit('emergency') actualy

earnest phoenix
#

Is it possible to make a npm package which modifies internal function of another npm package

umbral zealot
#

ok

Google translates my translation sentences nonsense.
is such an irony because it's literally a nonsense sentence. LOL

clear harbor
#

It would be better if I tried to do it myself.

umbral zealot
umbral zealot
clear harbor
earnest phoenix
umbral zealot
#

like what problem are you trying to solve

earnest phoenix
#

You know dbd.js?
I want to modify the parser so you can add support for selfmade functions

eternal osprey
#

hey @umbral zealot

clear harbor
eternal osprey
#
2|index  |     at RequestHandler.execute (/root/Miniboss5/node_modules/discord.j                                                                                                                               s/src/rest/RequestHandler.js:170:25)
2|index  |     at processTicksAndRejections (node:internal/process/task_queues:9                                                                                                                               4:5) {
2|index  |   method: 'put',
2|index  |   path: '/channels/836632001989705778/messages/836632002509013054/rea                                                                                                                               ctions/%3F%3F/@me',
``` if the emoji's are there, why is it still returning an error?
soft glade
#

for some reason its still not sending the joining user the message do i need to import anything?

umbral zealot
plucky raft
#

how can I make my bot 7/24 online

#

or glitch bot

umbral zealot
earnest phoenix
umbral zealot
earnest phoenix
plucky raft
#

I am looking for free

umbral zealot
# earnest phoenix do i have to delete require.cache?

no not at all. you'd have to import and then either modify or extend the code. It's probably easier to actually branch their source code and modify it directly rather than importing it and trying to modify it after the fact.

umbral zealot
earnest phoenix
eternal osprey
umbral zealot
#

indeed it's definitely a give and take

#

no win-win situation here

eternal osprey
#

i heard that google cloud offers free 100$ hosting tho

umbral zealot
#

even if you somehow extend dbd, you'd have to update anyway because... well... their code changed either way

earnest phoenix
#

it looks likethis

#

i will find a solution

cinder patio
#

better to write your own parser

eternal osprey
#

okay guys i am still cornered with my emoji problem

#

\❌

#

i tried copying this unicode character to my vps, still gives me ?? characters instead

#

my client returns me: DiscordAPIError: Unknown Emoji 2|index | at RequestHandler.execute (/root/Miniboss5/node_modules/discord.j s/src/rest/RequestHandler.js:170:25) 2|index | at processTicksAndRejections (node:internal/process/task_queues:9 4:5) { 2|index | method: 'put', 2|index | path: '/channels/836632001989705778/messages/836632002509013054/rea ctions/%3F%3F/@me',

vivid fulcrum
#

what are you editing the file with

eternal osprey
green kestrel
#

https://www.youtube.com/watch?v=Aqk7x_w1H98
just gonna leave some codin' music here for you all

Mick Gordon - The Only Thing They Fear Is You ( DOOM Eternal OST High Quality 2020)

#doometernal #doom #RazeHell

Here is My DOOM Eternal OST Playlist : https://www.youtube.com/watch?v=Bew_XUdU7dQ&list=PLNqTTJ3Zn5gmeOnWBUGrAcNtCic5rJEnc

SUBSCRIBE TO MY CHANEL
:https://www.youtube.com/channel/UCPqO1T-5tALJ7u5SRo_vnpQ

Donate to the Channel Via...

▶ Play video
eternal osprey
#

i remembered once that i had this issue, someone told me that i had to escape the emoji and return it as a /s22js9 or something

vivid fulcrum
#

you need to save as utf8

dusky sundial
#

Red cross would be something like \u274C

green kestrel
#

emoji endpoint takes either emojiname:id or the unicode, e.g. \😄

#

url encoded unicode

eternal osprey
safe raven
#

Is the webhook only working, if your bot is approved?

green kestrel
#

i copy and paste them from an emoji table on the web

dusky sundial
eternal osprey
#

will do that too, thank you!

green kestrel
#

@safe raven i think so yes

green kestrel
#

but the test option will still work

#

iirc

#

as the test is done from your browser isnt it

dusky sundial
#

yeah, pretty sure it is

eternal osprey
#

or the css number

#

this chart is confusing the hell out of me

dusky sundial
#

You can just take the unicode number and remove the +

#

and lowercase the u

eternal osprey
#

and add a \

dusky sundial
#

correct

eternal osprey
#

so: \u1F480

#

oaky thanks

dusky sundial
#

mhm

earnest phoenix
eternal osprey
#

okay guys

mystic gate
#

Okay

eternal osprey
#
3|index  |     at RequestHandler.execute (/root/Miniboss10/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
3|index  |     at processTicksAndRejections (node:internal/process/task_queues:94:5) {
3|index  |   method: 'put',
3|index  |   path: '/channels/836639007118589972/messages/836639007525306369/reactions/%E1%BD%880/@me',
3|index  |   code: 10014,
3|index  |   httpStatus: 400
#

how

#

i am using utf8 characters

mystic gate
#

What.....

sudden geyser
#

you tried to use do something with an emoji that didn't exist

mystic gate
#

Dumb it down for me

eternal osprey
#

i didn't

sudden geyser
#

doubt

eternal osprey
#

i used 💀 and ❌

#

but i changed them to utf8 characters

mystic gate
sudden geyser
#

those aren't custom emojis

eternal osprey
#

i know

earnest phoenix
#

why cant you just type \:emoji: on discord and copy the character

eternal osprey
#

but i had problems on my vps

#

it would turn them into ??

#

and still would get the same problem

earnest phoenix
#

um

#

the ?? is only a visual problem

eternal osprey
#

and someone told me to use utf8 characters

eternal osprey
#

really strange

earnest phoenix
#

and how tf are you coding on a vps those are for hosting you use a text editor for writing code

eternal osprey
earnest phoenix
#

i did

#

which utf8 code are you using

eternal osprey
#

the one with U+2592

#

And removed the + and added a \

#

so for example: \u2492

earnest phoenix
earnest phoenix
eternal osprey
#

okay i changed it back to unicode, still the same issue

earnest phoenix
eternal osprey
#

arthur please fuck off with your emojis

earnest phoenix
#

Ok

earnest phoenix
#

it's not an emoji lol

#

i tried console logging it and it outputs 11

mystic gate
earnest phoenix
#

i dont know python but there is something absolutely wrong with that code

sudden geyser
#

You'd probably need to parse the message to see if a command was run.

earnest phoenix
#

ok

dusky sundial
#

Just do what you already did. Check if the message starts with !userinfo and if it does, just await client.process_commands(message) instead of sending anything

eternal osprey
#

hey spaxter, do you know the utf8 sequence of 💀?

#

google returns me \u1F480

#

but that is not valid

sudden geyser
#

You wouldn't need to process the command either since both the command is run and the on_message event is triggered I believe

dusky sundial
#

So what are you asking for then? Cuz that's how I read your question

earnest phoenix
#

I have a name conflict in my ts project: an interface named Interaction which defines the structure of the payload from the API and an Interaction class for you to do stuff with the interaction

what should i rename them to?

dusky sundial
pale vessel
#

Rename the interface to IInteraction

vivid fulcrum
#

suffix your model interfaces (aka the ones that define the structure) with Model

eternal osprey
dusky sundial
#

Isn't that what your code already does?

eternal osprey
#

i tried console.logging it with some test bot here

#

it returned some strange characters

lavish bramble
#

if(msg.content === '$guild') {
  	const ownerr = client.users.cache.get("769077060944658452")
  	const { MessageEmbed } = require('discord.js')
  	const guild = client.guilds.cache
    .addField("Servers Name :- ", guild.name)

Itz giving me undefined

eternal osprey
vivid fulcrum
#

what the fuck is that code

pale vessel
#

collection.addField()

dusky sundial
#

You can try if message == client.user.mention instead

sudden geyser
#

@earnest phoenix one solution would be to listen to the on_command_error event and see if the exception was a CommandNotFound exception. If it was, you can run your hook to see if it mentioned the bot. This would be suitable if you don't want your bot being mentioned in any command to count.

earnest phoenix
lavish bramble
earnest phoenix
earnest phoenix
sudden geyser
#

InteractionModel looks and sounds 100% better

vivid fulcrum
#

^

sudden geyser
#

plus APIInterface has two Is next to each other which looks weird

vivid fulcrum
#

plus, the model suffix is self-explanatory

#

you read it and you understand that it's a model

earnest phoenix
#

k

opal plank
eternal osprey
#

hey, so is there any way to fetch a messageid that was sent in another channel?

opal plank
#

but yes

#

you need to know its channelId before you can fetch, as long as you have that, you good to go

eternal osprey
#

yeah i tried fetching the message but it of course gave me a message unknown error

#

as it was sent from another channel

opal plank
#

like i said, you need to fetch FROM the channel its inherited from

eternal osprey
#

i know

opal plank
#

then?

eternal osprey
#

i just said that i tried it

opal plank
#

you said it was SENT from another channel

#

you didnt say you fetched it from that channel

opal plank
#

what code you got?

eternal osprey
#

wahahha yeah i meant to say that i tried it before but it didn't work as i was using the wrong method apparently

opal plank
#

guildMemberAdd is just when new users join

lavish bramble
#

Oki

opal plank
#

not when a bot joins aserver

opal plank
#

should be as simple as ```ts
/The channel the message originated from/ <channel>.messages.fetch('id');

#

if its d.js should be that

#

or pérhaps it uses an object

#
/*The channel the message originated from*/ <channel>.messages.fetch({ids: ['id']});
#

fetch() on a string should work

lavish bramble
#

Hey I want to do
If I type $guild
Then my bot will send all guilds name in embed

opal plank
#

then do it

#

just .map() from all guilds

compact briar
#

is there a way to utilize roles.add from a variable if collected from the users previous roles?

for example

let oldroles = member.roles.cache.map(r => `${r}`).join('\n').replace('@everyone', "")```

will return whatever roles are there

i then remove the `oldroles` from the member and then i can replace <@& and >  to just get the role id out of it but it when trying to add `oldroles` back later with or without the <@&>, it gives me an error stating supplied role is not a role
#

i want to do this with multiple roles. i know if i remove the \n it works with one, however i would need it for more than one role at a time

earnest phoenix
#

Instead of manipulating a string to get the roles IDs, save their IDs by using <Collection>.keyArray() on <GuildMember>.roles.cache in a variable and then do whatever, and after that, just pass the variable to <GuildMember>.roles.add()

#
// Save member's role IDs
const oldRoles = <GuildMember>.roles.cache.filter(role => role.id !== <GuildMember>.guild.id).keyArray();

// Remove the old roles from the member
await <GuildMember>.roles.set([]);

// Do whatever here
...

// Add old roles back
await <GuildMember>.roles.add(oldRoles);```
cinder patio
#

might be faster to first turn it into an array and then filter if only the id is used in the filter function

earnest phoenix
#

why do i keep posting my token to my github repo

#

Then just don't 4Head

lavish bramble
lavish bramble
#

Means?

earnest phoenix
#

discord doesnt allow you to expose info about the guilds a user is in

#

not sure if that works for bots

#

In a short term

#

"Breach of privacy"

cinder patio
#

I don't think just listing guild names is a exactly a breach of privacy, it is a little intrusive and you should definitely let your users know

#

but just having the name of the guild doesn't mean much

earnest phoenix
#

!support will invite him to the server with admin perms

cinder patio
#

just for listing all the names of all guilds it's in?

#

The command should be owner only ofc

drifting wedge
#

well owner only ur good

earnest phoenix
cinder patio
#

you think it shouldn't?

earnest phoenix
#

nobody should do that

#

Are you sure they got banned from Discord for that

cinder patio
#

names only is ok

earnest phoenix
#

ok can someone tell me now how i could make ```py
global trophy
with open('trophy.json') as f:
trophy = json.load(f)

#

put your computer on a school globe

sudden geyser
earnest phoenix
#

wtf is trophy.json

#

oh god dont tell me you're using a json database

umbral zealot
#

clearly

earnest phoenix
#

good boy

#

not that

#

have a hug

crimson vapor
#

I use a json database

sudden geyser
#

I believe the code would be run for each time the file is imported from other files (aka import somefile).

crimson vapor
#

dw, I don't

earnest phoenix
#

add

#

another py file

#

import it

pale vessel
#

Oof

eternal osprey
#

hey

earnest phoenix
#

lol

eternal osprey
#

so i have a txt file with a username and 1 simple number after the name: js if(subcommand === 'levels'){ const leveling = fs .readFileSync("./levels.txt", "utf8") const embed = new Discord.MessageEmbed() .setColor("RANDOM") .setDescription(`Name: Level: \n${leveling}`) message.channel.send(embed) }how would i put a @in front of each users name?

umbral zealot
#

oh god not this again

earnest phoenix
#

so do i create

vivid fulcrum
#

stop using a text file as your db

earnest phoenix
pale vessel
#

Again haha

umbral zealot
#

jesus christ Awsome

#

not again

#

why

vivid fulcrum
#

awesome, this is not awesome

umbral zealot
#

why

earnest phoenix
umbral zealot
#

kek

pale vessel
#

Looks like you might have to change that "some" to "ful"

eternal osprey
#

i am not using this for any type of leveling system. These are constants.

#

not variables

#

the file doesn't change

cinder patio
#

then you could use json

umbral zealot
#

Then why would you store usernames?

#

that doesn't make any sense

pale vessel
#

or why do you have the need to manipulate them?

umbral zealot
#

and if you're storing usernames that are static why would you not just make them mentions?

pale vessel
#

They're constants

eternal osprey
#

because i want to make a register of my pokemons and their level, just manually put into the file.

umbral zealot
#

pokemon... waitWhat

#

ok then make a JSON file

#

and use objects

#

that would be much better

eternal osprey
#

sure

earnest phoenix
#
#globals.py

import json
import os


global trophy
with open('trophy.json') as f:
    trophy = json.load(f)
umbral zealot
#

But how is this levels.txt but it's about pokemon and you want to mention people with their username? that's like so damn confusing

earnest phoenix
#
#main.py

import globals
#

then what

#

@sudden geyser

cinder patio
#

I will admit, that level of commitment is admirable

umbral zealot
#

I dunno, have I ever told you the definition of insanity?

earnest phoenix
umbral zealot
#

imagine thinking pokemon are usernames that need to be mentioned with an @

eternal osprey
#

no no i am not dumb

#

well maybe i am

umbral zealot
#

Are you SURE?

earnest phoenix
eternal osprey
#

but i just got confused myself and made a typo

earnest phoenix
#

someone help me

earnest phoenix
eternal osprey
umbral zealot
#

Settle down, kids.

eternal osprey
#

no one is going to help you with that attitude.

earnest phoenix
umbral zealot
# earnest phoenix someone help me

I don't know specifically about python, but in general, making something global is a horrible thing to do. What you should be doing is importing the data from anywhere you specifically need it, not making it global.

earnest phoenix
#

lol

sudden geyser
#

global is not that bad

umbral zealot
#

Probably, yeah

eternal osprey
#

evie, is there a way to create a channel directly into a category?

#

instead of first fetching the channels

pale vessel
#

Provide parentID in the options

earnest phoenix
#

hi

umbral zealot
earnest phoenix
#

hi server auntie

vale garden
#

hi

#

has anyone verified a bot before

#

im doing this for the first time

#

its been saying this for the past 20 mins

#

is that normal

cinder patio
#

oop

vale garden
#

kk

drifting wedge
#

@vale garden how old r u?

#

u need to be 16+

lyric mountain
#

better sit down if you're going to watch it till it completes

cinder patio
#

I need to run a command inside an npm script in another directory

ex.

  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "enter another directory and run a command && node ."
  },
shadow compass
#

is this the right command to ping someone when they type "ping"

#

because there is an error in the terminal

earnest phoenix
#

Lol

lyric mountain
shadow compass
#

yes i did

lyric mountain
#

that's bad, don't do it again

#

show full file

#

you probably didn't define client

shadow compass
#

effortlessly covered up the bot token

quartz kindle
#

your client is called bot

sonic basin
#

bot.ready

quartz kindle
#

client is whatever name you assign Discord.Client to

sonic basin
#

ohh sorry no bot.on('ready', () => {

}

shadow compass
#

who do i listen to

quartz kindle
#

whatever name you chose, thats the name you have to use everywhere

#

you did bot = Discord.Client

#

so bot is your client

#

use bot everywhere

sonic basin
#

and also you covered the token really bad, I can still read it

shadow compass
#

@quartz kindle what do i write then

quartz kindle
#

i just told you

solemn wedge
#

change client to bot
bot.on('ready')...........
instead of client.on('ready')

shadow compass
#

is that better

sonic basin
#

and also 'member.user.roles' so the bot says 'member.user.roles' but i think you want to say for example owner, moderator

quartz kindle
#

i said everywhere

sonic basin
quartz kindle
#

you still have a client there

shadow compass
#

now is it good

quartz kindle
#

yes

sonic basin
#

working, but as i said

#

and also 'member.user.roles' so the bot says 'member.user.roles' but i think you want to say for example owner, moderator

shadow compass
#

i want it to ping the user

sonic basin
#

well then

lyric mountain
#

you're new to JS aren't u?

shadow compass
lyric mountain
#

pro tip: halt bot development and practice common programming

shadow compass
#

okay, but ill finish this first

lyric mountain
#

bot devving isn't a newbie-friendly task

shadow compass
#

just a simple bot i want to make

lyric mountain
#

it's like medium-hard project

shadow compass
#

someone types "ping" the bot pings that user

#

thats what i want it to do

sonic basin
#

message.channel.send(message.author.username);

shadow compass
#

now it is saying this

#

how do i define the client

lyric mountain
#

save the file

shadow compass
#

ok

sonic basin
#

if you saved then restart bot

#

node .

shadow compass
#

lets see

sonic basin
#

message.channel.send(message.author.username); this one says the username of the user

shadow compass
#

doesnt work

sonic basin
ebon heart
#

u can ping me for help with coding

sonic basin
#

CHANGE WHAT I SAID please

sonic basin
#

message.channel.send(message.author.username);

shadow compass
#

now it just says my username

ebon heart
#

it’s message.channel.send(“member.user.roles”);

sonic basin
#

this one displays the username. you can ping but I recommend you message.reply

sonic basin
shadow compass
#

how do i make it an actual ping

ebon heart
#

I can do that

shadow compass
#

can you help me

ebon heart
#

like show ur bot ping(

#

?

#

OHH

#

I see what he wants to do

#

i know it was a mistake lol

#

I didnt know what he wanted

sonic basin
#

well try this one message.channel.send(message.author.String())

#

is it working?

#

he just wants a mention

ebon heart
#

lol I can

#

help with that

solemn wedge
#

message.channel.send("<@"+message.author.id+">")

shadow compass
#

who the hell do i listen to

ebon heart
#

bruh

sonic basin
#

ok dm me i help you

ebon heart
#

author.username

sonic basin
shadow compass
#

just what should this turn into

ebon heart
#

message.channel.send("<@"+message.author.username">");

sonic basin
#

it's good now

#

try this

ebon heart
#

bruh no

#

he wants ping

#

not if

#

Id*

#

Ik

#

lol

#

T_T

sonic basin
ebon heart
#

bruh

shadow compass
sonic basin
#

@shadow compass does it work?

ebon heart
sonic basin
#

no it's not the best method but mine works

shadow compass
#

now the bot doesnt even go online

sonic basin
shadow compass
umbral zealot
#

what... is that .on attached to?

shadow compass
umbral zealot
#

... bot.on

#

the event has to be attached to something

sonic basin
#

just type in bot.on

umbral zealot
#

learnjs moment

solemn wedge
# shadow compass
bot.on("message", message => {
  if (message.content === "ping"){
    message.channel.send("<@"+message.author.id+">");
  }
}
shadow compass
umbral zealot
#

that does not correspond to your code

sonic basin
cinder patio
#

yours doesn't work either :/ it's .toString()

shadow compass
umbral zealot
#

but... you do'nt need either

sonic basin
#

ok then toString

umbral zealot
#

that cod eshould be fine

sonic basin
#

no.

umbral zealot
#

maybe just add spaces

sonic basin
cinder patio
#

Evie's right

umbral zealot
#

message.channel.send("<@" + message.author.id + ">");

#

try that

lyric mountain
#

<@${message.author.id}>

sonic basin
#

@350836145921327115

#

no it can't work 😄

cinder patio
#
`${message.author}`
```. The template literals are needed
umbral zealot
#

I mean yeah you can use it

#

but the concatenation is ok

shadow compass
umbral zealot
#

especially when you know nothing of javascript and you're just starting

sonic basin
#

then?

cinder patio
#

For some reason

send(`${message.author}`) => Mention
send(message.author) => User#tag
sonic basin
#

ohh yeah then it's a working code

umbral zealot
#

with spaces

shadow compass
#

is there a way to just automatically ping every minute or something

lyric mountain
#

no don't

umbral zealot
#

you should not ping people on a loop

shadow compass
#

thats what the person who wanted me to make this bot wanted

sonic basin
#

is this and

shadow compass
#

if that makes sense

lyric mountain
umbral zealot
sonic basin
#

and this works?