#development

1 messages · Page 1380 of 1

pure lion
#

well guys we did it

pale vessel
#

we reached a quater of a million subscribers, 250,000 subscribers

pure lion
#

we reached a quater of a million brain cells, 250,000 brain cells

pale vessel
#

what did you do lol

pure lion
#

take an hour to realise git commit

shy turret
#

after i use .fetch(), would it save on cache?

pure lion
#

cryig

pale vessel
#

yes

shy turret
#

nope

#

just tested it

pure lion
#

fla-

pale vessel
#

it should unless you explicitly say no in the options

shy turret
#

ok

#
const client = new Discord.Client({
  messageCacheLifetime: 300,
  messageSweepInterval: 600,
});

would this... get rid of member cache?

pale vessel
#

no

#

that has nothing to do with member cache

shy turret
#

ik

pale vessel
#

how do you know it didn't cache? what was your code?

shy turret
#

but like wtf i need to see why this isnt workin

#

ik it didnt cache because

          let result2 = (await manager.broadcastEval(`this.guilds.cache.get('${guild.id}').fetch('${userinfo.id}');`));
          if (result2[0] !== undefined) {
            let result3 = (await manager.broadcastEval(`this.guilds.cache.get('${guild.id}').members.cache.get('${userinfo.id}').hasPermission("ADMINISTRATOR");`));
#

(sharding)

pale vessel
#

you're doing guild.fetch() instead of guild.members.fetch()

shy turret
#

bruh

small prairie
#

someone from my team has been compromised ;-; sad
i am legit resetting the token every minute to make sure nothing bad happens

shy turret
#

i hate discord's new bot verification

small prairie
#

the owner isnt even active right now

honest perch
#

someone from my team has been compromised ;-; sad
i am legit resetting the token every minute to make sure nothing bad happens
@small prairie and thats why we use 2fa

shy turret
#

(node:12280) UnhandledPromiseRejectionWarning: TypeError: Error when sending eval response to master process: Cannot read property 'replace' of undefined epic ok one time erro rwtf

small prairie
#

i aint the owner i dont even know who got comprised and IF somone get compromised
it could be a real person doing that

#

i mean our team member

earnest phoenix
#

I still need to set up sharding but I have no idea how to get started any suggestions? I'm using discord.py

eternal osprey
#
if(message.content === "!invites"){
    const userInvites = message.mentions.members.first()

    message.guild.fetchInvites()
    .then

    (invites =>
        {
            const userInvites = invites.array().filter(o => o.inviter.id === user.id);
            var userInviteCount = 0;
            for(var i=0; i < userInvites.length; i++)
            {
                var invite = userInvites[i];
                userInviteCount += invite['uses'];
            }
                 message.reply(`You have ${userInviteCount} invites.`);
        }
    )
}
#

why is my code not working once i use !invites "@" member

earnest phoenix
#

lol ping

#

Shard question ping

eternal osprey
#

for fuck sake

earnest phoenix
#

haha

sudden geyser
#

@eternal osprey it's your code. You should be able to tell us what isn't working about it

#

are you getting an error, or is it doing nothing

earnest phoenix
#

How does sharding even work though

eternal osprey
#

well it should check the invites of the member you are mentioning

#

and it is not responding at all

earnest phoenix
#

How does sharding even work though
@earnest phoenix google

#

yes good

#

I've already googled "Discord.py Sharding" i've read most of it but it hasn't really helped explain it to me

#

google "sharding" itself

sudden geyser
#

Just from the code block, may it have to do with your syntax (like why you have (invites => {...})) separate from .then?

#

Auric that's very vague.

earnest phoenix
#

So we need to shard a database?

#

no

#

the servers get sharded

#

I thought this was totally different that's great then

#

how many servers is your bot in

#

Never mind

#

200ish

#

u don't really need to shard

#

but I want to get it out the way

#

do what u want tho

solemn latch
#

it increases resource usage to shard

earnest phoenix
#

Auric that's very vague.
@sudden geyser idk any better way to explain

#

I don't even know how to start it though

#

Like my amount of confusion is unexplainable

#

i use discord.js so i wouldn't know discord.py sharding

#

I know that's why it's so confusing for me

#

Most good sources are for a different language

#

and the sources I can find with google are just confusing

#

idk if that helps

#

Yeah I looked at it the documentation was the first place I checked but it didn't make much sense sadly

#

wdym by "it's didn't make sense"

#

Just hope someone can point me in a good direction or explain it better lol

#

are u able to implement it or not?

#

I don't understand it

#

Like it's beyond my understanding

#

Lite, can u explain?

#

I know I'm probably being annoying and stupid

#

nah lite will explain or something

pale vessel
#

lol don't you just need to change it to AutoShardedBot

#

it does everything else for you

earnest phoenix
#

he doesn't understand it that's all

#

what

#

I don't know what "it" is

#

That's the problem

#

sharding

solemn latch
#

sharding is the process of seperating your bot into separate processes or "shards"

earnest phoenix
#

I know kind of what database sharding is

solemn latch
#

discord only lets one connection be responsible for 2500 guilds

#

so sharding is the way to have multiple connections for more than that

earnest phoenix
#

Ok

#

So do I need to open ports

sudden geyser
#

You asked how sharding works (first message I saw). You can find some good responses by searching, like Tim's answer:

a shard is a connection to discord. they only allow each connection to have 2500 guilds, so if your bot has more guilds than that, it needs to start "sharding", which means splitting itself into multiple connections, each handling a specific number of guilds

And the documentation is useful. See the longer detailed info on sharding here: https://discordpy.readthedocs.io/en/latest/api.html#discord.AutoShardedClient

The difference between this line and what Auric sent you is this one is the base class.

earnest phoenix
#

So do I need to open ports
@earnest phoenix no

#

So this becomes my client?

pale vessel
#

yes

earnest phoenix
#

OOOOOOOOOOOOOOOOOOOH

pale vessel
#

AutoShardedClient

earnest phoenix
#

I'm a complete dumbass

pale vessel
#

same

earnest phoenix
#

Thanks you guys you were really helpful

#

i waffled so it's fine

solemn latch
#

mm waffles

earnest phoenix
#

I know Auric but Lite and Flaze really helped me a lot

haughty bough
#
    at JSON.parse (<anonymous>)
    at AsyncFunction.main.getFilters (C:\Users\---\Downloads\---\chika-bot\node_modules\ytsr\lib\main.js:76:23)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)```
#

I installed ytsr recently and when I try to run the code this error appears. Can someone help me?

short siren
#

Show the code

haughty bough
pale vessel
#

@haughty bough it's ytsr problem

haughty bough
#

Is there any way to fix it?

sudden geyser
#

It's probably trying to parse HTML as JSON.

#

Since it comes from a library, you should see if anyone else is complaining about it on the GitHub repository issues tab.

pale vessel
#

i have the same problem

#

there's also someone else here that faced the same issue

haughty bough
#

Sad :c

tulip ledge
#

is there a way to check if a certain user is in a discord call?

#

I wanna make a bot that kicks my friend at random times

pale vessel
#

nope

sudden geyser
#

If the call is taking place in the server (voice channels), you could.

pure lion
#

I wanna make a bot that kicks my friend at random times
Check if the message.member.voice.channel.members (map) includes your friend

#

Assuming js

tulip ledge
#
async function kickThibo(client) {
  let randomTime = Math.floor(Math.random() * 10) + 5;
  await wait(randomTime);
  let thibo = client.users.cache.get("610465200876814338")
  if(thibo.member.voice.channel) {
    thibo.member.voice.kick();
  }
  await wait(5000)
  if(thibo.member.voice.channel) {
    thibo.member.voice.kick();
  }
  kickThibo(client)
}

This doesnt work "voice" of undefined

earnest phoenix
#

you're trying to read a member property from a user.

tulip ledge
#

thibo.member

earnest phoenix
#

no shit didn't see that.

pale vessel
#

mihz, read. it says thibo.member /s

#

what are you doing anyway

#

what member?

#

what guild?

#

how can a user be inside a VC

earnest phoenix
#

since when does a user have a member property.

pale vessel
#

never ever been

earnest phoenix
#

exactly.

tulip ledge
#

how would I do it then

pale vessel
#

get a guild first

#

it's unclear what you're trying to do

tulip ledge
#

Tryna kick my friend at random times out of the voice channel

pale vessel
#

are you DCing the bot at random times-

#

oh

#

get the guild first

#

the guild your friend is in

earnest phoenix
#

then the member - then the voice state.

tulip ledge
#
async function kickThibo(client) {
  let guild = client.guilds.cache.get("538460586564911119")
  let randomTime = Math.floor(Math.random() * 200) + 100;
  await wait(randomTime);
  let thibo = guild.members.cache.get("610465200876814338")
  if(thibo.voice.channel) {
    thibo.voice.kick();
  }
  await wait(5000)
  if(thibo.voice.channel) {
    thibo.voice.kick();
  }
  kickThibo(client)
}

For some reason he basically gets kicked every second

#
function wait(time) {
  return new Promise((res) => {
    setTimeout(res, time, true);
  });
}
#

I can't find the mistake tho ;-;

pale vessel
#

what is that true

#

i don't think it does anything but why did you put it there

tulip ledge
#

i didnt

#

I yoinked it from my friend haha

pale vessel
#

well it gives true to the function but that does nothing

cosmic forum
blissful coral
#

lol

#

wait

#

im lazy

#

someone link me to sharex

thin turret
earnest phoenix
#

Hmm, i think that could be just

async function kickThibo(client) {
let guild = client.guilds.cache.get("538460586564911119"), randomTime = Math.floor(Math.random() * 200) + 100;
return new Promise(r => setTimeout(() => {
let thibo = guild.members.cache.get("610465200876814338");
return r(thibo.voice.channel ? thibo.voice.kick() : null),
 kickThibo(client);
}, randomTime));
}``` @tulip ledge
cosmic forum
blissful coral
#

thx

sudden geyser
#

@cosmic forum it's simple (which I like), but it feels like an empty void wanting to be filled. Maybe you could make the Upload an image button stand out more, like making it take up more of the frame?

I'd also suggest pinning the copyright to the bottom of the screen.

cosmic forum
#

@cosmic forum it's simple (which I like), but it feels like an empty void wanting to be filled. Maybe you could make the Upload an image button stand out more, like making it take up more of the frame?

I'd also suggest pinning the copyright to the bottom of the screen.
@sudden geyser Ok, thanks for the feedback. I'll try and add all that in!

timber cloak
#

how do i completely remove the dark theme option from my page

#

like if a user has dark theme already enabled, it forces white theme on my page

sudden geyser
#

You'd need to look in the HTML and apply CSS to your page, but why would you want to do that? The user would probably not like that, considering they enabled dark mode to stay away from the light.

earnest phoenix
#

you cant enforce light theme styling lol

#

there'll always be things like dark reader

timber cloak
#

no

#

dark mode removes my page background

pale vessel
#

imagine having no adblock

timber cloak
#

dude]

#

flaze

#

stfu

thin turret
#

Imagine being bothered by small ads

timber cloak
#

^

thin turret
timber cloak
#

fax

solemn latch
#

imagine dragons

pale vessel
#

not even small but okay

timber cloak
#

yea yea thats what i thought

earnest phoenix
#

how am i supposed to select these intents? its greyed out and wont let me click them

thin turret
#

< 10% of screen size

solemn latch
#

is your bot past 100 servers?

earnest phoenix
#

well over that

#

1200 servers

solemn latch
#

you have to request those intents

timber cloak
#

wheeze

earnest phoenix
#

how?

#

i emailed discord 15 days ago and no response

solemn latch
#

well when you originally got verification you where supposed to.

#

if not then yeah you gotta go the long process with their email

earnest phoenix
#

i verified before they were mandatory eyes3

candid moon
#

Türk varmib

solemn latch
#

there should have been a section for what intents you needed even at the early stages afaik

earnest phoenix
#

yeah, i never checked it then

#

didnt know i was supposed to lol

#

@timber cloak it shouldnt remove it if you styled it properly which im guessing you didnt, make your selector for the background flexible

#

but i cant get ahold of anyone to un-fuck it up for me at discord support

timber cloak
#

wym flexible

earnest phoenix
#

adaptable

timber cloak
#
body {
  color: #000000;
  background-image: url("https://cdn.discordapp.com/attachments/609162277312266280/745083199121522748/7356d5738f57e25e662172bc7d38ffe3.png")!important;
  height: 100%;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}```
solemn latch
#

a lot of devs did the same, so they probably have a lot of emails about it

blissful coral
#

!important @timber cloak

earnest phoenix
#

so see what changes when you enable dark mode and select that too @timber cloak lol

#

that too

timber cloak
#

wh a t

#

oh'

#

ok

earnest phoenix
#

lol nevermind

#

thanks to the nature of dbl's website

#

a literal dumpster fire i don't know who made this but it's horrible

pale vessel
#

it works if i add it

#

did you save

timber cloak
#

not yet

pale vessel
#

bruh

timber cloak
#

!important where

pale vessel
#

what

earnest phoenix
#

your css is going to be overriden regardless on dark mode because whoever made this does not know how to use css properly

pale vessel
#

dude

#

wtf

#

thats like a lot of unneeded properties

earnest phoenix
#

nah it's auto set by none !important

#

but

#

whoever wrote that

#

deserves to be fired from dbl

#

lol

pale vessel
#

no like the css itself

#

background- everything

timber cloak
#

bruh

earnest phoenix
#

yes

timber cloak
#

how do i keep my background from changing to black doe

earnest phoenix
#

it's auto set by none !important
firefox just expands it

pale vessel
#

expand dong

earnest phoenix
#

you can't

#

i explained above why

#

i mean you can, with js

#

but you need cert dev for that

#

whoever writes styling for dbl really needs to be fired this is hot garbage

timber cloak
#

it worked

#

i saved my changes

#

now it works

solemn latch
#

LOL

#

feels bad

pale vessel
#

why didnt you do that

earnest phoenix
#

i dont think these people ever heard of css variables

#

LOL

#

tfw when you follow w3schools

pale vessel
#

big brain

solemn latch
#

atleast im not the only one who just does random things to get the css to work

earnest phoenix
#

you can pass lol

#

this is embarassing for dbl

pale vessel
#

they're working on a rewrite

#

god knows when it will be finished

#

but it better be not shit

earnest phoenix
#

watch them mash together random css in hopes it works

solemn latch
#

I'm just excited for doc rework

#

being able to link to subsections pogey

lean wing
#

hello i need help for my project

1 i created a fivem bot and i have a command /players in a embed
and when the players are 34 and more the console send me this error

(node:11080) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
embed.fields[0].value: Must be 1024 or fewer in length.
    at RequestHandler.execute (C:\Users\30699\Desktop\FiveMStats\node_modules\discord.js\src\rest\RequestHandler.js:154:13)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async RequestHandler.push (C:\Users\30699\Desktop\FiveMStats\node_modules\discord.js\src\rest\RequestHandler.js:39:14)
(node:11080) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:11080) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

and my question is how can i filter the first 32 players and send an embed and after tha send an other embed with the other players remaned
can someone help ?

earnest phoenix
#

create an array of strings; do a for loop on your array and keep concatenating your string with the players up until it crosses 1024 chars, once it does, start concatenation on another new empty string

lean wing
#

ok thanks

pale vessel
#

@earnest phoenix read his presence lol

earnest phoenix
#

😬

solemn latch
#

people trying to figure out on their own, a rare person.

pale vessel
#

damn

#

this guy is amazing

solemn latch
#

with how rare it is in here, im practically proud.

earnest phoenix
#
//pseudo
let strings = [""];
let stringArrayIndex = 0;
for(let i = 0; ....)
{
  let player = //index your array here
  let el = strings[stringArrayIndex];
  if(el.length + player.length > 1024)
  {
    //switch the index, create empty string, reassign el
  }
  el += player;
}

this should be the base logic for it, it can be obviously improved i wrote this on the go in discord lol

#

the logic should obviously be adjusted if you want to introduce anymore characters i.e. newlines

lean wing
#

thanks

#

a lot

earnest phoenix
#

how can i delete a reaction from a message?

vast wave
#

How do I change the color of the header on my top.gg bot’s page?

rustic nova
#

inspect element

vast wave
#

Wat

rustic nova
#

get the css selectors

#

and change them how you want

vast wave
#

Ok...

#

how do I do the buttons?

#

I want to make them pills

rustic nova
#

same thing: use inspect element and css

vast wave
#

ah ok

rustic nova
#

you can use css inside your long description by using <style> tags btw

vast wave
#

i tried

#

it only made buttons inside my description

#

idk how

#

or why

rustic nova
#

send what you entered inside the <style> tags

vast wave
#

ok

rustic nova
#

pastebin if it's long

vast wave
#
</style>
</head>
<body>
<h1>Pill Buttons Example</h1>
<button>Button 1</button>
<button>Button 2</button>
<div></div>
<button>Button 3</button>
<button>Button 4</button>
</body>```
#

Is that long?

#

i think I found it but I want to confrim

rustic nova
#

yeah that's not how it works

#

unless you want the buttons inside your long description

vast wave
#

Yeah no

rustic nova
#

explaination about how style tags in html work

vast wave
#

Ok

rustic nova
#

woops wrong one

#

god damnit

timber cloak
#

how do i add a background to longdescription?

rustic nova
#

with css

#

use inspect element to find the css selectors

#

so you can use <style> inside your long description in order to override them

timber cloak
#

when i added it, there was no background

rustic nova
#

did you use the correct selector?

timber cloak
#
.longdescription {
 background: url("https://images.app.goo.gl/2Wefcj6CCJNX9Si29")!important;
}```
#

i tried both background-image and background

rustic nova
#

with a color for example

timber cloak
#

no it didnt change any elements lol

#

is it even possible to put a background image behind the text

rustic nova
#

yeah

timber cloak
#

o

#

o wait

#

i added a linear gradient to background: and it appeared behind the white box

#

like urs

rustic nova
timber cloak
#

o

#

what page is that

#

i think im using the wrong css container

rustic nova
#

the css selector for the element behind the test is called "content"

timber cloak
#

oh ok ty

rustic nova
#
html body section#bot-details-page.page article.wrapper-page div.container.is-widescreen div.container.is-widescreen div.longdescription div.content
#

is where it is

pale vessel
#

wtf

#

don't put everything

rustic nova
timber cloak
#

.longdescription .content {?

rustic nova
#

.longdescription .content

#

yeah

timber cloak
#

ahkk

rustic nova
fierce ether
hollow sedge
#

Don't forget #deletebot

rustic nova
#

#servers will get your bot denied if it lists servers

#

add #sendtoken

hollow sedge
#

Yes

rustic nova
hollow sedge
#

#password seems bad enough though

timber cloak
#

where the hell are these white triangles

blissful coral
#

lulw

#

Use dev tool

fierce ether
#

it dosent display servers displays numbers, and it sends a random generated password

hollow sedge
#

Why would you ever use that command

#

So everyone else can see the password you're generating?

timber cloak
#

wym dev tool

fierce ether
#

no its dmed

blissful coral
#

F12

hollow sedge
#

ohhh

timber cloak
#

dude

fierce ether
#

no console log or anything

hollow sedge
#

Inspect tool

timber cloak
#

not everyone is new to chrome elements

blissful coral
#

??

fierce ether
#

any other commands you think tho?

timber cloak
#

idk man

hollow sedge
#

Ur bot seems pretty random so...kinda hard to tell you anything

rustic nova
#

where the hell are these white triangles
@timber cloak finding the selectors is a pain sometimes

timber cloak
#

fr

#

ive been looking for a while

#

these single 3 triangles are ruining my life

rustic nova
#

i managed to get rid of them when i had my own bot

#

removing the position: relative property in the .atag seems to get rid of it @timber cloak

young flame
#

what bot should i make

rustic nova
young flame
#

hhh

#

i wanna make a music one

#

but i also wanna do a fully mod one

earnest phoenix
#

how do i make a dash board?

young flame
#

uhhh

rustic nova
#

Coding it

young flame
#

code one

earnest phoenix
#

ok

young flame
#

in html and js and c#

earnest phoenix
#

o

young flame
#

or get someone to make one for you

earnest phoenix
#

ah that would be nice XD

rustic nova
#

they will definitely not do it for free though

earnest phoenix
#

yes they would def not

midnight blaze
#

visual code is the best ide right?

timber cloak
#

sure

fair rover
#

I keep getting pinged

young flame
#

ok

#

leave

#

uh

#

make a command

#

but have a timeout

#

so it stops at a specified time

rustic nova
#

I keep getting pinged
@fair rover poor dude, your name is being used in examples

young flame
#

yea

#

anyways

#

mod or music

hollow sedge
#

in html and js and c#
@young flame well you don't need c#

drifting wedge
#

how do i make a dash board?
@earnest phoenix do the same as you would go about downloading ram

#

Or downloading printer ink

rustic nova
#

downloading happiness

#

that site always 404's though

drifting wedge
rustic nova
#

shit thats fucking deep

drifting wedge
earnest phoenix
#

V

young flame
#

downloading happiness
@rustic nova ReferenceError: happiness is not defined

rustic nova
young flame
#

it's always been this way.

cosmic forum
#

it's always been this way.
@young flame oof

digital ibex
#

wut

#

how is it the same lol

#

and @earnest phoenix there r many things to a dashboard (I’m assuming it’s for ur bot)

earnest phoenix
#

it's a joke

digital ibex
#

which part u need help with?

#

my sense of humour is ☠️

earnest phoenix
#

the punchline is they think fullstack development is as easy as opening a car door, so they'd be gullible enough to believe you can download ram

runic flare
#

ok guys

#

my bot is done

earnest phoenix
#

good for you

fast trench
#

who is able to help me with html/css for my bot page? I have no idea where to even start

rustic nova
#

inspect element is the way to go DrakeYes

fast trench
#

F12 right? That should open up the stuff to see it?

earnest phoenix
#

try it and see

rustic nova
#

you can also right-click and press inspect element

fast trench
#

didn't even know that was a thing lol I don't do this stuff ever 😂

#

i have absolutely no idea what I'm looking at when I inspect it...that's why I asked for help...in a development help channel

rustic nova
#

the best thing is to see what elements you would like to change

vast wave
#

How would I inspect my bot’s page?

#

because I tried to do it, it took an hour and it didn’t work 😐

tranquil plinth
#

Hiiiii

vast wave
#

hewo

tranquil plinth
#

Ummm do y’all know how to invite bots to a server on iOS ????

earnest phoenix
#

wrong channel

rustic nova
bleak crypt
#

Its hard to find someone who can help me code api scraping

earnest phoenix
#

what

bleak crypt
#

I need someone who can help me code a bot

earnest phoenix
#

what's the point of scraping an api

#

lol

vast wave
#

Wow. That’s exactly what I’m trying to do

#

but mine doesn’t want to work

#

😐

fast trench
#

That helped so much to find the correct element in the side panel...I'll look for a bit and see what I can think of then ask if I have issues

rustic nova
#

the only tip i could give is to compare the colors. If you mess anything up while testing, you can always just reload the page and it should be back to normal

fast trench
#

i was about to ask if I should test in VSC and a live server in case I royally fuck something up lol

rustic nova
#

nah you can literally test the css inside the actual inspect element. Once you find something you like, you can simply copy the whole class and insert it into the style tags on your long description

fast trench
#

oh so do tests in the inspect then just copy and paste it in the edit page? sorry if I'm confusing everything

#

I've done some minor html and css but this is new ground doing it this way

runic flare
#

ok my bot is online and ready

#

i am finally a bot maker :3

earnest phoenix
#
favouriteOs = input("what's your favourite os?")

if favouriteOs == "ubuntu":
	print("wise choice ![TrollFace](https://cdn.discordapp.com/emojis/766399852396412949.webp?size=128 "TrollFace"))
else:
	print(favouriteOs,"is cool but linux and Ubuntu is best")
#

Would this work

unique nimbus
#

linux and Ubuntu

#

Ubuntu is linux

vast wave
#

I keep inspecting my page but it doesn’t save

earnest phoenix
#

i

rustic nova
#

thats not how it works

earnest phoenix
#

yes

#

that's inspect element

#

if you want to edit the contents

#

there's an edit button

vast wave
#

Ohhhhh

#

dam it. All my work gone to waste

#

¯_(ツ)_/¯

#

Do I have to use the detailed description?

rustic nova
#

yes

#

there's no other way to insert your css

vast wave
#

Ah ok

lucid wharf
#

Who can help me pls?:((((
I am trying to call the variable but via the result name; for example:

${client.emojis.cache.get(ops.giemojis.Keqing)} to ${client.emojis.cache.get(ops.giemojis+`${body[result].name}`)}

But it doesn't detect anything, it gives me the result as 'undefined' ... how could I do it? Thank you

runic flare
#

How I get my bot online?

rustic nova
earnest phoenix
#

...run it?

lucid wharf
#

Q_Q

runic flare
#

Cost money??

vast wave
#

@earnest phoenix @rustic nova tysm

#

I totally get it now

#

this should be ez pz

shy turret
#

new Image() exist on javascript but doesnt on nodejs

#

im trying to check if a file is a valid image (not a gif or apng) but new Image() doesnt work on nodejs so i need an alternative

#

without needing to download a image

earnest phoenix
#

how do you check if a fruit is an apple if you don't have the fruit

shy turret
#

google

#
let img = new Image();
img.src = 'image link';
image.onload = function() {
  console.log('valid');
};
image.onerror = function() {
  console.log('invalid');
};
#

^ would work on js on browsers

#

but not on nodejs

earnest phoenix
#

yes

#

because that's just a html element

#

html does not exist in node

#

setting the src downloads the image

#

lol

shy turret
#

ik but like, it kinda saves it in well most browsers cache but ram usage or something im being dumb rn

earnest phoenix
#

it.... doesn't?

shy turret
#

"idk im being dumb rn"

#

but... wtf is acceptedImageTypes lmao

#

i alr tried google

earnest phoenix
#

it's literally equivalent of doing <img src='url' onload='load()' onerror='error() />

shy turret
earnest phoenix
shy turret
#

imma stop being lazy and just make the image be uploaded

lucid wharf
#

I am trying to call the variable but via the result name; for example:

${client.emojis.cache.get(ops.giemojis.Keqing)} to ${client.emojis.cache.get(ops.giemojis+`${body[result].name}`)}

But it doesn't detect anything, it gives me the result as 'undefined' ... how could I do it? Thank you

earnest phoenix
#

you need to be more descriptive about your issue

opal plank
#

wait theres a package to check extensions?

#

what?

earnest phoenix
#

there's a package for anything because node devs are known to be lazy

opal plank
#

jesus christ

lucid wharf
#

${client.emojis.cache.get(ops.giemojis.Keqing)} gives me the code of an emoji. what I want to obtain from all this is that with the name of a character "Keqing" I already obtain the code.
(ops.giemojis.Keqing) -> (ops.giemojis+`${body[result].name}`)
https://prnt.sc/vhouhq

Lightshot

Captured with Lightshot

earnest phoenix
#

this is where the node_modules meme comes from, you end up downloading half of the universe, erwin KEKW

opal plank
#
let arrayOfValidTypes = [];
let test = name.split('.');
if(arrayofValidTypes.includes(test[test.lenght - 1])) return true; else return false;```

There i made the package
#

array of valid types

#

split on .

#

get last entry

#

check if array inlcudes it

#

gg ez

#

173K weekly downloads

earnest phoenix
#

it's just lazy/new devs with the "muh package will do it for me 🤤 " mentality not understanding how much they're bloating their app

opal plank
#

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

#

i cannot emphasise this enough

delicate zephyr
#

I mean it just turns a 3 line solution into maybe a 1/2 line solution

#

I mean, there's always the argument "why write something thats already been written a million times"

#

using a package someone else wrote can actually end up with less bloat depending on how neat the package you download is

vast wave
#

I understand everything but the page menu

#

should I do:

element.style {
background-color: aliceblue;
}
#

nope.

#

that wouldn’t work. 😐

thin turret
#

Use a hex value for specific blues

sudden geyser
#

how do you check if a fruit is an apple if you don't have the fruit
back to the past

vast wave
#

@thin turret I was using that color as an example

#

@rustic nova do you have any clue?

rustic nova
#

again, use inspect element to get the css classes

vast wave
#

I did

earnest phoenix
#

not the side panel

#

the classes are in the html

vast wave
#

Yes ik

earnest phoenix
#

if the override doesn't work, slap !important on it

vast wave
#

im using the styles tab

#

lmao

earnest phoenix
#

if that doesn't work, you've got the wrong selector

vast wave
#

ok

#

i’ll try

#

🖐️ *slaps*

#

@earnest phoenix im pretty sure it doesn’t know what element it’s looking for

earnest phoenix
#

what's your css right now

vast wave
#
element.style {
background-color: #428h23;
}```
earnest phoenix
#

element is not a valid selector

vast wave
#

yep...

earnest phoenix
#

i'm on firefox

#

so it might be different

young flame
#

uhhh

#

i forgot how to make a reason thing like luca

#

hhhhh

vast wave
#

@earnest phoenix im pretty sure mine is on by default

earnest phoenix
#

what?

vast wave
#

wat

#

@earnest phoenix ok got it

#

mine is copy selector instead of CSS Selector

#

@earnest phoenix it says #menu

blissful coral
#

i forgot how to make a reason thing like luca
@young flame A -reason command?

#

Or just a reason

young flame
#

-reason command

#

Im making a fully mod bot

blissful coral
#

Just log the message ID and the Log ID

#

And the channel DI

#

Then get the channel then fetch the message then change the content

young flame
#

OH

#

YEA

blissful coral
#

Have funnnnnnnnnnnnnnn

young flame
#

OKAY

blissful coral
young flame
#

ILYYYY

#

EXTREME mad

#

@blissful coral BITCH

blissful coral
young flame
#

ISTG

#

SAY IT BACK

supple oriole
#

My music bot got this error

#

Segmentation fault (core dumped)

earnest phoenix
#

where

supple oriole
#

When I do !Play

earnest phoenix
#

i asked where

midnight blaze
#

when I open htop in my vps
I see a lot of things open
but I didnt even start anything yet.

How do you guys manage to keep it low?

earnest phoenix
#

segfaults shouldn't happen unless you're messing with memory or doing something you shouldn't be doing

supple oriole
#

Terminal

earnest phoenix
#

i

midnight blaze
#

I killed

vast wave
#

Oh @earnest phoenix your back

midnight blaze
#

f9

vast wave
#

so it said #menu

#

I’ll try and see if I can do something with this

earnest phoenix
#

so use it

#

thats a selector

supple oriole
#

a..

earnest phoenix
#

@supple oriole the segfault is more than likely because youre using replit

boreal flume
#

I am making sort of a dashboard, and I cannot seem to get the Oauth2 Working correctly, as I keep getting the error:

TokenError: Invalid "code" in request.
    at Strategy.OAuth2Strategy.parseErrorResponse (/home/impassive/Coding/Express_Apps/Discord-OAUT2/node_modules/passport-oauth2/lib/strategy.js:358:12)
    at Strategy.OAuth2Strategy._createOAuthError (/home/impassive/Coding/Express_Apps/Discord-OAUT2/node_modules/passport-oauth2/lib/strategy.js:405:16)
    at /home/impassive/Coding/Express_Apps/Discord-OAUT2/node_modules/passport-oauth2/lib/strategy.js:175:45
    at /home/impassive/Coding/Express_Apps/Discord-OAUT2/node_modules/oauth/lib/oauth2.js:191:18
    at passBackControl (/home/impassive/Coding/Express_Apps/Discord-OAUT2/node_modules/oauth/lib/oauth2.js:132:9)
    at IncomingMessage.<anonymous> (/home/impassive/Coding/Express_Apps/Discord-OAUT2/node_modules/oauth/lib/oauth2.js:157:7)
    at IncomingMessage.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1220:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
supple oriole
#

@supple oriole the segfault is more than likely because youre using replit
@earnest phoenix Ah alr.

earnest phoenix
#

you didn't provide the correct oauth code, as per the error @boreal flume

boreal flume
#

Do you mean the Client stuff?

earnest phoenix
#

don't know what you're talking about

#

the error says that you didn't provide a correct oauth code

#

...you do understand what that is, right?

boreal flume
#

Not really, this is my first time using discord to log in

earnest phoenix
#

i

#

smh

boreal flume
#

I code bots typically, not dashboards...

earnest phoenix
#

once the user completed authorization they'll be redirected to your redirect uri with a code url parameter

#

that's the code that you use to exchange for a token

#

you somehow provided an incorrect code

boreal flume
#

yes... this is what is redirrected me to: /auth/redirect?code=x8BFmuSQSCLkiz4KaNs5HgLEbn5LpG

earnest phoenix
#

log it to console and double check if they match ig

boreal flume
#

What should I log to the console, the accessToken?

blissful coral
#
#header {
    display: flex;
    align-items: center;
    justify-content: center;
}

Is there any noticeable problems right off the bat?
Because for some reason it is not centering.

#

Pissin me off

earnest phoenix
#

the code, because the error says you provided the incorrect code

supple oriole
#
C:\Users\Raj\Downloads\Mashiro-MusicBot (2)\node_modules\prism-media\src\opus\Opus.js:64
    return this.encoder.decode(buffer, Opus.name === 'opusscript' ? null : this._options.frameSize);
                        ^

TypeError: The compressed data passed is corrupted
    at Decoder._decode (C:\Users\Raj\Downloads\Mashiro-MusicBot (2)\node_modules\←[4mprism-media←[24m\src\opus\Opus.js:64:25)
    at Decoder._transform (C:\Users\Raj\Downloads\Mashiro-MusicBot (2)\node_modules\←[4mprism-media←[24m\src\opus\Opus.js:189:20)
←[90m    at Decoder.Transform._read (_stream_transform.js:191:10)←[39m
←[90m    at Decoder.Transform._write (_stream_transform.js:179:12)←[39m
←[90m    at doWrite (_stream_writable.js:392:12)←[39m
←[90m    at writeOrBuffer (_stream_writable.js:374:5)←[39m
←[90m    at Decoder.Writable.write (_stream_writable.js:314:12)←[39m
←[90m    at PassThrough.ondata (_stream_readable.js:708:22)←[39m
←[90m    at PassThrough.emit (events.js:315:20)←[39m
←[90m    at addChunk (_stream_readable.js:297:12)←[39m
#

Another error

boreal flume
#

How would I find the code to log it?

earnest phoenix
#

no idea, i dont use the package since i pretty much always implement the oauth protocol manually

#

googling around might help

boreal flume
#

I have no clue how to implement it manually, but would that be easier?

earnest phoenix
#

for you? definitely not

boreal flume
#

Ok then

#

Hmmmmmmmmmmmmmmm....

#

I am now not getting the code error

#

but it tells me I am unauthorized

drifting wedge
#

how can i make a box in html?

#

like a round ish box

boreal flume
#

<div style="border-radius: 50%"></div>

#

border radius rounds the edges, 50% makes it a circle/oval

blissful coral
#

Why the hell

#

Is it not using the flexbox

drifting wedge
#

oh

#

?

#

the color?

blissful coral
#

No

drifting wedge
#

just vsc

blissful coral
#

Here

#

CSS:

.header {
    display: flex;
    align-items: center;
    justify-content: center;
}

HTML:

 <body>
        <div class="wrapper">
            <div class="header">
                <img src="servervoting.png" alt="Server Voting+">
            </div>
        </div>
    </body>
#

Yet the image is still stuck in the top left

drifting wedge
#

maybe you have another tag

blissful coral
#

Yeah wrapper

drifting wedge
#

that is making is stick to thing?

blissful coral
#

But it isn't doing anything

drifting wedge
#

1 sec

blissful coral
#

No nothing is sticking

#

Brand new project

drifting wedge
#

try align-content?

blissful coral
#

Nope

#

Doesn't work

drifting wedge
#

umm

blissful coral
#

Yeah.

drifting wedge
#

maybe just do style?

blissful coral
#

I tried that aswell

#

LMAO

drifting wedge
#

whats alt?

blissful coral
#

It is registering

drifting wedge
#

not too familiar with html

#

@blissful coral?

blissful coral
#

The alt text describes what's on the image and the function of the image on the page.

drifting wedge
#

oh

#

ok ok

#

try aligning body?

#

man id klol

blissful coral
#

When I align body it will do it to everything in body

drifting wedge
#

what is flex?

boreal flume
#

When trying to center things it's best to use margins: auto;

blissful coral
#

@drifting wedge flexbix'

#

box

drifting wedge
#

what is it lol?

blissful coral
#

how to flex things

#

If you don't know not going to explain

drifting wedge
#

o ok

#

lol

blissful coral
#

Ok now it doesn't even work when I do it in body

#

Ugh

drifting wedge
#

umm

#

maybe dont do align content?

#

what did u have b4?

blissful coral
#

Doing align-items

drifting wedge
#

items

#

ye ok

#

...

blissful coral
#

Ooo

#

Ok

#

Wait

#
body {
    background-color: #23272A;
    display: flex;
    align-items: center;
    justify-content: center;
}
#

That is moving it

#

I fucking hate coding

#

LMAO

#

I found the problem

boreal flume
#

My discord Oauth2 login keeps failing... I have gotten rid of the Code error, but now it does not let me log in as it sends me to my forbidden page

stark abyss
#

how do you fetch a message in djs

vale garden
#

using collectors

#

lol

drifting wedge
#

how would i literally make a box in html

#

like a square

#

where i can put text in?

boreal flume
#

<div>Text Here</div>

#

@drifting wedge

drifting wedge
#

ik but like a box?

#

im trying something rq

boreal flume
#

What do you mean a box then

#

You can add borders to your div

zenith knoll
#
client.on("guildMemberRemove", async (member) => {
    if (member.id == client.user.id) return;
    if (!servers[member.guild.id] || !servers[member.guild.id].logs) return;
    const channel = member.guild.channels.cache.get(servers[member.guild.id].logs);
    const fetchedLogs = await member.guild.fetchAuditLogs({
        limit: 1,
        type: 'MEMBER_KICK',
    });
    const kickLog = fetchedLogs.entries.first();
    if (!kickLog) {
        const e = new Discord.MessageEmbed()
            .setColor('RED')
            .setTitle(`Member Left`)
            .setDescription(`${member} left the server`)
            .setFooter(`User ID: ${member.id} - OXYGEN Security`, client.user.avatarURL({ dynamic: true, format: 'png', size: 1024 }))
        return channel.send(e)
    }
    const { executor, target } = kickLog;
    if (target.id === member.id) {
        const e = new Discord.MessageEmbed()
            .setColor('RED')
            .setTitle(`Member Kicked`)
            .setDescription(`👮 ${member} was kicked from the server by ${executor}`)
            .setFooter(`User ID: ${member.id} - OXYGEN Security`, client.user.avatarURL({ dynamic: true, format: 'png', size: 1024 }))
        channel.send(e)
    }

})```

It wont trigger when someone leaves
#

only on kick

boreal flume
#

<div style="border: 1px solid black">Text Here</div>

rocky hearth
#

Is netlify better than heroku? Can I host node projects on it?

drifting wedge
#

heroku wokrs fine

bleak creek
#

How can I my bot bruh

zenith knoll
#
    if (member.id == client.user.id) return;
    if (!servers[member.guild.id] || !servers[member.guild.id].logs) return;
    const channel = member.guild.channels.cache.get(servers[member.guild.id].logs);
    const fetchedLogs = await member.guild.fetchAuditLogs({
        limit: 1,
        type: 'MEMBER_KICK',
    });
    const kickLog = fetchedLogs.entries.first();
    if (!kickLog) {
        const e = new Discord.MessageEmbed()
            .setColor('RED')
            .setTitle(`Member Left`)
            .setDescription(`${member} left the server`)
            .setFooter(`User ID: ${member.id} - OXYGEN Security`, client.user.avatarURL({ dynamic: true, format: 'png', size: 1024 }))
        return channel.send(e)
    }
    const { executor, target } = kickLog;
    if (target.id === member.id) {
        const e = new Discord.MessageEmbed()
            .setColor('RED')
            .setTitle(`Member Kicked`)
            .setDescription(`👮 ${member} was kicked from the server by ${executor}`)
            .setFooter(`User ID: ${member.id} - OXYGEN Security`, client.user.avatarURL({ dynamic: true, format: 'png', size: 1024 }))
        channel.send(e)
    }

})

It wont trigger when someone leaves
only on kick

drifting wedge
#

finally

#

this is what i was trying to do

sturdy gazelle
#

@zenith knoll why dont u just check that the user in your kick log is the same user that left? every time that you run that, it will basically just look at the last person that was kicked and therefore kicklog will be nonnull and that if won't ever evaluate, yes?

zenith knoll
#

@zenith knoll why dont u just check that the user in your kick log is the same user that left? every time that you run that, it will basically just look at the last person that was kicked and therefore kicklog will be nonnull and that if won't ever evaluate, yes?
@sturdy gazelle if (target.id === member.id) {

sturdy gazelle
#

yeah so it just falls through and does nothing

zenith knoll
#

wdym

#

i dont get how even though there is no kickLog if (!kickLog) returns false

#

meaning there is a kicklog? but users that leave dont cause a audit log

sturdy gazelle
#

no it means that kicklog is not null

#

if u do if (obj) it is basically saying if obj is defined iirc

zenith knoll
#

so

#

i should do

#

if (!kickLog || kickLog == undefined) {

sturdy gazelle
#

no just make it an if...else

zenith knoll
#

wdym

sturdy gazelle
#

if (target.id === member.id) {/*Kicked!*/}else{/*left!*/}

zenith knoll
#

ok

#

thanks ill try it

sturdy gazelle
#

that should work unless your ban log/audit log is slow then you could have unintended consequences

drifting wedge
#
<!DOCTYPE html>
<html>
<head>
<style>
div {
  text-align: center;
  background-color: #222233;
  width: 50px;
  height: 50px;
  border: 0px solid navy;
  line-height: 50px
}
</style>
</head>
<body>
<div style="color: #70FF69; font-size: 21px; font-family: helvetica;">
  <b>1</b>
</div>
<div style="color: #70FF69; font-size: 21px; font-family: helvetica;">
  <b>1</b>
</div>
</body>
</html>
#

why does it end up stacked up?

earnest phoenix
#

me los paso por la cabeza del pico

#

what do you want it to be, 0Exe?

drifting wedge
#

Like side to side

#

I’m getting this issue really frequently so solving it would be awsome

earnest phoenix
#

you want to stack it vertically?

#

i mean horizontally xd

drifting wedge
#

No sideways

#

Ye

earnest phoenix
#

try float: left;

drifting wedge
#

Ty

#

Tysm

weary torrent
#

any 1 here know any code to make ur bot join a voice channel and play music. Like MEE6 Does??

young flame
#

uh

#

make a music bot

#

?

vital bramble
#

can someone pls tell me the best way to calculate level from experience for a level bot

hollow sedge
#

exponents

#

Ez

hasty mulch
#
@commands.command(name='random')
async def _random(self, ctx, arg1, arg2):
    min = arg1
    max = arg2
    otcm = random.randrange(min, max)
    await ctx.send(f'Printing: {arg1} and {arg2}')
    await asyncio.sleep(0.1)
    await ctx.send('Transfering to variables...')
    await asyncio.sleep(0.1)
    await ctx.send(f'Results are {min} and {max}')
    await asyncio.sleep(0.1)
    await ctx.send('Choosing a number in between...')
    await asyncio.sleep(0.1)
    await ctx.send(f'Chose {otcm}')
    pass

Creates this: ```
Ignoring exception in command random:
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/home/pi/Documents/Room_Sealer/cogs/room-sealer-random.py", line 18, in _random
otcm = random.randrange(min, max)
File "/usr/local/lib/python3.8/random.py", line 212, in randrange
raise ValueError("non-integer arg 1 for randrange()")
ValueError: non-integer arg 1 for randrange()

Language is Python
pale vessel
#

args are strings

#

you have to parse them as ints by using min = int(arg1)

#

(iirc)

earnest phoenix
#

..., arg1: int, arg2: int):

young flame
#

hhhh

vale garden
#

hi

#
@bot.event
async def on_message(message):
  global counter
  global pkmn_list

  if message.author != bot.user:
     counter += 1

     if counter % 3 == 0:

       async def spawn():

        embed = discord.Embed(
         title = "A wild pokémon has appeared!",
         description = "Guess the pokémon and type `p!catch <pokémon>` to catch it!",
         color = 0x00ff00
        )
        rand_no = random.randint(0, len(pkmn_list) - 1)

        embed.set_image(url = pkmn_list[rand_no][2])

        await message.channel.send(embed = embed)

        catch(rand_no)

       await bot.process_commands(message)

async def catch(rand_no):

 @bot.command()
 async def catch(ctx, arg):

  global pkmn_list
  global rand_no

  if arg.lower() == pkmn_list[rand_no][0]:
   await ctx.send(f"Congratulations {ctx.author}! You caught a {pkmn_list[rand_no][1]}!")

  else:
   await ctx.send("That is the wrong pokémon!")
#

ive been trying all day and i finally made this

#

so after 3 messages, the spawn def takes place, spawns a pokemon

#

and then the user can catch it

earnest phoenix
#

that process_commands should not be indented inside if statements

vale garden
#

oh ok

#

but

#

the embed isnt being sent

#

thats my problem

#

any help?

pale vessel
#

he literally helped you

vale garden
#

thats below the embed

delicate shore
#

Alright so how to use .replace in JavaScript
I tried it didn't work

vale garden
#

so why will that affect it

delicate shore
#

This is what I'm doing

vale garden
#

.replace for what

pale vessel
#

it won't run the command if you're not processing it correctly

vale garden
#

oh wait nvm

earnest phoenix
#

you never call the spawn coroutine tho

vale garden
#

wdym

#

i have the function inside which the command is

#

so that the commad only works after the spawn

delicate shore
#

const leavemsg = db.get(`LEAVE_MSG_${member.guild.id}`) var finalmsv = leavemsg.replace("{user.name}", member.username);

umbral zealot
#

what's the contents of your leavemsg before the replace, and what's actually happnening vs what you want?

delicate shore
#

I want this
A user does s!setleavemsg {user.name} just left :( or any message

umbral zealot
#

looks like that should work

delicate shore
#

And in guildMemberRemove event it will replace it

#

My bot sends nothing when member leaves and logs nothing

umbral zealot
#

uhhh ok so what are you doing with finalmsv ?

delicate shore
#

I am sending it

#

in channel specified by guild admin

#

Oh wait

umbral zealot
#

ok so show that exact code perhaps

delicate shore
#

I'm so stupid

umbral zealot
#

yya I was good rubber ducky wasn't I? ayy

delicate shore
#

I don't have guild Member intent how will I get guildMemberRemove event

#

:yya: I was good rubber ducky wasn't I? :ayy:
Yes

#

If I commit event it works fine @umbral zealot
Now I just need to wait for discord to review my Intents request

umbral zealot
#

👍

delicate shore
#

Thanks for the help

earnest phoenix
#

like i said, if it's not sending the embed, then it's because you never call it. You're sending the embed inside spawn function, but you never call it

delicate shore
#

Is this for me ?

earnest phoenix
#

for Multi

pale vessel
#

why are they using events anyway

#

you can do those inside commands

#

oh nm its random

earnest phoenix
#

yeah it's random

pale vessel
#

so just call spawn()? 🗿

earnest phoenix
#

but there are some weird things though, why is it 1 space indented

pale vessel
#

wait why is it even a function

earnest phoenix
#

it's coroutine, so you have to await it

#

or use create_task if you don't want to block it

delicate shore
#

Hoi

vale garden
#

hi

#

yea i didnt even need the spawn fuction so i removed it

#

and now it all looks like this

#
@bot.event
async def on_message(message):
  global counter
  global pkmn_list

  if message.author != bot.user:
     counter += 1

     rand_no = random.randint(0, len(pkmn_list) - 1)

     if counter % 3 == 0:

        embed = discord.Embed(
         title = "A wild pokémon has appeared!",
         description = "Guess the pokémon and type `p!catch <pokémon>` to catch it!",
         color = 0x00ff00
        )

        embed.set_image(url = pkmn_list[rand_no][2])

        await message.channel.send(embed = embed)

        await catchs(rand_no) 

  await bot.process_commands(message)

async def catchs(rand_no):

 @bot.command()
 async def catch(ctx, arg):

  global pkmn_list

  if arg.lower() == pkmn_list[rand_no][0]:
   await ctx.send(f"Congratulations {ctx.author}! You caught a {pkmn_list[rand_no][1]}!")

  else:
   await ctx.send("That is the wrong pokémon!")
#

but then now the same pokemon is spawning everytime

#

which means the no is the same

#

but i thought the number would change everytime a message was sent

#

also im getting this error after every spawn except the first one

#
discord.ext.commands.errors.CommandRegistrationError: The command catch is already an existing command or alias.
earnest phoenix
#

is this for private server?

#

here's the thing, everytime you call catchs function, you register the catch command.

fading hatch
#

How do you get bot developer role

earnest phoenix
#

by developing a bot (?)

fading hatch
#

I don’t have the role though

#

I published my bot a couple hours ago

unkempt vapor
#

??

vale garden
#

here's the thing, everytime you call catchs function, you register the catch command.
@earnest phoenix wdym by register

#

sry im new to py i dont know much

#

lol

#

I published my bot a couple hours ago
@fading hatch did it get approved

earnest phoenix
#

that command decorator registers the function as command, so everytime you call catchs function, it'll register the catch command

fading hatch
#

@fading hatch did it get approved
@vale garden not yet

vale garden
#

yea so thats why you dont have the role

#

that command decorator registers the function as command, so everytime you call catchs function, it'll register the catch command
@earnest phoenix yea but what is wrong in registering it multiple times

#

cuz in a normal bot people use commands more than once

earnest phoenix
#

using a command multiple times is different than registering it multiple times

#

it's not like the command will be removed after used once

vale garden
#

ok so do you know what i can do?

#

to fix it

#

or instead

#

is there a way

#

to collect a certain word

#

by using bot.wait_for

pale vessel
#

of course

earnest phoenix
#
  1. I'd use bot variables over global variables, because this way i can access the variable anywhere as long as i got access to the bot instance
  2. If you're planning to make this bot public, I'd use dict, with guild ids as keys and another dict which has counter, index of current pokemon and probably channel id (though you probably need to store the channel id on db) as values
  3. So after you send the embed, you wanna assign the necessary values to the dict.
  4. When someone call the catch command, you wanna check the index of pokemon of current guild is not None or whatever the default value you set, meaning a pokemon was already spawned, if so, then check if the arg is the same as the element with the index you stored on the dict.

Maybe this isn't clear enough but I hope it is

#

You probably also wanna make a timeout, that shouldn't be hard to implement

delicate shore
#
    if(rating !== "5" || rating !== "4" || rating !== "3" || rating !== "2" || rating !== "1") return message.channel.send(`Second argument i.e Rating has to be a number out of 5 `)
#

Am I doing smthing wrng

#

My bot keeps returning this message

#

Event tho if i enter rating as 5

#

I have console loged rating

#

it also says 5

golden condor
#

you checked a string against a number

#

you need to get rid of the "" around the numbers

delicate shore
#

ooo. ok thanks

golden condor
#

Because you used !== it is also checking for types, if you used != it wouldn't check for types

#

Also that is a monstrosity

#

Just say

delicate shore
#

Oh ok

#

Still same error 😢

golden condor
#
if (rating > 5 || rating < 0) { //checks if the rating is above 5 or below 0
}```
delicate shore
#

oh k thanks

golden condor
#

If you do your first code, if the rating is anything other than 5 then it won't work, you needed && instead of ||

#

because it only goes onto the || statement if the first one isn't true

delicate shore
#

okk

#

fields.flat is not a function

golden condor
#

Assuming you use discord.js v12

delicate shore
#

Yes

#

I have latest version of discord.js v12

golden condor
#

Do you have at least node 12?

delicate shore
#

it's v10

golden condor
#

can you run node -v in your terminal

delicate shore
#

node is v10

golden condor
#

you need to update it

delicate shore
#

ok

golden condor
#

For djs 12 you need at least node v12

#

you can use nvm (node version manager), that's my recommendation

crystal wigeon
#

Idk why discord is cutting my image?

#

It looks fine on pc

delicate shore
#

alr

golden condor
#

On mobile it does that, it's normal @crystal wigeon

crystal wigeon
#

Is there a fix? Because I need the border to behave properly

golden condor
#

No there isn't, it's only so the image fits the mobile screen

crystal wigeon
#

mmm

#

bummer

golden condor
#

Yeah it is, sorry about that

rose warren
#

@hollow elbow you should use https://anidiots.guide for help on making basic commands using discord.js

hollow elbow
tribal siren
#

if(cmd === `${prefix}nickname`){ if(!message.member.hasPermission("MANAGE_NICKNAMES")){ message.reply('Missing Following Permissions: ``MANAGE_NICKNAMES``') } else{ let nickname = message.content.split(" ").slice(2).join(" "); let member = message.mentions.members.first(); try{ member.nickname.change(nickname) } catch(err){ console.log(err) } } }
it says that member.nickname.change is not a function

#

how to do it corectly?

#

oh nvm i got it myself

crude merlin
#

it's member.setnickname @tribal siren and also read the docs.

tribal siren
#

oh nvm i got it myself
but still thank you

crude merlin
#

Ok

wheat jolt
#

afaik try/catch won't work

tawdry arrow
#

how to turn off bot in visual studio

rocky hearth
#

end the node process, by ctrl + c

tawdry arrow
#

oh thx

rocky hearth
#

@wheat jolt What are you trying to do?

wheat jolt
#

I am trying to catch that error

#

lol

#

it throws because of msg.react on a deleted message

rocky hearth
#

😵

wheat jolt
#

?

earnest phoenix
#

How to match a string

change your name to 'nothing', You have <number> seconds

the <number> can be any number from 1 or higher. How do i do that? My brain is dying .-.

#

in javascript

#

btw

#

;-;

little meteor
#

anyone here good with discord.py ?

tribal siren
#

i used to be

#

but then i moved to discord.js

#

it's a ton better

#

so about my problem

#

i know that setSlowmode isn't a thing in discord.js

#

what can i replace it to?

little meteor
#

oooh

earnest phoenix
#

anyone here good with discord.py ?
wouldn't say i'm good with it, but i might be able to help

tribal siren
#

same

little meteor
#

so my problem is

#

the following code sometime return coming instead of the ID, do you have any ideas why?

msg = await channel.send(file=file, embed=embed)
print(msg.id)```
tribal siren
#

spesifically what do you want your code to do?

little meteor
#

just to send the message and store the message id

tribal siren
#

oooh

earnest phoenix
#

could you take a screenshot of what it printed?

silver lintel
#

i know that setSlowmode isn't a thing in discord.js
@tribal siren setRateLimitPerUser()

little meteor
#

could you take a screenshot of what it printed?
@earnest phoenix not possible since it does it at random, and I save the id on DB

tribal siren
#

oh

earnest phoenix
#

i've never found such thing, i always get the id, and there's nothing wrong based on those 2 lines if channel, file and embed were defined and the right types. Prolly because of the DB?

little meteor
#

no sure, cause it started to give that problem 2 days ago

#

I dont see how DB could affect it sweat_2

tribal siren
#

thank you

#

works now

earnest phoenix
#

neither do i

tardy hornet
#

my friend is trying to make his own bot, and when he is trying to turn him on
its giving him this error:

operable program. Check the spelling of the name, or if a path was included, verify that the 
path is correct and try again.
At line:1 char:1
+ node .
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (node:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException```


he tried to redownload node 5 times , what should he do
#

?

tribal siren
#

if(!member.hasRoles(mutedrole)) return message.reply("But he isn't even muted bruh")

#

what to change the hasRoles to?

warm marsh
#

my friend is trying to make his own bot, and when he is trying to turn him on
its giving him this error:

operable program. Check the spelling of the name, or if a path was included, verify that the 
path is correct and try again.
At line:1 char:1
+ node .
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (node:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException```


he tried to redownload node 5 times , what should he do

@tardy hornet install node

#

what to change the hasRoles to?
@tribal siren v12?

tardy hornet
#

he did

tribal siren
#

discord.js

tardy hornet
#

he did install node @warm marsh

warm marsh
#

Added to path during installation?

tardy hornet
#

yes

tribal siren
#

@tardy hornet why doesn't your friend contact us tho

warm marsh
#

Brace, member.roles.has(role)

tribal siren
#

oh

#

ok thank you

tardy hornet
#

@tardy hornet why doesn't your friend contact us tho
@tribal siren he dont know anything bout coding yet, want me to tell him to send it here?

tribal siren
#

yes

tardy hornet
#

he wont get anything you will say but,,, your call

tribal siren
#

lmao

#

it would be better for him since he would learn something new

warm marsh
tawdry arrow
#

how do you add more case ?

tardy hornet
#

enter after the break;

#

and typ

#

e

#

case 'command name':

warm marsh
#
switch(x) {
  case 1:
    break;

  case 2:
    break;
}```
tardy hornet
#

and do that over again

tawdry arrow
#

thx

tardy hornet
#

okay @tribal siren

#

here he is

#

@pastel fossil

tribal siren
#

breuhf

#

what's the problem

#

@warm marsh
TypeError: member.roles.has is not a function

warm marsh
#

What version of djs are you on?

tardy hornet
#

@tribal siren he said that he need to verified his phone,

#

lets wait lol

tribal siren
#

never thought of that

#

@warm marsh i think v12

#

not sure tho

warm marsh
#
member.roles.cache.has(role)
tribal siren
#

oh

#

okay

#

yes, now it works

#

thank you

tardy hornet
#

@tribal siren look