#development

1 messages · Page 893 of 1

split hazel
#

"ain't working" does not provide any details at all

hasty sparrow
#

I see the issue, haven't figured out what's causing it

fresh kernel
#

Hold on, I think I've done something.

static nexus
#

what's the issue

hasty sparrow
#

Possibly .call(this)

static nexus
#

which file

hasty sparrow
#

Talking to DrCas

#

Not you, lilu

fresh kernel
#

Yes, that was bugging me a little. I've scrapped the IntervalTimer class, and changed it to a setInterval, and calling the function as checkPosition.bind(null, args)

#

That fixes my issue it seems.

hasty sparrow
#

Perfect

fresh kernel
#

Well explaining my problems to someone else always seems to work.

static nexus
#

I'm trying to use heroku with cogs but it won't turn the bot on when i activate it
https://github.com/mohgram/DRIPBOT
Here's the code
(TOKEN'S RESET)

hasty sparrow
#

Check the error logs

static nexus
#

still no work

split hazel
#

no one here knows what 'it wont turn on' is

#

did it crash? etc

static nexus
#

The bot will not go online

#

No crashes

split hazel
#

Does error logs show anything? or are they empty

static nexus
#

using heroku

#

idk where they are

#

maybe ill go back to normal one file

split hazel
static nexus
#

got the error

#

lemme fix

sudden geyser
#

How would I be able to store an array/list-like datatype in SQLIte for a column? I have a table with prefixes that I want to store a list of prefixes the user defined. Is it possible, or would I need to do something like adding a single prefix per table data.

knotty steeple
#

u can yes

#

but what i would do is store it like a string

#

then parse it

#

@sudden geyser

#

its not hard

earnest phoenix
#

^^

#

join the array, store like a string, then split when pulling from the db

sudden geyser
#

alright, thank you

split hazel
#

there are some sqlite array plugins but converting it to text and back is easier

static nexus
#

I GOT IT WORKING

split hazel
#

gg

maiden mauve
#

@hasty sparrow

#

just cheesed it that way

#

too many variables in a function... maybe?

hasty sparrow
#

Not sure whether it's better or worse

maiden mauve
#

Yeah, not really sure how hard the machine is working to do that on every react

#

but it's a step away from eval

#

I'll shelf it til I get the motivation to restruction the "m." exports

#

there we go

#

a smig better

#

every new menu is just a case i can live with that

plain gazelle
#

i can never imagine making a webpage like that

#

i just like my good old .html files and write whatever i want there

quartz kindle
#

you dont need to break the switch case if you return anyway

summer torrent
#

^^

maiden mauve
#

break return pause

#

😄

#

Yeah good point

#

that's pretty silly

knotty steeple
#

i see c style coding

quartz kindle
#

so you c c style?

maiden mauve
#

I feel like weird stuff happens if you pull breaks out

knotty steeple
#

i c c style

earnest phoenix
#

i c sharp c style

maiden mauve
#

I could actually pull the switch out

#

if I made it a fancier array

knotty steeple
#

she sells (ba, z, k)sh shells by the C xor

nocturne grove
#

Hey. I was just looking to some documentation, and read about the privileged intents. One thing mentioned there is GUILD_MEMBERS. Does this mean I need that privileged intent when my bot is in more than 100 servers, when I just want to do things like guild.members.cache.filter(m => m.hasPermission('ADMINISTRATOR'));?

golden condor
#

@nocturne grove no it's more about getting user info

earnest phoenix
#

yes, you need to have the intent

#

if you want to filter all members

nocturne grove
#

private stuff I guess? So not things like username and id?

golden condor
#

Wait do you

quartz kindle
#

with intents of without intents, that specific line of code doesnt matter

#

because an X number of members will be uncached regardless

delicate zephyr
#

Discord.js will cache members as they talk without intents

#

With intents it'll have all given members cached on boot

quartz kindle
#

you can still fetch members without the guild_members intent, you just cant fetch all of them

nocturne grove
#

okay I guess you two are right then. But when does it matter (regarding the GUILD_MEMBERS)?

earnest phoenix
#

the guild_members intent allows you to request guild member chunking, before intents you could request guild member chunking whenever - intents have been implemented because of that in the first place (to prevent scraping data)

quartz kindle
#

another impactful thing about the guild_members intent is that it also controls all guild_member packets/events

nocturne grove
#

With intents it'll have all given members cached on boot
@delicate zephyr so they're directly available, just like messages that are not available when you start up your bot?

lofty lagoon
#

how do I stop my script with visual studio code

quartz kindle
#

meaning without it, your member count will not be accurate, and you will not get member join/leave/update events

nocturne grove
#

so I need that intent to use client.on('guildMemberAdd', ...? oof

delicate zephyr
#

Yea

lofty lagoon
#

how do I stop my script with visual studio code
pls

quartz kindle
#

in any case, intents rules only apply if you have intents enabled in your code, for exmaple, for discord.js would be new Client({ws:{intents:INTENTSHERE}})

summer torrent
#

wdym @lofty lagoon

knotty steeple
#

click the stop button

lofty lagoon
#

where x)

#

where is the stop button

quartz kindle
#

ctrl+C in terminal?

nocturne grove
#

in any case, intents rules only apply if you have intents enabled in your code, for exmaple, for discord.js would be new Client({ws:{intents:INTENTSHERE}})
@quartz kindle wait I don't understand that. Or do you mean, íf you have the intents available for your bot, you need to use that piece of code? instead of just new Client()?

quartz kindle
#

intents is an option you enable or disable in your client options

earnest phoenix
#

meaning without it, your member count will not be accurate, and you will not get member join/leave/update events
@quartz kindle speaking of this, a new endpoint has been added to GET an aprox. amount of members and presences in the guild

quartz kindle
#

if you dont enable it, all of its rules and related things will not apply

lofty lagoon
quartz kindle
#

although discord stated that intents will become mandatory in the future

#

but right now they are not

#

@earnest phoenix i heard about it, didnt check it out yet

#

but i heard people are complaining lmao

earnest phoenix
#

it's reasonable to complain, they're doing this thing on the rush without prior notice and it's being executed really badly

nocturne grove
#

hm I don't fully understand it now. But if I want to use guildMemberAdd with +100 guilds, I need my reason for using that event to be verified by Discord?

earnest phoenix
#

yes

quartz kindle
#

yes, but for the future, not for now

nocturne grove
#

yes 7 Oct

quartz kindle
#

for now you can keep running your bot without intents

earnest phoenix
#

you can be verified regardless, however if you want intents in 100+ guilds, you need a reason to get those intents

golden condor
#

That is really gonna be a deal breaker for Dyno and mee6 unless they make deals with them

earnest phoenix
#

annoying 100 server limit

nocturne grove
#

okay thanks

earnest phoenix
#

That is really gonna be a deal breaker for Dyno and mee6 unless they make deals with them
they're already verified and have intents

quartz kindle
#

intents are a life saver for most large bots

golden condor
#

@earnest phoenix I mean it says may limit to 100 servers

nocturne grove
#

But is it hard to verify that reason? Can you just say (is not my case though) my bot sends welcome messages?

earnest phoenix
#

for unverified bots

golden condor
#

Wait

quartz kindle
#

just by being able to use intents to stop receiving presence packets, large bots were able to cut cpu and network usage by up to 90%

#

they were long overdue

golden condor
#

So if I'm verified and get intents,I wouldn't be limited?

quartz kindle
#

bots like dyno/mee6/tatsu/rythm are probably saving hundreds of bucks per month thanks to intents

nocturne grove
#

huh but does that intent do something? I thought it was a permission to get that data

earnest phoenix
#

it's also nice that you can define certain intents for packets you want to receive, e.g. you may want to receive GUILD_MEMBER_ADD but not GUILD_MEMBER_UPDATE

golden condor
#

So if I'm verified and get intents,I wouldn't be limited?

quartz kindle
#

@nocturne grove

Maintaining a stateful application can be difficult when it comes to the amount of data you're expected to process, especially at scale. Gateway Intents are a system to help you lower that computational burden.
When identifying to the gateway, you can specify an intents parameter which allows you to conditionally subscribe to pre-defined "intents", groups of events defined by Discord. If you do not specify a certain intent, you will not receive any of the gateway events that are batched into that group. The valid intents are:
https://discordapp.com/developers/docs/topics/gateway#gateway-intents

lofty lagoon
#

someone can tell me how I can stop my bot with visual studio code pls

earnest phoenix
#

So if I'm verified and get intents,I wouldn't be limited?
@golden condor no, it would function normally

golden condor
#

So I wouldn't be limited to 100 servers

#

When verified

earnest phoenix
#

correct

golden condor
#

Like I didn't sign up for it in the verification

#

But I wanna do it afterwards

quartz kindle
#

discord by default sends you EVERYTHING
intents are a way to tell discord "send me only what i want"

earnest phoenix
#

you can sign up for it right now if your bot is in over 75 guilds

golden condor
#

@quartz kindle I need to use intents then

earnest phoenix
#

they went over day 1 and day 2 applications already i think

golden condor
#

you can sign up for it right now if your bot is in over 75 guilds
@earnest phoenix ik, I'm already verified

earnest phoenix
#

oh

golden condor
#

Check my profile

nocturne grove
#

@quartz kindle thanks. Maybe I'm confused now, but I'm seeing it as following now:
you can always (also with +100 guilds and after 7 Oct) use the events, but if you "want to consume less cpu power", you should get the intents.
My vision isn't right I guess

#

the intents are just to get the permission to use these events + consuming less cpu

quartz kindle
#

not sure how it will be after oct 7, but for now your understanding is correct

golden condor
#

I will use intents in my client

quartz kindle
#

if discord makes intents mandatory, then it will be a different story

lofty lagoon
#

someone can tell me how I can stop my bot with visual studio code pls

nocturne grove
#

okay thanks, but still confused

#

someone can tell me how I can stop my bot with visual studio code pls
@lofty lagoon maybe close visual studio code and launch node.js

#

but 🤷

lofty lagoon
#

I use python

#

not discord.js

nocturne grove
#

ow

#

erm no idea, sorry

lofty lagoon
#

ok

#

someone pls

marble juniper
#

do you have a terminal inside visual studio code

#

or what

modest maple
#

presss ctrl + C in the terminal with the script running

marble juniper
#

just kill the terminal

maiden mauve
#

is this not a thing at all in JS?

#

dynamic iterators?

#

or is my syntax just jacked up?

nocturne grove
#

oh wait last question about the intents, if you're using one of them, are they enabled in your developer portal?
My bot has none of them enabled there

#

NOTE: This may limit your bot to 100 servers in the future. Read more here```
#

and that's disabled

earnest phoenix
#

they're automatically disabled

nocturne grove
#

yeah but my bot is using guildMemberAdd and other events and things like guild.members.cache.filter()

earnest phoenix
#

if you depend on the user cache a lot, then yes you'd probably need the server members intent

nocturne grove
#

my bot is working fine now without these things enabled, so I don't need them?

earnest phoenix
#

discord said that they're going to enforce intents in the future 🤷‍♂️

#

it's your choice

#

you'll eventually have to enable the intent though

#

and if you want to use it in over 100 guilds, you'll have to get verified

#

it is

nocturne grove
#

ohh okay that explains it, that they want to enfore them. @earnest phoenix thanks again

earnest phoenix
#

it's your cache

#

flush it or use a different browser

nocturne grove
#

I don't see an icon too

hasty sparrow
#

Think he means the logo at the top of the page, not the favicon

earnest phoenix
#

first result of google

#

oh

#

your extension is uppercase

#

PNG is not png

hasty sparrow
#

Working now

grizzled raven
#

so

#

like

nocturne grove
#

yes that works here too

grizzled raven
#

discord currently still sends present updates and stuff

#

, right?

nocturne grove
#

yes

#

until 7 Oct everything is 'normal'

grizzled raven
#

and if i want them to stop sending them, i add intents stuff in the client options? or

#

wait

nocturne grove
#

sorry I barely understand it myself

earnest phoenix
#

How's it possible to change the output names of clientStatus?
For example if the user's clientStatus is { desktop: 'online' } change it to 🖥️ Desktop...

slender thistle
#

if (user.clientStatus.desktop == 'online') output = "!ONLINE ON DESKTOP!"

earnest phoenix
#

Hmm wait... <userdeclaration>.clientStatus.desktop or mobile or web is a function? @slender thistle

slender thistle
#

I don't speak JS, you might want to refer to the docs, I only gave you an overall idea

earnest phoenix
#

Hmm k lemme investigate then

maiden mauve
#

for all following my fun times

#

I think I've finally reached my goal

#

that was a doosie of trial and error

golden condor
#

How do you use intents on d.js

grizzled raven
#

on d.js v12 just read the docs

golden condor
#

I am not entirely sure

#

I was tryna find it and I couldn't find it in the options

#

nvm

#

I found it

#

Is it like this

#
const client = new Discord.Client({
ws:{
intents:{
//INTENTS HERE
}
}
})```
grizzled raven
#

yeah

golden condor
#

I said nvm

#

I found it

grizzled raven
#

i know i was late

golden condor
#

lol

tiny grotto
#

Hello, How can I send embed with Webhook?

earnest phoenix
#
var respuesta = prompt('Digo algo que no sea un numero')
}
var segunda = parseInt(prompt('Ingresa un numero'))
alert('Boomer')
if (typeof segunda === number && typeof respuesta === string) {
    console.log(respuesta)
    console.log(segunda)
}
else {
    console.log(`Hubo un error`)
01.js:4 Uncaught ReferenceError: number is not defined
    at 01.js:4
#

bruh

#

typeof segunda == "number"

#

not typeof segunda === number

#

same with typeof resquesta === string

#

ok

golden condor
#

c+reload edits

#

Oops

earnest phoenix
tiny grotto
#

xD

golden condor
#
const client = new Discord.Client({
ws:{
intents:{
//do you put each intent here in an array?
}
}
})```
grizzled raven
#

Clients are allowed 120 events every 60 seconds, meaning you can send on average at a rate of up to 2 events per second. Clients who surpass this limit are immediately disconnected from the Gateway
what exactly does this mean? that if i perform an action over 120 times in a minute i disconnect?

golden condor
grizzled raven
#

IntentsResolvable
Data that can be resolved to give a permission number. This can be:

  • A string (Intents.FLAGS)
  • An intents flag
  • An instance of Intents
  • An array of IntentsResolvable
quartz kindle
#

@grizzled raven thats only for gateway actions

#

not for rest requests

grizzled raven
#

why do you keep asking questions then answering them yourself angeryBOYE

golden condor
#
const { Client, Intents } = require('discord.js');
const myIntents = new Intents();
myIntents.add('GUILD_PRESENCES', 'GUILD_MEMBERS');

const client = new Client({ ws: { intents: myIntents } });``` You do it like this?
grizzled raven
#

yeah i knew i was getting mixed up, what exactly are gateway intents

golden condor
#

That's what d.js guide says

grizzled raven
#

IntentsResolvable
Data that can be resolved to give a permission number. This can be:

  • A string (Intents.FLAGS)
  • An intents flag
  • An instance of Intents
  • An array of IntentsResolvable
earnest phoenix
#

how i get the number 4 in this?
345

golden condor
#

I need to add all intents

earnest phoenix
#

with %

grizzled raven
#

you can do ```js
{
intents: ["GUILDS", "GUILD_BANS", "..."]
}

golden condor
#

Does using a guild's emojis count as guild_emojis

#

Like not fetching the emoji

#

But just using the id

#

Like this

earnest phoenix
#

how i get the number 4 in this?
345

golden condor
grizzled raven
#

that doesnt matter

#

its for emoji events

quartz kindle
#

@earnest phoenix depends, how do you want to get it?

grizzled raven
#

like emoji create

golden condor
#
const client = new Discord.Client({
  fetchAllMembers: false,
  disableMentions: "everyone",
  messageCacheMaxSize: 0,
  presence: { status: "dnd" },
  ws: {
    intents: ["GUILDS", "GUILD_MEMBERS", "GUILD_BANS"]
  }
});``` like this
earnest phoenix
#

with %

golden condor
#

?

grizzled raven
#

yes

earnest phoenix
#

@quartz kindle with %

quartz kindle
#

% doesnt work for that

#

% is a division remainder

#

what exactly do you want?

golden condor
#
GUILD_MEMBERS (1 << 1)
  - GUILD_MEMBER_ADD
  - GUILD_MEMBER_UPDATE
  - GUILD_MEMBER_REMOVE``` Oh
#

I don't need it then

earnest phoenix
#

like

#

get the number 4
with %

#

345 % ¿?

maiden mauve
#

Tim

#

since you started my problem with me

#

I need you to pat me on the back

golden condor
#

@grizzled raven so the privelleged intents only apply to events not methods

quartz kindle
#

@earnest phoenix is the number always 345?

#

what are other possible numbers you can get? do you need to get "4" from all possibilities?

#

do you always need the second character?

earnest phoenix
#

not, i use prompt to the user put a number like:
245, 645 the 4 in de middle

quartz kindle
#

so it is always the second character?

earnest phoenix
#

yes

#

like
second-character == 4

quartz kindle
#

then number[1] if its a string, or number.toString()[1] if its a number

earnest phoenix
#

this is js or djs?

wicked pivot
#
const { RichEmbed } = require('discord.js')

module.exports = (bot, oldMember, newMember) => {
    if(oldMember.user.bot)return
    let ChannedSend = bot.channels.get("703983082507599912")
    let guild = bot.channels.get("535553754359922705").guild
    if(!oldMember.user.presence.game && !newMember.user.presence.game)return
    if(oldMember.user.presence.game !== newMember.user.presence.game){
        console.log(" 2 event to trigger by : " + oldMember.user.tag) 
    }
}``` the event does not trigger, I'm on v11 (the presenceUpdate event)
quartz kindle
#

this is js

earnest phoenix
#

ok ty

grizzled raven
#

@golden condor putting an emoji into a messgae isnt a method

#

pretty sure discord does that

#

and takes care of whether the bot has access to the emoji to display ir

golden condor
#

ok

#

thx

cinder patio
#
SyntaxError: src/jsx/Util/Utilities.jsx: Unexpected token, expected ) (45:56)
  43 |         if (player2.relationships.with(playerName) > 5 && player1.relationships.with(playerName) > 5) score += 3;
  44 |         else if (player2.relationships.with(playerName) > 0  && player1.relationships.with(playerName) > 0) score++;
> 45 |         else if (player2.relationships.with(playerName) <= -2 && player1.relationships.with(playerName) <= -2) score += 4;
     |                                                         ^
  48 |     }    

Babel is screaming that this is wrong but my IDE doesn't, am I blind or something?

earnest phoenix
#

then number[1] if its a string, or number.toString()[1] if its a number
@quartz kindle
toStringing a number takes time, why not just do arithmetic operations? divide by 10 and MOD it by 10

quartz kindle
#

hmm lets see

#

yup, you are right, its much faster

#

however stringifying it is much easier to understand

lofty lagoon
#

why my bot message is x2

iron steeple
#

Is it running in two instances?

lofty lagoon
#

?

earnest phoenix
#

When I type f = open("file.txt", "r") print(f.read()) can otput be without ( and '

iron steeple
#

It might be running twice is all I mean

quartz kindle
#

@lofty lagoon show code

lofty lagoon
#

k

iron steeple
#

@earnest phoenix not sure what you mean. It should just output the contents of the file

lofty lagoon
iron steeple
#

That should work @lofty lagoon

earnest phoenix
#

the print screen button exists

lofty lagoon
#

@iron steeple but how I can stop my bot

earnest phoenix
#

do taskkill /f /im "python.exe"

iron steeple
#

You’re on Windows, correct?

earnest phoenix
#

in cmd

#

taskkill /f /im "python.exe"

lofty lagoon
#

yes

iron steeple
#

Yeah that’s exactly what I was gonna say lol

#

Use that command

earnest phoenix
#

haha

iron steeple
#

Beat me to it

earnest phoenix
#

thn run bot again

iron steeple
#

Yeah it just looks to me like you are running one version of the new one, and one version of the old one

earnest phoenix
#

yes

#

i was having same problem on strating programming bots

lofty lagoon
#

thx

#

it's work

earnest phoenix
#

afcorse

iron steeple
#

What IDE are you using?

earnest phoenix
#

me?

iron steeple
#

@lofty lagoon I meant 🤭

earnest phoenix
#

ok

#

which hosting you use?

iron steeple
#

I personally have a raspberry pi which works well enough for me

split hazel
#

i need one 👀

#

might actually order one that catches my attention

iron steeple
#

They’re quite good actually

#

Would recommend the pi 4 it’s got 4gb ram lol

earnest phoenix
#

how to use raspberry pi

#

i killed mine when it surged due to overvoltage lol

iron steeple
#

With 4K capabilities lmao

#

Oops!

#

@earnest phoenix it’s a tiny, power efficient computer that can run 24/7

earnest phoenix
#

where did you buy it

iron steeple
#

Amazon I think

earnest phoenix
#

price?

#

i've been thinking of making my home "smart" with rpis since it can easily run a webserver on it

iron steeple
#

You can get the newest one which can run two displays at 4K for around £50

earnest phoenix
#

ok

iron steeple
#

Which is probably $65

earnest phoenix
#

ok

iron steeple
#

But the one I have cost like $25

#

As an older model

earnest phoenix
#

but work

iron steeple
#

Yeah it works quite well although only has 1gb of ram

earnest phoenix
#

cool

#

first time i hear about something like that

iron steeple
#

Really? Well I would highly recommend one

earnest phoenix
#

yes

#

how i separe 2 numbers?

#

like:
45```js
console.log(num1/4/)
console.log(num2/5/)

raven urchin
#

What can I add

  shardId: process.argv[1],
  shardCount: process.argv[2],
  fetchAllMembers: true
});``` to my index.js?
earnest phoenix
#

@earnest phoenix u can check like this:

<@${message.mentions.users.first().id}>

#

Test

#
if(args[0] == `<@${message.mentions.users.first().id}>` || args[0] == `<@!${message.mentions.users.first().id}>` || )```
#

I don't really know if this can work but u can test

#

Nice

#

I think <@id> is only on computer

#

Or phone

#

Idk

#

Guys... If i use this function:
<clientname>.guilds.cache.get('GUILD ID').emojis.cache.find(e => e.name === 'EMOJI NAME')
and use it on an embed or message...
Will it bypass the USE_EXTERNAL_EMOJIS permission?

#

U can't bypass the permission @earnest phoenix

#

Hmm

#

But i think u can with a bot PepeShrug

#

the desktop client pings with <@!id> while mobile pings with <@id> for whatever reason

#

discord ™️

#

Okay ty cry

#

@earnest phoenix yea i was talking about doing it with a bot lmao

#

@earnest phoenix no i've thinking and u can't PepeShrug

lofty lagoon
#

@lofty lagoon I meant 🤭
@iron steeple 👀

earnest phoenix
#

Uhh

#

If the bot doesn't have the permission this is IMPOSSIBLE

#

Or i think u can used local images for test

#

there was a bug where bots can bypass external emoji permission by using emojis in an embed

#

i don't know if it's patched yet

#

Oh..

#

@earnest phoenix I'm thinking what discord staff was thinking when they were adding a ! For a ping format on a desktop and removing it on mobile...

#

I literally see no use on it

#

Lol i know why mobile and desktop are different on this thing

#

This is really stupid but wait

#

the ! format is legacy from 2016 discord, it used to indicate that the user has a nickname but ever since the public api exposure there's no point of using it and discord created an inconsistency with their platforms omegalul

#

OMEGALUL

#

<@id> = if a role with empty name exist, u can't ping any user

#

But with the !

#

U can

#

Hard to explain sorry

#

@earnest phoenix that's not how ping formatting works lmao

raven urchin
#

How can I make my shard fit into my index.js?

earnest phoenix
#

@earnest phoenix but thisi s a real thing

#

@raven urchin fit??

raven urchin
#

Because it also includes const client = new which was already added

earnest phoenix
#

Hmmm

#

Verify

#

If u don't have put 2 times

#

The const client

raven urchin
#

So if I add it and take the const client it'll give me an error

#

But how can I fix that

earnest phoenix
#

Oof...

#

On the launch shard file?

#

Or the "index"?

raven urchin
#

The index

earnest phoenix
#

U export the client?

#

Or just redefine it

raven urchin
#

Im trying to use:

  shardId: process.argv[1],
  shardCount: process.argv[2],
  fetchAllMembers: true
});```
earnest phoenix
#

Lol

#

Really bad

#

😅

#

U don't need this

raven urchin
#

Oh..

earnest phoenix
#
  shardId: process.argv[1],
  shardCount: process.argv[2],```
#

If u use this

#

U need to use a thing like

#

node yourindex.js 0 1

raven urchin
#

Oh

earnest phoenix
#

shard.js

const Discord = require("discord.js");
const client = new Discord.Client();


const { ShardingManager } = require('discord.js');
const manager = new ShardingManager('./index.js', { 
    token: "token",
    autoSpawn: true,
  respawn: true
});

manager.on('launch', shard => console.log());

manager.spawn();

manager.on('launch', shard => (console.log(`[SHARD] Shard ${shard.id} / ${manager.totalShards}`)));```
#

Try a thing like this

#

Replace index.js by ur index

raven urchin
#

I already have a token in my index.js

earnest phoenix
#

This isn't a problem

raven urchin
#

So I add that into a shard.js file?

earnest phoenix
#

Put the same in the file

#

And

#

node shard.js

#

Yeah

#

And

#
const client = new Discord.Client({
  shardId: process.argv[1],
  shardCount: process.argv[2],
  fetchAllMembers: true
});```
=>
```js
const client = new Discord.Client({
  fetchAllMembers: true
});```
If u don't need to fetch all members
=>
```js
const client = new Discord.Client();```
#

How can I make a command that responds to all messages e.g. I write "hi" bot inscriptions "hello"

#

And after u can use events like:

shardDisconnected, shardReconnecting, shardResumed

raven urchin
#

But when I add that into my index.js it gives me an error because const client = new Discord.Client() exists

earnest phoenix
#

@earnest phoenix event message and verify the content

#

@raven urchin where u host ur bot?

#

e.g ?

raven urchin
#

glitch....

earnest phoenix
#

@earnest phoenix u don't know how to make it?

#

@raven urchin send me invitation i help u

#

i just saw can you give me example

#

@earnest phoenix i know but if u can't make it u can't make a bot

raven urchin
#

K

earnest phoenix
#

This is a basic thing...

raven urchin
#

Can I trust you though.

earnest phoenix
#

Yeah

#

Totaly

raven urchin
#

Sus

#

But k

earnest phoenix
#

Send it in dms

raven urchin
#

K

earnest phoenix
#

resolved

grizzled raven
#

thats only for gateway actions
@quartz kindle what exactly are gateway actions?

#

is it like connecting to the gateway and

tired nimbus
#

sql.prepare("ALTER TABLE user ADD COLUMN dex TEXT;").run()

#

doesnt seem to making a new column

#

no error message

#

better-sqlite3

grizzled raven
#

maybe try instertin into the column

tired nimbus
#

would suing this sql browser to make columns be appropriate

earnest phoenix
#

Hi

#

Can you tell me where this code goes wrong? I'm trying to make a timer using Discord.js and I've used debuggers to solve the bugs and problems but no luck```js
function timer(arguments, receivedMessage){
var cnt = 0
receivedMessage.channel.send("ok it accually works" + arguments.length)
arguments.forEach((value) => {

    receivedMessage.channel.send ("Value::::" + value)
    //if (value == "start")
    
        receivedMessage.channel.send("Timer for" + value + "has started")
    
setTimeout(
    () => {
        cnt = cnt+1
        receivedMessage.channel.send("AHH IT RUNS ACCUALLY YAY!!!")
        receivedMessage.channel.send("CNT = " + cnt)
       },
   1000 * 60
  );
if (cnt == parseFloat(value)) {
    receivedMessage.channel.send("Beep beep beep timer for "+value +"has ended!")
}

 })
 receivedMessage.channel.send ("Timer end")
}```

Here's what it did last time
Me: +timer 1
bot: ok it actually works1
Value::::1
Timer for1has started
Timer end
AHH IT RUNS ACCUALLY YAY!!!
CNT = 1
Doesn't go through ```js

if (cnt == parseFloat(value)) {
receivedMessage.channel.send("Beep beep beep timer for "+value +"has ended!")
}```

#

pls help

#

It uses API you said?

#

its an overwatch api ?

#

Ok

spice pasture
#

hmm idk what to doo with my bot rn

#

its pretty much feature complete because its a small bot made for one feature

earnest phoenix
#

Oh

#

ok

#

ya Idk how to do that

#

Hi Can you tell me where this code goes wrong? I'm trying to make a timer using Discord.js and I've used debuggers to solve the bugs and problems but no luck```js
function timer(arguments, receivedMessage){
var cnt = 0
receivedMessage.channel.send("ok it accually works" + arguments.length)
arguments.forEach((value) => {

    receivedMessage.channel.send ("Value::::" + value)
    //if (value == "start")
    
        receivedMessage.channel.send("Timer for" + value + "has started")
    
setTimeout(
    () => {
        cnt = cnt+1
        receivedMessage.channel.send("AHH IT RUNS ACCUALLY YAY!!!")
        receivedMessage.channel.send("CNT = " + cnt)
       },
   1000 * 60
  );
if (cnt == parseFloat(value)) {
    receivedMessage.channel.send("Beep beep beep timer for "+value +"has ended!")
}

 })
 receivedMessage.channel.send ("Timer end")
}```

Here's what it did last time
Me: +timer 1
bot: ok it actually works1
Value::::1
Timer for1has started
Timer end
AHH IT RUNS ACCUALLY YAY!!!
CNT = 1
Doesn't go through ```js

if (cnt == parseFloat(value)) {
receivedMessage.channel.send("Beep beep beep timer for "+value +"has ended!")
}```pls help

#

pleaseeee help

grizzled raven
#

try Number(value)

earnest phoenix
#

ok

#

ill try that

#

what the fuck is that indentation lol

#

idk

#

put it theough a beaifier

topaz fjord
#

no

grizzled raven
#

wait actually

earnest phoenix
#

@grizzled raven how do you get bot developer

grizzled raven
#

nah nvm let someone else explain

#

submit a bot

earnest phoenix
#

ok

#

It didnt work

grizzled raven
#

try again maybe it'll work the second time

earnest phoenix
#

function timer(arguments, receivedMessage){
    var cnt = 0
     receivedMessage.channel.send("ok it accually works" + arguments.length)
    arguments.forEach((value) => {

        receivedMessage.channel.send ("Value::::" + value)
        //if (value == "start")
        
            receivedMessage.channel.send("Timer for" + value + "has started")
        
    setTimeout(
        () => {
            cnt = cnt+1
            receivedMessage.channel.send("AHH IT RUNS ACCUALLY YAY!!!")
            receivedMessage.channel.send("CNT = " + cnt)
           },
       1000 * 60
      );
    if (cnt == Number(value)) {
        receivedMessage.channel.send("Beep beep beep timer for "+value +"has ended!")
    }
    
     })
     receivedMessage.channel.send ("Timer end")
    }``` correct?
grizzled raven
earnest phoenix
#

uug

#

did i do what u told me to do

grizzled raven
#

yes

earnest phoenix
#

ok

#

i submit the bot

grizzled raven
#

now wait

earnest phoenix
#

ok

#

dhum

grizzled raven
#

until it gets accepted

earnest phoenix
#

dhum

#

dham

#

dhum

grizzled raven
#

stop

earnest phoenix
#

repeat*

oak cliff
#

Please do not spam.

earnest phoenix
#

how long does it take and ok i wont spam

oak cliff
#

1-2 weeks for a bot to be approved.

earnest phoenix
#

ok

#

and no luck

oak cliff
#

but this is development, so lets move somewhere else

earnest phoenix
#

code wont work

sinful belfry
#

it is currently a bit less though. more like less than a week @earnest phoenix

earnest phoenix
#

ok

#

@grizzled raven it didnt work your suggestion

grizzled raven
#

pretty sure arguments might be reserved

#

use args instead

earnest phoenix
#

ok

amber fractal
#

arguments is reserved, it's all passed arguments whether defined or not

earnest phoenix
#

ok

#

This??? ```js
function timer(arguments, receivedMessage){
var cnt = 0
receivedMessage.channel.send("ok it accually works" + arguments.length)
args.forEach((value) => {

    receivedMessage.channel.send ("Value::::" + value)
    //if (value == "start")
    
        receivedMessage.channel.send("Timer for" + value + "has started")
    
setTimeout(
    () => {
        cnt = cnt+1
        receivedMessage.channel.send("AHH IT RUNS ACCUALLY YAY!!!")
        receivedMessage.channel.send("CNT = " + cnt)
       },
   1000 * 60
  );
if (cnt == Number(value)) {
    receivedMessage.channel.send("Beep beep beep timer for "+value +"has ended!")
}

 })
 receivedMessage.channel.send ("Timer end")
}
amber fractal
#

no, you can't use arguments

#

like we said, it's reserved

#

use args

earnest phoenix
#

so```js
function timer(args, receivedMessage){
var cnt = 0
receivedMessage.channel.send("ok it accually works" + args.length)
args.forEach((value) => {

    receivedMessage.channel.send ("Value::::" + value)
    //if (value == "start")
    
        receivedMessage.channel.send("Timer for" + value + "has started")
    
setTimeout(
    () => {
        cnt = cnt+1
        receivedMessage.channel.send("AHH IT RUNS ACCUALLY YAY!!!")
        receivedMessage.channel.send("CNT = " + cnt)
       },
   1000 * 60
  );
if (cnt == Number(value)) {
    receivedMessage.channel.send("Beep beep beep timer for "+value +"has ended!")
}

 })
 receivedMessage.channel.send ("Timer end")
}```
#

oh

#

this?

amber fractal
#

should work, idk exactly what you're trying to do, just saw the arguments thing

earnest phoenix
#

timer

#

rying to make a timer

#

t

#

@amber fractal look 👀 ```js
timer(args, receivedMessage)
^

ReferenceError: args is not defined```

#

ur suggestion is wrong

grizzled raven
#

arguments is reserved only in functions

amber fractal
#

wait

#

show the code where you call timer

#

more of the code*

earnest phoenix
#

if  (primaryCommand == 
        "timer"){
            timer(args, receivedMessage)
        }```
amber fractal
#

args isnt defined in the call

earnest phoenix
#

+timer <time>

grizzled raven
#

ur suggestion is wrong
steven how you just gon let him diss you

#

change that args to arguments

amber fractal
#

no

#

what

earnest phoenix
#

ok

amber fractal
#

it's

grizzled raven
#

unkess

#

kfs in a funct

#

nevermind

earnest phoenix
#

in whole code?

grizzled raven
#

dont

amber fractal
#

He isn't showing the code

grizzled raven
#

no

#

stop

#

change every arguments to args

toxic plinth
#

I need help with my top.gg css, the votebutton and background color won’t change


<style>
  

  #bot-details-page { background-color:blue; }
 
  .votebutton { border-color:red; }
  

  #title { color:purple; }

</style>
amber fractal
#

I can't help with the code I'm given, but I can tell you that you didn't define args before calling the function

grizzled raven
#

define it

#

change "let arguments = ...." to "let args = ..."

amber fractal
#

@toxic plinth you should mention what you need help with

#

just saying you need help, doesn't help us

toxic plinth
#

Wdym

earnest phoenix
#

ok

amber fractal
#

what about it is wrong

#

what do you want to happen, etc

toxic plinth
#

Fixed

earnest phoenix
#

let arguments = splitCommand.slice(
1
) // All other words are arguments/parameters/options for the command

#

👀

grizzled raven
#

yes change it

earnest phoenix
#

it isnt taken cause i used it in whole code arguments

#

and no error

#

so

#

ya

#

doesnt matter if args or arguments

restive furnace
#

no

#

it can be anything you want

#

it can be eg. parameters too

earnest phoenix
#

yes ik

#

just saying arguments isnt taken

#

argument is

#

wait

#

the other way around

#

brb

#

how i do !top with megadb?

restive furnace
#

@earnest phoenix #what do you mean

earnest phoenix
#

top of money

#
  1. first name money$
  2. second name money$
    ...
    ...
    ...
#

@restive furnace

knotty steeple
#

wtf is megadb

earnest phoenix
#

json

#

npm

knotty steeple
#

better change to a real db

earnest phoenix
#

like which?

knotty steeple
#

uh

#

sqlite?

earnest phoenix
#

idk how to use sqlite

knotty steeple
#

learn

#

didnt u have to learn how to use megadb

tired nimbus
#

speaking of sqlite

#

sql.prepare("ALTER TABLE user ADD COLUMN dex TEXT;").run()
doesnt seem to making a new column
no error message
better-sqlite3

nimble escarp
#

PSQL seems like a better solution pepeshrug

quartz kindle
#

the 120/60 rate limit is for these

late hill
#

I keep frequently getting this error

events.js:183
      throw er; // Unhandled 'error' event
      ^
Error: unexpected end of file
    at Gunzip.zlibOnError (zlib.js:153:15)```
#

No idea where that even comes from

pale vessel
#

looks like it's something to do with zlib

late hill
#

How would I catch it 😩

pale vessel
#

did you install zlib-sync?

quartz kindle
#

unhandled error events can be caught via .on("error")

#

that doesnt look like discord though

earnest phoenix
#
collector.on("collect", async m => {
  if(m.content === password){
    await m.first().delete().catch(err => {
    console.log("Impossible de supprimer le message")
    });```

m.first is not a function
#

why?
#v11.5.1

quartz kindle
#

the collect event doesnt give you a collection

earnest phoenix
#

so i remove first() ?

quartz kindle
#

yes

late hill
#

I already listen for errors on the client

earnest phoenix
#

but if i remove first

#

console say me

#

m.delete(...).catch is not a function

quartz kindle
#

console.log(m)

earnest phoenix
#

Ok

quartz kindle
#

@late hill which library and version of library?

late hill
#

how do you check the version again

#

xd

#

it's eris

earnest phoenix
#

hi i just have a question

#

on the bot's profile, we can display the server count, but on mine it display N/A

summer torrent
#

npm ls eris

#

@late hill

#

@earnest phoenix you have to post server count

late hill
#

it's on 0.9.0 still

earnest phoenix
#

thanks ^^

pale vessel
#

that's really old

#

it's 0.12.0 now

quartz kindle
#

eris uses zlib for api requests

#

the error is coming from eris's request decompression

late hill
#

so

quartz kindle
#

the file that handles api requests has been changed several times in the last 6 months

#

so try updating it

late hill
#

do you think updating will fix it

#

ok

earnest phoenix
#

btw another question, in my bot, I have a music feature, but like after 2 minutes it marks the song as finshed but it is normally not

#

any suggestion ?

pale vessel
#

must be discord.js

earnest phoenix
#

i'm using v11 does the problem come from there ?

pale vessel
#

don't think so

#

are you saying ytdl?

earnest phoenix
#
1|index    |     voiceChannelID: undefined,
1|index    |     speaking: false,
1|index    |     nickname: null,
1|index    |     lastMessageID: '704061537018708121',
1|index    |     lastMessage: [Circular *1],
1|index    |     deleted: false
1|index    |   }
1|index    | }

@quartz kindle

#

yup

pale vessel
#

most people here have the same issue with that

earnest phoenix
#

like i do ytdl(url)

quartz kindle
#

@earnest phoenix whats the beginning of the log

earnest phoenix
#

//vote

#

hmmmmm

#

@real rivet

craggy pine
#

#commands if you're trying to have the bot post something cstef

earnest phoenix
#

oooops

#

sorry

#

didn't see the channel

craggy pine
#

No worries. 🙂

earnest phoenix
#

thought i was in testing

tired nimbus
#

ok I managed to find out while my sqlite table couldnt use order

earnest phoenix
#
    position: 1,
    parentID: '700619044079927348',
    permissionOverwrites: Collection(2) [Map] {
#

wtf

tired nimbus
#

Now how do you make a new column in a sqlite table?

#

hold on let me try smthing

earnest phoenix
tired nimbus
#

database disk image is malformed

Im guessing I corrupted it?

#

I just made 2 new columns and this happens

#

I have a backup but Im really confused why this is happening

quartz kindle
#

@earnest phoenix that looks like a channel, not a message wtf

#

thats not the full log

earnest phoenix
#

isn’t full log but m is supposed to be a message ... how can I do

#

@quartz kindle

#

m define is this

#
                length: "9",
                numbers: "5",
                symboles: "4"
            });
     
const filter = m => m.author.id === member.id && m.content === password```
quartz kindle
#

no thats the filter

#

m is this, and its correct

#

collector does give you a message

#

so m.delete() should work

earnest phoenix
#

no x)

quartz kindle
#

thats why console.log it

#

to see what it really is

#

and why delete doesnt work

earnest phoenix
#

you want complete logs ?

quartz kindle
#

yes

earnest phoenix
#

ok

empty owl
#

how would i run a function that waits for a result in a for of loop
for me it runs it all at once and doesnt wait for a result

#

javascript

wicked jasper
#

Hi guys i code my discord bot on python 3 and i wanted to know how do I do so that the activity of my bot is the ammount on guilds on wich he is idk if this is clear sorry for my bad english

#

so could anyone give me the command to put

earnest phoenix
#

we won't spoonfeed you code

wicked jasper
#

for the moment i have this

earnest phoenix
#

we can guide you to your goal, but no one will spoonfeed you

wicked jasper
#
        await asyncio.sleep(10)```
tired nimbus
#

my database became corrupted

pale vessel
#

this is why you don't use sqlite

earnest phoenix
#

my database became corrupted
@tired nimbus do you not have any sort of a backup?

tired nimbus
#

yes

wicked jasper
#

Bro i am not askling for spoonfeeding but for help

tired nimbus
#

but Im still gonna remake the table

#

Im just gonna use a dB browser and filter out users who have more than 0

#

and then manually add their data back and the delete everything else

quartz kindle
#

@empty owl show code

delicate zephyr
#

@tired nimbus I would recommend creating a script that duplicates or manually creating a duplicate of the database so that for instance your database corrupts you can revert to a backup

tired nimbus
#

I have a backup but whenever I try to add a new column it results in corruption

quartz kindle
#

how are you adding it?

tired nimbus
#

sql.prepare("ALTER TABLE user ADD COLUMN ordering INTEGER;").run()

earnest phoenix
#

@quartz kindle

empty owl
#

nvm

#

it works

quartz kindle
#

@tired nimbus better-sqlite3?

tired nimbus
#

yep

quartz kindle
#

run sql.close()

#

after doing the change

tired nimbus
#

ok ill try that

earnest phoenix
#

@quartz kindle ^

quartz kindle
#

@earnest phoenix looks correct

#

show me the code you tried

earnest phoenix
#

How can I change the widget style
Because I want to put this: &style=for-the-badge
Pls, I want help with that

#

which widget

#

discord or dbl

#

dbl

grizzled raven
#

damn

earnest phoenix
grizzled raven
#

i said i'll rewrite to d.jsv12 then shard but now im at 2100 guilds lmao

pale vessel
#

nm

grizzled raven
#

now i have to force myself to do yukcy v11 sharding

quartz kindle
#

rip

earnest phoenix
#

Yeah, I know that

#

But I want to change the style

#

Something like this:

#

How can I do that

#

that isn't dbl

#

Yeah, I know

#

But I want that style

#

Is posible or not?

#

you can't use something that doesn't exist

#

oh, :c

#

Ok, thanks

#

at best you can make your own cdn provider to generate that and put it on some small vps

#

ok

#

what you posted is shields.io, shields.io allows querying json data to generate an image which means you could use DBL's api to do it, however that would also mean exposing your API token to wherever you're providing the image

#

oh :c

#

Ok ok

tired nimbus
#

still corrupted

#

Im going to have to re make the table

quartz kindle
#

@earnest phoenix i believe you can use the widget as json and code your own html element and style for it

#

there is also this

earnest phoenix
#

ok

grizzled raven
earnest phoenix
#

guys

#

Your bot page mentions, or promotes NSFW functions in its descriptions. Please remove any mentioning of NSFW features.

#

is that include in help command ?

trim nexus
#

no

#

the nsfw command specifically

slender thistle
#

Wrong channel to ask, also

trim nexus
#

unless ur help command has nsfw content in it

earnest phoenix
#

sorry

#

you're not allowed to mention nsfw features in your bot page

#

however you are in the help command

#

ok thanks

clever briar
#

can someone tell me where to write python?

earnest phoenix
#

in your bedroom, at the kitchen table, on the toilet.... anywhere

clever briar
#

dude im not joking

#

actually

earnest phoenix
#

your question doesn't make sense

#

where, what do you mean where it's text

clever briar
#

what site/app to write python on

slender thistle
#

There's plenty of IDEs and just text editors to write Python tbh

#

Sublime Text, PyCharm, Visual Studio Code, Atom

clever briar
#

ok thanks

modest maple
#

Ngl just searching 'getting started python basics' would of awnsered that question

clever briar
#

ok thanks

astral yoke
#

hi guys so in my messanger this is where it gets the prefix for the custom prefix let prefix = bot.db.fetch(`prefix_${message.guild.id}`) ? bot.db.fetch(`prefix_${message.guild.id}`) : config.prefix
but the problem is if you dm the bot it gives an error so how would I make it so that if the channel type is dm then the prefix is db! ?

#

i tried to do if(id === null) { prefix = config.prefix } but it still gave me the same error

iron steeple
#

Not familiar with that language but something like ‘instanceof discord.DM’ but idk

astral yoke
#

im sorry but that dosent help

iron steeple
#

Which part are you stuck on then?

#

The DM part or the prefix part

pale vessel
#

message.channel.type returns the channel type

modest maple
#

Just check if the channel ID a Dmchannel

astral yoke
#

if (message.channel.type == "dm"

pale vessel
astral yoke
modest maple
#

Think logically

pale vessel
#

oh, spoonfeeding to himself

modest maple
#

Check if channel is Dmchannel if yes use default if not use custom

bitter meadow
#

@clever briar I write in python, I would recommend Atom or pycharm. Atom has a good extension call python run, and you just press F5 to run, but pycharm is built for python development and has more useful tools.

modest maple
#

Litterally every python IDE has a direct run system in place

#

IDEs are just personally preference in the end

#

Unless you're doing high level work it won't affect you at all

fervent goblet
#

how do i put this in my bot?

quartz kindle
#

put where in your bot?

fervent goblet
#

i see these in peoples status commands

#

i want to do that too

quartz kindle
#

copy the link and add it to your command

#

you need the png version, not the svg

fervent goblet
#

how do i get the png version?

quartz kindle
#

its written there

fervent goblet
#

yes i just read that lol

hasty lotus
#

hey

#
for (let f of jsfile) {
      let props = require(`./commands/${f}`);
      console.log(`Command ${f} loaded!`);
      bot.commands.set(props.help.name, props)
      if(props.help.alias) {
        props.help.alias.forEach(alias => bot.commands.set(alias, props))
      }
    };```
#

does anyoneknow why this prints me this error out :

                         ^

TypeError: props.help.alias.forEach is not a function
#

?

copper cradle
#

is alias an array?

#

or a string

hasty lotus
#

array

copper cradle
#

you sure

summer torrent
#

In one of the commands, the alias parameter is not an array

#

probably

wise quartz
#

Does ffmpeg work for music commands? Cuz its website won't open?

summer torrent
#

yes

wise quartz
#

How do i install it then?

summer torrent
#

which programming language do you use

wise quartz
#

Python

#

When i open the ffmpeg website it doesn't load n says
"This site can't be reached
ffmpeg.org took too long to respond."

pale vessel
#

he sent you a mirror

wise quartz
#

Aaaaaa....

quartz kindle
#

ffmpeg is back online

wise quartz
#

Okay ignore my old questions but does ffmpeg work on heroku???

#

Cuz my bot is hosted there 😅

gloomy imp
#

I'm using Discord.net. How do I get the message object/details? The tutorials I'm using don't seem to knw

summer torrent
#

you can't

oak cliff
#

you can set your bots presence but you cannot make a custom status

summer torrent
#

that is not a custom status

#

that is game activity

#

yeah

#

which library do you use

#

which version

#

<Client>.user.setActivity()

grizzled raven
#

how

fluid orbit
#

hello i'm trying to make a stats bot but in a message not a vc so anyone know how can i define the message instead of VC

        let EGC = client.guilds.get(`687018691023601726`);
        let memberCount = EGC.memberCount;
        let mcChannel = EGC.channels.get(`704091924809646100`);
        mcChannel.setName(`${memberCount} عضو`)
earnest phoenix
#

dbl.webhook.on('vote'
How can I use Webhooks vote

quartz kindle
#

@fluid orbit mcChannel.send(memberCount) will send it as a message to that channel

fluid orbit
#

oh, thanks

quartz kindle
#

@earnest phoenix did you configure the webhook correctly? in top.gg as well?

earnest phoenix
#

No, because when I put my token, the console says an error

quartz kindle
#

then you're doing something wrong lol

earnest phoenix
#

Yeah, but I don't know what

quartz kindle
earnest phoenix
#

I'm going to check the logs

quartz kindle
earnest phoenix
#

ReferenceError: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9 is not defined

#

This error appears

amber fractal
#

Show the code

#

this'll be fun

#

Wait

#

dont

earnest phoenix
#

this'll be fun
@amber fractal no

amber fractal
#

that looks like the start of a token that wasn't put in a string

#

Check your login statement and ensure you put your token in a string (at least in js)

quartz kindle
#

@earnest phoenix tokens are always strings

#

otherwise your code thinks they are variables

#

do you know the difference between a string and a variable?

heavy anchor
#

Is this Incorrect I'm getting an error?

if (!bot.user.hasPermission("CREATE_INSTANT_INVITE"))```
amber fractal
#

hasPermission can only be used on GuildMembers

heavy anchor
#

oh ok

#

Where do I find it the docs about permissions then?

#

discord.js

amber fractal
#

You can also look at the typedefs for the permissions stuff

heavy anchor
#

ok thx much

sick cloud
#

what's the best way to get content in quotes

#

ie "some text" and stuff would return ["some text", "and", "stuff"]

sudden geyser
#

probably regex.

amber fractal
#

I could tell you how to ge tthe stuff in the quotes, but not in an array with the stuff without quotes (atleast efficiently lol)

sick cloud
#

i want to get what's in the quotes and just treat it as a single argument

earnest phoenix
#

One question

amber fractal
#

/"(.*?)"/g is good regex for it

sick cloud
#

can it be modified to support ' as well?

earnest phoenix
#

Is allowed to create commands, and keep unlocked untill the vote restarts (or expires)

amber fractal
#

/("|')(.*?)("|')/g but this would also match "some string'

#

there's probably a way to ensure it isnt like that, but idk it

sick cloud
#

that's fine

amber fractal
sick cloud
#

i just need to make it possible to type things with spaces as one arg

#

for role names

#

alright that works

#

could you suggest how to integrate it with my existing args? since right now if i do "role name" User#0001 User#0002 i get ['"role', 'name"', 'User!0001', 'User#0002']

#

and you get my point hopefully as i want to replace the first arg with the regex one

amber fractal
#

so do you want to execute it on an existing array of arguments?

sick cloud
#

yeah

#

i'm using a pretty generic method: const args = message.content.slice(prefix.length).split(/ +/g);

amber fractal
#

gimme a sec lemme see

sick cloud
#

m'kay

amber fractal
#

idek what I'm doing anymore

#

regex fries my brain

#

yeah idk, I would say join the array and extract the content, but Idk if that fits your needs

sick cloud
#

the use case is !add "role name" User#0001 User#0002 @amber fractal

#

so i want to get 3 args, being role name and User#0001 / User#0002

#

@earnest phoenix const message = new Discord.Client(); why are you making a new client

#

use your existing bot or client

#

why are you doing this

#

message should already be there in your event

#
// here
});```
#

you're not using that?

#

because if you aren't it's obviously not going to work

#

making a new client will do nothing

#

as a client is not a message, and has no content or channel

#

show your full code

amber fractal
#

it's super inefficient though

sick cloud
#

that's not your full code @earnest phoenix

#

i mean including the client and events and all

amber fractal
sick cloud
#

yeah that'll work real well

#

i don't care about how efficient it is, it's only gonna be used in one server and occasionally

amber fractal
#

I used some nested loop stuff

sick cloud
#

¯_(ツ)_/¯

amber fractal
#

what lang do you use?

#

Well you could transfer it to any really

sick cloud
#

lang as in programming?

amber fractal
#

yeah

sick cloud
#

node v14

amber fractal
#

I have it written in js

#

ah yeah that'll do

sick cloud
#

that's messy code

tired nimbus
#

2 discord.client

sick cloud
#
const client = new Discord.Client();
const bot = new Discord.Client();
``` why
#

learn before you start making bots

#

they are wrong

#

follow it

tired nimbus
#

nice friend

sick cloud
#

he isn't

amber fractal
#
function getArgs(str){
    let result = []
    let args = str.split(" ")
    for(let i = 0; i < args.length; i++){
        let content = ""
        if(args[i].startsWith('"') || args[i].startsWith("'")){
            content += args[i].slice(1)
            for(let j = i + 1; j < args.length; j++){
                content += ` ${args[j]}`
                if(args[j].endsWith('"') || args[j].endsWith("'")){
                    i = j
                    content = content.slice(0, -1)
                    result.push(content)
                    break
                }
            }
        }else{
            result.push(args[i])
        }
    }
    return result
}```
normally I wouldn't just post code, because spoonfeeding, but I think you know how to program lol
if you want it to work with passed arguments, just change the argument from string to args and remove the `let args = ...` part
![mmLol](https://cdn.discordapp.com/emojis/356831697385422848.webp?size=128 "mmLol")
tired nimbus
#

anyone can easily copy and run it

#

from any open source project

sick cloud
#

he's somebody that you want to ignore because he doesn't know how to code properly

#

that's a fun chunk of code

#

but ty

amber fractal
#

lmao it's so inefficient

#

but you know

#

¯_(ツ)_/¯

sick cloud
#

it works

#

that's all i need lol

amber fractal
#

I was trying to do regex like (["'])(?:(?=(\\?))\2.)*?\1 but my brain said nah

tired nimbus
#

its in the docs

#

setPresence I do believe

amber fractal
#

presence or status

#

like online or Playing x

#

Well setPresence works with both, use setPresence() with a correctly defined PresenceData object https://discord.js.org/#/docs/main/stable/typedef/PresenceData, ex
{activity: {name: "hi"}, status:"online"} would set the status to online and the presence to Playing hi

earnest phoenix
sudden geyser
#

that's an image.

#

just add the source to the image in the embed

grim jasper
#

why i can't get servers count in this widget

#

its shows only upvotes ,lib and owner

oak cliff
#

are you posting your server count?

copper cradle
#

n o

lean swan
#

Set channel permission which permission dose it need?

earnest phoenix
#

just add the source to the image in the embed
@sudden geyser how should i do that can you please tell me?

valid frigate
#

assuming you are using discord.js

#

well first go to your bot page on the site, click edit and scroll down

#

where you see somehting similar, copy and paste the link to the image but you need to replace .svg with .png for it to show up on an embed

#

ok that had nothing to do with djs but that's how you obtain the image

gloomy imp
#
        [Command("addchar")]
        [Alias("ac")]
        public async Task addchar(SocketUserMessage message = null){
            if(message == null){
                await ReplyAsync(";-; I'm not smart enough to figure out the rest...");
            }

            await ReplyAsync("Things went well ;v;");
        }

Why does trying to use this with an argument cause an error when it says something along the lines "Message object not found"

sudden geyser
earnest phoenix
#

k

#

btw thx

sick cloud
#

what's the "safest" way to do a mass role addition operation?

cedar nova
#

hello everyone, is youtube api currently under limit today?
for those who have music bot whether youtube api limits daily exceeded today?

sick cloud
#

youtube api limits daily exceeded today means you've used that many api calls you're banned from using it until the next day

#

stop spamming the api to prevent it

cedar nova
#

ohh okay

sudden geyser
#

what's the "safest" way to do a mass role addition operation?
@sick cloud if you're adding to a single member, set the roles the user has so you're only sending one request for many role changes.

#

if you're doing it for many users probably just a rate limit

sick cloud
#

i had an idea to only add one role every second

#

would that do?

kind heron
#

Not sure if I am in the right channel, but I am new. Can someone help me with setting up Node.js on Ubuntu?

sick cloud
#

what version are you aiming for?

kind heron
#

At least 12. I downloaded version 14.

sick cloud
#

but use setup_12.x ofc

hard relic
#

weird, the GIF I had set image as in my rich embed suddenly doesnt want to load