#development

1 messages · Page 1214 of 1

pale vessel
#
function foo(bar = {}) {
   if (bar.something) ...
}```
earnest phoenix
#

lol

uncut cosmos
#

hey

earnest phoenix
#

hi

uncut cosmos
#

do u know how to get a bot to detect words without a prefix

earnest phoenix
#

no ı'm new this bot jobs

uncut cosmos
#

I code in Python

earnest phoenix
#

ı code in javascript

#

ı know middle js and pythom

#

n*

uncut cosmos
#

im just making an all in one bot

earnest phoenix
#

hmmmmm

#

well, ı think you will make a very good bot

uncut cosmos
#

its in 7 servers already

earnest phoenix
#

wow

#

ı'm waiting verify

uncut cosmos
#

and u can do !Cloaked for my YT or get ur own link

earnest phoenix
#

wow amazing !

digital ibex
#

if message.content.startswith(prefix):
whatever here

uncut cosmos
#

oh thats it

digital ibex
#

yeah

uncut cosmos
#

danng thanks officially lost

digital ibex
#

its a boolean btw and np

uncut cosmos
#

wait how do i block a word

#

sorry

digital ibex
#

wym block?

uncut cosmos
#

so if someone curses

#

its blocked

digital ibex
#

if “word” in message.content:
whatever

uncut cosmos
#

so i wright the word before message

digital ibex
#

yeah

pale vessel
#

With

uncut cosmos
#

if "word" message.content.startswith(prefix):

slender thistle
#

what

uncut cosmos
#

thats what it should look like ?

slender thistle
#

Use the and operator

#

if word in messagecontent and messagecontent.startswith

carmine summit
#

Is there a way to edit an array if the command is run by the same user?

small prairie
#

Edit an array?

carmine summit
#

delete and create a new one

#

if editing an array is not thing

small prairie
#

array[index]=whateveryouwant

#

Think that'll work

carmine summit
#

no i think that will not work because i didnt understand

small prairie
#

what?

pale vessel
#

if editing an array is not thing
@carmine summit it is

carmine summit
#

what i wanted to do is create a list. But only 1 value is allowed for each user. If a user runs the command again, the value will be replaced to the latest

small prairie
#

Why are you using arrays for that?

carmine summit
#

i think itl be the thing for the job

small prairie
#

Objects would be much better

carmine summit
#

right

digital ibex
#

arrays should be used in this case

#

an array with objects inside

carmine summit
#

taht makes it more complicated

digital ibex
#

it doesnt, doesnt change anything

small prairie
#

Right
But you have have a JSON system too like message.channel for example works

digital ibex
#

js is object oriented

quartz kindle
#

is the value user specific or member specific?

carmine summit
#

member specific

quartz kindle
#

like does each user have only one global value, or can they have a different value per guild?

carmine summit
#

i think

#

only 1 guild

#

my bot is private

quartz kindle
#

ah

#

do you need this value to survive bot restarts?

carmine summit
#

yes

quartz kindle
#

the simplest way is to save it in a json file

small prairie
#

^^

carmine summit
#

no nvm

#

i want it to die if bot restarts

small prairie
#

Then just create a variable in the code itsel

quartz kindle
#

then you dont need storage, you can attach it directly to a user object

#

for example message.author.myvalue = something

small prairie
#

oh yea

carmine summit
#

how do i read it?

quartz kindle
#

client.users.cache.get(userid).myvalue

carmine summit
#

i would like a single command that dont have arguments

#

which displays all values

quartz kindle
#

array = client.users.cache.map(user => user.myvalue)

carmine summit
#

alright now im confused

quartz kindle
#

message.channel.send(array.join(", "))

#

you probably also want to filter out users that have no value

pale vessel
#

2k 👀

quartz kindle
#

so slap a .filter(Boolean) to the array

carmine summit
#

you probably also want to filter out users that have no value
yes

#

uh

quartz kindle
#

or filter them before mapping, its more efficient

#

do you need a more detailed explanation?

carmine summit
#

Y E S

small prairie
#

Tim why dont you teach/ host classes on zoom
pretty sure ton of people'll come you explain pretty well lmao

quartz kindle
#

ok, so client.users.cache contains all users your bot sees, which means users that are online or active

carmine summit
#

yes

#

go on

quartz kindle
#

when you receive a message event, message.author contains one of these users

#

so you can attach a new property to it, for example message.author.myvalue = 10, and it will be saved in the cached user

#

so the next time the same user sends a message, the message.author will have the property you set previously

#

because its stored in the user object, which is stored in the cache

#

so if you want to list all users that have this property set to something

#

you need to first go through all the users in client.users.cache, then filter out the users that have no property

#

for example client.users.cache.filter(user => user.myvalue)

#

that will return an array of users that have a myvalue defined

#

then you need to map the array into displaying only what you want to display, because right now you have an array of full user objects

#

so you do this using the map function: resultOfTheFilter.map(user => user.displayname + ": " + user.myvalue)

#

that will return an array of strings like this: ["username1: value","username2: value","etc..."]

#

then to send this array as a message, you need to join it: array.join(", ")

#

in this case we joined it using a comma and a space

#

so the resulting message will be username1: value, username2: value, etc...

#

@small prairie i would if i got paid for that

small prairie
#

Pretty sure you would if you can find the right audience

earnest phoenix
#

uhhhh

#

long text

#

@quartz kindle Stackoverflow, how do i use JavaASM

quartz kindle
#

no idea

earnest phoenix
#

awh not stackoverflow

quartz kindle
#

definitively not for java

pure lion
#

Tim only scripts in java 😔 😔 😔 😔

uncut cosmos
#

hey

#

i need some help

pale vessel
#

just ask

uncut cosmos
#

I cant figure out how to block words with my bot

#

im doing it in python so heres the code

#

if "word" message.content.messagestartswithout(prefix):

tall current
#

What are some of the best bots to add to a server to spice it up cause my server is boring

uncut cosmos
#

Mr strawberry im making a bot with a bunch of commands

small prairie
#

What are some of the best bots to add to a server to spice it up cause my server is boring
@tall current #memes-and-media or #general

uncut cosmos
#

do u want to add it

tall current
#

Sorry @small prairie

uncut cosmos
#

my bot can say hi or get a YT link. SosOSosOSO EpIC

#

i really need help though

jagged sun
#

Hi, has someone got experience with discord.js and ytdl for a discord music bot? I always get the error Input stream: Status code: 416 while streaming the audio to a channel, what kills the stream, does someone know how to fix that?

thin turret
#

scripted java or javascript

#

😳

jagged sun
#

javascript

wanton anvil
#

can i use this in json?

{
  "members":[{"12345":"Numbers"}]
}
earnest phoenix
#

youtube kills the connection because you're hanging it for too long @jagged sun

#

so far i managed to fix this in c# where i buffer what comes from youtube, download it asap and while downloading stream it to discord

#

idling here need help ping me

#

if you're using ffmpeg you can also instruct it to reconnect iirc

wanton anvil
#

@earnest phoenix need help

earnest phoenix
#

with what

wanton anvil
#

can i use this in json?

{
  "members":[{"12345":"Numbers"}]
}

@wanton anvil

#

can i use numbers in keys

#

like this

earnest phoenix
#

yep

#

it will still be a string

wanton anvil
#

thank you bro

earnest phoenix
#

you should make it an actual Number in JavaScript instead of literally just throwing in the word Numbers inside a string

wanton anvil
#

i use python

pale vessel
#

that would be a dict

wanton anvil
#

thanks

#

ok

earnest phoenix
#

example:

{
  "members": [
    {
      "serverID": 1234 //memberCount
    }
]
}
wanton anvil
#

i can use numbers too right?

earnest phoenix
#

maybe

wanton anvil
#

maybe?

earnest phoenix
#

nto really experienced with Python

pale vessel
#

in values yes

wanton anvil
#

not in values

#

as keys

pale vessel
#

then no

earnest phoenix
#

json stores nums up to 53 bits

carmine summit
#

@quartz kindle how do I remove an array?

earnest phoenix
#

53

#

what the hell

#

blame js

#

lmao

wanton anvil
#

can i use this in json?

{
  "members":[{"12345":"Numbers"}]
}

like this @pale vessel

pale vessel
#

those are in strings

#

that's okay

earnest phoenix
#

yeah

wanton anvil
#

i can work?

#

i mean it works?

earnest phoenix
#

as long as you know whether it is a string or a number it would work

wanton anvil
#

thanks for help @earnest phoenix @pale vessel

earnest phoenix
#

lmao did i even help

wanton anvil
#

yeah of course

weak rain
#

do anyone know

#

how to use canvacord

pale vessel
#

waitWhat there's docs

#

hold on

#

i would understand people asking how to use canvas but a module that does everything for you?

#

jeez

#

sorry for my toxicity 😔

weak rain
#

ok

earnest phoenix
#

LoL

faint prism
#

json stores nums up to 53 bits
@earnest phoenix I was confused until I read it stores as floating-point values for regular integers, and the mantissa has 53 bits.

thick gull
#

i would understand people asking how to use canvas but a module that does everything for you?
@pale vessel bruh i had no idea canvacord did this, this is like 50% of all bots

pale vessel
#

some just use canvas itself

#

or APIs

slender wagon
#

is it possible to make a userinfo in canvas?

weak rain
#

Hm Yes

#

but u need high knowledge of canvas

#

for that

pale vessel
#

is it possible to make a userinfo in canvas?
@slender wagon someone already did it

slender wagon
#

damn i wanna learn that

pale vessel
#

but not in canvas, PIL in python

#

but canvas can do the same

earnest phoenix
#

Canvas make my brain explode

#

of thoose x, y, z

#

smh

faint prism
#

So in JS, the first few bits are reserved for the sign, and exponent.

earnest phoenix
#

can u guys give me a idea how Cap message warn function will work ?

#

just the idea

#

umm

#

it just dms the user

#

and add it to an array of his warns

jagged sun
#

What can I do when I get in JS an error without Stacks, Objects, anything, just UnhandledPromiseRejectionWarning: #<Object>?

fringe axle
#

How can I get a users guild join date? I looked in the docks and I found it but it‘s undefined for me...

fluid basin
#

you cannot get a "users" guild join date

fringe axle
#

Hm...

fluid basin
#

you can only get a member's guild join date

earnest phoenix
#

fringe axle
#

I tried message.author.joinedAt

#

And it‘s undefined

earnest phoenix
#

cuz

#

message.author returns a User class

#

you need to do message.member

fringe axle
#

Yea, I see. Thanks!

earnest phoenix
#

hmm

spare flicker
#

someone knows how to make a dashboard page like mee6?

misty sigil
#

yes

serene cliff
#

do anyone have any experience in docker? are you able to connect to discord gateway with a different ip, beside the server ip if you change the ip in docker compose file at port section?

misty sigil
#

you need

  1. OAuth2
  2. A good knowledge of web design
  3. A good knowledge of how to make the buttons do what you need them to do
  4. A number of other things
empty bough
#

how will i know when my bot is approved?

#

and what must i do to activate it

misty sigil
#

you don’t activate it

empty bough
#

ok just making sure anyway how will i know it's been approved?

misty sigil
#

luca dm u

empty bough
#

???

earnest phoenix
#

Your bot @Bot Cool has been approved! :tada:

empty bough
#

???

earnest phoenix
pale vessel
#

good for you

serene cliff
#

he was just showing an example to luis

#

since he didnt understand

empty bough
#

oh ok

#

thx

earnest phoenix
#

Hey

pure lion
#

is the nginx document root a file or a dir?

earnest phoenix
#

dir

#

There's something I don't understand about the documentation of top.gg

pure lion
#

just ask

misty sigil
#

what do it be

pure lion
#

also thank

earnest phoenix
pale vessel
#

in the body

#

header is for authorization

earnest phoenix
#

Thx ^^

stable eagle
#
                    ^

TypeError: Cannot read property 'toString' of undefined``` this is a function which adds a comma after thousands space, but this function gives an error when the argument doesnt contain a number, how do I fix that?
earnest phoenix
#

num = ?

faint prism
#

null, probably

pale vessel
fringe axle
#

So I have this:

            const presenceStatus = member.presence.activities.find(a => a.type === "CUSTOM_STATUS").state;

            if(presenceStatus === undefined) {
                return "None"
            }
``` but it don't say ``"None`` it says:
#

Someone knows why? (discord.js v12)

fluid basin
#

for 1 sec I thought you were mod

fringe axle
#

XD

fluid basin
#

uh

#

if you find a collection, you get a collection

#

not the activity

#

so you need .first() or something

fringe axle
#

Oh

#

Hm

slender thistle
#

Shouldn't .find return one element and not a collection? I think it would make sense if it was .filter or something 🤔

fringe axle
#

Okay

fluid basin
#

find can return more one iirc

#

wait let me check again

sonic lodge
fluid basin
#

hm interesting

#

@fringe axle ok you need check if the activity exist first then

fringe axle
#

Oh

#

hmmm...

fluid basin
#

let activity = ...find()
if (activity.state == ..) dowhatever

fringe axle
#

Okay

formal gale
#

Please enter at least 300 characters excluding special characters in your detailed description. Add your commands. Spaces or empty spaces are not counted.

#

how can ı do this

#

ı need to add my bot

sonic lodge
#

describe your bot

pale vessel
faint prism
#

Exactly like it says

formal gale
#

ım write a describe but program dont accept that

sonic lodge
#

write more

earnest phoenix
#

How i can check does message content includes a value from array ?

sonic lodge
#

use array.includes(message_content)

earnest phoenix
#

._.

remote yacht
#

i want to call the stop method inside my presenceUpdate Event
if the newPresence is 'offline' then it will run the collector.stop() method
but my collector is initiated inside my rank.js file
i tried making a Collection object
bot.y = new Collection()

then i set the collector data
bot.y.set('something', collector);

then in presenceUpdate event i get the event
bot.y.get('something').stop()
but it returns undefined
and the strange thing is
handleCollect and handleDispose methods are returned when i use get() but not the stop method
how to call the stop() method?

earnest phoenix
#

@sonic lodge No

fringe axle
sonic lodge
#

wdym "no"

#

that's what you need

faint prism
#

Development in Production
😖

earnest phoenix
#

I can know it but not what i mean

#

nvm imma go stackover flow

sonic lodge
#

is it the opposite

earnest phoenix
#
                let badwords = await require("../../asset/badwords");
                if(message.member.permissions.has("MANAGE_GUILD") || message.member.permissions.has("ADMINISTRATOR"))
                if(badwords.some(a => message.content.includes(a))) {
                    return message.reply("no swear in this channel !").then(m => m.delete({ timeout: 5000}))
                }

@sonic lodge from stackoverflow heheheheheh

sonic lodge
#

don't copy paste code

earnest phoenix
#

@faint prism why

#

i dont copy

#

dude tell me where is copy

sonic lodge
#

"from stackoverflow" -> "i dont copy"

thick gull
#

what is this

earnest phoenix
#
if (substrings.some(v => str.includes(v))) {
    // There's at least one
}
thick gull
#

it doesnt even

#

do anything for that if statement

earnest phoenix
#

this is the example

thick gull
#

if(message.member.permissions.has("MANAGE_GUILD") || message.member.permissions.has("ADMINISTRATOR"))

#

not returning nothing?

earnest phoenix
#

oh no

thick gull
#

does that even work

earnest phoenix
#

i forgot

#
let badwords = await require("../../asset/badwords");
                if(!message.member.permissions.has("MANAGE_GUILD") || !message.member.permissions.has("ADMINISTRATOR")){
                    if(badwords.some(a => message.content.includes(a))) {
                        return message.reply("no swear in this channel !").then(m => m.delete({ timeout: 5000}))
                    }
                }

fixed

pale vessel
#

do you need to check for admin?

earnest phoenix
#
{ error: 'Required parameter server_count or shards missing' }
#

admin ?

pale vessel
#

i don't think so

earnest phoenix
#

;-;

#

why

pale vessel
#

admin permission

earnest phoenix
#

why

#

i dont need to check

#
fetch(`https://top.gg/api/bots/719185888864632873/stats`, {
        method: 'POST',
        headers: {
          'Authorization': config.mila.apiKey
        },
        body: {
          'server_count': this.client.guilds.cache.size
        },
      })
        .then(res => res.json())
        .then(_res => {
          console.log(_res)
        });
```It is great ?
pale vessel
#

admin has all permissions

earnest phoenix
#

hmm maybe

#

wait

#

administrator has all perms

#

WUT

#

didn't know

faint prism
#

Yeah, check if admin first, or omit completely if it implies all other perm checks are true

earnest phoenix
#

I don't understand

#

not working :/

#
{ error: 'Required parameter server_count or shards missing' }

@earnest phoenix

faint prism
earnest phoenix
#

I have set it

pale vessel
#

add a content type header and ^^

earnest phoenix
#

okay

#

add a content type header and ^^
@pale vessel

#

ohhhh

#

yes lol

pale vessel
#

also, the body is a stringified object

earnest phoenix
#

I'm lazy

#

application/json

pale vessel
#

use body: JSON.stringify({ foo: bar })

earnest phoenix
#

yes thx

#

yeah

#

thx a lot

#

its work

balmy knoll
#

Since a few days, my bot is having an average latency of 4000/5000ms. As host I use a free dyno of Heroku that has always worked (average ping of 150/250ms) and MongoDB Atlas as database. I have already changed database server, but it doesn't seem to work. Do you know how to try to fix the problem?

thick gull
#

its probably

#

heroku

balmy knoll
#

From the Heroku status website you don't see any problems 🙃

earnest phoenix
#

but heroku can steal ur bot token

#

: /

misty sigil
#

definitely heroku

earnest phoenix
#

and more more

faint prism
#

steal ur bot token
lol?

misty sigil
#

if you're making a bot that you believe in

earnest phoenix
#

@misty sigil paste ur 5 reason to not use heroku

misty sigil
#

put some investment into it

#

any """""""""""free""""""""""" hosting is/will either:

  1. not intended to be used as hosting for bots
  2. not actually suitable for hosting for bots
  3. not actually free
  4. will get your token stolen
  5. all of the above
earnest phoenix
#

xD

balmy knoll
#

Yes but first I need to be sure that the bot is working and developed well before investing

earnest phoenix
#

LoL i can't stop laught

fluid basin
#

sure

#

if you don't mind moving things around

misty sigil
#

i just shoved my shit into my vps

#

and i invested before it was ready

earnest phoenix
#

i hosted with heroku my bot 1month until it get in 5 server or more , then i move to VPS

balmy knoll
#

And anyway being a fairly light bot I always used a free dyno of Heroku, but I repeat I never had any problems until a few days ago

misty sigil
#

how many servers

balmy knoll
#

111

earnest phoenix
#

oh no

misty sigil
#

one hundred and eleven

#

ON HEROKU

earnest phoenix
#

u should move to VPS

#

they can sell ur bot token

#

or stole it

#

or something

balmy knoll
#

I repeat the bot is not yet ready and it is useless to go and invest until it is out of the development phase.

earnest phoenix
#

any """""""""""free""""""""""" hosting is/will either:

  1. not intended to be used as hosting for bots
  2. not actually suitable for hosting for bots
  3. not actually free
    4) will get your token stolen
  4. all of the above
misty sigil
#

thats why the ping's so high

#

your bot is fucking killing the heroku dyno

vale garden
#

hi

misty sigil
#

I repeat the bot is not yet ready and it is useless to go and invest until it is out of the development phase.
@balmy knoll it has 111 servers

#

you need a vps at this point

earnest phoenix
#

yes

vale garden
#
let counter = 0;
bot.on("message", function(message) {
  if (message.author.bot) return;

  counter++;
  if(counter % 3 === 0){
    bot.channels.cache.get(`718760245014298654`).send(`yeet`).then((args[0] === "catch")).then((message.channel.send("caught")))
    
  }
})
misty sigil
#

you cannot use heroku for such large scale

earnest phoenix
#

@vale garden ur bot will get ban soon

vale garden
#

i need this code to say caught only after someone saying t!catch

#

plz help

#

what

#

why

earnest phoenix
#

for that random respounce msg

vale garden
#

wdym

#

whats that

#

why

earnest phoenix
#

@misty sigil explain

misty sigil
#

what

earnest phoenix
#

about ghost bot

#

auto respounce msg

#

wihtout prefix

misty sigil
#

it'll be muted

#

not banned

vale garden
#

what

earnest phoenix
#

ye same

gritty bolt
#

i want to run a function on each entry of my mongodb database, what would be the best way to do this using nodejs

vale garden
#

that is how pokecord works

#

and it didnt get banned

#

tf

earnest phoenix
#

NO

balmy knoll
#

@misty sigil Ok, I understand you, but at least I should have performance problems in RAM, CPU or similar. The bot has connection problems so I don't understand at all what the problem is and how to fix it

vale garden
#

can you use mewbot

#

and other such clones

#

YES

misty sigil
#

the

earnest phoenix
#

ok nvm

vale garden
#

probably

earnest phoenix
#

what is the problem ?

vale garden
#

bruh

misty sigil
#

the ram and cpu bottlenecks the

vale garden
#

what is the problem ?
@earnest phoenix asking me

#

?

misty sigil
#

connection

earnest phoenix
#

yes

vale garden
#

oh

#

see i need the code to say caught

#

only when someone says t!catch

earnest phoenix
#

huh

vale garden
#

after the yeet message

#

how can i do that

gritty bolt
#

i want to run a function on each entry of my mongodb database, what would be the best way to do this using nodejs
@gritty bolt

vale garden
#

cuz now it says caught right after

earnest phoenix
#

wdym ?

#

oh

#

i see

#
if(message.content.startsWith("t!catch"){
//code
}
#

@vale garden ^^

vale garden
#

oh kk

#

thnx

#

but

#

i cant use if

#

inside a .then() statement

earnest phoenix
#

why

#

ahm

vale garden
#

you cant do that

earnest phoenix
#

u can use if() in .then()

vale garden
#

what

earnest phoenix
#
.then(() => {
  if(message.content.startsWith("t!catch"){
    //code
  }
})
vale garden
#

kk thx

gritty bolt
#

i want to run a function on each entry of my mongodb database, what would be the best way to do this using nodejs

earnest phoenix
#

each entry of database ?

#

hmm

#

but it run only when you call ur database

#

right ?

#

so you can do code after that

#

@gritty bolt how u entry ur database ?

gritty bolt
#

mongoose

earnest phoenix
#

HOW

#

show code

gritty bolt
#

im asking how to loop through each entry

#

in mongoose

#

and preform a function on each one

earnest phoenix
#

but how u entry ?

gritty bolt
#
const messageReminderSchema = new mongoose.Schema({
                user: String,
                messageLink: String,
                time: String
            });```
#

thats my schema

earnest phoenix
#

ok but how u entry

gritty bolt
#

wdym by entry

earnest phoenix
#

"each entry of my mongodb database"

vale garden
#
let counter = 0;
bot.on("message", function(message) {
  if (message.author.bot) return;

  counter++;
  if(counter % 3 === 0){
    bot.channels.cache.get(`718760245014298654`).send(`yeet the feet`).then(() => {
  if(message.content.startsWith("t!catch")){
    message.channel.send("caught")
  }
})
    
  }
})
earnest phoenix
#

How u do ur entry

vale garden
#

this is the full code

#

and it isnt working

#

theres no response

earnest phoenix
#

@vale garden why

vale garden
#

wdym why

gritty bolt
#

oh

vale garden
#

it just isnt working

#

lol

gritty bolt
#

i meant that i wanted to loop through each entry

#

and preform a function

earnest phoenix
#

@gritty bolt i dont understand

gritty bolt
#

using the entry

#

like lets say I want to log each entry

earnest phoenix
#

ok

gritty bolt
#

into my console

earnest phoenix
#

how u get data from database

#

show code

gritty bolt
#

no im asking how to do the loop

#

like i dont know where to start

earnest phoenix
#
await mongoose.connect(URL, {
            useNewUrlParser: true,
            useUnifiedTopology: true
        })
#

this is to connect to ur database

misty sigil
#

he knows how

earnest phoenix
#

THEN HOW HE GET DATA FROM HIS DATABASE

#

smh

misty sigil
#

HE WANTS TO DO SOMETHING ON IT ALL YOU IDIOT

vale garden
#

someonee help plz

#
let counter = 0;
bot.on("message", function(message) {
  if (message.author.bot) return;

  counter++;
  if(counter % 3 === 0){
    bot.channels.cache.get(`718760245014298654`).send(`yeet the feet`).then(() => {
  if(message.content.startsWith("t!catch")){
    message.channel.send("caught")
  }
})
    
  }
})
#

the caught message isnt getting sent

#

for some reason

earnest phoenix
#
urData.findOne({SOmething: SOMEOTHING}, (err, result) => {})

this is one way to get data from ur database

fringe axle
misty sigil
#

@vale garden is that a message logger?

vale garden
#

yea

misty sigil
#

oHh no

vale garden
#

like after 3 messages

#

idk what you exactly mean by logger

#

but it sends a message every 3 messages of any user

earnest phoenix
#

like send info to another channel

#

that is log

vale garden
#

i am trying to make an rpg bot

earnest phoenix
#

mb

vale garden
#

no

#

lol

earnest phoenix
#

ok

#

console.log(conter) ?

vale garden
#

but why you askin

#

no it just sends a message

earnest phoenix
#

try it

vale garden
#

every 3 messages

#

wat

misty sigil
#

is it your first project in programming

vale garden
#

no the counter works

misty sigil
#

let me re-phrase that

vale garden
#

lol no

misty sigil
#

do you know basic js

vale garden
#

but well it is

#

wat

#

bruh

misty sigil
#

do you know basic js

earnest phoenix
#

maybe he know

vale garden
#

this is what @earnest phoenix told me

#

soo

earnest phoenix
#

and it should work

vale garden
#

and i do

misty sigil
#

ok tell me, what is an object

dire obsidian
#

What is the buttons class on the bot desc?

vale garden
#

bru

earnest phoenix
#

@vale garden ye what is an Object ?

vale garden
#

well

#

its a variable

gritty bolt
#

this is to connect to ur database
@earnest phoenix i know how to connect to the database

vale garden
#

ig

#

lol

gritty bolt
#

i dont know how to do the loop

vale garden
#

or a func

earnest phoenix
#

WDYM LOOP

misty sigil
#

objects aren't a variable

#

nor a function

vale garden
#

duude just

#

what

#

it is?

earnest phoenix
#
{
  Object: "THIS IS OBJECT"
}
vale garden
#

well

#

oh

misty sigil
#

@gritty bolt <find All>.forEach(data => console.log(data))

vale garden
#

nm

#

lol

#

nvm

gritty bolt
#

ok

#

thats all I needed lol

#

thanks

earnest phoenix
#

huh

#

wtf

vale garden
#

lol

earnest phoenix
#

nvm

gritty bolt
#

thats not the function im doing but I needed an example of how to start

earnest phoenix
#

@gritty bolt u suck at explain (Just saying)

vale garden
#

ok but why is this not working

#

it doesnt look wrong to me

earnest phoenix
#

hmm,

#

idk

vale garden
#

oof

earnest phoenix
#

console.log(counter)

#

just try it

#

and u will see

gritty bolt
#

ok

#

thanks?

#

i tried to explain it as best as I could?

fringe axle
gritty bolt
#

we coulda just ended it there lol

earnest phoenix
#

@fringe axle there is no thing has name state maybe

#

i think

fringe axle
#

Yes

#

But how can I return "None" instead of this error?

earnest phoenix
#

maybe use if(!pre. . .. )

fringe axle
#

Did that.

#

Still undefined

earnest phoenix
#

hmm

#
const presenceStatus = member.presence.activities.find(a => a.type === "CUSTOM_STATUS");

            if(presenceStatus === undefined) {
                return "None"
            }else{
              return presenceStatus.state
            }

@fringe axle ??

fringe axle
#

I can try it

earnest phoenix
#

k

crude karma
#

An alle die twitch haben... könnt ihr vllt bei einen streamer namens janos_yt die 2k Follower voll machen und ihm helfen die 100 Zuschauer zu kriegen

fringe axle
#

Same

crude karma
#

Pls sonst kommt Luft und levi xD

earnest phoenix
fringe axle
#

An alle die twitch haben... könnt ihr vllt bei einen streamer namens janos_yt die 2k Follower voll machen und ihm helfen die 100 Zuschauer zu kriegen
@crude karma It's advertising everyone!

earnest phoenix
fringe axle
#

Same error A-C-E

earnest phoenix
#

hmm

#

message.member

#

._.

#

not member

fringe axle
#

Bro... member is message.member...

earnest phoenix
#

:0

#

nvm

#

wait imma check docs

fringe axle
#

;__;

uncut vortex
#

I have a question

earnest phoenix
#

BRUH

#

@fringe axle .

fringe axle
#

ye?

earnest phoenix
#

wiat

#

smh

uncut vortex
#

I'm using javascript and I have a json. I don't know what the names of the items in the json as of coding but the code will know what the name is so I was wondering what the way to search for it is. I've tried this warplayers.message.author.id and it failed for obvious reasons but I don't know how to find the object in the json.

earnest phoenix
pure lion
#
nginx: [emerg] host not found in "*VPS IP:443" of the "listen" directive in /etc/nginx/sites-enabled/cosmicbotlist.tk.conf:2
nginx: configuration file /etc/nginx/nginx.conf test failed
#

how fix

fringe axle
#

@fringe axle it work normal to me : /
@earnest phoenix because you have one.

earnest phoenix
#

hmm let me try

#

without custom status

fringe axle
#

But if you have no Custom Status the error is coming

earnest phoenix
#
let statsu = message.member.presence.activities.find(a => a.type === "CUSTOM_STATUS");
if(!statsu) return message.channel.send("hmm");

@fringe axle try this

fringe axle
#

Okay

#

DA FUQ

#

He's returning the embed now with Custom Status

earnest phoenix
#

yes

#

nc

fringe axle
#

But with Custom Status

#

Not the text.

earnest phoenix
#

state ?

#

status.state

fringe axle
#

Okay, wait

#

It's returning hmmm

#

Good

earnest phoenix
#

yes nc

fringe axle
#

And now?

earnest phoenix
#

ah

#

show code

fringe axle
#
let presenceStatus = member.presence.activities.find(a => a.type === "CUSTOM_STATUS");
if(!presenceStatus) return message.channel.send("hmm");

earnest phoenix
#

do u have custom status ?

#

yes u have

#

ah

#

idk

#

idk

#

and idk

#

no clue

fringe axle
#

zMasterSkill has no custom status

#

Like you see in the screenshot

earnest phoenix
#

so it is good

#

ye

#

so it works

fringe axle
#

OH WAIT

#

I have a genius idea

earnest phoenix
#

huh

#

huh

fringe axle
#

HA

earnest phoenix
#

huh ?

fringe axle
#

If Custom Status is undefined he's just sending the same embed but without the custom status PU_200IQ

earnest phoenix
#

nc

#

but u can use without custom status

#
[{"name":"Visual Studio Code","type":"PLAYING","url":null,"details":"Editing ready.js","state":"Workspace: judger (Workspace)","applicationID":"383226320970055681","timestamps":{"start":"2020-09-04T14:26:19.656Z","end":null},"party":null,"assets":{"largeText":"Editing a JS file","smallText":"Visual Studio Code","largeImage":"565944799576719366","smallImage":"565945770067623946"},"flags":0,"emoji":null,"createdTimestamp":1599229579729}] 

for example this is my status

fringe axle
#

I know

delicate shore
#

I'm so fricking stupid

#

I accidentally leaked my token

#

And many people used bot client to login in my bot

earnest phoenix
#

idling here

#

need help ping me

pure lion
#

@earnest phoenix

#
nginx: [emerg] host not found in "*VPS IP:443" of the "listen" directive in /etc/nginx/sites-enabled/cosmicbotlist.tk.conf:2
nginx: configuration file /etc/nginx/nginx.conf test failed
#

hep

#

ple

#

s

#

e

#

ae

earnest phoenix
#

lmao

#

i use expressjs so uhhhh

pure lion
#

i use that too

pure lion
#

you think i havent done tha-

earnest phoenix
#

lmfao

#

never even heard of nginx so

pure lion
#

:(

delicate shore
#

SAD

earnest phoenix
#

there

#

URL encoded

#

no need to thank me

pure lion
#

no thank you (caps are stink)

earnest phoenix
#

@earnest phoenix

message.channel.send(`https://google.com/search?q=${question.split(" ").join("+")}`)
#

bruh

#

:))

#

do you think i'll use a bot for that

#

faster

#

bots makes everything faster

opal plank
#

question rq

earnest phoenix
#

bruh

opal plank
#

can i use this to grab creates and accumulatedWeiight from that object?

#

or will this be bound to the function?

earnest phoenix
#

this will be bound to the function

opal plank
#

hmmmm no way to hoist it?

earnest phoenix
#

maybe

opal plank
#

i mean i can pass down this.crates onto a param

earnest phoenix
#

ask @quartz kindle

misty sigil
#

why ask tim everything

opal plank
#

if anyone else knows, im more than happy to hear

fluid basin
#

wait what are you trying to do

#

@opal plank in what context

opal plank
#

i got it

fluid basin
#

neat

opal plank
#

arrow functions being fonky

fluid basin
#

yeah you need function to preserve the context

#

unless you do it like this

#

like

#

inline basically

#

hrm actually wait

opal plank
#

arrow functions cant call bind this onto parent aparently

#

only normal functions

earnest phoenix
#

is .endsWith even a valid string method in js?

misty sigil
#

yes i believe it is

earnest phoenix
#

interesting, alright thx

fluid basin
#

startsWith and endsWith

#

they both exist

#

@opal plank oh yeah, you can use it nested, but not as the top/parent function

opal plank
#

which is what i need

#

i think i got it though, going to let her run for a spin

#

see if it worked

fringe axle
#

message.author.presence.activities.name === 'Spotify' So I try this but it's still false but I listen to Spotify

fluid basin
#

what

misty sigil
#

.activities is an array iirc

fringe axle
#

Means?

slender thistle
#

collection

#

it's not just one activity object

fringe axle
#

Means? :0

fluid basin
#

its an array actually shiv

slender thistle
#

Fuck d.js with its fuckfest of own objects

fluid basin
#

ikr

fringe axle
#

What I have to change?

fluid basin
#

there is no .name

#

its array

fringe axle
#

Oh

slender thistle
#

You'll have to iterate over .activities

earnest phoenix
#

@fringe axle use activities[0]

fringe axle
#

Okay

earnest phoenix
#

for first activity

fringe axle
#

But I only want Spotify

earnest phoenix
#

then use .find()

fringe axle
#

Hm

earnest phoenix
#

nah or jusrt use [0]

#

maybe it is better : /

fringe axle
#

Nah

#

Won't work... hmmm

fluid basin
#

use find

fringe axle
#

Did it

#

Spotify is not a function. xD

jagged sun
drifting wedge
#

if i have a link

#

how do i fricking embed the image

slender thistle
#

In ASP.NET, should I worry about asynchronous tasks? If yes, what's the best way to achieve that?

earnest phoenix
#

I can help in a min

drifting wedge
#

using py

earnest phoenix
#

Nah node js

#

I know py too

slender thistle
#

Link it in set_image(url=image_link)

earnest phoenix
#

Yes

drifting wedge
#

Link it in set_image(url=image_link)
@slender thistle if the link is a variable?

#

same?

slender thistle
#

Replace image_link with the variable, yes

fringe axle
#

So I try if the user is listening to Spotify he return true but he don't

earnest phoenix
#

I can try to help in one min

fringe axle
#

Okay, thanks

fluid basin
#

uh

#

activities is array

fringe axle
#

I tried it too

#

I tried sooo many ways

dire obsidian
#

Quick question, web design or programation?

delicate shore
#
client.on("ready", () =>
console.log(`Black sheep is op`),
Promise.all(promises)
  .then(results => {
      const totalGuilds = results[0].reduce((acc, guildCount) => acc + guildCount, 0);
      const totalMembers = results[1].reduce((acc, memberCount) => acc + memberCount, 0)


      client.user.setPresence({ activity: { name: `bit.ly/blacksheepbot | ${totalGuilds} servers` }, status: 'idle' })
  })
  )```
#

no error but this is not working

fluid basin
#

web design does need to some extent programming

slender thistle
#

Quick question, web design or programation?
@dire obsidian What is the context to this question?

fluid basin
#

especially if you're using prototyping languages

#

like SASS or LESS

dire obsidian
#

Java or JavaScript

#

Ill just learn one

slender thistle
#

JS can be used outside of web browsers

fluid basin
#

Javascript is easy to start

#

same as python

slender thistle
#

and it's a scripting language, mostly easier than Java, a strictly typed language

pure lion
#

How would I DM in dpy?

fluid basin
#

java requires some knowledge on OOP etc

dire obsidian
#

Thanks

slender thistle
#

How would I DM in dpy?
@pure lion user.send

pure lion
#

Sounds easy

slender thistle
#

Where user is an instance of a User object (Member included, since it subclasses User)

delicate shore
#

Should I repost my question?

#

because it went up

pure lion
#

:o thanks shiv

delicate shore
#
client.on("ready", () =>
console.log(`Black sheep is op`),
Promise.all(promises)
  .then(results => {
      const totalGuilds = results[0].reduce((acc, guildCount) => acc + guildCount, 0);
      const totalMembers = results[1].reduce((acc, memberCount) => acc + memberCount, 0)


      client.user.setPresence({ activity: { name: `bit.ly/blacksheepbot | ${totalGuilds} servers` }, status: 'idle' })
  })
  )```
#

no error but it won't work

fluid basin
#

what is promises

delicate shore
#

one min

#
const promises = [
  client.shard.fetchClientValues('guilds.cache.size'),
  client.shard.broadcastEval('this.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0)'),
];``` @fluid basin this
fluid basin
#

hm

delicate shore
#

k

fluid basin
#

you don't need to use shard?

#

you can directly get the values

delicate shore
#

why

fluid basin
#

wdym why

#

how many servers is your bot in

delicate shore
#

820

fluid basin
#

yeah thats still far from 2500

delicate shore
#

but

#

Suggested one is 1 shard per 900

#

so i don't think it's bad to it earlier

pure lion
#

Since when?

fluid basin
#

wot, since when?

#

Shard helpers for the client (only if the process was spawned from a ShardingManager)

#

"only if the process was spawned from a ShardingManager"

pure lion
#

Suggested one is 1 shard per 900
Since when was this

fluid basin
#

well anyways

#

no one is stopping you from sharding your bot

#

back to the problem

#

is your bot currently sharded

#

if (client.shard) console.log('sharded')

pure lion
#

Lmao

fluid basin
#

discord API docs was meant for people to make their own libraries so

earnest phoenix
#

@delicate shore lmao the message that logs when the bot is online

fluid basin
#

if it wasn't understandable then something is really wrong there

earnest phoenix
#

discord API docs was meant for people to make their own libraries so
@fluid basin what the fu-

pure lion
#

Hehe uwu

#

I'm going to make a lib

#

Based on uwu

delicate shore
#

it worked anyways

earnest phoenix
fluid basin
#

if it wasn't understandable then something is really wrong there
this

#

imagine making broken libraries because of bad docs

earnest phoenix
#

i said that based on how terrible peeps like me are at following simple instructions

fluid basin
earnest phoenix
#

yeah

#

imagine making broken libraries because of bad docs
@fluid basin npm docs intensifies

fluid basin
#

LOL

earnest phoenix
#

lmao

#

are they any helpful

#

not for me

#

also guys i organized my code into multiple files
am i outta the club of maniacs waitWhatSpin

delicate shore
#

if (client.shard) console.log('sharded')
@fluid basin i am gonna eval that

#

It is sharded

slender thistle
earnest phoenix
#
client.on("ready" () => {
console.log("Black sheep is op"),

@delicate shore lmao wut

delicate shore
#

OP = overpowered

fluid basin
#

oh lol

#

that comma

delicate shore
#

ignore that

#

i fixed my code

drifting wedge
#

how do i get commands in cogs?

#

like commands.command?

#

command.commands?

delicate shore
pale vessel
#

no

delicate shore
#

Ok

slender thistle
#

like commands.command?
yes

earnest phoenix
#

Hello, I would like to know how I can make, for example, when a user puts .news, the bot sends a message with the latest news, for example, about the coronavirus thanks!

fringe axle
#

So I try to get a websites ping. JS code exist but he don't want to display the Ping...
Code:```html
<p id=ping class="text-base font-medium text-center"></p>

drifting wedge
#

discord.ext.commands.errors.ExtensionFailed: Extension 'help' raised an error: TypeError: cogs must derive from Cog
sys:1: RuntimeWarning: coroutine 'Command.call' was never awaited

#

im doing a cog for help command

#

wut is this?

pale vessel
fringe axle
#

I know

#

And?

pale vessel
#

quotes

slender thistle
#

I don't think they're required?

pale vessel
#

it's html?

honest perch
#

they are

fringe axle
#

Oh

drifting wedge
#

?

slender thistle
#

I must be remembering something differently 🤔

fringe axle
#

quotes
@pale vessel means what now?

pale vessel
#

prolly like <input type="text" required> or something

honest perch
#

like id="ping"

slender thistle
#

I do remember being something like x=y being allowed

fringe axle
#

I tried it with ""

slender thistle
#

But that's probably just my stale memory

fringe axle
#

But it's not required

honest perch
#

but what are you trying to do?

#

it is

fringe axle
#

get a ping..

honest perch
#

get a ping of what

pale vessel
#

where's the javascript code?

drifting wedge
#

discord.ext.commands.errors.ExtensionFailed: Extension 'help' raised an error: TypeError: cogs must derive from Cog
sys:1: RuntimeWarning: coroutine 'Command.call' was never awaited
im doing a cog for help command
wut is this?

fringe axle
#

Above

pale vessel
#

that is html

fringe axle
#

In <script> of course

#

xD

honest perch
#

show us it

fringe axle
#
function getBody() {
    const Http = new XMLHttpRequest();
    const url='http://o.zwolfy.tech:8888/';
    Http.open("GET", url);
    Http.send();

    Http.onreadystatechange = (e) => {
      document.getElementById('ping').innerText = Http.responseText; 
    } 
  }
pale vessel
#

xhr uh oh

slender thistle
#

@drifting wedge I feel like your code is cursed

#

or you're doing something very fucky

fringe axle
#

xhr uh oh
@pale vessel D:

slender thistle
#

because I remember going over this like plenty of times

pale vessel
#

where did you put the script tag?

fringe axle
#

Above the html code

pale vessel
#

try putting it at the bottom

fringe axle
#

Tried that already

pale vessel
#

can you show the code?

fringe axle
#

Of?

pale vessel
#

the html + js

fringe axle
#

Oh

pale vessel
#

might be too long though

fringe axle
#

That's too long for discord

pale vessel
#

check the console for errors

fringe axle
#

No errors

drifting wedge
#

i dont think so

#

my code works fine on main fily

#

file

#

and i added all the cog stuff\

modest smelt
#

Hey guys

#

i have a question

drifting wedge
#

sure

modest smelt
#

So basically I want my bot to ask the user something

#

and I want the user to respond

drifting wedge
#

wut?

#

wut lib?

modest smelt
#

like a guessing game

#

like if the bot says 1 - 10

#

and i say 5

drifting wedge
#

what lib

modest smelt
#

discordpy

drifting wedge
#

ok

#

great

#

so whats ur issue?

modest smelt
#

discord.py rewrite | How to wait for author message?

drifting wedge
#

wdym?

modest smelt
#

basically i will ask the user to pick from 3 options

#

and the user needs to respond with 1 of them

#

how do i store that?

drifting wedge
#

so get like if arg = option a do this

#

if arg = b do this

#

if c = say butt

slender thistle
#

client.wait_for

modest smelt
#

@slender thistle ik client.wait_for but how to use that?

#

like what is the code?

#

for that

slender thistle
#

Referred to the docs yet?

modest smelt
#

i tried

#

but i was kinda confused

slender thistle
#

Which part was the most confusing

modest smelt
#

lemme send u

#

w8

#

@slender thistle thats what i referred to

slender thistle
#

.................

fringe axle
#
<p id=ping class="text-base font-medium text-center"></p>
    <script>
        fetch("http://o.zwolfy.tech:8888/")
          .then(function (response) {
            return response.json();
          })
          .then(function (myJson) {
            document.querySelector("#ping").innerHTML = myJson.ping;
          })
          .catch(function (error) {
            console.log("Error: " + error);
          });
      </script>
``` I did it like this now but he still don't want to show any text...
slender thistle
#

Actually, wait

#

I was about to complain about the while loop

modest smelt
#

ah

slender thistle
#

...unless you don't need it

modest smelt
#

no

slender thistle
#

and it doesn't look like you do

modest smelt
#

it is just a 1 time thing

#

like i ask the user one question

slender thistle
#

Yeah, so scrapping the while loop

modest smelt
#

they respond

#

and it is over

drifting wedge
#

shivaco

#

wuts wrong with my code

#

its not cursed

modest smelt
#

what does this mean

#
msg = await client.wait_for('message', check=check, timeout=30)
#

what goes inside the 'message'?

drifting wedge
#

checks for message

#

the message

slender thistle
#

It waits for the next message event where if passing a message to the function passed in check argument, continue the code

modest smelt
#

and what does the check=check mean?

#

ok

drifting wedge
#

idk

slender thistle
#

check= - check parameter

#

the check after the = is the name of the function

modest smelt
#

oh ok

#

thanq

slender thistle
#

You can rename it for all anyone cares tbh

drifting wedge
#

shivaco

slender thistle
#

check=my_check where my_check is the question

drifting wedge
#

can u help me plez?

modest smelt
#

@slender thistle

#

so what happens after timeout

drifting wedge
#

Like im getting the error

modest smelt
#

can i send them a message

drifting wedge
#

but my code is fine