#development

1 messages · Page 1734 of 1

sudden knoll
#

then just format the diff

clear marlin
#

Moment has all the functions for dates

sudden knoll
#

^^^

clear marlin
#

Or whatever it was

#

yeah that ^^

eternal osprey
#

may i ask why you first use the modulus operator, and then do /25 ?

lyric mountain
#

oh, wait, mb

#

there

earnest phoenix
#

Native

sudden knoll
lyric mountain
#

modulo is if you want the remainder, but since we're talking about coins you want the amount

#

so just divide by the coin value

#

C floors integer divisions

eternal osprey
earnest phoenix
#

thx

eternal osprey
#

you would then do 9 / 25 ?

sudden knoll
eternal osprey
#

and then x100 at the end

lyric mountain
#

oh yeah, tru

earnest phoenix
eternal osprey
#

: 100

sudden knoll
sterile lantern
#

i used moment

earnest phoenix
sterile lantern
#

i got two dates

#

i just am unsure how to get it into <x> years/months/days

#

i dont want weeks

lyric mountain
#

ig bento's solution will be the smaller you can get for amount of coins

sudden knoll
earnest phoenix
#

is it look good

sage vault
#

Whatsupp ?

pale vessel
#

make it not scream?

sudden knoll
#

idk, looks fine ig, I wouldn't do all caps and probably would use fields

earnest phoenix
#

Caps-lock

lyric mountain
#

and don't be too bold

earnest phoenix
#

yes, remove all caps

lyric mountain
#

"best bot in X stuff" is the best way to get an user fight between same-genre bots

earnest phoenix
#

ok

#

wait

sudden knoll
#

also fix the grammar in "YOU CAN USE NAMES, VIDEO LINK OF SONG"

#

and it's inconsistent in punctuation use

#

irks me a bit

eternal osprey
#

alright, @lyric mountain one question. What if my input is 2.50.

#

that would give me no remainder at all

sudden knoll
#

look at my code awesome

#

or just multiply by 100 and use ints

lyric mountain
#

he's doing it already

sudden knoll
#

oh, then why is this a question

sterile lantern
#

so i could do var diffDays = b.diff(a, 'days'); but the thing is i want it to round to the appropriate measure.

e.g, if the difference is 35 days, i want it to round to 1 month
if the difference is 368 days, round to 1 year

sudden knoll
#

to get rounded down year

earnest phoenix
#

now is it ok

sudden knoll
#

fix your grammar, run it through a spell checker or smthn

earnest phoenix
#

bro

#

any one help me pls

slender thistle
#

It's more like you just miss some letters

earnest phoenix
#

for enlish

eternal osprey
#

google translate

earnest phoenix
sudden knoll
#

grammarly will prolly fix it all

eternal osprey
#

i've sent that page like 4x, 5 times by now

slender thistle
#

Grammarly Free is nice for typos

sudden knoll
eternal osprey
#

no not really

sudden knoll
#

what's the code

#

now

lyric mountain
#
int cents = money * 100;
int quarters = cents / 25;
int dimes = (cents - (quarters * 25)) / 10;
int nickels = (cents - (quarters * 25) - (dimes * 10)) / 5;
int pennies = cents - (quarters * 25) - (dimes * 10) - (nickels * 5);

if you want a single-liner for variables

eternal osprey
#

i tried what KuuHaKu did, but it is returning me 0 all the time

lyric mountain
#

basically the same as bento's

sudden knoll
#

lmao

lyric mountain
#

not the amount

eternal osprey
#

yeah i know

lyric mountain
#

obv the final remainder is 0

sudden knoll
#
// if money is in dollars
int cents = money * 100;
int quarters = cents / 25;
cents = cents % 25;
int dimes = cents / 10;
cents = cents % 10;
int nickels = cents / 5;
cents = cents % 5;
int pennies = cents;
#

this was mine

feral aspen
#
const mappedData = Object.keys(inventory.inventory)
    .filter(key => inventory.inventory[key] !== 0)
    .map((key) => {
        const { name, id, logo } = items.find((val) => val.id.toLowerCase() === key);
        return `${logo} **${name}** ─ ${inventory.inventory[key]}\n**ID:** \`${id}\``;
    })
    .join("\n\n")

Hm.. sometimes it maps through nothing and whenever I set mappedData as the description, it returns MessageEmbed field values may not be empty.. Should I add a if (!mappedData)?

boreal iron
sudden knoll
#

that's an ez solution, I don't see why not

lyric mountain
#

inventory is empty, so it'll not join anything

#

and u cant send an empty message

earnest phoenix
#

@sudden knoll you think my bot approve

#

say yes or no

sudden knoll
#

idk what ur bot does

#

well, i have a jist

earnest phoenix
#

this is music bot

feral aspen
eternal osprey
sudden knoll
#

If your other commands don't work, your bot will be declined

eternal osprey
#

but i removed it

feral aspen
lyric mountain
#

just being a grammar nazi

lyric mountain
earnest phoenix
sudden knoll
lyric mountain
#

btw, "beta" is marked because you shouldn't really call a released bot "beta"

sterile lantern
#
   return await msg.edit(embed).catch((err) => {
          msg.edit("Error")
          console.log(err)
        })```
#

am i missing something

#

cuz its not editing the msg indicating theres an error

copper cradle
lyric mountain
#

ah true

sudden knoll
#

and the capitalization of sentences

#

man just needs to run through grammarly

copper cradle
#

the overall grammar is just trash

#

is it overall √ or overal

sudden knoll
#

overall

#

b/c all

sudden knoll
sterile lantern
#

no

#

that isnt the issue

earnest phoenix
sterile lantern
#

b.moment()

#

thats probs why

earnest phoenix
sterile lantern
#

but it still didnt edit

sudden knoll
earnest phoenix
#

lo

charred roost
#

-info HypeBot

earnest phoenix
#

QNM_tanjiro_shock lol

#

ffffff

eternal osprey
#

guys..

#

i am finally done with this

#

holy shiot

sudden knoll
#

bruh

sterile lantern
#

(node:2353) UnhandledPromiseRejectionWarning: ReferenceError: aaa is not defined```

i put aaa instead of age, it shows the loading embed and doesnt show the error embed
earnest phoenix
eternal osprey
#

big thanks to bento and kuu, really helped me throught it.

sudden knoll
#

lmao

earnest phoenix
sterile lantern
#

the embed gets formed,
return await msg.edit(embed).catch(async (err) => {

and is expected to edit with it

#

and if theres an error editing the msg, then return

#

it didnt edit the msg at all

earnest phoenix
#

That still doesn't catch the error you showed

sterile lantern
#

embed.addField("Account Age", aaa, false)

#

the error is coming from this

earnest phoenix
#

try { ... } catch (...) { ... }

sudden knoll
#

^^^

#

why not just do a try catch instead of all inline

#

less confusing

copper cradle
#

this is kinda redundant

sudden knoll
#

did you instantiate it?

earnest phoenix
#

He's trying to catch the error purposefully to send an embed containing the error or something similar

sudden knoll
#

oh i see

#

just do a try catch

copper cradle
#

just say contact our support team on our server (link) or something like that

#

there's no need for such a long txt

earnest phoenix
#

But he's using <Promise>.catch() on <Message>.edit() which will only catch the error on that method

#

So as I said, use try-catch

sudden knoll
#

I agree with you

sterile lantern
#

this right

#
 try {
        return await msg.edit(embed)
        } catch (err) {```
earnest phoenix
#

no no no

#

Not there

#

Put try { before where the command starts

#

Because the error you showed doesn't occur there in the code you currently showed

severe patio
#

How do i get the user id of a user who voted for my bot when they vote?

sterile lantern
#

ohh

#

works ty

cinder patio
#

Thoughts on how this error looks?

earnest phoenix
#

It looks pog

#

Should draw big arrows for those that needs them LULW

cinder patio
#

lmao, thanks

#

now it's time for the hard part, error recovery 🤮

earnest phoenix
#

@earnest phoenix @sudden knoll thx for help I do all thing and do in my main bot from test bot

cinder patio
#

I don't even know where to start

earnest phoenix
sudden knoll
#

idk what that means but np

earnest phoenix
#

Now i do in main

boreal iron
sudden knoll
#

oh okay

earnest phoenix
#

Thx 😭

earnest phoenix
#

Any one cnt help you both help me

cinder patio
#

compiler, but ye

#

no clue how to implement the error recovery system

earnest phoenix
#

moment

cinder patio
#

I mean, I have an idea but it's probably not a good one

sudden knoll
#

sounds like the best kind of code to me

ebon dune
#

hi

#

actually my ```html
<style>
body{
background-color: #000001;
font-color: #ff0000;}
</style>
<body>
<h1 style="font-color:"#ff0000"; font-size:48px; text-align:center;"}> Cyte Bot </h1>

Cyte Bot is a multipurpous bot that can do a lot of stuff like

<h3 style="font-color:"#ea24fd"; font-size:20px;"> Giveaways with role requirements </h3>
<h3 style="font-color:"#ea24fd"; font-size:20px;"> Fun commands so that you don't get bored</h3>
<h3 style="font-color:"#ea24fd"; font-size:20px;"> A lovely economy to make you have more fun </h3>
<h3 style="font-color:"#ea24fd"; font-size:20px;"> Moderation system to make the members follow all the rules!</h3>

Bot is worth an invite!

<h3 style="font-color:"#06ee0a"; font-size:20px;"> Benifits of inviting the bot! </h3>
-> Increase server activity!
-> You can make chats more active by doing role req gws
-> And Much More!!!
</body>```

#

is not working

#

smh

#

ah saw it

#

nvm

lyric mountain
#

why do you open a body tag?

#

also, you don't need to use <h1>/<h3> since top.gg supports markdown

#

just set their styles in <style> tag and use # text for h1 and ### text for h3

ebon dune
#

ok ty

#

actually i use html css more

#

so i have habbit

#

of markdown instead of html

lyric mountain
#

you're basically escaping the hex

ebon dune
#

ye i saw lol

sudden knoll
ebon dune
#

and

sudden knoll
#

why is there a curly brace

ebon dune
#

why is my html <style> body { background-color: #000001; color: #ff0000 } </style>

#

not working?

lyric mountain
#

quotation

ebon dune
#

mistake

lyric mountain
#

"#000001"

ebon dune
#

wait in style?

lyric mountain
#

yes

#

idk if you can use hex colors without it

ebon dune
#

woops my dumbness smh

#

i had a really bad day today so i am in another world

#

still no work

#
<html>
<style>
body {
background-color: "#000001";
color: "#ff0000";
}
</style>
<body>
<h1 style="color:#ff0000; font-size:48px; text-align:center;"> Cyte Bot </h1>

Cyte Bot is a multipurpous bot that can do a lot of stuff like

<h3 style="color:#ea24fd; font-size:20px;"> Giveaways with role requirements </h3>
<h3 style="color:#ea24fd; font-size:20px;"> Fun commands so that you don't get bored</h3>
<h3 style="color:#ea24fd; font-size:20px;"> A lovely economy to make you have more fun </h3>
<h3 style="color:#ea24fd; font-size:20px;"> Moderation system to make the members follow all the rules!</h3>

Bot is worth an invite! 

<h3 style="color:#06ee0a; font-size:20px;"> Benifits of inviting the bot! </h3>
-> Increase server activity!
-> You can make chats more active by doing role req gws
-> And Much More!!!
</body>
</html>```
sterile lantern
#

How can I make Join Date allign with User ID

#

im using embed.addField("\u200B", "\u200B", true)

boreal iron
sterile lantern
#

to have only 2 fields per line

ebon dune
boreal iron
#

background-color: #000001;
color: #ff0000;

#

no quotes, god damn

lyric mountain
#

btw, I always use quotation just in case

#

and they do work

sterile lantern
#

not 3

boreal iron
#

body element is defined already btw.

lyric mountain
ebon dune
#

then arrange the inline acc my man

ebon dune
#

smh i am dumb

#

kty

lyric mountain
#

I mean, you can use blank fields

sudden knoll
boreal iron
#

the website has a body element already

sudden knoll
#

this appears to work

#

maybe

boreal iron
#

you can modify the content... use an element inspector to get the actual name

sudden knoll
#

those are some evil colors tho

sterile lantern
#

i just used \u200B

sudden knoll
#

by evil I mean eye hurty

lyric mountain
sudden knoll
lyric mountain
#

\u200B is void character

sudden knoll
#

lol

ebon dune
#

so basically i am wasting time?

sterile lantern
#

yea ^^^^

lyric mountain
#

you can, I do it

#

just don't create another body tag

#

and use !important where top.gg uses it

boreal iron
#

you should be able to edit anything

#

correct

#

overwriting existing rules, requires an !important

ebon dune
#

tf

boreal iron
#

the first rule being read will be used

ebon dune
#

lmao nvm i editted 99% of it

#

maybe its enough

earnest phoenix
#

Hmm last thing

ebon dune
earnest phoenix
#

Pls say

ebon dune
#

looks enough to me

ebon dune
lyric mountain
#

btw Benifits

ebon dune
#

lemme add <br>

boreal iron
#

matching elements already existing will only add rules if they don't exist already

earnest phoenix
#

Is my bot approvaed

boreal iron
#

!important will overwrite existing ones

earnest phoenix
lyric mountain
#

still using bold statements I see

ebon dune
lyric mountain
#

but yeah, it's a bit better

ebon dune
#

wahan

#

pata

#

chalega

#

jai modi

#

🎉

sudden knoll
earnest phoenix
#

Bata

earnest phoenix
earnest phoenix
sudden knoll
#

no

#

lol

earnest phoenix
#

zw24 lol

#

I. Mean sent friend request

sudden knoll
#

ik

earnest phoenix
ebon dune
#

i just noticed 35 pending lmao

earnest phoenix
#

Up

sudden knoll
#

CYTE's a popular person

earnest phoenix
#

@ebon dune Indian ho

#

Na

#

Tum

lyric mountain
#

I don't like friend requests

earnest phoenix
lyric mountain
#

they're coarse and rough and get everywhere

earnest phoenix
ebon dune
sudden knoll
#

LIAR!

ebon dune
#

lol

earnest phoenix
ebon dune
#

jk

earnest phoenix
ebon dune
#

jk bro

earnest phoenix
#

Jk

ebon dune
#

hindi bolra matlba obv indian

earnest phoenix
#

Matlb

ebon dune
#

jk matlab just kidding

earnest phoenix
#

Lol

#

Are to popular kasa

ebon dune
#

dm

lyric mountain
ebon dune
#

this is not channel

#

to

#

talk

sudden knoll
earnest phoenix
ebon dune
#

lol

lyric mountain
#

that's why calling your bot "best" in something is a risky move

ebon dune
#

just come dms bro why talk here

earnest phoenix
#

weirdsip I cnt say you tu judge my bot

#

It's mean your bot make bye an kido

solemn latch
#

please dont argue here angeryBOYE

earnest phoenix
#

She start

ebon dune
earnest phoenix
ebon dune
#

dms aa

earnest phoenix
sudden knoll
#

Anyone have some python code for a set prefix command?

lyric mountain
#

anyway, that was just an advice, I'm not saying your bot is bad

ebon dune
sudden knoll
earnest phoenix
ebon dune
earnest phoenix
ebon dune
#

dm aa

earnest phoenix
#

OK ata bro

lyric mountain
#

or was you joking?

sudden knoll
lyric mountain
#

sql, cool

sudden knoll
#

I am fully capable of doing this myself, just thought I'd ask

#

thanks CYTE

lyric mountain
#

any db in mind?

sudden knoll
#

hmmm, SQLite maybe

#

maybe Postgre

#

idrk rn

#

what package you recommend

lyric mountain
#

you can start sqlite then migrate to postgres later on

#

since sqlite has primitive datatypes which are supported on pretty much all sql dbs

sudden knoll
#

nice

lyric mountain
#

I use sqlite as a caching db and postgres as long-term storage

#

for python idk any package to recommend

earnest phoenix
lyric mountain
#

dw

earnest phoenix
earnest phoenix
sudden knoll
#

hmm since SQLite is 1 file, it'd be really easy to upload and download from AWS S3 for long term

lyric mountain
#

what I meant is that if you state that your bot is the best in something you'll make people compare it to major bots

#

like chip, rythmn, groovy, etc

earnest phoenix
#

So that I cnt write

#

Any one help me so I do it

lyric mountain
sudden knoll
#

ty

modest maple
#

dont use flask like that (sorry for long wait) you need to use a production server i recommend gunicorn

#
DigitalOcean

Docker is an Open Source application that allows administrators to create, manage, deploy, and replicate applications using containers. Flask is a web micro-framework that is built on Python. In this tutorial, you will create a Flask application and d

#

luckily for you pre-made images already exist that do it all

#

FROM tiangolo/uwsgi-nginx-flask

#
FROM tiangolo/uwsgi-nginx-flask:python3.6-alpine3.7
RUN apk --update add bash nano
ENV STATIC_URL /static
ENV STATIC_PATH /var/www/app/static
COPY ./requirements.txt /var/www/requirements.txt
RUN pip install -r /var/www/requirements.txt```
#

you're entry point should be just as simple as doing docker run <image>

#

also building on what that error is saying

#

the way WSGI (and also ASGI) works when you give the servers something to run it follows the <file name>:<variable name>

#

so if i had something like my_app.py

and it looked like:

from flask import Flask

app = Flask(__name__)
#

we would run it doing flask run my_app:app

knotty obsidian
#

can anyone show me an article about reading/writing jsons cuz most dont work for some reason (java not script)

#

they dont even show how the code gets the json file

sudden knoll
jolly niche
cinder patio
jolly niche
#

Ah

#

how?

cinder patio
#

idk the command off the top of my head, google it

slender thistle
#

@modest maple Does Selenium support POST requests internally or do I need to use requests for that?

modest maple
#

Well it's a browser interfacer

slender thistle
#

So makes sense if it doesn't

modest maple
#

so that's dependent of the browser but easiest is probably just getting selenium to execute a script

slender thistle
#

Don't think so, but I'll have to see what I can do to achieve something

modest maple
#

what r u trying to do

slender thistle
#

Does selenium support returned values from executed scripts?

modest maple
#

I think so?

slender thistle
#

Fake me using my college website via Selenium and requests

#

Or as I would say precisely

#

Forward my notifications from my college website to Discord

#

And as you could guess, it doesn't have an easily accessible API where I can just fetch a JSON

#

This shit actually requires cookies to work, so I'm trying to retrieve that once I create a session on the website via Selenium

modest maple
#

does it use JS rendering?

slender thistle
#

What kind of JS rendering do you mean?

modest maple
#

AJAX and the likes

slender thistle
#

Yup

modest maple
#

ah

#

oof

slender thistle
#

Doesn't look impossible to me though

#

Tough, but not impossible to accomplish 🤣

#

So what I do is:

  1. Make sure I log in;
  2. Get the cookies that I get when redirected to main page;
  3. Send "API request" to receive my notifications with cloned cookies
cinder patio
#

Haven't used selenium, but it sounds easy to do if you are using puppeteer (or python's version of puppeteer)

#

though you'll have to use chromium

#

which is an RAM eater

#

but it shouldn't be that bad for one page

slender thistle
#

I'm using Selenium's Firefox webdriver with repl.it

cinder patio
#

ah

slender thistle
#

So yeah, Chromium isn't feasible for me. That aside, I think I can make do with the requests module

#

Just need to figure out how I can get the cookies for my specific domain

cinder patio
#

o wait you can use puppeteer with firefox, at least the node.js version of it

slender thistle
#

I'll see if that's needed

#

Don't want to switch to another browser at this point KEKW

modest maple
#

and re-use the cookiejar

slender thistle
#

Oh yeah

#

Thanks

jolly niche
#

how can i fix that error?

cinder patio
#

did you copy the entire node_modules folder from your PC to your VPS?

jolly niche
#

yes

lyric mountain
#

oh my

cinder patio
#

delete node_modules and do npm i, you shouldn't do that

lyric mountain
#

imagine the bandwidth crying

opal plank
#

Transfering 4.9Gb...

#

the best is when an npm packages includes their own node_modules inside

earnest phoenix
#

A loophole

earnest phoenix
#

Heyyy

#

So I made an eval command and am trying to insertOne() with the eval command

umbral zealot
#

ok and? where's the rest of the question 😛

earnest phoenix
#

Like this: ;eval db.collection("ids").insertOne({_id: "info", latestid: 0});

umbral zealot
#

ok and what's the issue?

lyric mountain
#

database manipulation with eval command tsk tsk

umbral zealot
#

that should work fine

earnest phoenix
#

But I get this error: js TypeError: db.collection is not a function

umbral zealot
#

well it sure looks like db.collection isn't a function

#

what's db ?

#

specifically, how is it defined?

earnest phoenix
#

let me find that

earnest phoenix
#

Well

umbral zealot
#

ok and what module is "mongo" then

#

we need more of your picture here

opal plank
earnest phoenix
umbral zealot
#

ok. Now, is this all defined inside your eval command file?"

#

or a different file?

#

how does it get to eval?

earnest phoenix
#

oh wait

#

this makes sense.

#

I'm not quite sure how to do this in that case

#

My eval command is in its separate file

#

I need to find a way to access it anywhere.

#

I could just do it in index.js

umbral zealot
#

alright ok so next

#

how do you execute your run() function

#

in the message event

earnest phoenix
#

Oh it works and stuff

#

I am getting the error in the eval command

umbral zealot
#

yes. we're aware of the error you're having. I'm trying to help you with it.

#

how do you execute your run() function
in the message event

#

show me how you call command.run()

earnest phoenix
#
const Discord = require("discord.js");

function clean(text) {
    if (typeof(text) === "string")
      return text.replace(/`/g, "`" + String.fromCharCode(8203)).replace(/@/g, "@" + String.fromCharCode(8203));
    else
        return text;
  }

module.exports.run = async (client, message, prefix, player, db) => {
    const args = message.content.split(" ").slice(1);
      if(message.author.id !== process.env.ownerID) return;
      try {
        const code = args.join(" ");
        let evaled = eval(code);
        message.channel.createMessage('`You are authorized to use this command!`')
        if (typeof evaled !== "string")
          evaled = require("util").inspect(evaled);
        message.channel.createMessage('`Working!`')
        message.channel.createMessage(clean(evaled), {code:"xl"});
      } catch (err) {
        message.channel.createMessage(`\`ERROR\` \`\`\`xl\n${clean(err)}\n\`\`\``);
    }
}
module.exports.help = {
    name: "eval",
      };```
#

this is my entire eval code

umbral zealot
#

no

#

that is not what I asked

#

show me the ./events/message.js file

lyric mountain
#

just use \uCODE

#

in this case \u8203

umbral zealot
#

that's copied code from an eval command I wrote, don't worry about it kekface

lyric mountain
#

really? meh

#

anidiots?

umbral zealot
#

yeah probably

#

Also don't worry too much about the fact that this is still the damn frankensteinian horror of mixing two completely different discord libraries. It hurts the brain when you think too much about it.

earnest phoenix
#

Actually

#

I'm technically using 3

lyric mountain
#

you're wrong evie

earnest phoenix
#

Uh what

lyric mountain
#

that ain't a frankenstein

#

that's a chimera KEKW

umbral zealot
#

Whatever it is, it's a freak show.

earnest phoenix
#

3 discord libraries at same. Time???

#

There really shouldn't be a problem

umbral zealot
#

There is, but I was just commenting on it so people don't start wondering

#

but I'm still waiting for your message event code

earnest phoenix
#

I'm using eris and eris-additions for the gateway interaction

umbral zealot
#

... why is this relevant

earnest phoenix
#

discord.js for the collection and embed builder (nothing else)

#

just saying lol

opal plank
#

what

umbral zealot
#

just .. show... the... message... event... so ... we... can... get... to... more... debugging.

opal plank
lyric mountain
#

a car with boat wheels and plane body

earnest phoenix
#

I think i figured it out

opal plank
#

wanna add detritus and rose to the mix?

#

use command handler from detritus

#

gg

umbral zealot
#

Nah it's just a Civic with the engine from a Focus, and they slapped the logo from a Hyundai on the front & back for good measure

quiet jasper
#

how do I use Visual studio code?

lyric mountain
#

for?

quiet jasper
#

music bot

lyric mountain
#

ok, for coding then

quiet jasper
#

yes

umbral zealot
#

You open it and then you start typing in it

lyric mountain
umbral zealot
#

it's an editor

#

it just... edits files.

opal plank
#

embeds from djs, command handler from detritus, eris for gateway, rose for caching @lyric mountain

sudden knoll
#

use notepad

opal plank
quiet jasper
umbral zealot
#

yes

quiet jasper
#

okay

lyric mountain
opal plank
#

yes pls

#

use py for regex too

earnest phoenix
umbral zealot
#

And that Java library for the music of course

#

Install all the languages

opal plank
#

assembly for the main lang

umbral zealot
#

1.5GB of RAM to run a bot kekface

earnest phoenix
#

Well my bot is mix of javascript and python

quiet jasper
#

I also saw that there are bots to get free follow on Twitch

opal plank
#

1.5GB just for the deps, then you gotta create the clients

umbral zealot
opal plank
#

technically.....

quiet jasper
#

yes I know

opal plank
#

actually, not gonna get to that argument

#

you should do it, for moral reasons

#

shounldt*

#

but twitch has a weird as fuck policy with it

quiet jasper
#

there is a code for music bot? Pls...

opal plank
#

as long as you are watching ads, they are fine with it

#

dont ask me why

#

i asked their staff a couple times about it

umbral zealot
#

There are literally hundreds of music bots on github, Cola

opal plank
#

that was the response

umbral zealot
#

use the search feature

#

¯_(ツ)_/¯

earnest phoenix
#

İ think we should move to general

lyric mountain
#

technically, the only losing end is who paid for the ads

quiet jasper
umbral zealot
#

"discord music bot"

quiet jasper
#

okay thanks!

opal plank
#

well, yeah, idk why would they allow bots if they "wacth ads"

#

as long as its generating revenue, they fine with it presumably

lyric mountain
#

free muny

quiet jasper
earnest phoenix
umbral zealot
#

I mean if you want to be yet another unoriginal music bot in a sea of completely identical bots, sure, yeah, do that

opal plank
#

which, funfact, its harder to code the recieving part to "watch the ad" than to actually make a shitton of accounts

lyric mountain
median moss
#

discord.js:
how can I fetch if message author is in a specific server?

quiet jasper
earnest phoenix
umbral zealot
#

Not sure why you can't just invite Groovy and be done with it

quiet jasper
#

oh ahahaha

opal plank
#

thats it

#

PS: you need intents

median moss
opal plank
#

yes

umbral zealot
#

uhm no you don't

median moss
#

if so, I'll need to apply

umbral zealot
#

you do not need intents to fetch SINGLE users/members

opal plank
#

wait rlly?

sudden knoll
#

just to get the guild member list

gray bronze
#

Only for multiple right?

umbral zealot
#

jesus fucking christ people this is why the goddamn queue for intents is 5 months

opal plank
#

in a guild tho?

quiet jasper
#

can you send me all the code that servers to play music?

umbral zealot
#

message.guild.members.fetch( "139412744439988224") <--- this does NOT require any intents!

opal plank
#

i thought the endpoitn for what was whitelisted

umbral zealot
#

client.users.fetch("139412744439988224") <---- neither does this!!!

modest maple
#

CoffeeSip I see people are just discovering this

median moss
#

@umbral zealot but anyways, what should I make to do this?

opal plank
opal plank
#

right, its the list that requires intents

umbral zealot
#

what exactly do you need

#

a member or a user

median moss
#

message author

crimson vapor
#

hello Airwin

umbral zealot
#

message.author literally is the message author

median moss
#

lmao

opal plank
crimson vapor
#

hi

umbral zealot
#

So what do you mean then

median moss
#

but what is the string I should make

#

I want for example

#

if message author is not in server X, return message.channel.send('you're not in the server X')

crimson vapor
#

@opal plank have you ever heard of this discord library called detritus

opal plank
#

i have not, please enlighten me

crimson vapor
#

uhh whats the link to the message?

opal plank
#

for a single server it might be fine tbh

umbral zealot
median moss
#

ok

#

thx

opal plank
#

would add a ? there just in case

crimson vapor
umbral zealot
#

Erwin being completely vague and expecting people to know what the hell they're talking about lol

#

client.guilds.????get.memb?ers.fetch

opal plank
#

client.guilds.get("the guild ID")?.members.fetch("the user id")

#

you know very well which of those might return undefined

#

the comment was for u

median moss
#

it needs Node 14 I guess

opal plank
#

wait what

crimson vapor
#

|| {}

opal plank
#

d.js v12 is using node 15 tho

#

isnt it?

#

pretty sure it is

#

one sec

crimson vapor
#

I dont think so

gray bronze
#

Try client.guilds.get("GUILD ID").members.get("USERS ID")

opal plank
#

oh they changed it

#

wait a second

#

if its node 14 it supports it

#

look at the last one

#

conditional chaining was introduced in 14

#

which is the same requirement as d.js

umbral zealot
median moss
umbral zealot
#

because members are generally not cached.

median moss
#

repl = 12.65 or smth like that

opal plank
#

but d.js is node 14 tho, thats why im confused

umbral zealot
#

hey did you know you could tell repl to use a different node version? lol

opal plank
#

maybe that reffers to an older v12 v too, but idk if thats the case

median moss
#

idk

umbral zealot
#

¯_(ツ)_/¯

crimson vapor
#

conditional chaining was introduced in 14
before 14: js ((((client || {}).guilds || { get: () => undefined }).get('GUILD ID') || {}).members || { get: () => undefined }).get("USER ID")

opal plank
#

it says there too

earnest phoenix
#

They have upgraded their node js version to 14 from 10

crimson vapor
#

Erwin do you like my code?

opal plank
#

im confused about that other link

crimson vapor
#

hmmmmm

opal plank
#

where was it

#
function returnType(staff) {
return staff === undefined ? "staff is undefined" : staff === null ? "staff is null" : typeof staff === "number" ? "staff is a number" : typeof staff === "object" ? "staff is an object" : typeof staff === "string" ? "staff is a tring" : "staff is unkown"  }```
not this one tho
#

it was here somewhere

umbral zealot
#

ok well, adapt the code to your specific context?

median moss
#

how should I define it

median moss
#
const Discord = require(`discord.js`)
const db = require(`../database.js`)

module.exports.run = async (bot, message, args) => {

let user = message.author;

let server = client.guilds.get("774041271655333928").members.fetch(`${user.id}`)

if (server === undefined) return message.channel.send(`You must be in [Support Server](https://discord.gg/hHwXDmQabp) to redeem a code.`)
}```
umbral zealot
#

god, you provide 99% of what the user needs and they still demand th rest of the spoonfeed

#

yeah what's your client variable here?

#

you should know, you wrote this code

median moss
#

oh

#

nvmd

#

sorry

umbral zealot
#

What variable defines your bot's client

median moss
#

lmao

opal plank
#

@crimson vapor found it ts let channel = client.channels.cache.has(args[5]) ? client.channels.cache.get(args[5]) : await client.channels.fetch(args[5]), linkContent:Discord.Message; if(channel) linkContent = (channel as Discord.TextChannel).messages.cache.has(args[6]) ? (channel as Discord.TextChannel).messages.cache.get(args[6]) : await (channel as Discord.TextChannel).messages.fetch(args[6]); console.log(linkContent)

crimson vapor
#

what in the fuck?

opal plank
#

think you can beat me in cursed code? fek off noob

crimson vapor
#
    options.color = options.color ??
      (options.type === 'ERROR'
        ? this.worker.colors.RED
        : undefined) ??
      (options.type === 'KICK'
        ? this.worker.colors.YELLOW
        : undefined) ??
      (['BAN', 'MUTE', 'NO'].includes(options.type ?? '')
        ? this.worker.colors.SOFT_RED
        : undefined) ??
      (options.type === 'YES'
        ? this.worker.colors.GREEN
        : undefined
      ) ??
      (options.error
        ? this.worker.colors.RED
        : this.worker.colors.GREEN)```
umbral zealot
#

don't try to out-noob the noobs 😛

opal plank
#

imagine flexing you're noob'er than the noobs

opal plank
#

seen it

#

not even close

quartz kindle
#
options.color = options.color
??
(
    options.type === 'ERROR'
    ?
    this.worker.colors.RED
    :
    undefined
)
??
(
    options.type === 'KICK'
    ?
    this.worker.colors.YELLOW
    :
    undefined
)
??
(
    [
        'BAN',
        'MUTE',
        'NO'
    ]
    .includes(
        options.type
        ??
        ''
    )
    ?
    this.worker.colors.SOFT_RED
    :
    undefined
)
??
(
    options.type === 'YES'
    ?
    this.worker.colors.GREEN
    :
    undefined
)
??
(
    options.error
    ?
    this.worker.colors.RED
    :
    this.worker.colors.GREEN
)
sudden knoll
#

in discord.py, why does guild.get_member(ID) require the members intent while await guild.fetch_member(ID) does not?

#

is it b/c get_member uses the member list?

quartz kindle
#

neither requires it, just get_member tries to get it in the cache, so it will fail if not cached

sudden knoll
#

oh, that makes sense

quartz kindle
#

the members intent doesnt not guarantee the member will be cached either

sudden knoll
#

ik that, but it's strange that get_member(ID) returned a member instead of None when nothing changes btwn runs besides the intents

quartz kindle
#

yes but its still not guaranteed

sudden knoll
#

maybe it was a one time thing

#

best not to rely on it

quartz kindle
#

the members intent by itself doesnt give you members, it has to have both members and presences, and even then it will only give you online/active members

#

offline/inactive members still wont be cached

#

unless you specifically fetch all

#

not sure how py does it, if it has an option to automatically fetch all or not

sudden knoll
#

idk, I don't see any of that info in the docs

#

all I know is that get_member(ID) returned None while fetch_member(ID) returned a member

#

hmmm wait it does say "If you have Intents.members and member cache enabled, consider get_member() instead."

#

instead of fetch_member(ID)

quartz kindle
#

fetch_member will always work, regardless of intents

sudden knoll
#

yup, that's what I'll use

#

but the way the docs are worded, it looks like get_member() requires the members intents, although I'll take your word for it that it doesn't

quartz kindle
#

well i dont use py so idk how it works internally

#

but thats what the discord api docs say

opal plank
#

@sudden knoll

#

i was talking to evie about it just a couple mins ago

#

indeed fetching a member doesnt require intents

sudden knoll
#

ik that

#

but the question rn is whether get_member() does

opal plank
#

i assume get_member() looks in cache

#

which, without intents, wont have much cached, if any

sudden knoll
#

ahhh

opal plank
#

thats what i would assume at least

sudden knoll
#

that makes sense

quartz kindle
#

yw

opal plank
#

like tim, idk py well, so thats just a polite guess

sudden knoll
#

welp, I'll be using fetch anyway so I'm not really worried about it

stiff lynx
#

how can I send a message in a specific channel?
I want to put the channel ID inside a database for the currency system command
so there isnt a spam inside chats that are not made for bots

sudden knoll
#

channel = bot.get_channel(ID)

#

channel.send(akahsdlkajd)

#

in python at least

opal plank
#

bet its d.js

#

its always d.js

stiff lynx
#

I dont know py

opal plank
#

never detritus

sudden knoll
#

i mean the code should be similar tho

opal plank
#

kinda, yeah

quartz kindle
#

if i ever make a discord lib, guess what im gonna call it

crimson vapor
#

discord-light

quartz kindle
#

nope

opal plank
sudden knoll
#

discordtim

opal plank
#

timcord

quartz kindle
#

nope

opal plank
crimson vapor
#

what?

opal plank
#

timcord

sudden knoll
#

timcord's good

stiff lynx
opal plank
#

conditional chaining

#

ifs the same as

#

if(<client>.channels.get(id)) <client>.channels.get(id).send()

#

it basically checks if whatever returned isnt falsey

#

read that for more

sudden knoll
#

so what's the name gonna be Tim

zenith terrace
solemn leaf
#

Erwin

opal plank
opal plank
crimson vapor
#

astrocord @quartz kindle

solemn leaf
#

Hru

boreal iron
#

Probably "better-detritus"

solemn leaf
#

Bot is talkin

opal plank
#

im gucci, u

#

its been a while since i last heard someone utter that word

boreal iron
#

Hi Gucci I am table

crimson vapor
#

same

zenith terrace
#

ok

boreal iron
#

Looks like you earned enough cash, don’t you?

#

For your evil ads okeh

sudden knoll
#

Tim crashed

quartz kindle
#

lmao

opal plank
#

tim's crashCord lib

#

there

sudden knoll
#

lmao

quartz kindle
#

if i say you guys are gonna steal the name

opal plank
#

[420_69]xxXX([BOOSY_SLAYER_LIB_JS])XXxx

sudden knoll
#

Erwin would never betray Detritus

boreal iron
opal plank
#

indeed, im committed to my religion

lyric mountain
#

where's my gif

opal plank
#

in detritus

#

probably

#

maybe

#

perhaps

quartz kindle
#

detroit us

lyric mountain
sudden knoll
#

lmao

boreal iron
#

Oh oh it’s happening... we’re losing control notlikenoot

quartz kindle
#

xD

opal plank
#

if cake went fro detritus, i guess tim will go for rubble?

boreal iron
#

I wonder if Erwin ever payed taxes for the cash he got for his ads

opal plank
#

thats some high iq joke there

#

and nobody laughed

#

not a single person laguhed

#

yikes

boreal iron
#

Similar: waste

#

Aha

opal plank
#

im gonna retreat myself into coding more useless features onto my bot till i get courage to port it to the new dyamic handler

boreal iron
#

The more useless stuff the better

viscid thistle
sudden knoll
#

guild.shard_id
then get_shard

viscid thistle
#

guild.shard_id?

#

oh yea

#

thanks

sudden knoll
#

np

toxic jolt
#

How can I do Heroku, "Restart all dynos" with node.js?

#

Does anyone know

lyric mountain
#

you don't

#

you can only control dynos via CLI or with the dashboard

#

but obviously, if you shutdown your process through code it'll auto-restart

severe patio
#

How would i fetch a channel by id in discord.js v12

#

im new to v12

sudden geyser
#

Discord.js doesn't have a method like <Guild>.channels.fetch, but you can still get the channel in the cache via <Guild>.channels.cache.get(...)

severe patio
#

i found it out

#

i have another question

#

How would i fetch the name of a channel that a message author sent a message from?

#

@sudden geyser ^

#

or get the channel name

sudden geyser
#

If it's from a DM it won't have a name property.

bold fulcrum
#

hi

sudden geyser
#

why hello there

umbral zealot
sacred juniper
#

Anyone use BDFD ?

quartz kindle
#

no

brisk frost
umbral zealot
#

ARE YOU CALLING ME FAT

boreal iron
#

No Kevin you’re not fat, you’re sweet. All the other kids looking differently are abnormal.

dire kraken
#

I haven't tried it yet, do you need a payment method?

cosmic forum
dire kraken
#

Ok

#

Is there any other good ones that are free?

pale vessel
worn sonnet
#

U can do it via CLI or program it

lyric mountain
lament rock
#

I wonder why DMChannel.name doesn't exist considering if you send <#DMChannelID> the client resolves it to #recipient

#

nvm. It's not the client resolving it like that. It's the server

#

I guess the server resolves it to the current user name if the current user has access to that channel

#

What. There is no way.

#

I wonder how the server determines who the recipient to resolve is

#

That channel ID I provided in the second image is to a bot

lament rock
#

Clarified elsewhere: client resolving. Not server. message content is still in <#ID> format

opal plank
#

what the fields embed for a message again?

lament rock
#

what

opal plank
#

its 25

#

limit*

#

omitted that word by mistake

lament rock
#

Oh. Embed field limit

#

lol

dusky garden
#

how would I detect it when someone finishes a sentence in discord.js when i have put a audio stream on them to record there activity in voice

lament rock
#

That would require analyzing the stream and detecting frames "quieter" than frames of when they're speaking. This would require some logic to determine when someone is actually speaking and what's "noise" and such

solemn latch
#

seems theres a few tensorflow models out there for this.

long crow
lament rock
#

Someone's mic still might be going off if there's background noise. As such, that's not reliable

dusky garden
lament rock
#

Yeah, so having an AI to detect voice activity would be your best bet

#

some kind of model

dusky garden
#

that might just work

#

but its a bit complicated

#

and i have absouletly no clue how to use it

#

and

#

its

#

based

#

in

#

python

lament rock
#

You can pipe that data to that process through IPC

#

might become computationally expensive depending on user count unless that allows for parallelized stream detection vs just 1 stream

stark abyss
#
Error: EISDIR: illegal operation on a directory, read
    at Object.readSync (fs.js:592:3)
    at tryReadSync (fs.js:366:20)
    at Object.readFileSync (fs.js:403:19)
    at UnableToResolveError.buildCodeFrameMessage (C:\Users\x\OneDrive\Desktop\testapp\testapp\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:304:17)
    at new UnableToResolveError (C:\Users\x\OneDrive\Desktop\testapp\testapp\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:290:35)```
I keep getting this error but unsure what's causing it
`EISDIR stands for "Error, Is Directory". This means that NPM is trying to do something to a file but it is a directory.` is what I found so far. I really don't know what is causing it but it returns an error as soon as i start the app
#

and then I get

(node:38556) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 change listeners added to [HasteMap]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)```
boreal iron
#

Isn’t it obvious?
You’re using filesync on a directory not on a file.

stark abyss
#

I don't know what filesync means

lament rock
#

if you want to read a dir, use fs.readdirSync

stark abyss
#

Well I don't think I have coded anywhere to do that because this is a react app

solemn latch
#

your react module is doing it

#

probably initialized wrong, or something configured incorrectly.

lament rock
#

Probably intended to read an asset, but passed a dir

stark abyss
#

import TvShowScreen from './screens/tvshow';
is the cause of the error importing a file?

#

Sorry if I am completely misunderstanding it

solemn latch
#

is ./screens/tvshow a directory? or a file

stark abyss
#

directory i guess

twilit hemlock
#

    fs.readdir('./commands', (err, files) => {
        if(err) return console.log(err);
        let jsfile = files.filter(f => f.split(".").pop() == 'js')

        if(jsfile.length == 0) {return console.log("Could not find any commands!")}

        jsfile.forEach(f => {
            let props = require(`./commands/${f}`)
            bot.commands.set(props.help.name, props)
        })
    })  
  ``` how do i look for sub folders
boreal iron
#

A directory

solemn latch
#

it needs to be a file.

stark abyss
#

oh

twilit hemlock
#

say the subfolder is named

#

helpCommands

#

or a diffrent folder in general

stark abyss
#

import TvShowScreen from './screens/tvshow.js';?

lament rock
solemn latch
stark abyss
#

yeah

solemn latch
#

dont do that lol

stark abyss
#

Well it was a hypothesis

solemn latch
lament rock
#

files.filter(i => !i.match(/\.\w+$/))

#

would return an Array of sub directory strings

stark abyss
lament rock
#

so that you understand regex more because regex is powerful: .\w+ matches the . in the filename and any ascii character (inclusive of numbers) after that . (you need to escape the . because . matches ANYTHING) and the $ specifies the end of the string.

stark abyss
#

How did this error appear on it's own don't think I caused it sadBonk

twilit hemlock
#

sh: 1: node-pre-gyp: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! @discordjs/opus@0.5.0 install: node-pre-gyp install --fallback-to-build
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the @discordjs/opus@0.5.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

#

-----> Installing dependencies
Prebuild detected (node_modules already exists)
Rebuilding any native modules

@discordjs/opus@0.5.0 install /tmp/build_de9dfaf6/node_modules/@discordjs/opus
node-pre-gyp install --fallback-to-build

#

-----> Restoring cache
- node_modules is checked into source control and cannot be cached

#

idk

#

i get like an email a min from them omg

stark abyss
#

is this on heroku?

twilit hemlock
#

yea

earnest phoenix
#

how solve api probaleam in repkit

sudden geyser
#

Confused.

slate oyster
#

3 versions of the same bot go vroom
I love creating bot tokens, y'know?

#

@sudden geyser
Basically the middle one runs on my local machine, and is the one I do testing on (V4, local machine)
The top one is the stable version (V3, VPS)
And the bottom one is a version of the alpha one running on a VPS so that users can see my progress. (V4, VPS)

Since V4 is unfinished still.

sudden geyser
#

ah, that's interesting

#

for my former bots I just had a public and private bot for develoment

slim heart
#

Hey, so I was wondering what's the best way to register someones purchase with chargebee, I've the drop-in script working atleast somewhat, and now I want to actually get the premium register working. I hold users in a database with their third-party login, so what's the best way to handle it? Should I have a webhook with the users being redirected to it a different path and that'd link their user to a subscription ID, or should I use the webhooks and link users via their email?

slate oyster
#

I wish I knew how to answer, but I am not smart enough.

sturdy dock
#

If I'm already using prepared statements for MySQL is there any additional sanitization I should be doing for user input? mysql2 lib for js.

slate oyster
slate oyster
prime mist
#

Hey, is there a way to track someone using an invite link if they have already joined the server?

sturdy dock
#

Fairly certain you can only record that when the user joins the server, not if they've already joined.

prime mist
#

Hmm yeah thought so. Oh well.

sturdy dock
#

yeah, discord doesn't store that unfortunately

prime mist
#

I made a bot that automatically adds roles depending on what channel the invite was for.
But it would be nice to somehow make it work even if they were already part of the server.

Getting mods to manually add the roles should be fine though.

#

Oh man, I wish I had found Eris before building a bot with Discord.js.

opal plank
prime mist
opal plank
#

pros and cons

stark cape
#

how to reactivate it?

opal plank
opal plank
#

Nopes problem

opal plank
prime mist
#

Just reading through the API docs

opal plank
#

would highly recommend just checking the basic stuff, the docs are generated

#

you'll abuse most of the stuff in intellisence

#

"basic stuff" i mean the examples

#

forgot to mention. heres the links

prime mist
#

Was just making sure I could deploy it on our Kubernetes cluster, with proper sharding support.

opal plank
#

it has sharding on its own

#

no need for kubernetes to spawn them

#

unless you really want to

prime mist
#

I really want to.

opal plank
#

it has its own cluster spawning

#

you should ask in their server how to do it in all honesty, i personally dislike kubernetes

prime mist
#

But it looks like you can set the shardID and shardCount just fine. So we are all good 🙂

opal plank
#

detritus best lib

#

by far

slim heart
#

eyes

opal plank
#

stink

slim heart