#development

1 messages · Page 962 of 1

calm lantern
#

I'm dub af

#

sorry

earnest phoenix
#

Np

calm lantern
#

dumb*

earnest phoenix
#

You'll get there soon

sudden geyser
#

how what

calm lantern
#

sorry I'm kinda dumb, I know that one of the ways to edit a message is using this .then(msg => { msg.edit but how can I trigger it without the ".then"?

#

I know I need to define the message first

#

I did

#

I'm saying that to lite

#

she asked it

earnest phoenix
#

mihz0 how do i destory queue 😄

digital ibex
#

@calm lantern use await

light jackal
#
  <style>
    .html { 
      background-color: #4a4a4a;
    }
  
    .body { 
      background-color: #4a4a4a;
    }

    .bot-img {
        border-radius: 500%;
    }
  </style>
#

i tried to change background color to see efects

#

Timo

#

But like i said, this doesnt give any efect.

#

i tested border-radius on inspect element and it should work

knotty steeple
#

500%?

weak parrot
#

Try and do !important at the end of each thing (example: background-color: #4a4a4a !important;) as some things need an important to be overwritten. Also pretty sure it's just body rather than .body

digital ibex
#

yello

knotty steeple
#

yes its just body

light jackal
#

@weak parrot nah, doesnt work

digital ibex
#

does anyone know why req.guilds is undefined?

#

in expressjs

knotty steeple
#

are u sending guilds

digital ibex
#

i have: ```js
app.use(passport.initialize());
app.use(passport.session());

light jackal
#

Okay nevermind it worked, now thanks guys.

digital ibex
#

for a dashboard, but req.guilds is undefined for some reason. i also have: ```js
router.get('/', auth, (req, res) => {
res.render('dashboard', {
user: req.user,
guilds: req.guilds
});
});

valid frigate
#

i wrote this code in rust but i'm curious as to why i need to cast data_set.len() to i32? if i don't do this it says the type is usize

fn main() {
    let mut data_set = vec![2, 4, 8, 10, 6];
    data_set.sort_unstable();

    let sum: i32 = data_set.iter().sum();

    println!("The mean of data_set's values is {}", sum / data_set.len() as i32)
}
west raptor
#

uh

#

one sec lemme hop onto my computer

#

Ok so I took a look and .len() returns a usize because that's obviously how big the array could possibly be and Div<i32> isnt impl'd for uize because that can cause some errors say the sum is -5

#

I don't think there is a big work around

#

I guess you could make sum usize which might eliminate some redundancies but that's all i know of to do

valid frigate
#

huh

#

maybe

#

ok yeah apparently setting sum type to usize fixed it

dusky marsh
#

im not entirely sure of what your problem is, but rusts compiler wants to know what type of result you want. it doesnt know what to value to use that emcompasses all the possible values of your solution whatever that solution may be. i hope that makes sense ferris_think

opaque seal
#

Can you send an embed + normal text in the same message?

misty sigil
#

help

#

anyone know how i can adapt this for use with my bot it only accepts stuff like this https:\/\/purr.objects-us-east-1.dream.io\/i\/zeVFT.jpg and not this https://i.imgur.com/VQi7xiv.jpg

opaque seal
#

Yes @opaque seal.
thx

lyric mountain
#

@misty sigil what?

misty sigil
#

tryna get images from an api

lyric mountain
#

Ok

#

What's the issue?

#

Doing a simple fetch would return u the image from imgur

misty sigil
#

it doesn't go past the fetch command tho

opaque seal
#

What's the char to quote text like that?

lyric mountain
misty sigil
#

ok now im just ruining my code more

#

how on earth do i use node-fetch

lyric mountain
#
fetch("someurl")
	.then(res => dosomething)
misty sigil
#

res => then just my code?

lyric mountain
#

Res can be called whoever you like

#

And yes, res will be the response returned by the fetch

#

That's a promise

misty sigil
#

RESponse

lyric mountain
#

That's why I call it like that

opaque seal
#

thx

#

.send(‘msg’, { embed: embed }); [@opaque seal]
@earnest phoenix is there a way to send the embed first and then the msg?

lyric mountain
#

No

#

Message is always at the top

misty sigil
#

aside from actually sending them seperately

opaque seal
#

Uhm

misty sigil
#

but the api might wanna have a talk

lyric mountain
#

Yeah, you'll need to do a bit of research about fetch

#

Also, there might be another easier way of getting an image from the web

misty sigil
#

im getting a random link

#

from a json api

lyric mountain
#

As I said, there might be an easier way of getting an image from an url

misty sigil
#

probably

lyric mountain
misty sigil
#

dont wanna download

#

should be able to adapt

lyric mountain
#

Probably

misty sigil
#

just need it to return res.body.whateveriwannaget

lyric mountain
#

Just dont save the image, use it from inside a var

#

Downloading doesn't necessarily means creating a file in your system

misty sigil
#

although I want to get the link not the file

lyric mountain
#

So fetch would be better then

misty sigil
#

yea

lyric mountain
misty sigil
#

as the API im working with returns

{
    "message": "https://images.dog.ceo/breeds/pitbull/20190710_143021.jpg",
    "status": "success"
}```
lyric mountain
#

You'll need to use imgur api if you want to get imgur links

#

You can't use api from X to get links from Y

misty sigil
#

ill just ignore imgur then

lyric mountain
#

Imgur is the safest tho

frigid galleon
#

I need help trying to get my bot online

astral yoke
#

give
code

frigid galleon
#

ok

#

dm's ill give in dms

astral yoke
#

no no

#

you dont need to

#

this is how it works

#

alr ill look at it though i guess

#

theres 2k people who dont need your coding but alr

night tartan
#

lol

#

true

digital ibex
#

hi

earnest phoenix
#

hi

digital ibex
#

im kinda new to css

#

does anyone know why <link rel="stylesheet" href="../../public//stylesheets/main.css"> isn't changing anything?

#

like, the css in there isn't changing anything

earnest phoenix
#

Do you run a node.js server or a ftp server?

#

or is it local on your disk

digital ibex
#

its on my pc

earnest phoenix
#

then you could try replacing the // with just / or providing an absolute path

digital ibex
#

thats the path that vsc automatically done

#

like, i just do / and it says the next path thing

earnest phoenix
#

just replace // with /, vscode has a seizure sometimes

digital ibex
#

straight of course tho lol

#

still nothing

earnest phoenix
#

then you can try to look at the network tab in devtools and look at the path your browser compiled that to

#

and maybe fix it from there

#

or add a ./ infront of the path

digital ibex
#

the path to the file is correct

earnest phoenix
#

try adding a ./ infront of the path

#

that means basically “Go from the directory this file is in”

digital ibex
#

thats not the issue, idk if its cuz of whats around it

#

kk

#

but thats changing the path

earnest phoenix
#

just add it

#

magik

digital ibex
#

im already doing ../

lyric mountain
#

Have you closed that tag?

twilit prairie
#

how can i make it so that when my dashboard goes offline it will show on command stats

earnest phoenix
#

you don’t need to close a link tag

lyric mountain
#

Ah

earnest phoenix
#

@twilit prairie ping it every few secs / mins and if it times out display it as offline

digital ibex
#

nothing

#

<link rel="stylesheet" href="./../public/stylesheets/main.css">

earnest phoenix
#

no

#

./../../

#

add it in front of the path

#

don’t change it

digital ibex
#

still nothing

earnest phoenix
#

so you should now have ./../../public/stylesheets/main.css

digital ibex
#

<link rel="stylesheet" href="./../../public/stylesheets/main.css">

earnest phoenix
#

if you don’t you fucked up

#

hm

digital ibex
#

yeah

earnest phoenix
#

is the link tag in the head tag?

digital ibex
#

its not

earnest phoenix
#

bruh

digital ibex
#

im new to html and css

#

im trying to learn it

earnest phoenix
#

link tags belong into the head tag

#

<head>
(the link tag)
</head>

digital ibex
#

so like html <head> <link rel="stylesheet" href="./../../public/stylesheets/main.css"> </head>

earnest phoenix
#

yes

digital ibex
#

?

#

o ok

#

how do i give the site a little icon?

earnest phoenix
#

did it work

digital ibex
#

uh, it didn't

earnest phoenix
#

you have to (I think) create a link with favicon as rel

#

but I’m not sure

#

also REEEE

digital ibex
#

in an ejs file btw

#

any ideas?

earnest phoenix
#

no

pale vessel
#

favicon lol

#

<link rel="icon" href="path/to/icon" type="mime">

digital ibex
#

do u kno y the css doesn't work

#

im so confusrd

pale vessel
#

check console

#

browser console

digital ibex
#

theres nothing there

pale vessel
#

there should be

digital ibex
#

oh, browser console

#

i only get The key "width-device-width" is not recognized and ignored.

lyric mountain
#

What is "width-device-width" lol

#

Your css has issues in it

digital ibex
#

<meta name="viewport" content="width-device-width, initial-scale=1.0">

#

i'm using something called 'bulma'

amber fractal
#

it's width=device-width

#

not width-device-width

pale vessel
#

that's not bulma, that's html xd

digital ibex
#

o

pale vessel
#

does it work now?

digital ibex
#

just chekcing 2 secs

lyric mountain
#

What is bulma? Never heard that name except for goku's passion

pale vessel
#

it's like bootstrap but better (i heard)

lyric mountain
#

Ah

amber fractal
#

It's a css framework that makes responsive designing easy

earnest phoenix
#

***I NEED ***

digital ibex
#

nothing in the console and it still doesn't work

woeful pollen
#

help it says I don't have permission to install npm package

lyric mountain
#

@woeful pollen if on ubuntu use sudo

#

Else run command prompt as admin

woeful pollen
#

how

#

im trying to install it onto repl it

lyric mountain
#

Right click -> run as administrator

autumn summit
#

Hi can I get some help

#

I already have from discord.ext import commands, tasks

#
    @tasks.loop(minutes=10)
    async def auto_updateleaderboard(self):
        guild = self.bot.get_guild(privacy)
        channel = guild.get_channel(privacy)
        msg = await channel.fetch_message(privacy)
        count = 0
        leaderboard = discord.Embed(title="Leaderboard", description="top 25 clans, based on points", color=0x00FF00)
        for rol in points.find().sort('points', pymongo.DESCENDING):
            rol_id = rol["_id"]
            clanname = self.bot.get_role(int(rol_id))
            if count == 0:
                leaderboard.add_field(name=f"**:medal:: __{clanname}__**", value=f"Points: **__{str(rol['points'])}__** \n \n ", inline=False)
                count += 1
            elif count == 1:
                leaderboard.add_field(name=f"**:second_place:: __{clanname}__**", 
                value=f"Points: **__{str(rol['points'])}__** \n \n ", inline=False)
                count += 1
            elif count == 2:
                leaderboard.add_field(name=f"**:third_place:: __{clanname}__**", value=f"Points: **__{str(rol['points'])}__** \n \n ", inline=False)
                count += 1
            elif count <= 25:
                leaderboard.add_field(name=f"**{clanname}**", value=f"Points: {str(rol['points'])} \n \n ", inline=False)
                count += 1
            if count == 25:
                await msg.edit(embed=leaderboard)
                print("Leaderboard updated.")```
#

for context there are 25 clans with points

#

but there is no "Leaderboard updated." in my terminal

#

I also already have self.auto_updateleaderboard.start() in my init

#

help

earnest phoenix
#
3|python   |     at Function.Module._load (internal/modules/cjs/loader.js:543:3)
3|python   |     at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
3|python   |     at startup (internal/bootstrap/node.js:238:19) code: 'MODULE_NOT_FOUND' }
3|python   | { Error: Cannot find module '/root/python'
3|python   |     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15)
3|python   |     at Function.Module._load (internal/modules/cjs/loader.js:520:25)
3|python   |     at Object.<anonymous> (/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js:32:23)
3|python   |     at Module._compile (internal/modules/cjs/loader.js:702:30)
3|python   |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
3|python   |     at Module.load (internal/modules/cjs/loader.js:612:32)
3|python   |     at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
3|python   |     at Function.Module._load (internal/modules/cjs/loader.js:543:3)
3|python   |     at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
3|python   |     at startup (internal/bootstrap/node.js:238:19) code: 'MODULE_NOT_FOUND' }```
#

🤔

#

Learning python

sudden geyser
#

pythonscript

earnest phoenix
#

Yes

#

It's got error

fiery stream
#

Ayy

#

I was planning on getting a vps which should i get

#

Google cloud platform pr aws

#

Or*

pale vessel
#

google cloud platform free 12 months

#

maybe that

fiery stream
#

Is it fast?

#

And what does it offer

#

By offer i mean specs

pale vessel
#

it's google, yes

#

i'm not sure

#

it's probably listed somewhere

fiery stream
#

K thx

steel drum
#

i recommend OVH

#

3.49 for a 2gb vps

fiery stream
#

Whats that

steel drum
#

probably a good option to start with

#

a vps provider

fiery stream
#

Well google is free for a year

#

With 300$ credits

steel drum
#

then use that

lyric mountain
#

Contabo is also very good and cheap

#

Their customer service is excellent

fiery stream
#

Well only google, aws and azure are the bosses in this stuff for me

strong tundra
#

i hear hetzner is good

fiery stream
#

I never heard of these 😭😭

strong tundra
#

honestly i'd probably only use gcp/aws/azure if something i'm doing requires something only they can provide

#

like autoscaling etc

lyric mountain
#

There are better providers than the big three lol

strong tundra
#

or you can use them for their free credits lol

lyric mountain
#

Well, not exactly better

#

But give them a look

fiery stream
#

I only know digital ocean linode n vultr except the gcp, aws, azure

strong tundra
#

vultr is nice

fiery stream
#

Yee

strong tundra
#

if you don't need to host anything they do have a cheap plan with only a ipv6 address

steel drum
#

aws and azure

#

are overpriced imo

#

you can get cheaper vpses from other reliable providers

fiery stream
#

Actually aws offers way more free services and i like that

steel drum
#

same w digitalocean too tbh

#

yea but they're free for a reason

#

they're not that strong

fiery stream
#

But i dont like how the random make you pay if you overuse em

steel drum
#

¯_(ツ)_/¯

#

ive been using ovh for years

#

3.49 for a 2gb vps

fiery stream
#

Who is ovh by?

steel drum
#

and its easy to upgrade

fiery stream
#

Imma prolly use gcp

#

Cuz then i can use dialogflow pro too

paper phoenix
#

I only know digital ocean linode n vultr except the gcp, aws, azure
@fiery stream - I use and love Vultr. Would highly recommend

fiery stream
#

I understand but isnt the free option better then that

#

Since google cloud platform is free for a year

strong tundra
#

i used to use DO

#

i'd say it's good but there are cheaper

steel drum
#

thats extremely deceiving advertisement

#

ive tried out other offers from other sites but

fiery stream
#

Do is nice i like it#

steel drum
#

its "free for a year"

#

if you use the lowest tier option

#

like 512mb of ram lol

narrow hedge
#

you my bot get verifyed ?

fiery stream
#

Lol my bot actually needs 10mb as of now

steel drum
#

yes, now

strong tundra
#

my bot needs about 10mb too

#

lol

paper phoenix
#

With a good provider, you're paying for more than just the VPS. Vultr ain't cheap but they respond in minutes at all hours, they've helped me with legal issues, and I've got projects that haven't had a minute of downtime in two years

vale garden
#

how do i fix this

steel drum
#

^^ what @paper phoenix said

strong tundra
#

yeah totally

narrow hedge
#

how my bot get verifyed ?

lyric mountain
#

Same with contabo

steel drum
#

@narrow hedge wait a week or two

strong tundra
#

i hear do support is insanely good

vale garden
#

hey how do i fix that error

lyric mountain
#

Issues solved within hours

strong tundra
#

@fiery stream what lang is your bot?

vale garden
#

someone help

steel drum
#

ive never had downtime w ovh

#

not even for a few minutes

narrow hedge
#

yeah, but you i
I request ?

#

yeah, but how i
I request ?

vale garden
#

hey help me someone

paper phoenix
#

Getting a VPS and the service that comes with it is very, "Pay cheap, get cheap." Or the other, "The cheap man pays twice."

vale garden
#

HELP ME

steel drum
#

or something like that

#

just look around top gg

strong tundra
#

yea

steel drum
#

is tehre somewhere

vale garden
#

SOMEONE HELP

lyric mountain
#

@vale garden you've put , instead of dot

fiery stream
#

@strong tundra py

strong tundra
#

i feel most of the mainstream vps providers are good enough in terms of that

vale garden
#

where

strong tundra
#

thanks

narrow hedge
#

how my bot get verifyed in discord

fiery stream
#

@vale garden i think it’s supposed to be "." Not ","

lyric mountain
vale garden
#

oh

strong tundra
#

lol

vale garden
#

kk

#

lol

narrow hedge
#

how my bot get verifyed in discord

lyric mountain
#

Read error plz

fiery stream
#

lol it happens sometimes

#

@strong tundra whats lang your bot in?

steel drum
#

it says .js

strong tundra
#

rust

steel drum
#

at the end of the file

#

o

fiery stream
#

Oh nice

#

I actually wanan try rust

paper phoenix
#

how my bot get verifyed in discord
@narrow hedge - If you don't know how to properly research that you're probably not going to be eligible.

But start out by joining the official Discord Developers server.

strong tundra
#

it's pretty nice

fiery stream
#

But before that i wanna try go

strong tundra
#

i've actually never used go

#

it seems pretty nice

steel drum
#

real bot developers make a bot entirely in scheme

fiery stream
#

Py is my second Lang after js

steel drum
#

ah yes, one of the "script-kids"

fiery stream
#

I dont like compiling

#

Seems hard thing to do

steel drum
#

ull appreciate the compilers one day

#

trust me

lyric mountain
#

It's as hard as pressing a button

steel drum
#

plus even js is compilable now!

fiery stream
#

How?

lyric mountain
#

And compilers point your errors before you actually run the code

steel drum
#

well, compile to js

lyric mountain
#

Wait, what?

steel drum
#

you can write code in typescript

#

and itll be compiled to javascript

fiery stream
#

Oh that

#

Ik i never used ts to cuz of that

steel drum
#

which is how javascript should be written now imo

lyric mountain
#

Lol for a second I though I'd be able to compile js code

fiery stream
#

Nah js is fine

steel drum
#

its really helpful when you're working on a git repo

#

with other ppl

strong tundra
#

compiling doesn't really take that long for a smaller project

fiery stream
#

Actually any one of you used deno

#

?

strong tundra
#

i used to be kinda scared of compilation times lmao

fiery stream
#

Thats why i dont like that langs

steel drum
#

compiling + type declaration has helped me write smarter code the first time tbh

lyric mountain
#

Also it can save a ton of time finding errors

#

And you can profile the code

steel drum
#
  • helpful for when you come back to some old code after awhile and give you a better idea of where u left off
fiery stream
#

Its my brain who stops me from writing a compiling app

lyric mountain
#

Not to say the supreme debugger

fiery stream
#

Whenever i start on something i just randomly start thing how is multi file compiling gonna work n stuff

#

And then i do t get any motivation

lyric mountain
#

?

#

Like, compiled langs aren't hard at all to understand, "compiling" itself ain't cerberus

fiery stream
#

I dont know ill try that sometime later in life

wise cosmos
#

Yo

viral plover
#

Hey, is there a way to make sure an image embed works?
I have a bot set to post a random image using a list of imgur links.
Whether an individual image loads in the embed seems to vary on the day, completely unrelated to the code or the bot's state.

wise cosmos
#

Are u using discord.js

viral plover
#

Yes.

#

In javascript.

wise cosmos
#

Ik

#

U wanna to randomize?

earnest phoenix
#

it pretty much depends on how discord's cdn and how the image host you're using feels

viral plover
#

Gosh darnit.
That's what I thought.

wise cosmos
#

I really don't understand you hehe

viral plover
#

It randomizes fine.
Sometimes the images just don't load.

wanton nova
#

you might wanna include a link in the description just in case the image doesnt work

viral plover
#

Yeah...

wanton nova
#

and the user is that desperate lol

viral plover
#

This bot is time-sensitive so I'd rather not but I might just in case...

wise cosmos
#

I want to do a Spotify Playlist bot but

viral plover
#

I want the bot to be able to detect when the image isn't working. Is that possible?

#

I tried using the image properties in the embed but they aren't different between when it loads and it doesn't.

#

I'd help you poryx but I don't know how to do that either.

wise cosmos
#

But

#

The image

#

Load in the same msg?

#

I don't speak a lot of english

woeful pollen
#

can you help with mongo

#

I am a little bit stuck

#

Im trying to make a database to hold currency system

#

where the key is the user ID and the value money is a number

#

so a bit like this

Documents
{
    {name : (id), money : 10},
    {name : (id), money : 69},
    {name : (id), money : 420},
}```
#

my issue is finding the money of a user and then changing it

#

ive read the docs and don't quite understand

#

I think this is the code to change the value:

db.collection('money').updateOne({
        "money": money
        }, {
            $set: {
                "money": (newvalue)
            }
        });
#

But how do I get the specific user's data (which is the one I want to update)

#
var cursor=db.collection('money').find({name: id})

Is this it??

pure lion
#

@pure lion error pls?
@jagged gulch none, but it's only ever calling the first if statement no matter the condition of the custom status

vale garden
#

i have no idea what to do

#

i use quick.eco

#

i randomly removed everything from the sqlite file

#

and put it back

#

and that did something

earnest phoenix
#

you corrupted it

vale garden
#

so what do i do

earnest phoenix
#

start from scratch if you don't have a backup

vale garden
#

..

#

so should i make a new bot

earnest phoenix
#

oh no, just a new db

vale garden
#

wdym

#

i didnt understand

steel drum
#

its nothing wrong with the bot

vale garden
#

oh

steel drum
#

its a problem w the database file

vale garden
#

yeah but what do i do

#

its controlled by the package

#

quick.eco

#

@steel drum

steel drum
#

¯_(ツ)_/¯

#

im not familiar with quick.eco

#

sry

#

try deleting the file

vale garden
#

yeah but its the same with any package right

#

ok

#

the sqlite?

#

ill delete thesqlite file and the package

#

then reinstall it

#

will that work

#

@steel drum

copper cradle
#

dude

#

delete the file

vale garden
#

yeah the sqlite file right?

copper cradle
#

yes

#

just delete it

vale garden
#

kk

copper cradle
#

you gotta create your tables and add colums to them again

vale garden
#

oh donw

#

done

copper cradle
#

never touch database files

vale garden
#

it works now

#

thnx

copper cradle
#

np

steel drum
#

what snails said

vale garden
#

now i know how to reduce everyone's bal back to 0

#

lol

#

thats like what i tried to find out

copper cradle
#

don't do it that way

steel drum
#

there is software to edit SQLite files using a client, but you'd need to download those

#

wouldnt a simple query like sql UPDATE users SET money=0

earnest phoenix
#

or just execute the commands from code

#

yeah

copper cradle
#

yeah

steel drum
#

work

vale garden
#

ok

copper cradle
#

an SQL string will always work

vale garden
#

its ok ill just delete the file

#

lol

earnest phoenix
#

you should make backups of your database file if you're going to use it long term fyi

vale garden
#

how do i

steel drum
#

since you're using sqlite, you could just copy the file

#

save it under a different name

vale garden
#

ok

#

btw

#
const Discord = require("discord.js");
const client = new Discord.Client();
const Eco = require("quick.eco")
const eco = new Eco.Manager();

module.exports = {
  name: 'leaderboard',
    description: "shows the server's leaderboard",

  execute (message, args) {

    let lb = eco.leaderboard({ limit: 10, raw: false });
        const embed = new Discord.MessageEmbed()
        .setAuthor("Leaderboard")
        .setColor("BLURPLE");
        lb.forEach(u => {
            embed.addField(`${u.position}. ${client.users.cache.get.tag}`, `Money: ${u.money}`);
        });
        return message.channel.send(embed);
}}```
#

this is my code for the leaderboard command

#

but it gives me this

#

does anyone know how to fix the undefined

steel drum
#
client.users.cache.get.tag```
#

should be

#

client.users.fetch(ul).tag

vale garden
#

ok

steel drum
#

wait

#

im sorry

vale garden
#

oh

#

ok

steel drum
#

thats what it should be

#

you could check the cache,

vale garden
#

is that L or 1

steel drum
#

but unless you specified you want to cache all users, its possible the user isnt in the bot cache

#

so its better to fetch the user

vale garden
#

but is that L or 1

#

lol

steel drum
#

if he is in the cache, itll just return whats in the cache

#

what do u mean L or 1?

vale garden
#

ok but

#

u1

steel drum
#

that says ul lol

vale garden
#

oh lol

steel drum
#

well

#

it should be a u

#

idk why i added a l

#

but u get the gist of wht im trying to say

vale garden
#

ok

#

i got this

#

and if i didnt use cache it just didnt work

#

@steel drum

#

help me lol

#

what

#

i got this without cache

golden condor
#

You don't need .cache

#

Just do

#

.fetch(u).tag

steel drum
#

what he said

vale garden
#

without cache i still have problems

#

i changed it to this

#
const Discord = require("discord.js");
const client = new Discord.Client();
const Eco = require("quick.eco")
const eco = new Eco.Manager();

module.exports = {
  name: 'leaderboard',
    description: "shows the server's leaderboard",

  execute (message, args) {

    let lb = eco.leaderboard({ limit: 10, raw: false });
        const embed = new Discord.MessageEmbed()
        .setAuthor("Leaderboard")
        .setColor("BLURPLE");
        lb.forEach(u => {
            embed.addField(`${u.position}. ${client.users.fetch(u.id).tag}`, `Money: ${u.money}`);
        });
        return message.channel.send(embed);
        }
}```
tight plinth
#

What problem you get without cache

pure lion
#

how do i fetch all the member ids in a guild (discord.js) my current code is this but idk how to get just the ids

  var membersInGuild = msg.guild.members.fetch()

:^)

tight plinth
#

With discordjs you have to fetch the entire member object sadly

pure lion
#

oh god

#

is there a way to only do the first 100? i dont want my computer to explode

#

log the first 100*

tight plinth
#

The first 100 members of a guild? No

sudden geyser
pale vessel
#

first 100 members are not guaranteed

tight plinth
#

Your bot will probably fetch other members after a while

pale vessel
#

you would fetch all members and sort by join timestamp

#

then it should be accurate

pure lion
#

oh alrighty

obtuse lodge
golden condor
#

Probably

sudden geyser
#

I see.

pale vessel
#

@coral trellis

earnest phoenix
#

I have same problem.

toxic jolt
#

its my error i how to fix?

#

okay

#

my discord version 11.

pale vessel
#

it's easier to use .catch if you only need to make one request

#

otherwise use try catch with await

toxic jolt
mossy vine
#

fixing your indentation would be a good start

toxic jolt
#

It should do "msg.reply" in certain sentences, but it does not detect.

earnest phoenix
#

yeah

golden condor
#

Hello there, I am having issues with going setting my bot's status (to dnd) but I only have this issue when intents are on, when they are not defined, everything works fine. What could be causing this and how can I fix this (feel free to ping if you have a response). I am using discord.js v12.2.0. Thanks in advance :)

#

This is what I have in my ready event

#
const presences = [
    "c!help | New Web Dashboard!",
    "c!help | https://corynth.xyz/",
    `c!help | ${client.guilds.cache.size} servers`,
    `c!help | https://corynth.xyz/support`,
    "c!help | https://corynth.xyz/invite"
  ]
  let i = 0;
  setInterval(() => {
    if (i === 2) {
      client.user.setPresence({ activity: { name: `c!help | ${client.guilds.cache.size} servers` }, status: 'dnd' })
      i++
    }
    else {
      client.user.setPresence({ activity: { name: presences[i] }, status: 'dnd' })
      i++
      if (i > 3) i = 0;
    }
  }, 15000)```
pale vessel
#

nope

golden condor
#

No

smoky spire
#

15 seconds is way too fast for presence change

pale vessel
#

it was setGame() iirc

golden condor
#

15 seconds is way too fast for presence change
@smoky spire no it isn't

pale vessel
#

it's less than ~5 secs

golden condor
#

^

#

that's not the point, the bot won't set itself to dnd

#

If you don’t put the variables in the interval they won’t update since the ready event only happens once.
@earnest phoenix it works, it sets the status every 15 seconds

quartz kindle
#

he overrides the index 2

golden condor
#

No

#

Yep

quartz kindle
#

the problem is that statuses randomly dont work

#

and nobody knows why

golden condor
#

no it works when I comment out intents

#

But doesn't when I use intents

quartz kindle
#

oh really

golden condor
#

yeah

quartz kindle
#

which intents are you using?

golden condor
#

intents: ["GUILDS", "GUILD_MEMBERS", "GUILD_BANS", "GUILD_VOICE_STATES", "GUILD_PRESENCES", "GUILD_MESSAGES", "DIRECT_MESSAGES"] (I am whitelisted)

quartz kindle
#

weird lol

#

i just tested in mine and it worked

#

my intents are "GUILDS", "GUILD_MESSAGES", "GUILD_MESSAGE_REACTIONS", "DIRECT_MESSAGES", "DIRECT_MESSAGE_REACTIONS"

golden condor
#

That's weird

#

@quartz kindle mine won't work

#

That's weird

placid cobalt
#

is any one here able to make an announcments channel for me?

golden condor
#

That costs money mate

quartz kindle
#

@golden condor do you have another bot running? like a development version of your bot

golden condor
#

No

#

This is the only version

#

I can try reset the token to check if you want

quartz kindle
#

do you have an eval command?

golden condor
#

Yes

quartz kindle
#

have you tried using client.user.setStatus() in your eval?

golden condor
#

Yes I have

quartz kindle
#

well idk then

#

i've seen this happen to other people and nobody knows why

#

it randomly works or doesnt

golden condor
#

It's so weird that it works without intents but doesn't with tjem

#

I'm just so confused

earnest phoenix
#

@dusty bronze

obtuse lodge
digital ibex
#

how can i make a fill the background of something with css?

#

like ^

#

but not messy, just a big block

pale vessel
#

background-color

#

create a container

digital ibex
#

im trying to see if the thing even works, and when i do css base { background-color: #fff } nothing happens

cinder patio
#

Isn't #fff just white

#

and isn't it already white

pale vessel
#

that is definitely not the correct "base"

#

are you sure it's a tag?

#

the tag base would be in head

#

maybe it's a class/id

digital ibex
#

oh

pale vessel
#

also, ;

digital ibex
#

and yeah, i just realised its white 🤦‍♂️

#

o ok

earnest phoenix
digital ibex
#

oh shit. thank u

#

it works

earnest phoenix
digital ibex
#

use css

opaque seal
#

Can I use markdown on Discord?

earnest phoenix
#

@opaque seal discord ?

digital ibex
#

yes u can

pale vessel
#

embeds and webhooks only

#

OH

opaque seal
#

Ouch

pale vessel
#

that's hyperlinks

earnest phoenix
#

use css
@digital ibex i said how

pale vessel
#

they told you how

#

now go learn css

digital ibex
#

ok, now i done css body { background-color: grey; } but it didn't change anything

pale vessel
#

you can insert css styles by using the <style> tag in html

#

try adding important

opaque seal
#

embeds and webhooks only
@pale vessel ?

pale vessel
digital ibex
opaque seal
#

So Discord doesn't support markdown?

digital ibex
#

fill that bit in

pale vessel
#

discord does

#

is that localhost?

digital ibex
#

e

#

yes

pale vessel
#

aw

#

use inspector

opaque seal
#

So embeds support markdown completely while normal text only a few things

pale vessel
#

no

#

the only addition in embed is hyperlinks

opaque seal
#

Oh

#

Ok

pale vessel
#

still, there's no headers and stuff

opaque seal
#

Discord should implement markdown fully imo

pale vessel
#

bad idea

#

since it's for chatting

opaque seal
#

Could be useful for announcement and stuff

pale vessel
#

would you want people to send big text

earnest phoenix
#

@digital ibex whats used for multiple colors ?

pale vessel
#

maybe an option to toggle them, yeah i would agree

opaque seal
#

And create a permission for it

digital ibex
#

wym

stable grail
#

u can use w3schools for color search

#

just saying :d

still merlin
#

I deleted a folder in my bots project by accident and I can't find the file I need in the recycling bin, How do I recover deleted files in visual studio code

stable grail
#

idk but it would be good if you do backups 😄

#

or where do you host ur bot?

still merlin
#

If your not gonna be helpful don't respond if you don't know

stable grail
#

if you have a host and posted it on github you could get ur code back

#

i wasnt finished xd

cinder patio
#

VSC puts in the recycling bin it should be there

still merlin
#

Thank you, I found the folder in my recycling bin tysm

pale vessel
#

If your not gonna be helpful don't respond if you don't know

idk but it would be good if you do backup
This is useful.

stable grail
#

ikr xd

#

im doing every 2 weeks some backup so it cant get lost or if my hard drive dies

south totem
#

does anyone actually use a .yml file for their bots error messages etc? i dont im lazy af xD

digital ibex
#

hi, with css, how can i change the background of the whole page?

#

like ik i need to use background-color but what hthing do i put? like css this-thing-here { background-color: .. }

golden condor
#

body

haughty night
#

either the body{
}
Or the container that contains the page

digital ibex
#

i done that but it didnt change anything

haughty night
#

Use element inspect for that

digital ibex
#

nothing

haughty night
#

;

#

try adding that

cinder patio
#

There is a * next to the file name, is it saved?

digital ibex
#

nothing

#

how do i save it?

haughty night
#

ctrl + s ?

#

Wait, this is element inspect

digital ibex
#

yeah

#

i remove the .navbar and the css goes, and i add it back and it comes back straight away

cinder patio
#

When I edit anything in the console a * appears above the file name so it's probably not saved

#

CTRL+S to save it

digital ibex
#

kk

#

still nothing

haughty night
#

What does it say when you hover over the triangle?

digital ibex
#

'changes to the file were not saved to the system'

cinder patio
#

why aren't you using an editor

digital ibex
#

I am

cinder patio
#

Then why aren't you editing the file in the editor instead of in inspect element?

digital ibex
#

diesIrae said try in inspect

haughty night
#

Yae , i assumed he was changing an existing page

digital ibex
#

doesn't work in either

haughty night
#

Didnt know you were making one from scratch

cinder patio
#

reload the page, are you hosting the files on a server or is it just a html file

digital ibex
#

just html and css

cinder patio
#

try reloading the page

digital ibex
#

same

cinder patio
#

have you saved the css file?

haughty night
#

can you open your editor and show me?

digital ibex
#

yeah

#

sure

stable grail
#

u can open it over a browser and then look at it

#

just click on the file and click open with

digital ibex
#

it shows it in inspect as well

stable grail
#

hm ok

haughty night
#

try putting body above .navbar

stable grail
#

it will be still the same

haughty night
#

Yes, normally it doesnt matter

#

But you can always try

pale vessel
#

doesn't matter lol

#

try adding !important

stable grail
#

let me look at my css file

#

wait xd

digital ibex
#

where do i add !important?

haughty night
#

grey !important;

pale vessel
#

before semicolon

digital ibex
#

kk

stable grail
#

i have it like this

#

why is it so blurred

#

weird

pale vessel
#

isn't this for his dashboard

digital ibex
#
body {
   background-color: grey !important;
}```
#

yes, im trying to make my home page

stable grail
#

its actually pretty easy xd

#

i wrote that when i was 12

marble osprey
#

how can I send the embed to a different channel than the one where I sent the command? (discord.js)
https://prnt.sc/svcfzz

Lightshot

Captured with Lightshot

golden condor
#

fetch the channel and then use .send

#

example

#

<client>.channels.cache.get("channel id").send("a message")

marble osprey
#

Where is the mistake?

cinder dove
#

Yes

pale vessel
cinder dove
#

What is ''channels''

marble osprey
#

@pale vessel how I define channels

cinder dove
#

To define a channel you must specify in what event you want to get the channel, or just get it from all the guilds.

#

If you want to get it from the message event, and in the same channel of the message, use message.channel for that.

#

If you want to get another channel from the guild of a message event, instead of the channel where the message was sent (message.channel), you must use message.guild.channels.cache.get('ID')

#

This will go in the message event message, get the guild where the message was sent guild, then get the channels of that guild channels and you must use cache for the get function.

marble osprey
#

thank you very much

cinder dove
#

You're welcome.

pearl igloo
#

How do I do that when I start my bot in my terminal it shows me on which servers it is?

#

If it's possible.

stable grail
#

you mean server count?

pearl igloo
#

yes

stable grail
#

its possible but i have never done one

cinder dove
#

(client).guilds.cache.size

#

to show the names of that, use (client).guilds.cache.forEach(g => {

then for each guild, you can store g.name into an array, or just console.log it / export it.

earnest phoenix
#

(client) is what you defined discord.Client() after

pearl igloo
#

how can i add it to this code, or rather where

async def on_ready():
    activity = discord.Game(name="Netflix", type=3)
    await bot.change_presence(status=discord.Status.idle, activity=activity)
    print("Bot is ready")```
earnest phoenix
stable grail
#

python

#

xd

earnest phoenix
#

idk shit about py so ima go

cinder dove
#

well

#

i don't code in py but it should be rather similar

earnest phoenix
#

nah b

cinder dove
#

set activity with the name equal to the size of the guilds.

pearl igloo
#

or do i have to make a new event

earnest phoenix
#

on_ready should be good

stable grail
#

u can actually put it in that event

pearl igloo
#

ah thx

earnest phoenix
#

len if you want the amount

stable grail
#

u can do it as a command

earnest phoenix
#

don't spoonfeed code, especially incorrect code

stable grail
#

:c

pearl igloo
#

im kinda lost, how do i do have to change this event? Or rather what do i have to "copy & paste"

async def on_ready():
    activity = discord.Game(name="Netflix", type=3)
    await bot.change_presence(status=discord.Status.idle, activity=activity)
    print("Bot is ready")```
earnest phoenix
stable grail
#

len(client.servers)

earnest phoenix
#

you don't copy paste anything

#

you code it step by step

stable grail
#

or len(self.bot.servers)

#

i think that should work

#

just give it a new activity

#

like game or watching

#

@pearl igloo does it work?

pearl igloo
#

no

digital ibex
#

hi,i have padding-left: 50%;. why does it not go 50% of the way, it only goes a a bit?

pearl igloo
#

where do i have to put it in? i put it under await bot.change...

#

but it says that "self" isn't defined

digital ibex
stable grail
#

why await?

digital ibex
#

i want it to go where the line is

#

not where it actually is

stable grail
#

wait

#

u have to position it in the center

#

position: center;

#

i think that was that

#

oh wait

digital ibex
#

o ok

stable grail
#

test it out with left: 50px;

#

try to put 50px more so it gets centered

#

test around with it

earnest phoenix
#

are you trying to center or what

stable grail
#

yeah im not sure if position: center; would function

earnest phoenix
#

padding expands the container of the element, "padding" it out

stable grail
#

i think its float: center;

digital ibex
#

im trying to make it go to the middle

earnest phoenix
#

such thing does not exist

stable grail
#

float exists

earnest phoenix
#

look into flex containers

#

i know float exists

#

float: center does not exist

stable grail
#

let me look give me sec

earnest phoenix
#

i took 2 years of web design, i know what exists and what doesn't lol

stable grail
#

i havent done it for years

#

xd

#

i did it when i was 12

digital ibex
#

oki, thank u

earnest phoenix
#

it was a part of my course for two years

stable grail
#

i took 2 years of web design, i know what exists and what doesn't lol
@earnest phoenix i thought u meant float doesnt exist

#

but u are right center on float doesnt exist

earnest phoenix
#

in modern css you should almost always go with flex containers for aligning now

slender thistle
#

Flexbox is nice

earnest phoenix
#

flexbox is the best

vale garden
#

hi

#

i keep getting problems

#

my bot was working normally

#

so i randomly check my bal

#

i didnt change anything

earnest phoenix
#

you have multiple instances of the bot running

vale garden
#

what does that mean

#

and how do i fix it

#

@earnest phoenix

earnest phoenix
#

multiple processes running the same code

vale garden
#

i use repl

#

.it

earnest phoenix
#

ok

vale garden
#

what do i do

#

then

#

like do you know why this happens

#

i didnt do anything

worthy kindle
#

@vale garden You could try to restart it.

vale garden
#

ok

#

didnt work

empty owl
#

when you cant afford a vps

turbid bough
#

restart the computer*

brisk torrent
#

Is there any html template or something like that i can copy paste for a documentation of the possible bot command and maybe a "getting started" ?

turbid bough
#

check task manager

earnest phoenix
#

bootstrap is a css framework

#

there isn't a template

#

you should try to be original and build your own regardless though

turbid bough
brisk torrent
#

<pre> incomming

turbid bough
#

he asked for html templates, i gave him html templates

dusk cape
lethal hawk
pearl igloo
#

How can i see at my presence on how many servers my bot is?

amber delta
#

guilds.cache.size?

paper phoenix
#
bot.user.setPresence( { activity: { name: `${ bot.guilds.cache.size.toLocaleString( ) } Servers` }, status: 'online' } );
earnest phoenix
#

@earnest phoenix nice theme

#

how did u do that

#

🤔

#

ultrauxthemepatcher

#

thx

loud horizon
#

hello

#

im new to discord.js

#

and bot making

#
const Discord = require('discord.js');
const prefix = require('./config.json');
const token = process.env.DISCORD_BOT_SECRET
const fs = require('fs');
const keep_alive = require('./keep_alive.js')
const client = new Discord.Client();

client.commands = new Discord.Collection();
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));

for (const file of commandFiles) {
    const command = require(`./commands/${file}`);
    client.commands.set(command.name, command);
}

client.once('ready', () => {
    console.log('Ready!');
});

client.on("message", async message => {
  let perms = message.member.permissions;

const args = message.content.slice(prefix.length).split(' ');
const command = args.shift().toLowerCase();

  if (command === "ping") {
  client.commands.fetch('ping').execute(message, args);
  }


});
client.login(token);```
#

this is my index.js

#

and

#
module.exports = {
    name: 'ping',
    description: 'Ping!',
    execute(message, args) {
        msg.channel.send('Pong.');
    },
};```
#

this is my ping.js

#

but when i do the command it doesnt work

#

even an error doesnt show up

#

how do i fix it

#

?

lyric mountain
#

Is that code copy-pasted?

loud horizon
#

yeah of couse

#

course

#

like do you mean the

#

wait

#

i typed it in by the help of a website

#

but i understand and typed lot of the stuff myself

lyric mountain
#

You haven't created a commands.js file

loud horizon
#

do you have to

lyric mountain
#

Yes

#

That's the issue of copying

loud horizon
#

ok

golden condor
#

It's reading the directory

loud horizon
#

yeah i did that

#

what do i do in that file

golden condor
#

Does the command dir not exist?

loud horizon
#

idk what that means

lyric mountain
#

Ah, readdir

golden condor
#

Yeah

#

idk what that means
@loud horizon the command folder

loud horizon
#

yea i made the folder

#

the ping.js is in it

golden condor
#

You used msg.channel.send

#

But defined it as message

#

So change msg to message

loud horizon
#

oh ok

golden condor
#

Also with the module.exports, how would you use async execute ?

#

I've seen people using it

#

But I'm not sure how to use it myself

loud horizon
#

i did it

#

but it still diesnt work

#

doesnt

golden condor
#

What is your message event?

loud horizon
#

msg

#

module.exports = {
    name: 'ping',
    description: 'Ping!',
    execute(msg, args) {
        msg.channel.send('Pong.');
    },
};```
earnest phoenix
#

has anyone here messed around with azure pipelines, i'm wondering if it's good enough as a CD for a small private github project

loud horizon
#

can i use something like this

#
    bot.commands.get('test').execute(message, args);
    break;```
#

instead of the command === 'test'

#

i found this one somewhere

earnest phoenix
#

while if/else and switch case commands are not the best ones, switch case commands will be more performant than if else ones

loud horizon
#

ok so ill use this

green kestrel
#

Can anyone here with a dashboard tell me what percent of your users access your dashboard via a mobile device please?

lyric mountain
#

More than half as it seems

green kestrel
#

I'm getting 60% desktop and 40% mobile, I'm thinking that's lower than the expected for web as a whole

#

Mobile includes tablet users

loud horizon
#

im getting this now

earnest phoenix
#

well do you have a switch

loud horizon
#

ohh

#

thats why

earnest phoenix
#

case statements are illegal outside of switch closures

green kestrel
#

switch (cmd) { or similar

#

Something to also consider in your code is prefixes

#

I didn't see any prefixes, and best to be configurable too

loud horizon
#

i fixed it but it still doesnt work

#

no errors too

earnest phoenix
#

debug

loud horizon
#

how

earnest phoenix
#

inspect your variables, log at each closure

#

see if the event even hits

green kestrel
#

Debug is what flies round de room all de night MothmanCute

loud horizon
#
const Discord = require('discord.js');
const prefix = require('./config.json');
const token = process.env.DISCORD_BOT_SECRET
const fs = require('fs');
const keep_alive = require('./keep_alive.js')
const client = new Discord.Client();

client.commands = new Discord.Collection();
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));

for (const file of commandFiles) {
    const command = require(`./commands/${file}`);
    client.commands.set(command.name, command);
}

client.once('ready', () => {
    console.log('Ready!');
});

client.on("message", async message => {
  let perms = message.member.permissions;

const args = message.content.slice(prefix.length).split(' ');
const command = args.shift().toLowerCase();

  switch (args[0]) {

  case 'ping':
  client.commands.fetch('ping').execute(msg, args);
  break;

}});
client.login(token);
green kestrel
#

Aaaaah

loud horizon
#

i really cant find anything

#

wrong

earnest phoenix
#

you did not have to put the huge wall here

#

i told you to debug

green kestrel
#

I think you're about getting to the point where you should use a pastebin

earnest phoenix
#

you're going to find your issue if you do so

loud horizon
#

whats a pastebin

earnest phoenix
#

avoid pastebin

#

use alternatives like hastebin/paste.mod.gg/hatebin

#

pastebin is profiting from something that should be free lol

green kestrel
#

Really?

#

So do you get all your hosting for free then

earnest phoenix
#

a text sharing service does not require much processing power at all

#

in fact, hastebin is hosted on heroku for that very reason

green kestrel
#

It does when you get millions of hits a month

earnest phoenix
#

alternatives (which are free) do too, and they still remain free

green kestrel
#

I wouldn't put any real production site on heroku any more than I'd try and host a bot on it

earnest phoenix
#

pastebin profits from ads, which contain trackers because google adsense, and it does not allow you to use a dark theme by default, making it a shitty ass service when there are much much better alternatives to it

green kestrel
#

Anyhow i did say use "a" pastebin

#

Not the site called pastebin

#

But I think too much flack is thrown at sites for deciding to put ads on them

#

Just use adblock

#

They learn that it's not profitable soon enough

earnest phoenix
#

not everyone is that smart :p

green kestrel
#

Using adblock is common sense, it's the 2020s version of using antivirus, except it doesn't eat all your pc

earnest phoenix
#

today alone in this guild i saw 3 people not use adblock when they screenshotted their device lol

green kestrel
#

More fool them

#

Lol

#

Still most malware is delivered through malicious paid for ads these days

#

On dodgy ad networks

earnest phoenix
#

honestly, ublock origin + anti adblock killer scripts is a match made in heaven

lyric mountain
#

Chrome has built in adblock iirc

#

Although it's minimal

topaz fjord
#

adblock for resource heavy ads

earnest phoenix
#

chrome FeelsClownMan

topaz fjord
#

nanoblock is basically ublock origin and anti adblock killers in one

#

it's pretty nice

earnest phoenix
#

also i think chrome has anti trackers, not adblockers built in? which are very minimal

lyric mountain
#

It does have adblock

earnest phoenix
#

mozilla went full in with anti trackers on firefox

lyric mountain
#

It was implemented in a recent update

topaz fjord
#

didn't chrome say they're killing ad blockers

green kestrel
#

Chrome will never build in an ad blocker

#

Google make their money through adwords

earnest phoenix
#

^

topaz fjord
#

they said they would

green kestrel
#

They can try lol, I don't use Chrome

earnest phoenix
#

it's a browser made by google, google makes a lot of their profit from adsense