#development

1 messages · Page 1640 of 1

river panther
#

sir, are there any youtube tutorials for dertius

nimble kiln
#

Webhooks are apparently not affected by your bot's ratelimits

#

At least that's what I experienced yesterday

signal summit
#

So did your bot's uptime got reset when it restarted? Or any sort of data that it was holding when up.

nimble kiln
signal summit
#

Ah okayy, was there any message warning in console? (Assuming you have logging enabled)

lusty quest
#

if you enable the debug event you see for how long you are locked out

modern granite
#

How to get a free website hosting with the domain? Bruh, I know idiot question but a lot of people get websites for their bots, so I just wonder

lusty quest
#

also there is a event for ratelimiting

copper peak
#

that depends on how your lib handles it

nimble kiln
#

A bunch of ratelimits which were hit on /channel/message and a bunch of 429 ratelimits, idk actually what caused it. Should've investigated further but I didnt

signal summit
earnest phoenix
#
const Discord = require('discord.js');
const db = require('quick.db')
const { defaultPrefix, deletionTimeout, reactionError, suggestionPending, suggestionApprove, suggestionDecline } = require('../../config.json');

module.exports = async (client, oldMessage, newMessage) => {
    if (oldMessage.content === newMessage.content) return;
    const logsmessageupdate = oldMessage.guild.channels.cache.find(channel => channel.name === 'suggestion')
    if (!logsmessageupdate) return;
    console.log(oldMessage)
    const embed = new Discord.MessageEmbed()
        .setColor("RANDOM")
        .setTitle(`Un message a été modifié !`)
        .addField(`Membre :`, `${oldMessage.user}`)
        .addField(`Ancien message :`, `${oldMessage}`)
        .addField(`Nouveau message :`, `${newMessage}`)
        .addField(`Channel :`, `<#${oldMessage.channel.id}>`)
        .setTimestamp();
    logsmessageupdate.send(embed)
}

Hey, my event messageupdate.js has a lot of errors:

  • the oldMessage is null and oldMessage.user is null too 😦
copper peak
modern granite
#

Thank you

lusty quest
#

possible that the old message is not cached or an partial

signal summit
#

changed*

earnest phoenix
#

I delete partials?

lusty quest
#

you probably want to use them right?

earnest phoenix
#

euhhh idk

#

I just want the event works xD

lusty quest
#

partials only return the id nothing more, if you want to get the message you have to fetch it, but since it gets edited idk if its possible

earnest phoenix
#

but why others bots can? O_O

#

so its possible

#

but I don't understand their events

#

Its not the same like me

#

can somebody design good landing page or have some tips

lusty quest
#

d.js does some stuff in a weird way, other libs /languages do it different, possible that this also helps with this

earnest phoenix
lusty quest
#

its your bot lol

earnest phoenix
#

oh

#

my brain is very low

#

i'm sad

#

I test 9489534 times but not works :/

slender thistle
#

❤️

earnest phoenix
slender thistle
#

Which library?

opal plank
#

detritus? i can be the prophet if you wish(though im kinda busy irl rn)

lament rock
#

Erwin too busy to preach about detritus? Preposterous

earnest phoenix
river panther
#

tf, never seen that in 15 years

earnest phoenix
#

(node:21066) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'content' of undefined

const Discord = require('discord.js');
const db = require('quick.db')
const { defaultPrefix, deletionTimeout, reactionError, suggestionPending, suggestionApprove, suggestionDecline } = require('../../config.json');

module.exports = async (client, message, oldMessage, newMessage) => {
    console.log(oldMessage)
    if (oldMessage.content === newMessage.content) return;
    const logsmessageupdate = message.guild.channels.cache.find(channel => channel.name === 'suggestion')
    if (!logsmessageupdate) return;
    const embed = new Discord.MessageEmbed()
        .setColor("RANDOM")
        .setTitle(`Un message a été modifié !`)
        .addField(`Membre :`, `<@${newMessage.id}>`)
        .addField(`Ancien message :`, `${oldMessage.content}`)
        .addField(`Nouveau message :`, `${newMessage.content}`)
        .addField(`Channel :`, `<#${oldMessage.channel.id}>`)
        .setTimestamp();
    logsmessageupdate.send(embed)
}

I do what? 😦

river panther
#

line?

earnest phoenix
#

if (oldMessage.content === newMessage.content) return;

river panther
#

wait, if there is no change then how will there be a new and an old message?

#

remove that line

earnest phoenix
#

(node:21617) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined
at line ```js
.addField(Membre :, <@${newMessage.id}>)

river panther
#

umm

lament rock
#

newMessage is not defined

quartz kindle
#

why did you add message back

#

i already explained to you how that part works

#

you just broke it now lol

earnest phoenix
#

yes but

#

I do how you say

#

I have more errors

#

:/

quartz kindle
#

that doesnt meant its wrong

#

you just made it worse again lol

opal plank
# earnest phoenix yes i just want to know the main features of the lib

everything, it every sense of the word i categorize it better than d.js

specially the commandClient

this is one example, but, you probably have a command handler for commands and the sort. probably implemented ratelimit, cooldown and some extra stuff right? Well, detritus has that out of the gate, with literally everything you can as for
check the commandOptions https://cdn.discordapp.com/attachments/272764566411149314/818351864910970900/unknown.png
https://cdn.discordapp.com/attachments/272764566411149314/818351915263066152/unknown.png

#

reloading commands? pff trivial

earnest phoenix
earnest phoenix
#

O_O

opal plank
#

only line

#

you can scan your whole commands folder in one line

earnest phoenix
#

omega lul

opal plank
#

instead of the old crappy ```ts
fs.scandir('./commands').foreach(command => const cmd = require(command))

#

its cleaner

#

its better

#

its faster

#

and it uses less ram

#

the ONLY reason you wouldnt want to use detritus is if you dislike typescript

opal plank
#

since its made to be used with typescript mainly

earnest phoenix
opal plank
#

no

#

the structure is super similar

#

there are small changes

quartz kindle
#

you can have 1 error that prevents the rest of the code from running, so you only ever see one error because the others are never even reached

opal plank
#

you could say its amost to the point where you'd change from v11 d.js to v12

#

its minor things that change

quartz kindle
#

once you fix that error, and multiple more errors appear, then you know that part is finally working

earnest phoenix
#

who is the owner of the lib? you?

opal plank
#

no, cake

lament rock
#

why would there exist multiple methods for reading a directory from fs. fs.scandir, fs.readdir, fs.readdirSync, fs.promises.*
fs.readdir* and fs.promises.* makes sense, but why would scandir exist

opal plank
#

i do provide feedback and questions, but im not a contributor of the project

#

i simply advertise it because of how good it is

earnest phoenix
earnest phoenix
opal plank
#

to put into context

#

let me write a big thing so i can copy paste for the future

#

one sec

quartz kindle
earnest phoenix
#

okay lol

#

readdir?

#

btw my custom command bot is working fluent .I have fixed the bugs 😏

opal plank
#

its readdir

#

i just wrote that off my head

quartz kindle
#

i already explained how function parameters work

#

if you add message there, then message is oldMessage, and oldMessage is newMessage, and newMessage is undefined

opal plank
#

this was my old handler for d.js

#

this is my current for detritus

quartz kindle
#

so adding message there just makes everything worse, doesnt fix anything

river panther
#

WHAT

#

2 LINES

opal plank
#

this was my ahndler for a reload on d.js

earnest phoenix
river panther
#

yes ik djs

opal plank
#

this is for detritus

river panther
#

what things change if i change from djs to detritus?

opal plank
#

not many, mainly commandClient instead of client

#

thats the biggest change

lusty quest
#

how is the resource usage of it?

opal plank
#

commandClient is like a cluster, so instead of calling it directly, its within the shard that you would have your normal cline

river panther
#

oh

opal plank
#

legit same bot

#

not a single difference

#

just ported

#

same bot in my status

lusty quest
#

wtf?

opal plank
#

unliked d.js shitty design, you can customise caching

earnest phoenix
#

ayo what?

opal plank
#

its like d.js-light, out of the boo

#

supported natively instead

earnest phoenix
opal plank
#

d.js is retarded, and im not exaggerating

earnest phoenix
#

now its oldMessage undefined

opal plank
#

tim can probably tell you the same

#

@quartz kindle feel free to call me out if im talking bullshit

#

d.js , on the docs themselves

#

tell you not to use this on -1 since it'll lead to massive edit backlogs

#

yet this is the default they use

#

its literally in the description

#

not only this, presence is cached automatically

#

and a lot of other useless shit

#

d.js is an unoptimised bulked lib for users that dont know much about development

lament rock
# quartz kindle dafuq is scandir

scandir was what Erwin wrote. Usually, he knows what he's talking about, so I figured that was a real thing I must have overlooked

opal plank
#

its made for small bots

quartz kindle
#

they removed the message edit thing in master already after being called out on it

#

xd

river panther
#

exdi

opal plank
#

thats the thing, partials, edits, presences, no cache customizable, its all shit

#

the more you look, the worse it gets

opal plank
#

detritus supports and fixes all that out of the gate

river panther
#

wait, so if i start using detritus my bot will go wonders?

quartz kindle
slender thistle
#

How-

quartz kindle
#

if you edit a message 500 times, you have 500 copies of it in the cache

pale vessel
#

amazing

opal plank
#

not only that, presences are still cached

earnest phoenix
#

Is this correct?

message.author.flags```
pale vessel
#

yes

#

it might not be cached

#

you can use user.fetchFlags() for that

slender thistle
#

LMFAO oh my god

opal plank
#

d.js is made for small devs who dont give 2 shits about performance

#

it'll drink your ram faster than i drink vodka

slender thistle
#

I'm glad to be using a framework that doesn't have weird crap in it <3

opal plank
#

and thats saying seomthing

earnest phoenix
slender thistle
#

cough cough wink wink Tim

#

😛

pale vessel
#

you can't get nitro/boosting flags

river panther
opal plank
#

yes

#

presences too

river panther
#

oh no

opal plank
#

thats exactly what this was showing me

earnest phoenix
opal plank
#

same bot, mind you

#

just ported

#

no extra features

#

no extra fancy design

#

nothing

#

literally the same bot ran after a week uptime

river panther
pale vessel
opal plank
#

i know, im annoying

earnest phoenix
opal plank
#

dont mind me, im a cultist

river panther
#

tell something new

cinder patio
#

Lmao every time I go to this channel I see that screenshot

pale vessel
#

same

#

for real

opal plank
#

i could screenshot it now

#

its just handy

#

cuz its on the detritus server

#

and nobody talks much there

earnest phoenix
#

no u are you only give good criteria

quartz kindle
#

in the end is all about control

#

detritus gives you more control

opal plank
quartz kindle
#

discord.js doesnt give you any control

opal plank
#

not only that, the small control they give by default is shit

quartz kindle
#

if you can control the lib, you can control the resources

opal plank
#

for small bots its not much of an issue

#

but the moment you scale, it crumbles

quartz kindle
#

discord.js is like apple

misty sigil
#

very expensive?

river panther
#

apple is good for health

#

wait, phone?

quartz kindle
#

"it just works"

river panther
#

company*

quartz kindle
#

but you dont know how

#

there is no configuration

#

xD

river panther
#

breh, i am an apple using for past 7 years ;-;

misty sigil
#

it works™️

opal plank
#

deitrus isnt only a replacement, its an upgrade

#

aight enough salesman talk

quartz kindle
#

detritus is changing operating systems

opal plank
#

people getting too annoyed already

quartz kindle
#

going from mac to linux

opal plank
#

enough salesman talk, im going out before i get lynched

misty sigil
#

i wonder what would happen if I started using it

river panther
quartz kindle
#

the world would explode

opal plank
#

no libs rn support slash

#

its too unstable

misty sigil
#

COOL

opal plank
#

but the way you would do in d.js and detritus is the same

#

detritus exposes an api/gateway

#

so its really not that much to port

earnest phoenix
#

for slash you do not need any lib ,you only have to use the api endpoint

opal plank
#

but anyway, i'll stop talking about our lord and saviour detritus before people start calling me JesusMan

misty sigil
#

ok JesusMan

opal plank
#

@river panther detritus-client

misty sigil
#

detritus server when

slender thistle
opal plank
#

"detritus-client": "^0.13.0",
"detritus-client-rest": "^0.9.4",
"detritus-client-socket": "^0.7.2",
"detritus-rest": "^0.7.0",

#

these are the ones i have installed

#

@slender thistle no u AngeryBoye

river panther
#

imagine starting off with an error

#

let me make a new folder

earnest phoenix
#

oh shit, I'm going to suicide me, I was thinking works but NO

#

...

river panther
opal plank
#

im the Jeovah Witness of detritus
i'll randomly show up on your door, uncalled for, and will start talking about our lord and saviour

misty sigil
#

talk about it more

#

im interested

opal plank
#

oh yeah by all means

#

so

#

detritus is a nice lib

#

and everyone else is a sinner

misty sigil
#

i think I’m getting it

opal plank
#

therefore we must save those sheep

lusty quest
#

looks interesting, but idk how some of the stuff i use will work with it.

river panther
#

what will be the entry point, index?

#

@opal plank

misty sigil
#

does it support voice

opal plank
#

you can use whatever entry point you want, that part is still .js

#

unrelated to the lib

opal plank
misty sigil
#

ok pog I’ll play about

opal plank
#

ask in their server, the devs are super nice

#

specially cuz its small, its cozy af

#

so you can just talk directly to them

slender thistle
#

Has anyone suggested actually describing stuff in their docs?

river panther
opal plank
#

i would recommend using TS with import

#

but its up to you

river panther
#

ok

opal plank
#

check this

river panther
#

doesn't work on my laptop

#

this link

opal plank
#

oh, right

#

erm

#

here

misty sigil
#

ooh ts

slender thistle
#

Can one have typing from a TS package in a JS project?

#

Rather, would IDEs allow that?

opal plank
river panther
#

wirus

lusty quest
#

sadly erwin where a few days to late with detritus, i will probably switch to C# entirely

river panther
opal plank
#

detitus worth a try

#

lul

earnest phoenix
#

How do i make a file into a rar file?

opal plank
#

the commandClient just by itself is something worth praising

misty sigil
#

is it worth a try?

opal plank
#

definitively

#

im usually the guy ranting about how shit things are

#

specially datatabses

lusty quest
#

yea but i will recode the bot anyways, why should i take a extra step in js before switching to C#?

earnest phoenix
#

How do i make a file into a rar file?

opal plank
#

you're comparing langs, in that regard, c# should have better management with memory

opal plank
#

though, idk what C# libs will offer you in terms of functionality

#

detritus offers a great deal of shipped out functions

#

like the command client

lusty quest
opal plank
#

ratelimits, cooldown, owner, aliases, everything that you would find that you normally would have to code, its shipped out internally

lusty quest
misty sigil
opal plank
#

yeah thats what i mean

#

c# would likely be more mem efficient

#

but idk any lib in C#, so i cant make the comparison

opal plank
#

for example super

misty sigil
#

got it

lusty quest
#

i probably will use dsharp plus

opal plank
#

i posted before, but idk if you seen it

#

take a look at how much stuff its offered off the boo with the commandClient

#

those are options just for the commands

#

theres also options for the hanlder itself

river panther
#

wait, so like, in discord.js we do

const bot = new Discord.Client()

in detritus is it

const { CommandClient } = require('detritus-client');
lusty quest
#

dsharpplus is quite nice, also offers way more stuff than d.js

opal plank
#

thats what i meant, i cant comment on c# since i havent used it

#

i can safely compare d.js and detritus since i used both

#

i havent touched eris, so i usually holdback on that too

opal plank
#

but thats still JS

river panther
#

oh yes

opal plank
#

use import instead

river panther
#

oh, ok ok

lusty quest
river panther
#

why are there so many things?

earnest phoenix
#

How do i make it so my code cant be seen when they are running the code? @lusty quest

opal plank
#

its all optional btw

earnest phoenix
#

exes can be compiled so i dont want that

opal plank
#

its not like you have to use reverything

#

aight, i gotta take care of my aunt now

#

peace

misty sigil
#

ok cya

river panther
opal plank
#

no

misty sigil
#

no

river panther
#

=|

opal plank
#

import {CommandClient } from 'destritus-client'

river panther
#

ok ok

opal plank
#

here

lusty quest
#

one thing i love with dsharpplus is that you have a build in dynamic help command

opal plank
#

ask there

proper mica
#
function postTopGGServers(bot){
    fetch(`https://top.gg/api/bots/583995825269768211/stats`, {
            method: 'POST',
            body: JSON.stringify({
                server_count: bot.guilds.cache.size
            }),
            headers: { "Authorization": bot.config.botlists.topgg }
        }
    ).then(console.log)
}```im getting 400 bad request, what did I do wrong? its node-fetch
lusty quest
opal plank
#

@lusty quest just did this

#

lalbe is the same as command name

#

label*

#

and description is what it does

#

but it also has a usage

misty sigil
#

compiling your bot as an exe?!

lusty quest
#

dsharpplus comes with a help command shipped, you can make your own, but having not to go throu making one is nice

opal plank
#

fair

lusty quest
#

but making one is quite easy, so its not really something i would count

proper mica
pale vessel
#

{ headers: { "content-type": "application/json" } }

misty sigil
#

Content-Type: application/json

#

fuck you flaz

pale vessel
#

fuck you

latent heron
#

Hey guys, what is the best VPS provider currently available for a bot that is mainly Google Cloud based and can be affordable?

lusty quest
#

google?

latent heron
#

I work with the Google cloud stuff but it looks pricey for their actual hosting

lusty quest
#

the big 3 are quite expensive

lusty quest
#

maybe look into galaxy gate or linode

latent heron
#

I see

lusty quest
#

also if you need a certain size maybe look into Root Servers, at some point they are Cheaper with more power than VPS

latent heron
#

Well my bots aren't really needing a lot of GB size anyhow

#

My database stuff has moved away from being localized

#

I'm looking mainly for the bandwidth and affordability I suppose

lusty quest
#

i where at the point where ive needed more Processing power, a VPS from Digitalocean that where Compute Optimized where at 40$/Month(2Cores/4GB RAM 25GB Disk), a root Server (6Cores/12Threads 64GB ram and 512GB NVME ssd) is about 55$

latent heron
#

Oh my

lusty quest
#

yea i guess look into galaxy gate or linode they should be quite decent

slender wagon
#

is galaxy gate better than digitalocean

latent heron
#

Gate seems to offer just as much as ocean for only USD $3/mo

#

@sick cloud did you want added to the team for the repo?

proper mica
# pale vessel ```{ headers: { "content-type": "application/json" } }```

it actually still doesnt work 😦 js function postTopGGServers(bot){ fetch(`https://top.gg/api/bots/583995825269768211/stats`, { method: 'POST', body: { server_count: bot.guilds.cache.size }, headers: { "Content-Type": "application/json", "Authorization": bot.config.botlists.topgg } } ).then(console.log) }

#
 [Symbol(Response internals)]: {
    url: 'https://top.gg/api/bots/583995825269768211/stats',
    status: 400,
    statusText: 'Bad Request',
    headers: Headers { [Symbol(map)]: [Object: null prototype] },
    counter: 0
  }```
#

oh my bad json.stringify :/

earnest phoenix
#

@quartz kindle For my messageupdate.js, I found, I just needed to add:

if(oldMessage.partial) await oldMessage.fetch()
```  XD
latent heron
#

Lol

proper mica
#

i remvoed it before dk why sorry for ping

earnest phoenix
latent heron
#

Probably a call to .env

proper mica
#

my topgg token it works now forgot to stringify the data

latent heron
#

I store all of my API tokens in a configuration file and read then

#

Similar thing I guess

sick cloud
latent heron
#

Standby

sick cloud
#

i won't be able to accept until the morning though

#

my laptop is dead so

latent heron
#

F

copper peak
river panther
#

@quartz kindle umm, sorry for the ping, but from where can i learn how to use dev toold and if i change the colour of my discord stuff from the console is that against the ToS?

copper peak
#

They have the most downtime of all VPS hosts (bar those shitty bullshit popup ones)
Their clustering is bad last I heard so an IP lockout is per cluster

#

But handing a customer another person's network disk is a serious breach in itself

#

I'd recommend hetzner instead. Based in Germany, but p cheap

latent heron
#

Hmm

#

My VPS is rather picky because my bot focuses on a shit ton of synchronous HTTP communication with varied API services

#

So ideally i want the VPS to be hosting my bot near those locations as well

copper peak
#

DO, Linode

#

And you can use the free trials on Azure, AWS or GCP as well. If you wish to scale, however, these may become pricey

#

OVH is also good, I used to use it before Hetzner

#

There's also this thing called Scaleway, which I've heard is decent.

cinder patio
copper peak
lusty quest
copper peak
#

Really?

#

I've had no issues for close to a year hmm

lusty quest
#

yes in 2018 i think there where some issues

copper peak
#

It works wonderfully actually

lusty quest
#

i know, got a Root server from Hetzner

broken sentinel
#

somebody to help ?

#

the error comes from line 12

rocky spoke
#

hmmm

broken sentinel
#

how to replaec members

#

roles i mean

rocky spoke
#

idk

earnest phoenix
#
    message.channel.send({
        embed: {
            color: "GREEN",
            title: "![Deezer](https://cdn.discordapp.com/emojis/818817465319686145.webp?size=128 "Deezer") Added to the queue! ![Deezer](https://cdn.discordapp.com/emojis/818817465319686145.webp?size=128 "Deezer")",
            description: track.title,
            url: track.url,
            thumbnail: { url: track.thumbnail },
            footer: {text: "The Suite"},
        }
    });
};``` 

how do I move the blue line to the description?
broken sentinel
#

you cannot because your link is in the text title

#

the down text is description

earnest phoenix
#

Uh

broken sentinel
#

i think

earnest phoenix
#

So It's impossible to put the blue text to the description?

broken sentinel
#

idk

steel pumice
#

In description

#

So it could be align a bit i never tried custom emojis like that but i think you can

broken sentinel
earnest phoenix
#

No idea

steel pumice
#

I cant see the lines bruh +_+

#

@broken sentinel send one clear

broken sentinel
#

wait

steel pumice
#

@broken sentinel but the error says that you didnt told properly to get the role

broken sentinel
steel pumice
broken sentinel
pale vessel
#

can you stop reposting your question

broken sentinel
#

i repost it because i post the incorrect photo

earnest phoenix
modern granite
#

HTML and CSS <div class="ariel" style="font-size:40px; font-family: font-family: 'Oswald', sans-serif;"><span style="color: #ffffff;">my text</span></div>

#

why isn't it changing the font?

#

I guess I did everything right

#

oh ok nevermind

#

I understood

#

I just accidently wrote 2 font-family

broken sentinel
#

i need help with line 12

distant cloak
# broken sentinel code: https://imgur.com/70JoeAb error: https://imgur.com/dChJ4Mj
const db = require("quick.db")

module.exports = {
  name: "setwelcome",
  category: "moderation",
  usage: "setwelcome <#channel>",
  description: "Set the welcome channel",
  run: (client, message, args) => {
    
    let channel = message.mentions.channels.first()
    
    if(!channel) {
      return message.channel.send("Please Mention the channel first")
    }
    
    //Now we gonna use quick.db
    
    db.set(`welchannel_${message.guild.id}`, channel.id)
    
    message.channel.send(`Welcome Channel is seted as ${channel}`)
  }
}```
zenith terrace
#

that no where near helps lol

zenith terrace
broken sentinel
#

yep i need help with that roles

#

it dont need to be roles.

zenith terrace
#

your error doesn't even match up with the code

dark crest
#

how do i get the roles of the bot?

#

i mean i try to get the posotion of his highest role but this not work client.roles.highest.cache.position

#

😦

umbral zealot
#

because that's a user, not a member

#

guild.me represents the bot on a guild as a member

old cliff
#

@dark crest ^

dark crest
#

THX

broken sentinel
#

Does anybody know how to make it to check if member has react something in discord.js for example
if (react) ....
But this dont work

umbral zealot
#

you could use the awaitReactions features

old cliff
#

Or make a reaction collector

umbral zealot
#

either/or, yeah

old cliff
#

Or use on reactionAdded event

broken sentinel
broken sentinel
umbral zealot
broken sentinel
#

i want to make it when user react a message to get role

old cliff
#

If I were you.... and I was making reaction roles or something else I would use reactionAdded event

#

And check for guild config and roles

earnest phoenix
#

(requested by : ${track.requestedBy.username.mention})

it returns as undefined

old cliff
#

user.mention is not a function ... its actually nothing

slender thistle
#

username.mention

#

yeah.

old cliff
#

Use user.toString()

earnest phoenix
#

user to whaaaat?

slender thistle
#

Just do {track.requestedBy}

umbral zealot
#

no need for toString

#

it's clearly a template literal

earnest phoenix
#

I want it to tag the user

#

in the embed

slender thistle
#

Redundant .toString in template literals woohoo

#

yes

umbral zealot
#

yes so remove .username.mention there

broken sentinel
#

any idea what to write in (user.react)

slender thistle
#

When a user is converted to a string via .toString (aka what template literals do), it's converted into a mention

broken sentinel
#

i isnt user.react

earnest phoenix
#

ah

umbral zealot
old cliff
earnest phoenix
#

I understand 50% what you said but I think I know

#

xd

old cliff
umbral zealot
#

yes it would be

#

You're right I read purgeCommand at the top and thought...

#

why the fuck is this in the purge command

old cliff
#

Copypasta

broken sentinel
old cliff
#

No

broken sentinel
#

?

umbral zealot
#

instead of just mashing away at the keyboard like a noob

broken sentinel
umbral zealot
#

Ok so go learn javascript first

latent heron
#

That's unfortunate

#

Learn JS

umbral zealot
#

The solution to "I'm a beginner" is "learn more"

broken sentinel
#

i am tring

umbral zealot
#

Don't try to make bots. Try to learn the language.

slender thistle
#

P.S. Discord bots are a bad idea to start learning programming

old cliff
#

You would have to add it to a db and then check on reactionAdded event if the message id and channel id are same as of the panel and the reaction is same... then give the role.... this way it would be permanent

#

rr is not as easy as it seems...

umbral zealot
#

indeed, last time I tried I failed kekface

#

but it was mostly a unicode-related problem

old cliff
#

Emoji name and stuff?

umbral zealot
#

yeah

#

I was just trying to make a tutorial but I guess I also didn't have enough patience at the time

earnest phoenix
#

hi

#

can you help me @umbral zealot

umbral zealot
#

No, but you can ask your question here on this channel

#

No one can help until you ask your question

earnest phoenix
#

no help me in private

old cliff
#

No

umbral zealot
#

No. If you need help, ask here.

earnest phoenix
#

i need the script of music (javascript)

umbral zealot
gray ledge
#

i am sorry but I didn't find the solution for it.
I am supposed to paste a guild key in the .env file for the bot, but I don't know where to find it

umbral zealot
#

A "guild key"?

#

What's that?

gray ledge
#

oh i am very sorry for wasting your time

#

i am just stupid

#

it was guild name xd

umbral zealot
#

ok then!

earnest phoenix
#

| (requested by : ${track.requestedBy})

How do I make it so the output gives it in hi but that it doesn't give an error

umbral zealot
#

"gives it in hi" ?

#

what?

earnest phoenix
#

he means escape characters

umbral zealot
#

Oh you mean code block

earnest phoenix
#

like hi as output

#

yes

#

i.e. ```
`text`

umbral zealot
#

You can escape the backtick characters with \

earnest phoenix
#

CH_UhHmm yeah I don't understand am dumb

#

lmao

umbral zealot
#

So you do ``` thing ``` for example

old cliff
#

``````hi``````

earnest phoenix
#

ah so I do ` and the after again

umbral zealot
#

Do \ and then the `

earnest phoenix
#

\ `

#

and then at the end again?

#

yes

umbral zealot
#

yes

earnest phoenix
#

in the middle put text

#

so after `

#

yes

old cliff
#

Yes

umbral zealot
#

Whenever you want a backtick within the template litearl you put \ ` instead of just `

earnest phoenix
#

ok

umbral zealot
#

damn it's hard to explain markdown in a markdown-enabled chat service.

old cliff
#

Same

earnest phoenix
#

@umbral zealot if i say play (prefix) music the bot is join the room and disconnect

earnest phoenix
#

or ffmpeg

earnest phoenix
#

what

#

like dat

old cliff
#

`````````

umbral zealot
earnest phoenix
#

ayy

umbral zealot
old cliff
#

ok 👌

earnest phoenix
#

wrong ping

#

@earnest phoenix

#

i'm unsure if that package is good, never used it since i use lavalink and erela.js

tired panther
#

Does someone know, how to bulkdelete on mongoose?

old cliff
#

mongoose ? Read the docs

#

This may help

tired panther
earnest phoenix
#

ok wait

#
<Model>.collection.updateMany({},
  { $unset: { PropertyToDelete: true } },
  { multi: true, safe: true }
);```
#

you can do something like that

tired panther
#

oh sorry, yes it does

earnest phoenix
#

yes with unset

#

you can do the opposite i assume by switching unset to set

#

also it should work if you eval it

tired panther
#

lemme explain lul

earnest phoenix
#

what did I do wrong it's not giving error

earnest phoenix
#

Well I tried adding duration to it

#

but now it's not showing the link

#

it shows 4 duration but not the links

#

after ${track.requestedBy} there seems to be a back tick or something, try remove that

#

hmm im unsure about that

#

i only know how to delete a specific property from all users

#

@earnest phoenix

#

I removed the tick

tired panther
earnest phoenix
tired panther
earnest phoenix
earnest phoenix
#

i'll just do the syntax for you ig

#
            embed: {
                color: "GREEN",
                title: "Server Queue",
                description: `**Server queue - ${message.guild.name} ${client.emotes.queue} ${client.player.getQueue(message).loopMode ? '(looped)' : ''}**\nCurrent : [${queue.playing.title}](${queue.playing.url}) | ${queue.playing.author}\n\n` + (queue.tracks.map((track, i) => {
                    return `**#${i + 1}** - [${track.title}](${track.url}) | \`(requested by:\` ${track.requestedBy}) `duration: \`${track.duration}\``
                }).slice(0, 5).join('\n') + `\n\n${queue.tracks.length > 5 ? `And **${queue.tracks.length - 5}** other songs...` : `In the playlist **${queue.tracks.length}** song(s)...`}`),
                footer: {text: "The Suite"},
            },
        },  
        )},
};```
#

bruh

#

oh the line

#

xddd

#

``` return **#${i + 1}** - [${track.title}](${track.url}) | \(requested by:` ${track.requestedBy}) duration: \${track.duration}````

#

I can't really copy it as yeah

#

syntaxes frick up

tired panther
earnest phoenix
#

what

#

heh

#

fuck

#

tf am i doing with my life

#

rate it?

tired panther
#

☮️

earnest phoenix
#

hey

earnest phoenix
earnest phoenix
#

is it ugly

tired panther
earnest phoenix
#

@earnest phoenix how do I do it xd

#

idk try that

#

ok

earnest phoenix
earnest phoenix
#

idk been a while since i've made my own dashboard

#

lol

#

hey ban

tired panther
earnest phoenix
#

bad guy

#

sorry

#

do not ban me

#

my bot is under verification

#

then u can ban me

#

lol

#

this was a fake nitro,it did not exist

earnest phoenix
#

and hacking maybe i should report it

earnest phoenix
#

sorry

#

i will stop right now

#

plzzzzzzzzzzzz

#

then do a nitro drop

#

ok

#

take

#

done?

#

bye

#

no

#

it is fake lol

pseudo phoenix
#

what type is afk_channel a text channel or a voice channel??

crimson vapor
#

should be voice

slender thistle
#

Voice

earnest phoenix
#

VOICE

pseudo phoenix
#

mmm so if i want to make a command to do afk i cant use afk_channel ??

umbral zealot
#

"to do afk" ? what does afk do exactly in your mind?

tired panther
umbral zealot
pseudo phoenix
#

If they mention the bot, send a message saying that it is afk, but that only in a specific channel can you use that command

umbral zealot
tired panther
pseudo phoenix
#

okay thanks

green kestrel
#

hmmm

#

i typoed in my code... and this happened.
Posting webhook Host=https://discord.co Path=m/api/webhooks/818839012105912390/R1GB.....
note the hostname and path. I wonder what the probability is that some malicious person might reg typo domains like discord.co for stealing credentials that are accidentally posted to it.

tired panther
umbral zealot
drifting wedge
#

time module isnt sync right?

#

time.sleep is

#

but like time.time isnt

#

ye?

green kestrel
umbral zealot
#

Well I did and it redirects to the .com domain

#

so it's not a 3rd party

tired panther
#

Agree same

gilded swallow
umbral zealot
#

Thanks for confirming what I've said, that's great thumbs_up

gilded swallow
#

you're most welcome

#

let me say it again

stark cape
#
const { MessageEmbed } = require("discord.js");
const fetch = require("node-fetch");

module.exports = {
    config: {
        name: "instasearch",
        aliases: ["searchinsta", "sinsta"],
        category: "info",
        description: "Find out some nice instagram statistics",
        usage: "[instagram username]",
        accessableby: "everyone"
    },
    run: async (bot, message, args) => {
        const name = args.join(" ");

        if (!name) {
            return message.reply("Maybe it's useful to actually search for someone...!")
                .then(m => m.delete(5000));
        }

        const url = `https://instagram.com/${name}/?__a=1`;
        
        let res; 

        try {
            res = await fetch(url).then(url => url.json());
        } catch (e) {
            return message.reply("I couldn't find that account... :(")
                .then(m => m.delete(5000));
        }

        const account = res.graphql.user;

        const embed = new MessageEmbed()
            .setColor("GREEN")
            .setTitle(account.full_name)
            .setURL(`https://instagram.com/${name}`)
            .setThumbnail(account.profile_pic_url_hd)
            .setDescription("Profile information")
            .addField("**Username**", `${account.username}`)
            .addField("**Full name**", `${account.full_name}`)
            .addField("**Biography**", `${account.biography.length == 0 ? "none" : account.biography}`)
            .addField("**Posts**", `${account.edge_owner_to_timeline_media.count}`)
            .addField("**Followers**", `${account.edge_followed_by.count}`)
            .addField("**Following**", `${account.edge_follow.count}`)
            .addField("**Private account**", `${account.is_private ? "Yes 🔐" : "Nope 🔓"}`);

        message.channel.send(embed);
    }
}
tired panther
valid blaze
#

could anyone help me w setting up my server to top.gg thanks!

umbral zealot
crimson vapor
#

new Date(X).getTime() - new Date(Y).getTime()

old latch
#

or use a library like moment.js

#

with that it's easier to get years, months, days and so on because it does the math for you

#

well it works

#

uhm

#

moment().diff() is a thing I think

#

search that in the docs

#

yes and then use moment.duration("the difference here")

snow portal
#

bro u dont know how happy i am that my bot got verified lmfao

#

it took sooooooooo long

#

;c

old latch
#

nice congrats

snow portal
#

thank you <:

#

does this mean in the future all bots get verified

#

or is it just the one?

#

Oh, rip

old latch
#

yes, every bot you make has to be verified, no matter how many verified bots you already have

snow portal
#

ooooooooooooof

#

thats going to be an annoying process, but you shouldnt have more than 3 you want verified anyway

old latch
#

are you planning to do 100 bots or what?

snow portal
#

nope! just wanted to see if that was a thing lol

austere skiff
#

?HELP

umbral zealot
old latch
#
const diff = moment("first moment here").diff("second moment here");
const diffDuration = moment.duration(diff);```
#

@earnest phoenix

#

then u can use diffDuration.days()

#

and so on

#

I think so... I only use days, hours, minutes and seconds

#

just check the docs

snow portal
#

light theme go brrr

old latch
#

uhm

snow portal
#

yes

old latch
#

@earnest phoenix I think you have to put the newer date first

#

48 years wow

snow portal
#

lmfao

old latch
#

uhm

#

well for me it always works...

#

and what if you try Date.now()

#

instead of new Date()

#

idk if that makes a difference tbh

#

probs not

#

but worth a try

#

also wait

#

why are you subtracting it

#

isn't the createdAt already the timestamp u need

#

you don't have to subtract it pretty sure

#

what exactly does createdAt contain then?

#

this is 2 and a half years old right

#

that's already the time... I don't understand why you subtract it from now

#

yes

#

then u have to do the difference between 2018 and now

#

right?

#

so just use the createdAt timestamp in the one parameter

#

and Date.now() in the other

#
let diff = moment(user.createdAt).diff(Date.now());
let diffDuration = moment.duration(diff)
console.log(diffDuration)```
#

just try it

#

did it work?

#

because I got to go now

#

nice!

#

no problem

#

do you also understand the logic behind it?

tired panther
#

Is it right that mobile users have Problems moving roles and channels?

slender thistle
#

Problems in what sense

tired panther
umbral zealot
#

You can't "drag" channels in the server view from mobile no. you have to go into server settings

slender thistle
#

Well I just moved them

#

So shrug

umbral zealot
#

¯_(ツ)_/¯

umbral zealot
#

What?

#

why

tired panther
earnest phoenix
#
for (let i = 0; i < Object.keys(guildInfo).length; i++) {
if (!client.guilds.cache.get(guildInfo[i].id) { continue; }
await client.guilds.cache.get(guildInfo[i].id).members.fetch(requserid)
if(!client.guilds.cache.get(guildInfo[i].id).members.cache.get(requserid) continue;
if(client.guilds.cache.get(guildInfo[i].id).members.cache.get(requserid).permissions.has("MANAGE_GUILD")) {
                guildinfo2.push(guildInfo[i]);
            }
        }

what is the efficient way?

umbral zealot
#

I mean it's not like you can make a bot to modify the features in Discord Mobile app

cinder patio
#

use a variable for the member instead of getting them from the cache 2 times

earnest phoenix
#

actually i am fetching a member in a guild

cinder patio
#

yes, store it in a variable

tired panther
earnest phoenix
cinder patio
#

Use it instead of getting the member in the cache twice

#

client.guilds.cache.get(guildInfo[i].id).members.cache.get(requserid) you using this two times

#

you can just do const member = await client.guilds.cache.get(guildInfo[i].id).members.fetch(requserid)

#

and then use member instead of client.guilds.cache.get(guildInfo[i].id).members.cache.get(requserid)

earnest phoenix
#

ah okay thx

cinder patio
#

I think fetch throws an error when the id is invalid so make sure to catch it

earnest phoenix
#

permissions: 104189505, how can i transfer this to a permission like "MANAGE_GUILD"

#

Can someone help me with a currency system

earnest phoenix
earnest phoenix
#

npm

cinder patio
earnest phoenix
#

i want to check if the bitfield includes 104189505 "Manage.." perms

cinder patio
#

(bitfield & bit) === bit

earnest phoenix
#

so it will convert this to a string?

cinder patio
#

no it will tell you whether the bitfield include the bit

earnest phoenix
#

let me test

#

and what is bit?

cinder patio
#

a number

earnest phoenix
#

thx

cinder patio
#

You can also do 1 << position_of_permission instead of those ugly hexadecimal numbers

#

for BAN_MEMBERS it'd be 1 << 2 cause it's the 3rd permission in that table

earnest phoenix
#

noice it works

#
for (let i = 0; i < Object.keys(guildInfo).length; i++) {
if (!client.guilds.cache.get(guildInfo[i].id) { continue; }
guildinfo2.push(guildInfo[i]);
}

then i only need this

cinder patio
#

You can also do

const length = Object.keys(guildInfo).length
for (let i=0; i < length; ....)
#

Also what is guildInfo? Why are it's keys numbers

earnest phoenix
#

that is same xD
.But i have to till double login on my client since i need the channels :c

#
req.user.guilds.forEach(async (o, i) => {
if((o.permissions & 0x00000020) == 0x00000020 )
guildInfo.push(o);
});```
cinder patio
#

it's not really the same. i < Object.keys(guildInfo).length here you're getting the keys and length on every iteration

earnest phoenix
cinder patio
#

Can you rephrase your question

earnest phoenix
umbral zealot
#

I mean you can simplify this with map() but forEach isn't "bad"...

#

oh wait no not map. filter(), rather

#

guilds.filter(g => (g.permissions & 0x00000020) == 0x00000020)

earnest phoenix
#

I have to login to my client so I can use the channels for the dashboard(like for setup) .Since bot and website are hosted separately ,I have double login :c

cinder patio
#

oh... so you're logging in your bot... on the client side?

#

Terrible idea

plucky geyser
#

-_-

cinder patio
#

huge security risk

#

someone can easily steal your bot token

#

Instead, just communicate with the backend via HTTP requests

earnest phoenix
#

how that is on client side?

#

i use express for the dashboard

cinder patio
#

oh your bot and your express server are hosted separately

#

misunderstanding

earnest phoenix
#

yes

cinder patio
#

you can use HTTP requests to communicate with your bot, but you'll have to create an express server on the bot's side as well

earnest phoenix
cinder patio
#

You can also set up a TCP/UDP connection between the two servers

earnest phoenix
#

is it a big problem if you double login maybe api-abuse

#

0 events are enabled

tired panther
cinder patio
#

I wouldn't say it's terrible, but I think the stuff I mentioned is a better solution

lament rock
#

I like how it's Object.<K extends string | number | symbol, V>, but Object.keys returns Array<string>

cinder patio
#

If the bot and the server are hosted on the same server, just a different process, you can make the server spawn the bot process and then you can exchange data between the two

lament rock
earnest phoenix
#

I need only cached things like role and channel for the page

cinder patio
#

You still need to setup a solid communication method
Same host - IPC
Different hosts - HTTP/TCP/UDP

earnest phoenix
tired panther
lament rock
#

I need to start saving gateway sessions and seq in db so I can resume instead of identify every time I restart. Shouldn't matter since I store all my data in a db

cinder patio
lament rock
#

Objects can be keyed as numbers

tired panther
cinder patio
#

but they get turned into a stirng

earnest phoenix
#

how can i use redirect uri for bot invite

cinder patio
#

&redirect_uri=URL_ENCODED_SITE at that to the url

earnest phoenix
#
https://discord.com/api/oauth2/authorize?client_id=this&permissions=268561655&scope=bot&redirect_uri=https%3A%2F%2Fccommandbot.ga%2Fdashboard```
returns me a error invalid redirect_uri
cinder patio
#

where are you getting this error??

#

Does the redirect uri even work with bot invites

earnest phoenix
#

here

earnest phoenix
lament rock
#

You can access object properties with numbers since get and set do coerce the key to a string if necessary.

For all intensive purposes, you can key Objects with numbers

pale vessel
cinder patio
#

and not strings or numbers

earnest phoenix
#

i did not got redirected

#

weird

lament rock
#

the client has to handle 307 status codes

surreal sage
#

Is it possible to redirect all content of console to like a function?

#

I'm trying to make a write stream but not a fs one

#

(Node.JS btw)

umbral zealot
#

not without wrapping the entire app inside another app that captures STDOUT

surreal sage
#

pain

earnest phoenix
#

what does this do?

lyric mountain
#

nothing you should worry about

#

I don't even know why that's still there

#

never seen ANYONE find a usage for that

umbral zealot
#

It requires a user to be authenticated through oauth2 on your website and given a code grant before they are able to invite the bot

earnest phoenix
#

okay 🤣

cinder patio
#

you can use it to restrict who invites your bot

earnest phoenix
#

premium bot 🤔

surreal sage
#

not like that...

cinder patio
#

I mean, you can make a premium bot

#

you have to pay to invite it... thonkku

unreal estuary
quartz kindle
#

imagine you make a super op bot that can only be invited if people pay monthly

#

genious EAdea

cinder patio
#

lmao

pale vessel
#

™️

lament rock
#

The painful part is figuring out what "super op" entails

#

You've got some bots that specialize and some that do it all

pale vessel
#

STOP

#

pinging me

unreal estuary
#

?

pale vessel
#

wow ok

lament rock
#

@round cove

earnest phoenix
#

lol?

unreal estuary
#

do u realise u dont have perms to ping everyone

round cove
#

oh man

lament rock
#

people can dream somewhatfunnycat

quartz kindle
#

imagine any paid service out there

#

just make it into a bot

crimson vapor
#

netfilx but as a discord bot

quartz kindle
#

yes

#

it sends movies as gifs

#

every 5 seconds

crimson vapor
#

LOL

cinder patio
#

cloud gaming on discord

quartz kindle
#

you know what could realistically be made into a bot

#

social media manager

#

one of those platforms where you post to 20 social medias at once

#

just do it from a discord command

modest maple
cinder patio
#

omg yes

lament rock
#

True. It would be pretty convenient to do that from Discord as well if you're on it all the time

crimson vapor
#

would you give username and password or just authenticate through it?

cinder patio
#

oauth2 probably?

#

I don't think social media managers ask for yous credentials

quartz kindle
#

i mean

lament rock
#

Some websites might not allow it since some oauth scopes don't allow message creating

quartz kindle
#

we're talking about premium bots that need code grants to invite

#

so oauth2 is a given

cinder patio
#

No I meant how would the bot send messages as the user

quartz kindle
#

make it part of the oauth flow

#

put the bot invite at the end, after authorizing everything

cinder patio
#

Okay so who's doing it bloblul

#

doesn't sound all that difficult

#

Though, you may need to contact some of the social meds to get permission to ask for sending permissions

lament rock
#

Why not just organize a dev team consisting of people here.

Consider the fact that front end work is not fun

green kestrel
#

hmmmm

lament rock
#

also, bot could be completely stateless. That's pretty poggers in terms of memory usage

cinder patio
#

yeah all it needs is to listen for messages. Could also use slash commands to completely get rid of the websocket connection

green kestrel
#

i want to notify 76000 server owners of a new bot feature thats in all of our advantages (the server owner, and us) to enable. it involves them giving the bot manage webhooks permission to make it work.
Whats the best, non-spammy way to spread the word to them all about why they should enable the role on the bot to allow a new feature to work?
If they did, they'd be able to customise the bots pfp and name on a per channel basis, and it would eliminate tons of lag.
I've sorted out new users going forwards by changing the permissions the bot requests when invited.
Thoughts?

cinder patio
#

maybe tell them when they use a certain command?

lament rock
#

Perhaps advertise the feature through general command usage

umbral zealot
#

let people subscribe to your news instead of forcing it on them.

#

Then you don't even need to worry about publishing oyu just post to a channel and publish. boom.

cinder patio
#

But what if only a very small amount of guilds are subscribed

umbral zealot
#

That's their problem honestly

#

If someone doesn't want updates, they don't want updates.

#

Make best effort by adding links and information to commands and such.

#

Maybe add a command for bot updates or new features or changelog or wahtever

#

link that to your server and announcement channel

boreal iron
#

Using the presence activity within its rate limit to display a short text of "new stuff" etc will also be noticed by a few guilds, surely not all

cinder patio
#

What about... just advertise it through general command usage like Papi said, but only show the advertisement if the person using the command has the power to add the permission, and also don't show it every time, maybe once or twice and then stop

lament rock
#

That would require some tracking which is CVRchanMonka

pale vessel
cinder patio
#

Hmm to remove the tracking you could make it chance-based

lament rock
#

That's pretty reasonable

#

Could also implement other "tips" to make it seem more inconspicuous

boreal iron
old cliff
#

Whats code grant?

#

and how does it work?

quartz kindle
#

it grants you coding prowess

old cliff
#

No the invite code grant

umbral zealot
# old cliff Whats code grant?

The code grant system is that the user must log in with oauth on your website and you give them a code grant, for them to invite the bot

old cliff
#

Interesting...

earnest phoenix
#

does someone know how express-validator works?

#

bc I want to know if it's possible to clear the validationResult errors after they are shown

#

please

#

i need help to this

sterile lantern
#

is it possible to omit an @ everyone ping from webhooks

#

like im using zapier

#

for google forms -> discord

#

but i dont want @ everyone to be a valid response

#

and i already have one reg expression

vivid fulcrum
#

allowed_mentions?

sterile lantern
#

im not using a bot though so rip

vivid fulcrum
#

right

sterile lantern
#

im using zapier