#development

1 messages · Page 1707 of 1

rustic nova
#

that name doe

blissful coral
#

lulw

#

Wait-

#

LMFAO

drifting wedge
#

@blissful coral probably do a bit more than 1k tho

blissful coral
#

yeah

drifting wedge
#

Unnecessary

quartz kindle
#

too many objects

blissful coral
#

I am switching from djs sharding manager to kurasuta so was just curious

drifting wedge
#

Maybe 1.5 or 2 if you feel like

blissful coral
#

Luckily all the functions are the exact same for 1 and I don't use that 1 KEKW

drifting wedge
#

But like 2.5 is MAX

#

And 1k is MIN

#

well not really but like it's the normal params

#

So anything in between is good

crimson vapor
#

1k is not min

#

0 is min

#

kekw

blissful coral
#

I think if I get performance issues I will change it but I should be fine for now

drifting wedge
#

Well yeah

blissful coral
#

Shutup million lulw

drifting wedge
#

But you shouldn't shard under

#

Like 1 shard per 500 guilds

blissful coral
#

yea

drifting wedge
#

Is SUPER OVERKILL

blissful coral
#

LMAO

drifting wedge
#

like taking a plane to the supermarket

blissful coral
#

I have a guild per shard and 10 shards wdym

crimson vapor
#

actually thats impossible to have 1 shard per guild

drifting wedge
#

Or taking a car to your living room

#

You can have more than one shard per guild

crimson vapor
#

some guilds will be bound to be put on the same shard

drifting wedge
#

Actually

#

You can have empty shards

crimson vapor
#

yes

#

ik

#

but the way the math works out

vivid fulcrum
crimson vapor
#

iirc you can't have that many shards

drifting wedge
#

Wait wtf we're on dev

#

WHT

#

I thought we were in general

crimson vapor
#

I mean how many shards would you need for it to be satisfied by the shard equation

#

too many

opal plank
#

actually tempted to spin 100 shards

#

just to see what happens

vivid fulcrum
#

you'll have like an 8 minute startup

unreal estuary
#

my body width doesnt cover the full screen when i see how it looks on mobile

#

margin: 0;
padding: 0;
width: 100vw;
height: 100vh;

#

i have this in my body

unreal estuary
#

<guild>.leave()

earnest phoenix
#

dose the other maker of the bot need to be in here?

pale vessel
#

No

tidal sparrow
#

anyone know where lavalink went?

#

the github page is gone

pale vessel
lyric mountain
#

anyway, show ur css

shell pond
#

sa

#

I am turkish

faint sonnet
#

Hoi, what is the plugin thingy that can make profile cards, llike a ui for my discord bot in js, please take it easy as i have had around like an 8 month break of off coding

quartz kindle
#

you mean a drawing library?

#

to create graphics and images?

faint sonnet
#

yup

#

to create something like this

thick nexus
#

is it possible to get message content from message id xD

umbral zealot
faint sonnet
thick nexus
#

hmm ok

umbral zealot
faint sonnet
umbral zealot
steel wedge
thick nexus
#

o

#

ok

umbral zealot
faint sonnet
#

now to look at the docs of node-canvas

lament rock
#

kinda strange how you need the channel ID to get a Message since no two resources can have the same id. Although, the route makes sense

umbral zealot
#

It's because of the HTTP route which requires the message ID first, since it's a nested structure.

lament rock
#

Yeah. Having everything like how it is makes sense, but all things considered, getting a resource by ID requiring two IDs just seems a bit strange

umbral zealot
#

Also in terms of IDs you say no two resources can have the same ID... no, actually, not globally. I've seen message IDs being the same in two channels of the same guild.

#

No to same resources have the same ID.

lament rock
#

oh? amandathink

#

Now that kinda breaks my expectations of the term "Snowflake"

blissful coral
lyric mountain
#

The "it's been X months since I used Y language"

lament rock
#

how do you export and import the class

crimson vapor
#

is this typescript?

#

@blissful coral

blissful coral
#

Js

#

@crimson vapor

#

Thats from what was compiled in the dist

crimson vapor
#

ok show the ts code for exporting and importing

blissful coral
#

I fixed it now

#

Just was a rootDir thing

lament rock
#

pain

lyric mountain
#

Ah, yes, the ball

blissful coral
#

Anyone know why I would get this error from kurasuta?

steel wedge
blissful coral
quartz kindle
#

veza is a clusterfuck

#

idk why kurasuta uses it

blissful coral
#

Yeah

blissful coral
quartz kindle
#

a cluster of clusterfucked clusters of clusterfucks

blissful coral
#

yes.

quartz kindle
#

welp, im way past my bed time so cant help sry

#

cya

crimson vapor
#

Tim has a bedtime wut

sage bobcat
#

One message removed from a suspended account.

drifting wedge
#

For dropdown menus (not the input ones, like the user option ones or whatever) how can I get the menu under the button in all types of screen sizes etc?

full dirge
#

ANyone say how to add embed to my bot
lang : python

outer zenith
#

does anyone use lavalink

#

kek

#

no one?

full dirge
#

yes

odd stratus
#

Do you need help setting it up or?

outer zenith
#

i have it setup

#

its just being buggy

#

when i try searching

#

it throws thsi

#

@odd stratus ?

odd stratus
#

Oh you're using a Python lavalink lib?

outer zenith
odd stratus
#

Sorry I don't know Python. I use a JavaScript lavalink wrapper

dusky wyvern
#

hi

reef lintel
#

which is the best free and trusty VPS to host our discord.py bot on

cinder patio
#

check pins

#

oj

pale vessel
#

"Best free and trusty VPS"
Those combined do not exist

cinder patio
#

I guess heruko

#

Can be the closest to that

pale vessel
#

I wouldn't call heroku a VPS but it's great if you don't need much memory

#

and it's free

cinder patio
#

yea true it's not really a vps

#

You get 512 mb for free which is pretty good, You can have at least 1k guilds if you handle memory right

copper pond
#

Can anyone help me create an thread to run lavalink while my bot is hosted

drifting quartz
#

HOW MUCH TIME IT WILL TAKE TO GET VERIFIED

cinder patio
#

which are p easy to use

copper pond
swift nimbus
#

Hello

#

Are u here

#

@clear marlin

#

Are u here

#

@wet dove

clear marlin
#

Sure

swift nimbus
#

Ok lemme show u

clear marlin
#

Go on, although im not a python developer

#

Just so you know.

wet dove
#

im not a python dev, so i cant help, sorry

swift nimbus
#

Here

#

Im getting this syntax error

earnest phoenix
#

use tab

clear marlin
#

f'string'

swift nimbus
#

?

clear marlin
#

Isn't that format

#

?

swift nimbus
#

Yeah

clear marlin
#

I'll be out of here

earnest phoenix
#

@clear marlin format is also valid

clear marlin
#

I'm not a pythonier

swift nimbus
#

@earnest phoenix

clear marlin
swift nimbus
#

Do u know how to fix this?

earnest phoenix
#

yeah

#

are you on pc?

swift nimbus
#

How do u fix this?

#

Yeah

#

Im on pc

earnest phoenix
#

ok goto line that has print

#

and press tab

swift nimbus
#

Yea

#

Ok lemme see

#

Here

#

It doesnt give error but it gives nothing

#

?

earnest phoenix
#

¯_(ツ)_/¯

swift nimbus
#

What do u think?

clear marlin
#

Use a proper code editor maybe

#

Which shows you the errors?

slender thistle
#

Oh my fucking God

#

Okay

slender thistle
swift nimbus
#

I already finished

#

@earnest phoenix helped C:

slender thistle
#
def get_role(client: Client,
             guild_id: Union[str, int],
             role_id: Union[str, int]) -> Optional[dict]:
    return client.guilds.get(guild_id, {}).get("roles", {}).get(role_id)

cursed

earnest phoenix
#

i dont see any use of this code

#

snowflake type mixing lol

summer acorn
#

would fetching webhooks in nearly 4000 servers at around the same time ratelimit my bot

alpine hornet
#

Hey guys, I'm having an issue with setting the status on my bot. I feel dumb for this, but I'm getting an error in my terminal when I'm running "node .".
Here's the issue:

#

Am I blind?

summer acorn
#

bot is not defined

lusty quest
#

where did you define the discord client

earnest phoenix
#

or what did you define as

copper pond
#

Can anyone help me create an thread to run lavalink while my bot is hosted

alpine hornet
#

Here, can someone dm me.

summer acorn
#

@earnest phoenix would fetching webhooks in around 4000 servers at the same time ratelimit my bot

earnest phoenix
#

no idea

#

but softly dont try it

copper pond
#

@earnest phoenix pls help me

earnest phoenix
#

about what=

earnest phoenix
#

idk

summer acorn
#

well, I kinda need to do it to make sure my bot is fixed

copper pond
#

@earnest phoenix who can help me?

earnest phoenix
#

¯_(ツ)_/¯

lusty quest
#

just to make sure you wont get Ratelimited

#

sure its quite slow and will take a hot minute to fetch all webhooks

#

but i guess its the safest way

summer acorn
#

the thing is

#

this loop is 60 seconds

lusty quest
#

add a delay after each time the loop ran once, it should help with ratelimits

#

but yea its slow

summer acorn
#

well, what is the ratelimit for get requests?

pale vessel
#

More context?

#

Ah

near stratus
summer acorn
#

@pale vessel I am sure you already know why I am asking this x)

pale vessel
copper pond
#

@lusty quest can you help me out pls

near stratus
pale vessel
#

You can use MongoDB cloud

#

It's free

near stratus
pale vessel
#

Yes

cinder patio
#

it's free

near stratus
#

Not Heroku alone
like atlas for db, Heroku for ram+ processor, Dropbox for storage, imgur for image hosting

#

When I can get 2yrs free vps with AWS

cinder patio
#

That's what you have to do if you don't want to spend a few bucks on a VPS

near stratus
#

Also Heroku is hosted on AWS

cinder patio
#

ew AWS

near stratus
cinder patio
#

still 2 different services

near stratus
cinder patio
#

performance? there shouldn't be that much of a difference, but heruko is super easy to use and it can be easily integrated with github

near stratus
#

Proof:

cinder patio
#

How is that relevant, Heruko is easier to use and just as powerful

near stratus
# cinder patio performance? there shouldn't be that much of a difference, but heruko is super ...
Amazon Web Services

(This post has been updated on October 1, 2018 to reflect the deprecation of GitHub services. You can learn more about this deprecation here. We now recommend setting up automatic deployments from GitHub using AWS CodePipeline and AWS CodeDeploy.) AWS CodeDeploy is a service that makes it easy to deploy application updates to Amazon EC2 […]

near stratus
pale vessel
#

Then roll with that, sure

near stratus
#

I am

lusty quest
lusty quest
#

¯_(ツ)_/¯

final trail
#

How do i add imgur gifs on my discord embed?
I do .setImage('imgur.com/gallery/****') but it doesn't work

copper pond
#

@last lava pls help me

lusty quest
#

lol, cant find someone to help, decides to ping random people

final trail
#

Lol

last lava
#

?

#

...

near stratus
cinder patio
#

If you want to do everything yourself go with aws

final trail
near stratus
final trail
#

Nooo

cinder patio
#

We're talking about free tier here

near stratus
last lava
#

Free tier only lasts a year iirc

final trail
#

I use CentroNodes its a free VPS and it xorks 24/7

near stratus
final trail
near stratus
last lava
#

Ah

cinder patio
#

And heruko is free-forever

#

with less RAM

near stratus
lusty quest
#

if its free, it sucks. thats my opinion on free Hardware

cinder patio
#

oh my god can you stop being an ass

near stratus
cinder patio
#

so you're gonna continue being an ass, okay

near stratus
# cinder patio so you're gonna continue being an ass, okay

Also one last thing about Heroku

- Bots are not what the platform is designed for. Heroku is designed to provide web servers (like Django, Flask, etc). This is why they give you a domain name and open a port on their local emulator.

- Heroku's environment is heavily containerized, making it significantly underpowered for a standard use case.

- Heroku's environment is volatile. In order to handle the insane amount of users trying to use it for their own applications, Heroku will dispose your environment every time your application dies unless you pay.

- Heroku has minimal system dependency control. If any of your Python requirements need C bindings (such as PyNaCl binding to libsodium, or lxml binding to libxml), they are unlikely to function properly, if at all, in a native environment. As such, you often need to resort to adding third-party buildpacks to facilitate otherwise normal CPython extension functionality. (This is the reason why voice doesn't work natively on heroku.)

- Heroku only offers a limited amount of time on their free programme for your applications. If you exceed this limit, which you probably will, they'll shut down your application until your free credit resets.
pale vessel
#

bruh

cinder patio
#

Heruko is a good starting point

#

obviously you are going to upgrade once your bot grows

pale vessel
#

and it's free forever for one project if you link a card

lusty quest
pale vessel
#

But eh, if you have a card, it's probably better for aws/gcp free tier/trial

lusty quest
#

yes, but i havent meet anyone that started out having a credit card

pale vessel
#

True

lusty quest
#

they are usually 12-16 years old

pale vessel
#

They can ask their parents though

#

If it's free they might be fine with it

near stratus
pale vessel
#

*might*

#

That's why you need a card

lusty quest
#

they probably wont bcs its likely they are Boomers and say technology is bad and a free VPS is a waste of time

near stratus
cinder patio
#

If you have a card it goes on for a full month

lusty quest
cinder patio
#

It's harder to get the student pack when you're not from the USA

near stratus
cinder patio
#

I said it's harder

#

not impossible

near stratus
#

All you need is a suggestion from the principal

#

and homeroom teacher

lusty quest
#

lol all the teachers on my school where Boomers who had the knowledge about PCs like my Granddad

cinder patio
#

same. I tried multiple times, didn't get it

lusty quest
#

they just managed to fire up Youtube

pale vessel
#

Same here

near stratus
lusty quest
near stratus
#

The whole school knows the password anyway

pale vessel
near stratus
lusty quest
#

does Github Student existed back in 2010?

pale vessel
#

Nope

#

It was introduced in 2018

lusty quest
#

well then it wont have changed anything

near stratus
#

I don't know
I was only 5 y/o then

lusty quest
#

yea 2018 i where already out of school for 2 years

#

atleast ive managed to get some Free CAD software before getting out of my last school

near stratus
#

....

#

How old are you again ?

lusty quest
#

i turn 25 in 11 weeks

near stratus
#

Great only 10 years to go for me

pale vessel
#

mMlOl Same

lusty quest
#

to be fair ive started with an Apprenticeship when i where 15

#

that lasted 3.5 years

#

so i could afford to rent hardware with 15

dusky sundial
#

@oblique shuttle I'm not a js dev, so I can't tell you

oblique shuttle
rocky dagger
#

i have this code and i wondered if you can wait to store a message in every variable before it continues because now it just goes strait to sending the variables as undefined ```js
const filter = (m) => m.author.id === message.author.id && !message.author.bot;

const collector = message.channel.createMessageCollector(filter, {
// time: 1000 * 1 // seconds
time: minute * 2 // minuts
// time: hour * 1 // hours
});

collector.once('collect', m => {
msg1 = m.content
});

collector.once('collect', m => {
msg2 = m.content
});

collector.once('collect', m => {
msg3 = m.content
});

collector.once('collect', m => {
msg4 = m.content
});

message.channel.send(msg1 + ' \n ' + msg2 + ' \n ' + msg3 + ' \n ' + msg4)```

exotic lotus
#

await msg1 =...
await msg2 =... In all and async m => { to async it

#

I guess this will work

cinder patio
#

Uh that's not how collectors work

#

why use multiple once events instead of just one

exotic lotus
#

And its collector.on

cinder patio
#

and store the responses in an array

#

once is also a thing

exotic lotus
#

m.first().content

rocky dagger
cinder patio
#

Also you should look into awaitMessages cause it does exactly what you want

#
const messages = await <TextChannel>.awaitMessages(filter, {...});
// messages is a Collection with all messages it collected
messages.array(); // Array with all messages
eternal osprey
#
 const allItems = fs
    .readFileSync("./levels.txt", "utf8")
    .split("\n")
    .map((x) => x.split(/ +/));
      let filtered = allItems.filter((x) => x[0]);
      let final = filtered.map((x) => x[1]);
      const labell0 = [final]
      const french = Math.max(labell0)``` So final is returning an array like this: [25, 30, 98, 299];. Why is french returning as NaN?
cinder patio
#

max doesn't accept an array

#

Math.max(1, 2, 3, 4, 5)

#

Also labell0 is essentially [ [ ... ] ]

#

final is already an array, just spread it

eternal osprey
#
const array1 = [1, 3, 2];

console.log(Math.max(...array1));
// expected output: 3```
from mozilla.dev
cinder patio
#

That's not passing an array

#

it's spreading it

eternal osprey
#

owh

#

how would i spread an array?

cinder patio
#

It's in the code you sent earlier

#

...array1

eternal osprey
#

aha okay

rocky dagger
cinder patio
#

You can use awaitMessages in DMs

rocky dagger
#

how

cinder patio
#
const channel = await user.createDM();
channel.awaitMessages...
earnest phoenix
#

please help me

lusty quest
#

why do people still use json as "database"

#

also your json file is either corrupted or badly formated

earnest phoenix
#

what can i do to remove this error

rocky dagger
cinder patio
#

Replace user with the actual user object you have

lusty quest
earnest phoenix
#

how do i fix it

copper pond
#

Can anyone help me?

dusky sundial
#

Not unless you ask your question

copper pond
#

@dusky sundial i asked mt question 3 times

#

Can anyone help me create an thread to run lavalink while my bot is hosted

#

@dusky sundial ^^

#

@last lava sir^^

cold meteor
#
    if isinstance(error, commands.MissingPermissions):
        await ctx.send(f'It seems you are missing permissions! in particular the {MissingPermissions} one' )

Currently making a quick error handler for a command, but em- how can i send back which specific permission they are missing??

#

i cant find the right function

dark totem
lusty quest
#

you want to have a pretty output?

cold meteor
#

Fixed.

dark totem
#

i want it say in embed** for example**
44 seconds
3 minutes
15 hours
1 day

lusty quest
#

i guess you could use MS to convert milliseconds into a pretty output

dark totem
#

someone told me to use pretty ms package but i am working on save storage as much i can

opal plank
#

this is a horrible way of doing it btw

#

you'll end up with 24h 30m for example

dark totem
#

horrible?!

#

why

opal plank
#

i literally just explained

#

using Date with getDay, getMinute, etc will cause the same effect

#

use the % operator to remove them as you go instead of diving

earnest phoenix
#

what does git push --force do

lusty quest
#

this is why i suggested to convert milliseconds with MS to a pretty output, but idk how it will handle stuff larger than 1 day

lusty quest
opal plank
#

doesnt bash have a human redable for everything?

#

yeah it does

lusty quest
#

i guess if you add -H tag or was it -h

earnest phoenix
#

how can there be conflicts

#

im not merging two branches

#

im adding more commits to a branch

lusty quest
#

what if 2 people work on the same branch?

#

then you get conflicts

#

usually you should resolve them

opal plank
#

imagine not using git kraken

lusty quest
#

but sometimes you need to force it

opal plank
#

never force it

#

just resolve the conflicts

#

:p

earnest phoenix
#

k

#

ty

rocky dagger
#

this just gives me a Cannot read property 'first' of undefined error. am i using it incorrect? ```js
const Discord = require('discord.js');

const minute = 1000 * 60
let response = [];

module.exports = {
name: 't',
description: 'test',

async execute(message, args) {

    const filter = (m) => m.author.id === message.author.id && !message.author.bot;

    const collector = message.channel.createMessageCollector(filter, {
        time: 1000 * 10,
        max: 4
    });

    collector.on('collect', m => {
        response.push(m.collected.first())
        response.push(m.collected.second())
        response.push(m.collected.third())
        response.push(m.collected.fourth())
    });

    collector.on('end', m => {
        message.channel.send(response[0] + ' \n ' + response[1] + ' \n ' + response[2] + ' \n ' + response[3])
    })
}

}```

cinder patio
#
  • don't define the array outside of the command,
  • m is a Message, just push the content push(m.content)
  • I don't think you know how collectors work. The collect event is emitted when the user sends ONE message, currently you will push the same message four times in the array
  • Like I previously said, use awaitMessages instead of a collector
#

If you still want to use collectors, completely get rid of the collect event and just use the end event - the first argument to the callback is all the collected messages

earnest phoenix
#

@rocky dagger imagine using an async execute function and avoiding await

cinder patio
#

I don't think they know how

#

time to learn

rocky dagger
earnest phoenix
#

what a nice excuse

rocky dagger
#

and i amloast dont know anything about await and collect

cinder patio
#

awaitMessages works in dms...

earnest phoenix
#

how about you learn

rocky dagger
#

i am trying

earnest phoenix
#

one sentence to explain await: wait for smth to finish before executing the rest of the code

rocky dagger
#

i still dont know how you do it tho

rocky dagger
umbral zealot
earnest phoenix
#

@umbral zealot stinky adverts

umbral zealot
#

Need help of my own real quick. ```
message.guild.channels.cache.get("260228691886473223").messages.cache
.filter(m => m.embeds[0].description.includes("2 days 10 hours ago"))
.first()
.embeds[0].description.match(/<@(\d+)>/g)

So this match() is returning `[ '<@​831249237349630025>' ]` instead of `[ '<@​831249237349630025>', '831249237349630025' ]`
and I'm not sure why. (\d+) is the capture group isn't it? I'm sure it's stupid, but I just woke up, hadn't had my coffee, and need to ban 98 spam accounts asap
earnest phoenix
#

wait no you dont

#

@umbral zealot try using matchAll if you're on node v14

#

and remove the g flag in the regex

umbral zealot
#

Ah yeah I just took the lazy route and sliced 'em in a map() lol

#

and it was because of a zws in there I Couldn't see

#

Thanks for helping though!

earnest phoenix
#

wdym zws

#

how did zamazon web services wreck your code

umbral zealot
#

zero width space 😛

quartz kindle
#

zamazon web services best hosting

#

:^)

earnest phoenix
#

zamazon elasic sreach is so gud

tacit drum
#

h

quartz kindle
#

h

willow frigate
#

can bot post nitro emojis
without an embed ?

dusky sundial
#

Yes, it can

lavish bramble
#

My serverinfo command is not working

#

It doesn't showing owner

dusky sundial
#

Show your code

lavish bramble
#

Oops

#

Can I paste it here or in paste bin?

dusky sundial
#

If it's too long to put here you can do a pastebin

#

Otherwise it's fine to paste it here

cinder patio
#

you can send the file

dusky sundial
#

but do it in a code block

lavish bramble
#
const embed = new MessageEmbed()
			.setColor('RANDOM')
			.setAuthor(message.guild, message.guild.iconURL( ))
			.setTitle('Server Info', message.guild)
			.setThumbnail(message.guild.iconURL())
			.addField('Owner', message.guild.owner.user.tag)
			.addField('Location', message.guild.region, true)

			.addField('Member Count', message.guild.memberCount)
			.addField('Emoji Count', message.guild.emojis.cache.size)
			.addField('Roles Count', message.guild.roles.cache.size)
			.addField(
			
				`Text Channel :-`,`⌨${
					message.guild.channels.cache.filter(channel => channel.type == 'text')
						.size
				}`
			)
			.addField(
				
				`Voice Channel :-`, `🔉${
					message.guild.channels.cache.filter(
						channel => channel.type == 'voice'
					).size
				}`
			)

			.setFooter(message.author.username, user.displayAvatarURL())
			.setTimestamp();

		message.channel.send(embed);
	}```
#

Ohk

#

Its not showing owner

#

And this is an error

#

Anyone help?

quartz kindle
#

guild.owner is nullable

#

not guaranteed to exist

#

it only exists if the owner's GuildMember object is cached

#

so you need to fetch it

lavish bramble
#

How?

#

?

earnest phoenix
#

xD

dusky sundial
#

@earnest phoenix do you have a development related question?

earnest phoenix
#

Ye

dusky sundial
#

Then ask it

earnest phoenix
#

?

#

What

dusky sundial
#

Ask your question

earnest phoenix
#

I can german xD

quartz kindle
earnest phoenix
#

Englisch

#

I cant Englisch

dusky sundial
earnest phoenix
#

Whem i asks?

quartz kindle
#

das kannal ist fur programming problem
has du ein problem?

earnest phoenix
#

Wie mach

lavish bramble
earnest phoenix
#

Ich jetzt das mein bot on ist @quartz kindle

quartz kindle
#

and what is the problem?

earnest phoenix
#

Is not i will

quartz kindle
#

ok, and you need help?

earnest phoenix
#

Ye

quartz kindle
#

help with what?

earnest phoenix
#

I send a

quartz kindle
#

your bot needs to be verified

#

you have to wait

earnest phoenix
#

Long?

umbral zealot
#

1-2 weeks or more

near stratus
#

Few weeks

earnest phoenix
#

Ok

lavish bramble
dusky hawk
#

I made another bot

#

Who wanna use it?

#

@lavish bramble

lavish bramble
#

Yes?

dusky hawk
#

Wanna use a Moderation Bot I made?

quartz kindle
dusky hawk
#

@lavish bramble Wanna use my bot

dusky sundial
#

@dusky hawk this channel isn't for plugging your bot

lavish bramble
dusky hawk
#

aw man

dusky sundial
quartz kindle
lavish bramble
quartz kindle
#

it will be cached after you fetch it

opal plank
quartz kindle
#

or you can do this

#

(await guild.members.fetch(guild.ownerID)).user.tag

lavish bramble
#

Ok ill try

opal plank
#

or conditional chaining

#

actually

#

conditional chaining is the same version as d.js right?

#

v14 i think?

quartz kindle
#

ye

opal plank
#

should be able to just slap a ? there

lavish bramble
#

Mmm
Error
tag is not defined

quartz kindle
#

why tho

opal plank
#

no catch tho

#

but frick that

#

cuz that lul

quartz kindle
#

i mean

opal plank
#

might return null

#

or even fail to fetch

quartz kindle
#

you're fetching the ownerID

#

which is guaranteed to exist

lavish bramble
#

Yup

#

But in this
Like
Mentioned
@ᵈʳᵉᵃᵐ乡𝓟𝓻𝓲𝓷𝓬𝓮★᭄ꦿ᭄☆#1646

quartz kindle
crimson vapor
#

Erwin with his brazil internet needs to check every request Tim

opal plank
#
(await guild.members.fetch(guild.ownerID).catch(() => null))?.user.tag

this would be better no?

quartz kindle
#

his internet is better than mine tho

crimson vapor
#

shhh

opal plank
quartz kindle
#

sure

lavish bramble
# quartz kindle show your code
const user = message.author;
    const Owner = await message.guild.members.fetch(message.guild.ownerID).user.tag;
		const embed = new MessageEmbed()
			.setColor('RANDOM')
			.setAuthor(message.guild, message.guild.iconURL( ))
			.setTitle('Server Info', message.guild)
			.setThumbnail(message.guild.iconURL( { dynamic: true } ))
      .addField("owner", Owner)
			.addField('Location', message.guild.region, true)
quartz kindle
#

but if that errors a bunch of other things will be erroring as well

#

because discord borked

opal plank
#

is discord never borked tho?

quartz kindle
quartz kindle
opal plank
#

well yeah

#

its very unlikely they'll try to get a different guild and ownerId

earnest phoenix
#

@earnest phoenix

void gate
#

hello i made a bot. But I don't know how to command.

dusky sundial
#

Do you have any knowledge in programming?

void gate
#

Which program?

dusky sundial
#

No, programming

#

coding

void gate
#

I have codes

dusky sundial
#

Do you understand them?

void gate
#

yes

dusky sundial
#

So what is your issue?

void gate
#

I don't know where to code, I need a command program.

dusky sundial
#

What language are you programming in?

void gate
#

tr

dusky sundial
#

tr?

#

Programming language

void gate
#

Turkish

dusky sundial
#

Turkish is not a programming language

crimson vapor
#

gotta save every time someone does that

sudden geyser
#

no stars for you

zenith terrace
earnest phoenix
wary oriole
void gate
wary oriole
#

aha valla

dusky sundial
wary oriole
#

oke

void gate
dusky sundial
#

I mean, there's a whole lot of them

#

but the most popular ones for bot development are Python and JavaScript

dusky sundial
#

What about it?

void gate
#

yes

dusky sundial
#

Yes? Okay huh

void gate
#

ok

void gate
void gate
dusky sundial
void gate
#

how so?

opal plank
#

pretty sure w3schools has py course

void gate
#

thank you

opal plank
#

np

void gate
opal plank
void gate
#

what is np?

opal plank
void gate
#

I do not know much English

opal plank
#

it means "you welcome"

#

"no problem"

void gate
#

ok

hidden anchor
#

hiw

#

fo

#

i

dusky sundial
#

@earnest phoenix move to #general-int for other languages please

hidden anchor
#

how do i share my bot in top.gg ?

dusky sundial
opal plank
#

some people never learn

hidden anchor
#

or any ?

opal plank
#

any

dusky sundial
#

As long as it works

hidden anchor
#

kk

dusky sundial
#

and follows the rules

hidden anchor
#

rules ?

dusky sundial
hidden anchor
#

k

#

Just a question

#

How do I make a bot always online for free

#

( Best Method )

dusky sundial
#

There is no good free way to do it

hidden anchor
#

is this good ?

dusky sundial
#

It might work, but once again, it's not going to be good

quartz kindle
#

the best free host you can get is google compute engine f1-micro, but you need to have a credit card to create an account

hidden anchor
#

tnx bro ❤️

quartz kindle
#

repl.it is probably the best option that is free and does not require anything

#

but its not 24/7 it goes offline if its not active after a while

lavish bramble
#

Yup

hidden anchor
#

ohhh

#

sh!t

zenith terrace
hidden anchor
#

am building a bot for ip & geo tools

#

used by coders... hackers baybe

zenith terrace
quartz kindle
#

you still need to setup an external service

quartz kindle
#

but there are services like uptimerobot that can be used to keep it online by regularly sending it requests and not allowing it to go inactive

#

so yes there are tricks to make it stay online longer

covert tree
#

does repl.it hacker plan keep it online 24/7

quartz kindle
#

paid plans never go offline

covert tree
#

ok ty

old cliff
#

Use heroku

quartz kindle
#

use an actual vps

pale vessel
old cliff
pale vessel
#

But expensive af

modest maple
quartz kindle
#

cant compare with an actual vps lol

zenith terrace
pale vessel
#

Ghost ping

#

I saw that

quartz kindle
#

oh yes very worth much wow

covert tree
nocturne grove
#

ok I heard there was a new way voor vote webhooks etc. (https://www.npmjs.com/package/@top-gg/sdk). Is it right that that package only replaces the webhook and the rest should go the old way (including the <dbl>.on(error event)?

quartz kindle
#

that package replaces the entire dblapi

#

you have to change both webhook and rest

modest maple
#

omegalul Rewrite it all

nocturne grove
#

ohh now I see, there is an url there to further documentation

#

thanks

nocturne grove
exotic lotus
#

Lang: Python
Files

main.py
logo.png

Code py "small_image": "logo.png"

pale vessel
#

very professional

exotic lotus
#

Is this the correct way to use img in python? Cuz the img isnt being displayed by the programm

quartz kindle
#

wat

earnest phoenix
#

Hey guys

#

I got sublime text 3

#

And now wat shoud i do?

pale vessel
#

kode

#

and be programmer

quartz kindle
#

wdym what you should do

#

why did you get it?

earnest phoenix
lavish bramble
#

Can I get a database with infinite storage

quartz kindle
#

no

lavish bramble
#

For my bot

#

Like dyno

earnest phoenix
earnest phoenix
#

GODDAMIT

pale vessel
quartz kindle
#

@earnest phoenix what do you want to do? why did you get sublime text?

earnest phoenix
#

I DUNNO SOME GUY

#

JUST TOLD ME

quartz kindle
#

...

lavish bramble
#

So what can I use for database with maximum storage

quartz kindle
#

what did you tell them that made them tell you to use sublime text?

old cliff
#

Thats a scam lol

quartz kindle
#

exactly

earnest phoenix
#

They kinda say

lavish bramble
#

what can I use for my database

earnest phoenix
#

OH FU I FORGOT

quartz kindle
# earnest phoenix I dunno...

is there anything you DO know? every time you come here with weird out-of-context questions and when we ask more information about what you actually want you just say you dont know lol

#

we cant help if you cant explain what exactly are you trying to do

old cliff
#

No... its 7$ for hobby plan

#

Which is also of double price

#

But the git deploy is worth it perhaps

quartz kindle
#

have you seen how much their redis costs?

#

its hilarious lmao

earnest phoenix
#

Fuc thats it im weird

#

Gofddddddd

nocturne grove
#

Can I still use this code with the "new" dbl api?

// changed line:
const dbl = new DBLAPI.Api(DBL.token);

dbl.on('error', (error) => {
    consoleLog(error.stack);
});

dbl.webhook.on('ready', (hook) => {
    consoleLog(`DBL webhook running at port ${hook.port}!`);
});```
quartz kindle
#

no i dont think so

rocky dagger
#

i get a TypeError: Cannot read property 'send' of undefined error when i do this and i have the correct id and name```js
const bountyChannel = client.channels.cache.find(channel => channel.name.toLowerCase() === 'bounty');
bountyChannel.send('hello');
or
const bountyChannel = client.channels.cache.get('channelID')
bountyChannel.send('hello');

nocturne grove
#

edited :)

#

still not?

quartz kindle
#

nope

nocturne grove
#

hm thanks. Do you know an alternative? Can't see it in the documentation

quartz kindle
rocky dagger
#

but why? i have the correct id and name

quartz kindle
#

where are you using that code?

old cliff
#

Discord should fix its mobile copy text and also copy formatting such as ** **

nocturne grove
#

oh wait I'm in the wrong channel for this

rocky dagger
#

idk if thats what you mean

nocturne grove
#

@quartz kindle so there's no way to know if your webhook is ready or if there's any error?

#

it's not in the docs

quartz kindle
fierce ether
#
          registerCommand(Command) {
            if (typeof Command !== 'function') return;
            

              let command = new Command(this._config, this.beta)``` this isnt registering commands all of a sudden
quartz kindle
#

you post your server starts yourself in an interval, so to check for errors just catch the function

nocturne grove
#

no I found another package for that

quartz kindle
#

and webhooks are used in a webserver as a middleware so use your webserver's own events

nocturne grove
quartz kindle
#

then use that one

#

that one has an event as you can see in the example

nocturne grove
#

ok but still no error event?

rocky dagger
# quartz kindle show your code
const Discord = require('discord.js');
const client = new Discord.Client();

module.exports = {
    name: 't',
    description: 'test',

    async execute(message, args) {

        const bountyChannel = client.channels.cache.find(channel => channel.name.toLowerCase() === 'bounty');
        if(!bountyChannel)    {
            console.log('channel not found');
        } else {
            bountyChannel.send('hello');
        }
    }
}```
nocturne grove
#

yes only a 'posted' event, but I only want to know when something's going wrong

#

but if that event doesn't exist, I think it's not relevant

quartz kindle
#

it auto-logs errors to the console

nocturne grove
#

oh that's nice

#

thanks for the help

quartz kindle
#

new Discord.Client(); creates a new discord client, completely empty and not logged in

rocky dagger
#

Ohh

feral aspen
#
Object.keys(inventory.inventory).includes(itemToUse);

I have this object called inventory and I have a property called attitudecoin that is stored as a value to itemToUse.

#

How can I check if the value of attitudecoin is more than 1?

woeful pike
feral aspen
pale vessel
#

Filter by item name and check the array length

quartz kindle
#

xD

#

honestly at that price the server better be inside a nuclear bunker

feral aspen
pale vessel
#

if the value is the item count, yes

feral aspen
#

the first inventory ignore that.

#

Second inventory is the object.

#

The bracket notation value is the item ID

#

or as known as the property

#

so we take that value and check if its greater than 1.

#

Correct what I did?

quartz kindle
#

you're checking if its greater or equal to 1

#

but yes

feral aspen
#

👍

#

Thanks! :)

#

Is there no not greater than or equal to symbol?

sudden geyser
#

<=

#

Is less than or equal to

#

< is less than

#

> is greater than

feral aspen
#

I know.

#

Ah, woops

#

Ok, figured it out, thanks.

placid meadow
#

does js do != or <> ?

#

or both ?

quartz kindle
#

!= and !==

#

there's no <>

placid meadow
#

whats the double = for ?

quartz kindle
#

strict equality

placid meadow
#

or the triple = ?

#

i see

quartz kindle
#

same value and same type

placid meadow
#

is that like Type bounded or something ?

quartz kindle
#

like 1 == "1" is true but 1 === "1" is false

placid meadow
#

i see

#

type bounded

fierce ether
#

              for (const file of files) {
                  this.registerCommand(requireReload(file))
              }``` is returning command first alias
rocky dagger
umbral zealot
#

you should only have ONE of those.

#

don't create one in each of your files

rocky dagger
#

then i get ReferenceError: client is not defined

umbral zealot
#

you have to find how to get the client from other objects

crystal breach
#

oop

umbral zealot
#

in the case of your code here, message.client is a thing

feral aspen
#
(node:2416) UnhandledPromiseRejectionWarning: C:\Users\Mohammad Hajjiri\Desktop\Attitude\src\commands\economy\inventory.js:80
                                    if (key === 0) continue;
                                                   ^^^^^^^^
SyntaxError: Illegal continue statement: no surrounding iteration statement
const mappedData = Object.keys(inventory.inventory)
    .map((key) => {
        if (key === 0) continue;

        ...
    }).join("\n\n")

Did I do something wrong?

umbral zealot
#

map doesn't allow for continue

#

you'd have to filter first instead

feral aspen
#

Bruhhhhh

umbral zealot
#

bruh what

#

use Array.filter

feral aspen
#

Alright, thanks!

sudden basin
#

hi can someone pls help me setup fact of the day bot plss?

umbral zealot
#

Is this a bot you made or one on top.gg?

sudden basin
#

its teh fact of the day bot that i wanna setup in my server

umbral zealot
#

Ah ok in this case this is the wrong server. You're on top.gg server not the Fact Of The Day support.

sudden basin
#

oh thx

unreal estuary
#

Your client should store the session_id from the Ready, and the sequence number of the last event it received

#

can someone explain where i should get the sequence number from

#

OH

#

nvm

tawdry oracle
#

how can i have a difference presence for each shard of the bot?

old cliff
#

yes

tawdry oracle
#

yes

#

but how

pale vessel
silent hornet
#

hi guys !

pale vessel
#

hey !

silent hornet
#

anyone know an npm package for music filters? ( 8D, bassboosted)

pale vessel
#

are you using lavalink?

silent hornet
#

noup

pale vessel
#

ffmpeg?

silent hornet
#

discord-core

pale vessel
#

discord-ytdl-core ah

silent hornet
#

yes ffmpeg too

silent hornet
#

i want to add filters

#

xD

#

maybe premium command 🙂

old cliff
#

use discord-player ezier

silent hornet
#

yea I saw taht

#

that

#

can I implement that or I must change all code?

silent hornet
old cliff
#

no spoonfeed

silent hornet
tawdry oracle
# pale vessel

yes but how do i do that each shard has a different presence

cinder patio
#

Get the amount of all shards, loop through each one of em, set a status depending on the id or just randomly

quartz kindle
#

js find of the day:
a = [""]; a.pop(); a.push("a");
is faster than:
a = []; a.push("a");

slender thistle
#

Sorry what

quartz kindle
#

yes

pale vessel
quartz kindle
#

30% faster

#

the reason is simple

#

[""] tells v8 to create an array of strings

#

[] tells v8 to create an array of unknown type

#

when you push a string, it has to convert the array type if its different than the value type

opal copper
#

Can someone explain me the difference between client.on and client.once in Discord.JS, i never had to use .once and their difference is explained nowhere

cinder patio
#

Once executes the callback... once when the event occurs

umbral zealot
#

no

#

.on() can run multiple times. .once() will run once and then self-destruct so it won't run again.

#

So if you were to do something like client.once("message", msg => console.log(msg)) it would get one message, then never react again.

cinder patio
#

I was trying to say the same thing, should've worded it better

umbral zealot
#

yeah sorry I misread what you said, Google. somehow my brain saw "error" instead of "event" kekface

opal copper
umbral zealot
#

yeah no definitely not a solution for that, unfortunately.

opal copper
#

anyway thx for the explanation

feral aspen
#
const mappedData = Object.keys(inventory.inventory)
.filter(key => key !== 0)
.map((key) => {
    const itemName = items.find((val) => val.id.toLowerCase() === key).name;
    const itemID = items.find((val) => val.id.toLowerCase() === key).id;
    const itemLogo = items.find((val) => val.id.toLowerCase() === key).logo;

    return `${itemLogo} **${itemName}** ─ ${inventory.inventory[key]}\n**ID:** \`${itemID}\``;
})
.join("\n\n")

embed.addField("Owned Items", mappedData);

I applied the filter, but doesn't seem to work.

#

I was planning to add continue in map but doesn't work.

umbral zealot
#

define "not working"

#

what's the problem

earnest phoenix
#

Is it advisable extend the Client class?

pale vessel
#

yes

feral aspen
cinder patio
#

do you know the type of key

#

could be a string

crimson vapor
#

just .filter(k => k)

cinder patio
#

because you compare it to a string in the map callback

umbral zealot
#

so the numbers there, 0, 1, 2, that looks like it's inventory.inventory[key] which yould mean it's your other array that's returning that value

#

not the key

cinder patio
#

Try a loose compare

#

val.id.toLowerCase() === key if this is returning true then key is 100% a string

quartz kindle
#

if your inventory is something like js { a: 1, b: 2, c:0 } then when you do Object.keys(inventory) you get ["a","b","c"]

#

aka, the KEYS of the object

#

of course you cant filter the value like that

cinder patio
#

the keys could be numbers

#

I mean, strings containing a number, object keys are always strings

#

That's why it doesn't work, he's strictly comparing if the key is 0

#

and it returns false cause key is a string

quartz kindle
#

his keys are not numbers

#

the values are numbers

tawdry oracle
#

if the server goes out of ram, pm2 just stops the process?

cinder patio
#

It restarts it if that option is on (it is by default I think)

tawdry oracle
#

whats the option? the --no-autorestart keeps turning off my bot on the vps with no reason

cinder patio
#

It restarts the bot by default

tawdry oracle
#

not restart

cinder patio
#

--no-autorestart, like the name suggests, doesn't restart it

tawdry oracle
#

shut down

#

it shuts down one of the process with no reason

feral aspen
cinder patio
#

When the auto restart option is on?

feral aspen
#

keys were the properties and I had to deal with the values not the properties.

tawdry oracle
#

yes

#

and without it

feral aspen
#

.filter((_, value) => value !== 0)

earnest phoenix
#

when is it good to use multiple event listeners

quartz kindle
feral aspen
#

👀

quartz kindle
#

the second parameter is the index

earnest phoenix
#

use a map or djs collection instead of an object for your inventory

quartz kindle
#

not the value of the item

earnest phoenix
#

that way it is wayyyy easier

quartz kindle
#

it worked only because its the first value thats 0

cinder patio
# earnest phoenix when is it good to use multiple event listeners

When you want to structure your code, I guess. Let's say you have two different functions which do two different things but need to listen to the same event, you can put them in a single event listener, which will make the code messier, or you can just have two different event listeners for the same event

feral aspen
#

It used to return the 0 part.

quartz kindle
#

if any other value is 0 it will not work

tawdry oracle
#

Someone here uses pm2?

earnest phoenix
feral aspen
cinder patio
feral aspen
#

What now. pain

earnest phoenix
#

no

#

multiple mesasge event listeners to make code prety

feral aspen
quartz kindle
#

you have keys, not values

#

so if you want to filter the keys

#

you have to do something with them

feral aspen
#

keys is the properties, but I want to fill the values

cinder patio
#

Use Object.entries instead

quartz kindle
#

to get the values they are assigned to

outer perch
#

omfg, I forgot what's called when you can align the text at different hanging points

quartz kindle
#

for example

cinder patio
#

Or just inventory.inventory[key]

quartz kindle
#

.filter(key => object[key] > 0)

feral aspen
#

I am trying to deal with the values of the keys

feral aspen
feral aspen
cinder patio
#

bruh

tawdry oracle
#

can someone respond me? : (

feral aspen
quartz kindle
outer perch
#

what's called the text alignment thing?

#

like Top, Middle and Bottom

tawdry oracle
#

logs dont say anything

quartz kindle
#

what do the logs say?

#

are you sure?

tawdry oracle
#

lol

#

yes wait

quartz kindle
#

pm2 logs yourprocessname --lines=500

earnest phoenix
#

that's text-align

outer perch
#

but I wanted the image that shows you those alignments at W3

tawdry oracle
outer perch
#

I can't find it xD

#

I have this but there isn't the image I saw somewhere around here

quartz kindle
#

also scroll up to the errors section and show the last logs from there

tawdry oracle
#

i think i know whats happening

#
PM2        | 2021-04-15T15:05:10: PM2 log: App [doom:0] exited with code [1] via signal [SIGINT]
PM2        | 2021-04-15T15:17:25: PM2 log: Process 0 in a stopped status, starting it
PM2        | 2021-04-15T15:17:25: PM2 log: App [doom:0] starting in -fork mode-
PM2        | 2021-04-15T15:17:25: PM2 log: App [doom:0] online
#

its a mongodb connection error

#

the vps keeps disconnecting mongodb

quartz kindle
#

anything in the error logs tho?

tawdry oracle
#

no

#

just normal bot logs

quartz kindle
#

did you scroll up to the errors section?

tawdry oracle
#
0|doom|      ReferenceError: client is not defined
0|doom|      at NativeConnection.<anonymous> (/root/doom/mongodb.js:24:61)
```is the lastest error from like a week ago
#

fuck google im moving to aws

quartz kindle
#

lol

lyric mountain
#

just maybe tho

quartz kindle
#

well he said thats from 1 week ago

tawdry oracle
#

ye

#

was fixed instantly

fierce ether
#

(node:5100) UnhandledPromiseRejectionWarning: TypeError: Class constructor AddRole cannot be invoked without 'new' if i add new (node:5272) UnhandledPromiseRejectionWarning: TypeError: Command is not a constructor

lyric mountain
#

read docs, you're trying to add a role the wrong way

fierce ether
#

no, im trying to run the command, it wont even register the command

#
          /**
           * Register commands to client
           * @param {Command} Command command class to add to client
           * no async/await for performance
           */
          registerCommand(Command) {
              let command = new Command(this._config, this.beta)```
lyric mountain
#

show your Command file

fierce ether
#
'use strict'

const { Command, Color, MessageEmbed, FailureEmbed } = require('../../')
    /**
     * @class AddRole
     * @extends Command
    */
 class AddRole extends Command {
    constructor(...args) {
        super(...args);

        this.name            = 'Add Role'
        this.aliases         = ['addrole', 'createrole'],
        this.group           = 'Administrator',
        this.description     = 'Add a new role, with optional color and hoist.',
        this.usage           = 'addrole [hex color] [name] [hoist]';
    this.example         = 'addrole #748bd4 test true';
        this.botPermissions  = 'ADMINISTRATOR',
        this.permissions     = 'MANAGE_ROLES'
        this.parameters      = [{ type: 'color', required: false}, 
          { type: 'string', required: true, missingError: 'failures:commands.createRoleFailure'}, 
          { type: 'boolean', required: false }]
    }
}

module.exports = AddRole;```
lyric mountain
#

that's AddRole file

#

not Command file

fierce ether
#

thats the command file?

lyric mountain
#

or is Command internal?