#development

1 messages · Page 833 of 1

summer torrent
narrow kettle
#

thanks :>

royal portal
#

@digital ibexHow?

digital ibex
#

...

summer torrent
#

what is your djs version

royal portal
#

latest

summer torrent
royal portal
#

Thanks!

#

Uhh

#

It's been 2 minutes

#

Just 2

#

With presence

#

It works fine

#

But then it just turned my bot offline

#

And then back on

#

And the presence stopped working.

grizzled raven
#

what

royal portal
#

I have .catch and it didnt show any error

summer torrent
#

put your code to ready event

royal portal
#

bot.on?#

summer torrent
#

yes

royal portal
#

I did that

narrow kettle
#
def count_chars(my_str):
  my_dict = dict()
  for x in my_str:
    if my_str[x] not in my_dict:
      my_dict[my_str[x]] = my_str.count(my_str[x])
  return my_dict
``` File "main.py", line 4, in count_chars    if my_str[x] in my_dict:TypeError: string indices must be integers
royal portal
#

I worked for 2 minuyrs

narrow kettle
#

im not sure why im getting an error?

royal portal
#

And my bot went offline, presence stopped working

#

It only went offline with presence

#

It doesnt go offline when I don't have the presence on

summer torrent
#
bot.on("ready", () => {
bot.user.setActivity("activity text")
})```
royal portal
#

Yeah but does that work

modest maple
#

@narrow kettle Because you dont need to index that string

#

you've done sorta what i told u todo

#

x is going to be a character of a string

narrow kettle
#

oh

#

oh right... i forgot

modest maple
#

rather than a index (0, 1, 2, 3) etc...

narrow kettle
#

thanks :>

slender thistle
#

How dare you forget....... I'm disappointed. You should just go and learn ASM instead.

modest maple
#

shiv

#

bad

narrow kettle
#

great it works :>
@slender thistle Im sorry i disappointed you master

slender thistle
#

I'm trying to have fun with python newbies ok

modest maple
#

Shiv dont make me thread you 👀

royal portal
#

me.exe isnt working

#

when i start my bot with idle and playing activity, the activity shows up for like 1 second and it stops itself

#

idle as in setStatus

#

its one or the other

narrow kettle
#

if i do ```py
for x in my_dict:

will it happen the 4 times if my_dict have 4 keys?
royal portal
#

I can do idle by itself

#

or activity by itself

#

:/

narrow kettle
#

or does it happen by the stuff that my keys contain

modest maple
#

depends

#

by defualt

#

that code would iterate over the keys

#

so x would be each key in the dictionary

narrow kettle
#

ok thats perfect for me

#

since i need to switch the keys with it containments

modest maple
#

but lets say we did my_dict.values() x would then become the values of each key

narrow kettle
#

oh

#

nice to know, Thanks

#

can i access a dict with numbers

#

lets say access it like that my_dict[3] = "hello"

#

and simply change the name of the key?

slender thistle
#

If the key is 3 yes

#

You can't access indexes on dicts afaik

#

Because they're not exactly ordered

narrow kettle
#

ok so if its in a for i simply access it by writing x

#

but how do i change the name of the key?

slender thistle
#

You create a new one and... delete the previous key? ThinkingBTTV

narrow kettle
#

mh

#

oh right... i always forget there is that option of creating new stuff "/

cinder jetty
#

for some reason my music command isn't working, saying something about the fact ive hit my daily quota for queries yet I haven't even done 10k, I am using the youtube data api

#

anyone know how to work around this?

slender thistle
narrow kettle
#

thank you master

#

why wouldnt this work?

def inverse_dict(my_dict):
  my_dict = dict()
  for x in my_dict:
     my_dict[my_dict[x][0]] = my_dict.pop(x)
  return my_dict

  print(inverse_dict({'c': 'd', 'b': 'c', 'a': 'b'}))

its suppose to replace the name of the key with the first containment of the key and switch the first containment of the key to the key(hopefully if you understood what i just said)

#

its just returning []

modest maple
#

because you're overriding the input

narrow kettle
#

(i just remembered i forgot to replace the containment of the key but its still not working)

#

wym?

modest maple
#

my_dict is immediately getting overridden into a dict object

#

you pass the dictionary

#

to the function

#

to the parameter called my_dict

#

then

#

my_dict = dict()

#

which completely overrides it

slender thistle
#

You're shadowing the parameter by creating another object under the same variable name

narrow kettle
#

oh

brittle pasture
#

hi guys can someone see my % command is it correct?

narrow kettle
#

ops... its from my last code... i didnt even notice it

#

sorry for my dead brain

brittle pasture
#

percentage = Math.floor(Math.random() * (103 - 1) + 1);
if (percentage < 45) rarity = "common";
else if (percentage > 44 && percentage < 79) rarity =

#

common 44.4% 0-400

narrow kettle
#

ehm

#

yeah so now its not even returning anything

brittle pasture
#

thats the % i trying to code,please ping me if u can help me thanks

narrow kettle
#

oh nvm

#

File "main.py", line 4, in inverse_dict my_dict[my_dict[x][0]] = my_dict.pop(x)KeyError: 'c'
im only getting that error

modest maple
#

pretty sure if you want the value of that key popped out you need popitem()

#

wait

#

nvm

#

resend your code

narrow kettle
#
def inverse_dict(my_dict):
  for x in my_dict:
     my_dict[my_dict[x][0]] = my_dict.pop(x)
  return my_dict

print(inverse_dict({'c': 'd', 'b': 'c', 'a': 'b'}))
#

the error is in line 3*

modest maple
#

ah

#

right

brittle pasture
#

cf8

#

can u check my command?

modest maple
#

it looks alright? ig

#

i dont do js

brittle pasture
#

tks anyway

narrow kettle
#

wait

#

so how do i fix my error

modest maple
#

i have no idea

#

what are you trying todo again

narrow kettle
#

my brain is so dead i just wrote arrow instead of error

#

its suppose to replace the name of the key with the first containment of the key and switch the first containment of the key to the key(hopefully if you understood what i just said)

modest maple
#

so like swap the Values and keys around

narrow kettle
#

yes

#

but only the first value

#

and the values are all lists

modest maple
#

so if i have
{'a': 'b', 'c': 4} would become {'b': 'a', 4: 'c'}

#

correct?

#

expected result?

narrow kettle
#

ehm

#

yes

#

i can send an example that they sent if you want

modest maple
#

and do you want the key appended onto said list

#

or just have it override the list

narrow kettle
#

it does not matter

#

as long i end with "{'b': 'a', 4: 'c'}"

modest maple
#

okay

#

we might actually not even need a loop for this

narrow kettle
#

also while doing this im suppose to sort the lists in the keys? can i just do my_dict["keyname"].sort()

#

oh thats noice

modest maple
#

we can use <dict object>.keys() and list() it to get a list of keys

#

and then use <dict object>.values() and list() it to get a list of values

#

then just make values the keys and keys the values

narrow kettle
#

but i need to make only the first value in the list into a key

#

so lets say the list is [1,3,4] then 1 will be the key now

#

Oh

#

I did it

modest maple
#

fuck

#

i just did it

#

xD

#

how did u end up doing it

narrow kettle
#

actually

#

i didnt do it

#

its only working for one char

#

but if there is more then one it just YEETS it

#

this is what i did

#

def inverse_dict(my_dict):
  new_dict = dict([(value, key) for key, value in my_dict.items()]) 
  for x in new_dict:
    new_dict[x] = list(new_dict[x])
  return new_dict

#

but its only working if the list inside the keys contains only one char

#

what did you do?

modest maple
#
def the_dictifer(my_dict):
    new_dict = dict()  # lets just make a blank dict object
    for key, value in my_dict.items():  # lets iterate through the keys and values
        new_dict[value[0]] = key  # now we just assign the first index of value as the key and key become the value
    return new_dict  # return new dict



print(the_dictifer({'d': 'c', 'c': 'b', 'b': 'a'}))```
#
>>> {'c': 'd', 'b': 'c', 'a': 'b'}```
narrow kettle
#

its working just like mine xD

modest maple
#

you've just made it a lil more complicated than it needs to be

narrow kettle
#

[ what the code returned ] - [ what is suppose to be ] - [ what command ran ]

#

its the same as mine :< both arent working completly fine

modest maple
#

OOH

#

it wants the values becoming lists

narrow kettle
#

yeeee

modest maple
#

send me the bottom dict

#

and the results

narrow kettle
#

bottom dict?

#

oh

modest maple
#

just send me the bottom row

narrow kettle
#

{'dd': ['c', 'c'], 'cd': ['b', 'b'], '5': ['$'], '4': ['%']} {'dd': ['cc'], 'cd': ['ab', 'bb'], '5': ['!', '$', 'dd'], '4': ['%']} inverse_dict({'cc': 'dd', 'dd': '5', 'ab': 'cd', '!': '5', '%': '4', 'bb': 'cd', '$': '5'})

modest maple
#

i take it the first bit is the expected result?

narrow kettle
#

no

#

the first is what we got

#

oh wait

#

its my code lemme show you what your code got

#

[ what the code returned ] - [ what is suppose to be ] - [ what command ran ] its like this btw

#

{'4': '%', 'd': 'cc', 'c': 'bb', '5': 'dd'} this is what your code returned

#

What Your Code Returned - {'4': '%', 'd': 'cc', 'c': 'bb', '5': 'dd'}, What Your Code Is Suppose To Return - {'dd': ['cc'], 'cd': ['ab', 'bb'], '5': ['!', '$', 'dd'], '4': ['%']}, The Command Ran - inverse_dict({'cc': 'dd', 'dd': '5', 'ab': 'cd', '!': '5', '%': '4', 'bb': 'cd', '$': '5'}).

#

here this is better

modest maple
#

the only issue with that expected result

#

is that it depends on how you do it in order

#

because cd is gonna override the hashmap

narrow kettle
#

mhm

#

this thing is looking so damn complicated to me

modest maple
#

that might take me some time to get my head around xD

narrow kettle
#

its realy fine... you are helping me and i realy appreciate it!

astral yoke
#

I'm getting an error shortly after starting up my bot. I can read this but don't know how to repair it. Can someone help?

    at Client.<anonymous> (C:\Users\Cools\dog1bot\src\index.js:16:13)
    at Client.emit (events.js:219:5)
    at Guild._addMember (C:\Users\Cools\dog1bot\node_modules\discord.js\src\structures\Guild.js:1542:19)
    at GuildMemberAddHandler.handle (C:\Users\Cools\dog1bot\node_modules\discord.js\src\client\websocket\packets\handlers\GuildMemberAdd.js:12:13)
    at WebSocketPacketManager.handle (C:\Users\Cools\dog1bot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:108:65)
    at WebSocketConnection.onPacket (C:\Users\Cools\dog1bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:336:35)
    at WebSocketConnection.onMessage (C:\Users\Cools\dog1bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:299:17)
    at WebSocket.onMessage (C:\Users\Cools\dog1bot\node_modules\ws\lib\event-target.js:120:16)
    at WebSocket.emit (events.js:219:5)
    at Receiver.receiverOnMessage (C:\Users\Cools\dog1bot\node_modules\ws\lib\websocket.js:789:20)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fyre@1.0.0 start: `node src/index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fyre@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Cools\AppData\Roaming\npm-cache\_logs\2020-03-22T20_53_39_085Z-debug.log

C:\Users\Cools\dog1bot>```
summer torrent
#

show index.js 16th line

modest maple
#

okay, so looking at it:

They want use to go through the dict
if there are multiple keys with the same values
we added them to one list with one inverted key (so we dont override it)

narrow kettle
#

yep

astral yoke
#

This is 14-17.

#
    const channel = member.guild.channels.find(channel => channel.name === "welcome-and-goodbye");
    channel.send(`Welcome to the server! ${member}! Read the rules and have a good time!`)
});```
#

I have the same thing but instead it goodbyes users.

#
    const channel = member.guild.channels.find(channel => channel.name === "welcome-and-goodbye");
    channel.send(`Someone just left, it was ${member}.`)
});
summer torrent
#

make sure that there is channel named "welcome-and-goodbye" in your server

astral yoke
#

There is. But since it's a bot that is usable for all users, I believe that's why.

#

It trys to detect a channel in someone elses guild but dosen't and throws an error.

#

I'm just going to remove the whole idea.

next mica
#

how do i make my bot detect the lower or uppercase version of a command

#

like and

#

it also detects as And

hollow granite
#

I think you could just do ```js
if(channel) channel.send(Welcome to the server! ${member}! Read the rules and have a good time!)

#

so it only sends it if there is a channel found

astral yoke
#

Oh that's a good idea.

summer torrent
#

or js if (!channel) return;

hollow granite
#

^

astral yoke
#

Yeah.

#

Thank you two for helping me.

hollow granite
#

np

royal portal
#
    const channel = member.guild.channels.find(channel => channel.name === "welcome-and-goodbye");
    if(!channel) return;

    channel.send(`Welcome to the server! ${member}! Read the rules and have a good time!`)
}); ```
hollow granite
#

for the 2 commands capitalizations I think you could just do

if(command == "help") {
  //  "help" stuff
}
if(command == "Help") {
  //  "Help" stuff
}
#

just make sure command is not set to always be lower cased

astral yoke
#

Can someone check out #topgg-api for what I'm asking?

royal portal
#

it says dont ask to ask

snow urchin
finite bough
#

@hollow granite why are u using them seperately

#

u can do if(command.toLowerCase === "help") {...

astral yoke
#

How would I put a certain command to a specific guild? I'm attempting to make the whole api vote thing, and I want it so that it goes into my server guild, finds the "vote" channel, then sends something like ${vote.user} has just voted! Woohoo! 🎉

narrow kettle
#

@modest maple you good?

finite bough
#

@astral yoke get the server by its id

narrow kettle
#

i hope you didnt get your head around too much

modest maple
#

ngl, i forgot when helping you i forgot i was supposed to be restarting the bots

#

xD

finite bough
#

cf8 is busy making wine holders

#

xD

narrow kettle
#

lol

astral yoke
#

@finite bough Already have it.

narrow kettle
#

you got time to help me now tho? i just found out i got only 30 mins till i gotta go :<

modest maple
#

i kinda could rlly do with sorting my current stuff out

#

ill still be thinking about it if you check in tomorrow?

narrow kettle
#

ah nah its fine then if u got stuff to do

#

cuz i have only half hour to do it so tom wont realy help(even tho it wll help cuz then i will know how to do it) i will just try to do it myself :> You did help me ALOT today tho

#

thanks!

pallid vector
#

does anyone understand why this happens?

#

CPU usage suddenly spikes from time to time

#

just started happening recently and it causes bot to stop

#

which I need to restart

heavy marsh
#

Discord.js version 12.0.2

let verifLevels = ["None", "Low", "Medium", "(╯°□°)╯︵  ┻━┻", "┻━┻ミヽ(ಠ益ಠ)ノ彡┻━┻"];
let FilterLevel = ["None", "With Out Roles", "All Members"];

      embed.addField("Content Filter ", `\`${FilterLevel[message.guild.explicitContentFilter]}\``, true);
      embed.addField("Verification Level", `\`${verifLevels[message.guild.verificationLevel]}\``, true);

I get it as undefined

amber fractal
#

Because it returns a string

heavy marsh
#

ok ...

#

How could I fix it ...

amber fractal
#

well you dont index an array with string for one

#

you could convert it to a number by using a object to map the string to a number

dusky marsh
#

i couldnt think of how to phrase that for some reason

heavy marsh
#

So ...

#

Use a map?

amber fractal
#

what?

#

You can map the return value to the value you want

finite bough
#

@pallid vector u must be using something which takes a lot of cpu

amber fractal
#

like js let vericicationLevels = { NONE: "None", LOW: "Low", MEDIUM: "Medium", HIGH: "(╯°□°)╯︵ ┻━┻", VERY_HIGH: "┻━┻ミヽ(ಠ益ಠ)ノ彡┻━┻" }
and same with explicit content filter

finite bough
#

it can be api requests, editing files, loading up a database

heavy marsh
#

OOh I se

pallid vector
#

hm so what I think was the problem

#

hm actually.. idk how to explain, but basically I have a cached ver of prefixes that I load

#

but if bot down, it cant create a cached ver of prefixes on guild join

#

and some servers were added in while bot was down

finite bough
#

u use customizable prefix?

pallid vector
#

yeah

royal portal
#

now i give up with my bot's setActivity

#

it stops working after 20 mins

finite bough
#

db?

pallid vector
#

yeh but I create a cached ver of prefix

finite bough
#

@royal portal any errors?

royal portal
#

no

#

even with .catch

#

i have latest version of discord.js and node.js

#

running on raspberry pi 3

finite bough
#

what db do u use

royal portal
#

db?

finite bough
#

@royal portal does ur bot still work?

royal portal
#

yes

#

its just the setActivity

finite bough
#

can u show the code

royal portal
#

not sure why it stops working randomly after 20 mins

#

ok

#

dms

#

@finite bough sent to you

heavy marsh
finite bough
#

@heavy marsh d.js version

heavy marsh
#

Yep

#

oofs

#

12.0.2

finite bough
#

u can slice the 1st letter

#

or subtract it

#

tim knows better

quartz kindle
#

Lol

royal portal
#

anyone know how to fix setActivity

quartz kindle
#

@heavy marsh all you want is to make the first letter uppercase?

heavy marsh
#

But incase if its US Central

finite bough
#

else if (guild.region.toLowerCase === us central )

heavy marsh
#

Ahh ok .. but where can I find the full list of server regions?

regal saddle
#

Discord Server Options?

finite bough
#

make a server

#

click change region

#

u can check manually from there

heavy marsh
#

Is there no special regions for verified & partnered servers?

finite bough
#

const cregion = guild.region.charAt(0).toUpperCase() + guild.region.slice(1);

quartz kindle
#

you can also do region[0].toUpperCase()

heavy marsh
#

OOh ok thanks

finite bough
#

now come to think of it

#

why tf do discord save names of the regions in small letter

quartz kindle
#

data is usually stored as simply as possible

#

usually to avoid case issues when moving stuff around databases

finite bough
#

true

earnest phoenix
#

can someone tell me what's wrong here
serverQueue.songs.map((song, index) => index + 1 + ". " + song.title).join("\n"); it says [object Object]

#

when i use an embedder

quartz kindle
#

looks correct

earnest phoenix
#

ik but its say that

quartz kindle
#

show where you put it in the embed

earnest phoenix
#

module.exports = {
    name: "queue",
    description: "Show the music queue",
    
    execute(message) {
      const serverQueue = message.client.queue.get(message.guild.id);
      if (!serverQueue) return message.reply("There is nothing playing.").catch(console.error);
      const queues = serverQueue.songs.map((song, index) => index + 1 + ". " + song.title).join("\n");

      let embed = new discord.MessageEmbed()
      .setColor('RANDOM')
      .addField(queues)

      return message.reply(embed)
        .catch(console.error);
    }
  };```
quartz kindle
#

addField is incorrect

#
.addField({
  name: "field name",
  value: "field value"
})```
crimson vapor
#

What is the best way to check if a time has passed? For example a mute command. Just intervals and checks or is there a more efficient way

quartz kindle
#

does it need to be remembered between bot restarts?

finite bough
#

well

#

mutes have to be remembered

earnest phoenix
#

hey i have installed the jdk 1.8 and gradle 6.2.2 why doesn't appears java-application? Anynone can help me?

#

im following a guy tutorial..

#

btw

quartz kindle
#

i dont use java sorry

#

@crimson vapor a timeout would be more effective, however if you're regularly tracking multiple timeouts (like hundreds of them), an interval would be better

crimson vapor
#

Yeah

twilit rapids
#

setInterval and compare timestamps

#

ez

crimson vapor
#

It would probably be an hourly check

quartz kindle
#

you can do best of both worlds

crimson vapor
#

Regardless of bot restarts though

quartz kindle
#

an interval that fires timeouts

#

for regardless of bot restarts you need a database

crimson vapor
#

yeah

#

The data is stored as a data string

twilit rapids
#

If you check if a timestamp has passed then restarts aren't an issue, if you save the data correctly that is

crimson vapor
#

I think I’ll check if the date now is greater than the data that it is supposed to expire and of it is, delete the data

earnest phoenix
#

how do i develop a fly swatter command

crimson vapor
#

What does a fly swatter command do?

earnest phoenix
#

swat flies

regal saddle
#

First of all, you need a Pc

earnest phoenix
#

some

#

done*

heavy marsh
#

Or is this the splach banner

earnest phoenix
#

no it doesnt = that

heavy marsh
#

the banner on the invite?

earnest phoenix
#

idk

heavy marsh
earnest phoenix
#

@quartz kindle thank you CatWow

#

For discord.js v12, does ShardingManager.broadcastEval() only returns if something was found?

#

like if i try to get a user

summer torrent
#

@heavy marsh banner cannot be a gif

heavy marsh
#

But why does have that option then lol

quartz kindle
#

@earnest phoenix broadcastEval is like eval()

#

it returns whatever the code you sent evaluates to in an array, where each item of the array is the response from one shard

#

ie: if you have two shards, and you do broadcastEval("5+5") it should return [10,10]

summer torrent
#

But why does have that option then lol
@heavy marsh yes but it will be not animated

heavy marsh
#

ok

amber fractal
#

unsupported media

summer torrent
#

yes

earnest phoenix
#

When I do ```js
<ShardingManager>.broadcastEval(client.users.cache.get("myidhereimtoolazytoputitin"))

It says that client is not defined. Any idea why is that a thing?
amber fractal
#

Because it runs off the client

#

in the context of the Clients.

earnest phoenix
#

am using d.js v12

amber fractal
#

That is v12

earnest phoenix
#

so i have to remove the client?

amber fractal
#

yes

#

should just be users.cache...

earnest phoenix
#

ok now it says users is not defined

amber fractal
#

Can you show me the error?

copper cradle
#

did u try to do users.cache?

earnest phoenix
#
(node:21684) UnhandledPromiseRejectionWarning: ReferenceError: users is not defined
    at eval (eval at _eval (/root/node_modules/discord.js/src/client/Client.js:376:12), <anonymous>:1:1)
    at Client._eval (/root/node_modules/discord.js/src/client/Client.js:376:12)
    at ShardClientUtil._handleMessage (/root/node_modules/discord.js/src/sharding/ShardClientUtil.js:184:82)
    at process.emit (events.js:321:20)
    at emit (internal/child_process.js:881:12)
    at processTicksAndRejections (internal/process/task_queues.js:85:21)
(node:21684) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
copper cradle
#

what code did u run

earnest phoenix
#
let user = await manager.broadcastEval(`users.cache.get(${vote.user})`);
#

^

copper cradle
#

don't you need a client instance for that?

earnest phoenix
#

manager is a ShardingManager

copper cradle
#

that's not what I meant

amber fractal
#

broadcastEval runs in the context of client

copper cradle
#

ah

amber fractal
#

shouldn't need client.

copper cradle
#

well

earnest phoenix
#

i didnt put it in

amber fractal
#

I know

#

was telling snails

earnest phoenix
#

ok

copper cradle
amber fractal
#

ah what if you try

#

this.users...

copper cradle
#

yes

amber fractal
#

so instead of client use this

copper cradle
#

try that

earnest phoenix
#

alr

#

gimme a few seconds to restart my bot

#

wait

copper cradle
#

I'm awaiting

regal saddle
#

kk

earnest phoenix
#

does the test webhook button on the website post to the webhook that tonkku voted?

amber fractal
#

no it uses your id

copper cradle
#

yes

#

did u just get a vote from tonkku?

earnest phoenix
#

no

copper cradle
#

then congrats

#

then why r u asking

earnest phoenix
#

because i remember that when i was experimenting with webhooks

#

i remember that it always say tonkku voted

copper cradle
#

well

#

either dbl fucked up or tonkku really likes your botum

earnest phoenix
#

also will broadcastEval return anything if nothing was found on that shard?

copper cradle
#

I'm guessing it'll return null

earnest phoenix
#

btw how do I do typeof with custom classes

#

like if(typeof user === Discord.User)?

copper cradle
#

instanceof exists for a reason

earnest phoenix
#

wait it exists?

copper cradle
#

yes

#

#TiL

earnest phoenix
#

thanks

amber fractal
copper cradle
#

gtg

earnest phoenix
#

bye

#
dbl.webhook.on("vote", async vote => {
  console.log("THE WEBHOOK RECEIVED SOMETHING!!!")
  let db = mongo.db("main");
  if(vote.type == "test") vote.user = "312559122144821248";
  let user = await manager.broadcastEval(`this.users.cache.get(${vote.user})`);
  let stats = await db.collection("users").findOne({_id: vote.user});
  let player;
  if(user[0] instanceof Discord.User) player = user[0];
  if(user[1] instanceof Discord.User) player = user[1];
  if(player && stats){
    let embed = new Discord.MessageEmbed()
    .setTitle(`Thanks for voting Beycord, ${player.username}!`)
    .setDescription("Beycord would not be here without people like you who vote for Beycord every day.\n\nYou received :valtz:250 and 800 EXPs as a voting reward!")
    .setAuthor(player.tag, player.displayAvatarURL())
    .setColor("#7f7fff")
    .setFooter("Make sure to turn on the voting reminder by doing ;reminder.")
    .setTimestamp();
    db.collection("users").updateOne({_id: user.vote}, {$set: {coins: stats.coins + 250, xp: player.xp + 800}});
    player.send(embed);
    if(stats.premium == true){
      db.collection("users").updateOne({_id: user.vote}, {$set: {coins: stats.coins + 250, xp: player.xp + 800}});
      player.send("You received a doubled reward because you have a Premium membership. Yay!:tada:");
    }
    if(stats.reminder == true){
      setTimeout(() => {
        let remind = new Discord.MessageEmbed()
        .setTitle("24 hours had passed since your last vote which means... YOU CAN VOTE AGAIN NOW!")
        .setURL("https://top.gg/bot/570115430786531340/vote")
        .setColor("#7f7fff");
        player.send(remind);
      }, 86400000)
    }
  }
});
``` Can anyone tell me why doesn't it work? The console didn't output any errors about it so I have no idea where's wrong
#

manager is a ShardingManager, db is a MongoDB Client thing and I am using d.js v12

summer torrent
#

try {} catch {}

crimson vapor
#
  if(user[0] instanceof Discord.User) player = user[0];
  if(user[1] instanceof Discord.User) player = user[1];``` is this code for your 2 shards?
earnest phoenix
#

yes @crimson vapor

crimson vapor
#

you might want to change that because if you ever have more shards, it would need to be updated

amber fractal
#

could loop and a half over all results and the first one that is an instaceof Discord.User break

earnest phoenix
#

im planning to add to that code if there's new shards

#

or just use a loop

crimson vapor
#

well a loop would be best probably

amber fractal
#

so if shards are down it doesnt matter

crimson vapor
#

oh yeah I didnt think about that

amber fractal
#

you want to generalize your code as much as possible for things like that

crimson vapor
#

if a shard is down, it would error

#

probably user[1] is undefined or something

amber fractal
#

It'd be an array index out of bounds most likely

crimson vapor
#

oh yeah

earnest phoenix
#

so did you guys spotted any errors that caused it to not DM the voter?

crimson vapor
#

I did not

#

I guess make sure dm's are on

earnest phoenix
#

it is on

#

and it won't even give the rewards

crimson vapor
#

I guess start console logging every other line and figure out how many lines down it stops

#

thats what I do

#

not very efficient but it works

quartz kindle
#

im not sure that way will ever work

earnest phoenix
#

ok i will try that

quartz kindle
#

what are you trying to do?

earnest phoenix
#

ok million's idea worked

#

the problem that caused it to not work is

#

if(player && stats)

#

but i dont get why it cant define them

quartz kindle
#

i dont think you can send entire class instances over broadcastEval

#

messages are serialized/stringified when sent across processes

crude magnet
#

would someone mind checking out a site i'm working on and telling me what they think? i'm trying to work on making things slightly aesthetically pleasing since my past work has been gross

earnest phoenix
#

so what should i do?

quartz kindle
#

also, you cant sent messages to people from your sharding manager, because there is no client instance there, so no access to any rest methods nor token

earnest phoenix
#

how do i fix it now then?

#

im stuck

#

also doesn't broadcastEval returns an array?

quartz kindle
#

you need to run that function in your shards, not in the manager

amber fractal
#

yes

quartz kindle
#

put that code inside a function in your shards, then call it from the shard manager via broadcastEval

#

like this

earnest phoenix
zenith terrace
#

@quartz kindle status still broken ;-;

#

xD

quartz kindle
#
dbl.webhook.on("vote", user => {
  manager.broadcastEval(`if(client.users.cache.has(${user}) { executeVote(${user}) }`)
})```
#

@earnest phoenix

earnest phoenix
#

thanks

quartz kindle
#

you receive vote events in your manager, and then make the relevant shard run the rest of the function

zenith terrace
#

Ive had my bot on dnd for a while but setStatus wont change it

#

Reeee

earnest phoenix
#

so i just have to make a function in the client's file to handle votes?

quartz kindle
#

yes

#

there you can access the client, send messages, etc

earnest phoenix
#

thanks, i will try it now and tell you if it works

quartz kindle
#

@zenith terrace blame discord

zenith terrace
#

Yes

#

or the coding 🤔

#

I blame Duane_

#

Def his fault

copper cradle
#

@crude magnet I want to see it

quartz kindle
#

Duane the rock johnson

zenith terrace
#

Duane the paper johnson

marble juniper
#

Duane the scissors johnson

earnest phoenix
#

-ajuda

#

U

crude magnet
#

it's just a retirement calculator widget

earnest phoenix
#

Rip google is banning my yt api key

#

6 banned

#

is there anything I can do

crude magnet
#

anyone have any luck on fiverr?

#

i've been on the site for like a year and had no success whatsoever

zenith terrace
#

Make a new key

earnest phoenix
#

ok

amber fractal
#

Well what you're doing with the api key is against their ToS

#

so, without spamming new ones, no

copper cradle
#

@crude magnet yo it looks promising

earnest phoenix
#

I need help keeping my bot on 24/7

#

I made a bot with Discord Bot Maker

real summit
earnest phoenix
#

@real summit I made it on discord bot maker though :/

#

Not in visual studio

real summit
#

hmmm

#

then idk

#

sorry 😦

earnest phoenix
#

@real summit I love that pfp

copper cradle
#

@earnest phoenix it doesn't matter

#

visual studio is just a text editor

#

the program you use (if you're a real programmer) doesn't matter

#

at the end of the day everything is just a text file

#

and in that video they're using atom

#

ffs

earnest phoenix
#

lmao

#

jeez

#

calm down boio

real summit
#

i don't think discord bot maker is a text editor

earnest phoenix
#

Its not

#

its like code blocks or smth like that

real summit
#

@real summit I love that pfp
@earnest phoenix thanks btw

earnest phoenix
#

Im rewatching dragon slayer lol

real summit
#

i still need to finish it

soft flare
#

Who can tell me how can i make a status to count how many servers are my bot like Servers: NaN / n!help

copper cradle
#

dude

#

what lib

crimson vapor
#

shards or no?

earnest phoenix
#

getting server count is harder if your bot is sharded

#

but still possible

amber fractal
#

Just need to reduce an array

#

which I guess if you dont know how to use reduce could be "hard"

calm shore
#

how do i make an ON and OFF command for this script. https://pastebin.com/srf9qurD.

I want it so that admins can turn off or on the LEVEL UP( Line 19 ) message if they feel its annoying for their guild.

earnest phoenix
#

@calm shore use a database

calm shore
#

How

#

Dm me

earnest phoenix
#

You just need true and false

calm shore
#

Yea thats what im having trouble on

#

Can I screenshare and you guide me?

earnest phoenix
#

No

calm shore
#

Oh.

earnest phoenix
#

I don't give lessons for free

calm shore
#

tf

earnest phoenix
#

🤦‍♂️

stuck wedge
#

guys i need help

calm shore
#

then dont give a pointlessa ass answer in this channel

earnest phoenix
#

@stuck wedge problems and code

#

@calm shore don't ask for spoonfeed lol

stuck wedge
#

the discord installation it self

earnest phoenix
#

?

calm shore
#

Listen. Even ik i need to use a database

earnest phoenix
#

Read channel topic you both

calm shore
#

im not dumb

#

Everyone should know that

stuck wedge
#

i tries for like 9 time to install it .... first a transparent box

#

and then

#

nothing

earnest phoenix
#

@calm shore if you're not dumb you never came here and asking for help

#

@stuck wedge you makes no sense

calm shore
#

your basically calling all the people coming here dumb by saying that

earnest phoenix
calm shore
#

go put ur toxic self somewhere else

earnest phoenix
#

Wow your attitude

calm shore
#

@stuck wedge Please send me your error and code using pastebin.com

stuck wedge
calm shore
#

For one

#

dont use discord on a website when ur trying to code a bot

#

download it

#

and please send me ur error on ur console

stuck wedge
#

i can`t that white box is the discord updator

calm shore
#

Oh okay

#

this is a bot development channel

earnest phoenix
#

Just wait then

calm shore
#

but ill help

#

goto task manager

stuck wedge
#

thanks

calm shore
#

did you open task manager?

stuck wedge
#

yup

calm shore
#

click "More Details"

stuck wedge
#

you mean process ?

#

processes

earnest phoenix
#

Yes

stuck wedge
#

opened

earnest phoenix
#

Just end task discord

stuck wedge
#

all of them there are 4

#

?

calm shore
#

how do i make an ON and OFF command for this script. https://pastebin.com/srf9qurD.

I want it so that admins can turn off or on the LEVEL UP( Line 19 ) message if they feel its annoying for their guild.

stuck wedge
#

totally done

crimson vapor
#

I stored it as a boolean on the guild data

#

if true send else dont

earnest phoenix
#

Same

crimson vapor
earnest phoenix
#

That's what i told him

calm shore
#

No u really didnt

#

U said i needed a database

#

and i said ik

stuck wedge
#

is that all i have to do ?!

calm shore
#

and then u said i dont give lessons for free

#

yes @stuck wedge

#

anyways @crimson vapor whats that

stuck wedge
#

should i start it again

crimson vapor
#

db's arent hard to learn the basics

#

mongo would be easy

earnest phoenix
#

@calm shore you directly asking me to code it but i don't

calm shore
#

No i didnt

earnest phoenix
#

You need to learn it

calm shore
#

I never said. "Oh rlly. can you write me a whole code."

earnest phoenix
#

@crimson vapor he is using json

calm shore
#

no, now please dont argue in here

stuck wedge
crimson vapor
#

json isnt too bad for guild data if you only have a few guilds

stuck wedge
#

btw...... thanks for the helpdblWink

calm shore
#

yw

earnest phoenix
#

@stuck wedge you need to end em all

calm shore
#

he did\

earnest phoenix
#

Ok

stuck wedge
#

yup

earnest phoenix
#

Start it again

calm shore
#

@crimson vapor so would this be correct
xpNotifications = message.channel.send(`Congratulations ${authorId}! You leveled up to level ${curlvl + 1}`); ?????

earnest phoenix
#

@calm shore no

idle mountain
#

you need to have an if check for whether or not that server's xp notifications are on

earnest phoenix
#

if(xp = true) {your message} else return;

#

Where xp is a stored object in your database

idle mountain
#
if (xpNotifications) //if true, this block will proc
{
  //xp stuff here
}```
calm shore
#

but thats saying if the xp is active. I want it so if i type a command, it will turn off the whole levelup message

earnest phoenix
#

No

stuck wedge
#

yay

earnest phoenix
#

You need to set guild id with it

stuck wedge
earnest phoenix
#

If(guild.id = xp.guild&& xp.msg = true) @calm shore where xp.guild and xp.msg have guild id and boolean respectively

#

@stuck wedge uh oh

#

Restart it again

#

Or reinstall or download latest version from website

stuck wedge
#

i reinstalled before like 9 times ..... sign

earnest phoenix
#

Or you can use specific statement and string

idle mountain
#

wait

#

is this javascript?

calm shore
#

yes

earnest phoenix
#

Yes

idle mountain
#

i thought so

earnest phoenix
#

Try it @calm shore

idle mountain
#

that if (xpNotifications) might need to be if (xpNotifications == "on")

#

I thought you were gonna use a boolean

earnest phoenix
#

He didn't?

idle mountain
#

although I'm not sure "on" and "off" count as type boolean in javascript

earnest phoenix
#

Oh he really didn't

#

@idle mountain they are strings

calm shore
#

if (xpNotifications == "on") //if true, this block will proc
^

ReferenceError: xpNotifications is not defined

earnest phoenix
#

You need to get it from json file

calm shore
#

what should i define it as

#

xpNotifications = message.channel.send(Congratulations ${authorId}! You leveled up to level ${curlvl + 1});

#

?

idle mountain
#

I'm assuming you could define it by default as "on" if you want them to be on by default, or "off" if you want them off by default

#

but you'll want to define that out-of-scope, so that it's not reset on every command trigger

calm shore
#
    if(message.content.startsWith("-leveling on")) {
    xpNotifications: "on",
  } else if(message.content.startsWith("-leveling off")) {
    xpNotifications: "off",
}```
earnest phoenix
#

    xp[message.author.id] = {

      xp: 0,

      level: 1

    };

  }
#

You never defined xpNotifications

calm shore
#

Ik

earnest phoenix
#

🤦‍♂️

calm shore
#

what would i define it as

crimson vapor
#

True or false

earnest phoenix
#

You know how to use json database?

calm shore
#

nope

#

so instead of

    if(message.content.startsWith("-leveling on")) {
    xpNotifications: "on",
  } else if(message.content.startsWith("-leveling off")) {
    xpNotifications: "off",
}```
#
    if(message.content.startsWith("-leveling on")) {
   let xpNotifications = true,
  } else if(message.content.startsWith("-leveling off")) {
   let xpNotifications = false,
}```
earnest phoenix
#

You need to use fs.writeFile

calm shore
#

Yea i have no clue how to use that

earnest phoenix
#

You never did any changes with that database

#

You really need to learn it

stuck wedge
#

it did start ....i guess

calm shore
#

I just looked piece by piece on google trying to connect it like a puzzle

stuck wedge
earnest phoenix
#

That's not how programming works

crimson vapor
#

You won’t be able to figure out the puzzle if there are no colors

earnest phoenix
#

Lol

calm shore
#

thats smart

#

lol

earnest phoenix
#

Yeah so learn js

calm shore
#
    if(err) console.log(err)```
#

Thats my xp file

earnest phoenix
#

Otherwise you'll keep causing bugs

stuck wedge
#

got any idea ??

calm shore
#

so whenever someone talks it goes to that follow

#

file*

earnest phoenix
#

You need to use it after xpNotifications

calm shore
#

i did

earnest phoenix
#

Really?

calm shore
#

its all the way at the end

#

yea scroll up and goto the script i sent

#

the pastebin

earnest phoenix
#

What you're changing is xp

stuck wedge
earnest phoenix
#

You never did anything with xpNotifications

calm shore
#

      //off
      if (xpNotifications == "off") //if true, this block will proc
      {
    let xpAdd = Math.floor(Math.random() * 7) + 8;
    console.log(xpAdd);

    if(!xp[message.author.id]) {
      xp[message.author.id] = {
        xp: 0,
        level: 1
      };
    }
    let authorId = message.author;
    let curxp = xp[message.author.id].xp;
    let curlvl = xp[message.author.id].level;
    let nxtLvl = xp[message.author.id].level * 400;
    xp[message.author.id].xp =  curxp+ xpAdd;
    if(nxtLvl <= xp[message.author.id].xp){
      xp[message.author.id].level = curlvl + 1;
    }
        }```
#

?

#

I made it so if it == "off" then it will still level people up but not send the messager

#

for example

earnest phoenix
#

No u didn't

calm shore
#

line 27

#

and line 50

earnest phoenix
#

Tell me where you saved the xpNotifications

calm shore
#

line 27 has the message sent if the leveling is on

#

and line 50 where its off completely ignores it

earnest phoenix
#

You need to store

#

This as an object

calm shore
#

uhhh

earnest phoenix
#

    xp[message.author.id] = {

      xp: 0,

      level: 1

    };

  }

#

Learn from this

#

And check how you defined xp

pallid vector
#

there's 2 things here - whenever I close it, it always gives me an error saying that unclosed client session, how do I fix that

#

also, does the attempting to bind address mean

#

that port is taken?

#

and I should use something else

proper inlet
#

Hello, I try to get role by id using eval, but I get only error

UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
content: Must be 2000 or fewer in length.

//eval message.guild.roles.get(roleid);
(Discord.js v11.6.1)

marble juniper
#

thats because the bot after you tried to use eval sent a message which was too long
@proper inlet

#

because once you got the role it sent the entire role object

proper inlet
#

Thx

ivory cedar
#

Devs that have web interface for your bot: What tools did you use and what are you running it on? I've never done an 'actual' website so it's gonna be a long journey for me. I just have no idea where to start from except learning more html and css.

slender thistle
#

Some use frontend frameworks, I go with WYSIWYG

earnest phoenix
#

yuck

#

SPA websites for web interfaces >>>>

ivory cedar
#

Sounds interesting, what framework would you suggest?

earnest phoenix
#

ive personally worked with react a lot but there's angular which is a really good competitor

#

you'll have to do a bit of research to see which one really suits you, that is if you want to go for a SPA on frontend

cinder patio
#

IMO React is definitely easier to learn than angular

#

I usually go with node.js and express + nginx on the server side, React for UI

quartz kindle
#

Ive never used any frontend framework lul, maybe thats why i hate frontend deving

#

But i always felt that websites that use react and stuff are slow and bloated af

storm bluff
restive furnace
#

i just use pure html & css

#

(express + node.js for hanling requests and etc.)

storm bluff
#

what's problem??

heavy marsh
#

Discord.js - v12.0.2

bot.guilds.get('611881570202025986').members.cache.filter(m => m.presence.status === 'online').size

ERROR:

bot.guilds.get is not a function
storm bluff
#

@heavy marsh ?

#

wtf

heavy marsh
#

what

cinder patio
#

@heavy marsh It's bot.guilds.cache.get(...)

storm bluff
#

for me?

heavy marsh
#

I did that tooo

#
bot.guilds.cache.get(...).members.filter is not a function
cinder patio
#

members.cache.filter

heavy marsh
#
bot.guilds.cache.get('611881570202025986').members.cache.filter(m => m.presence.status === 'online').size```
#

I did that ...

cinder patio
#

The code is correct, maybe you have provided the wrong ID to get

heavy marsh
#

hold on

#

OOh ok

#

Got it 🙂

#

Thanks

soft flare
glad charm
#

@pallid vector

soft flare
#

?

glad charm
#

Sorry, was trying to get anothers attention.

pallid vector
#

@glad charm

glad charm
#

Are you using JS/py? or

soft flare
#

Js

glad charm
#

Show the line

#

I assume you're on D.js v12?

soft flare
#

12.0.2

glad charm
#

Right, this.guilds.size

heavy marsh
#
const roles = member.roles.cache.sort((a, b) => b.position - a.position).array();

const userRoles = roles.cache.filter(r => r.id !== message.guild.id);

error:

TypeError: Cannot read property 'filter' of undefined
#

discord.js version 12.0.2

glad charm
#

I've never sorted roles before, but you can guess that roles doesn't get a result.

heavy marsh
#
const member = message.mentions.members.first() || message.guild.members.cache.get(args[0]) || message.member;
#

member is defined

glad charm
#

Let's say the member has no roles.

zenith terrace
#

@soft flare bot.guilds.cache.size

#

Should be

heavy marsh
glad charm
#

Shouldn't have to do cache for client guilds.

heavy marsh
#
embed.addField("Roles", `${userRoles.slice(0, 8).join(' ')}${userRoles.length > 8 ? ` **+${userRoles.length - 8} role(s)**` : ''}` || "No Roles");
glad charm
#

@heavy marsh you're assuming the member has roles, what if the member doesn't?

heavy marsh
#

I did do that

#

Tim 👀

#

Hey Tim

quartz kindle
#
const roles = member.roles.cache.sort((a, b) => b.position - a.position).array();
// roles is alreadu taken out of the cache here, doing roles.cache here is like going member.roles.cache.cache
const userRoles = roles.filter(r => r.id !== message.guild.id);```
heavy marsh
#

ooh

zenith terrace
#

Tim got ur back

glad charm
#

Ah good point.

heavy marsh
#

🙂

soft flare
#

@zenith terrace let me see

heavy marsh
#

tim*

soft flare
#

who can just give me a exemple

glad charm
#

undefined nickname lol

soft flare
#

i know

#

client.on("guildCreate", guild => {
// This event triggers when the bot joins a guild.
console.log(New guild joined: ${guild.name} (id: ${guild.id}). This guild has ${guild.memberCount} members!);
client.user.setActivity(Serving ${this.guilds.size} servers);
});

#

@final creek

#

is it muted?

#

n!help

#

yep

#

lol

#

or maybe

zenith terrace
#

Common prefix

soft flare
#

ok this is the code for that

zenith terrace
#

so its muted

soft flare
#

**client.on("ready", () => {
// This event will run if the bot starts, and logs in, successfully.
console.log(Bot has started, with ${client.users.size} users, in ${client.channels.size} channels of ${this.guilds.size} guilds.);
// Example of changing the bot's playing game to something useful. client.user is what the
// docs refer to as the "ClientUser".
client.user.setActivity(Serving ${this.guilds.size} servers);
});
**

glad charm
#

Dear lord.

twilit rapids
#

I would recommend to use code blocks

zenith terrace
#
`${client.guilds.size}````
quartz kindle
#

afaik setActivity takes an object, not a string, whats your discord.js version?

twilit rapids
pallid vector
#

what's the port # range that it has to be in between again?

quartz kindle
#

port range for what?

pallid vector
#

uh

#

for the webhook thing

quartz kindle
#

there is no port range for that, you chose whatever port is available in your host

slender thistle
pallid vector
#

what was the range of numbers it had to be in?

zenith terrace
#
client.on("ready", () => {
  // This event will run if the bot starts, and logs in, successfully.
  console.log(Bot has started, with ${client.users.cache.size} users, in ${client.channels.cache.size} channels of ${client.guilds.cache.size} guilds.); 
  // Example of changing the bot's playing game to something useful. client.user is what the
  // docs refer to as the "ClientUser".
  client.user.setActivity(Serving ${client.guilds.cache.size} servers);
});```

@soft flare Gotta have .cache in v12
pallid vector
#

o I remember seeing something about that

twilit rapids
#

Quoting from there:

webhook_port must be between 1024 and 49151.

pallid vector
#

yep got it

#

thanks!

soft flare
quartz kindle
#

whats your discord.js version?

soft flare
#

12.0.2

#

Parsing Error Unexpected token has

#

alot of error have your code

quartz kindle
#

that error is not coming from that code. but that code has other issues

#

in v12 you have to put .cache before all collections

#

users.cache.size, channels.cache.size, guilds.cache.size

twilit rapids
soft flare
#

i know

#

or maybe should i downgrade..

earnest phoenix
#

hello

twilit rapids
#

It's worth upgrading, newer version mostly cover more of the API, older issues should also be fixed

earnest phoenix
#

yeah

soft flare
#

ok

#

so there a way to fix that?

earnest phoenix
#

v12 is like

soft flare
#

UNDEFINED

earnest phoenix
#

put cache in everything

#

and it works

zenith terrace
#

I just told you to put .cache before everything...

twilit rapids
#

Not everything

twilit rapids
#

Before collections

soft flare
#

and where i suppose to put .cache in glitch com

earnest phoenix
#

yea

zenith terrace
#
client.on("ready", () => {
  // This event will run if the bot starts, and logs in, successfully.
  console.log(Bot has started, with ${client.users.cache.size} users, in ${client.channels.cache.size} channels of ${client.guilds.cache.size} guilds.); 
  // Example of changing the bot's playing game to something useful. client.user is what the
  // docs refer to as the "ClientUser".
  client.user.setActivity(Serving ${client.guilds.cache.size} servers);
});```

@soft flare Gotta have .cache in v12

@zenith terrace

earnest phoenix
soft flare
#

Parsing Error: unexpected token has

#

rlly

quartz kindle
#

what file and what line?

twilit rapids
#

I don't see any has in the code you send

soft flare
#

wait

#

file

#

/bot/status.js

zenith terrace
#

you dont have `

quartz kindle
tight plinth
#

`Bot has started...`

soft flare
#

let me

quartz kindle
#

you're not using strings

soft flare
#

where `

zenith terrace
#

console.log(`Bot has started, with ${client.users.cache.size} users, in ${client.channels.cache.size} channels of ${client.guilds.cache.size} guilds.`);

tight plinth
#

^^

soft flare
#

meh ... you fooled me

zenith terrace
#

I forgot to add them in

quartz kindle
#

now i noticed lol, you're not using any strings at all

#

in both lines

tight plinth
#

in client.user.setActivity too

#

do the same thing

soft flare
#

done

#

no more i think

#

Bot Power Up

#

yep

#

Bot has started, with 23524 users, in 308 channels of 10 guilds.

#

hooooly

#

works

#

WORKS

#

10 servres

tight plinth
#

user count is false uwu

soft flare
#

wow

zenith terrace
#

Lol

soft flare
#

i know

tight plinth
#

ez to fix

soft flare
#

idc

#

its only showing Servers

tight plinth
#
let usercount = 0;
client.guilds.cache.forEach(g => {usercount += g.memberCount})```
soft flare
#

Thank you

#

i will leave it

#

Bot has started, with 23524 users, in 308 channels of 10 guilds. its showing only on console

slender thistle
#

or use a for loop which should be more performant nekothinking

soft flare
#

not on stattus

quartz kindle
#

you only show this on status: Serving ${client.guilds.cache.size} servers

tight plinth
#

^

soft flare
#

let me think my bot is on this server and mine

#

hmm

#

can someone tell me how can i make bot to show servers?

tight plinth
#

to show servers?

soft flare
#

in my dm of course

#

ye

tight plinth
#

like a serverlist?

soft flare
#

the server list

#

yep

tight plinth
#

2 sec

soft flare
#

cuz im curious

tight plinth
soft flare
#

i know my bot is on this server and my server

#

and other 8 i dont know

#

aww its command handler

tight plinth
#
let string = '';
client.guilds.cache.forEach(guild => {
    string += guild.name + '\n';})
    
    
    message.author.send(string)
    message.channel.send('Server list sent in dm!');```
#

code looks like this

#

basic but works

soft flare
#

im bad at it because i dont know how to run it

tight plinth
#

just run it

#

in a command

soft flare
#

like how

#

oh

#

nvm

tight plinth
#

lol

soft flare
#

jk

zenith terrace
#
let usercount = 0;
client.guilds.cache.forEach(g => {usercount += g.memberCount})```

@tight plinth so would the bottom part go into the .setActivity

tight plinth
#

usercount replaces client.users.cache.size

astral yoke
#

db!eval bot.guilds.size

#

db!online

quartz kindle
astral yoke
#

oops

#

that’s why sorry lol

soft flare
earnest phoenix
#

are you aware of what that does

quartz kindle
#

that will send a separate message for each guild

#

and each message will show one guild plus all previous guilds

#

lmao

soft flare
#

n!say hello

#

oh its muted

#

well

quartz kindle
#

oh nvm i was looking at the wrong brackets

soft flare
#

@final creek

spice pier
#

ye we got it muted

#

sorry m8

zenith terrace
#
if (message.author.bot) return;```
Put that in your message event
finite bough
#

is getting the default everyone role using js message.guild.roles.everyone.id
a good idea?

pale vessel
#

yes

quartz kindle
#

the default role has the same id as the guild

finite bough
#

a

quartz kindle
#

so you can simply use the guild id

finite bough
#

ok i didnt know that

heavy marsh
#
${member.nickname !== null ? `${member.nickname}` : "None"}

Why is it undefined

pale vessel
#

just put member.nickname ?

heavy marsh
#

If no nickname?

quartz kindle
#

you're checking if member.nickname is not EXACTLY null

heavy marsh
#

|| "Non"

quartz kindle
#

there are other ways making a value not exist

#

such as undefined, or 0

heavy marsh
#
${member.nickname !== 0 ? `${member.nickname}` : "None"}
quartz kindle
#

if you do member.nickname ? something : something else it will check for all falsey values instead of strictly checking for null

zenith terrace
#

I mean, I have !== null ? for mine and it works fine 👀

pale vessel
#

but why null?

heavy marsh
#

I am in v12.0.2

quartz kindle
#

its the same as doing if(!member.nickname) {}

heavy marsh
#

in v 11 it was fine

#

hmm ok

pale vessel
#

use an easier method when there's one

quartz kindle
#

another way would be to do member.nickname || "None"

zenith terrace
#

Anyway back to college work. Cya

quartz kindle
#

the OR there makes it resolve to "None" if member.nickname is any falsey value

heavy marsh
#

Thanks

#

it works now 🙂

astral yoke
#

How would I be able to make a web hook that outputs discord’s status? Like, if there’s outages or lags on the website it states it sends to the web hook.

#

For discord.js.

golden condor
#

Hello

#

I am very confused

#

It comes out with (node:4366) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of null

#

d.js = v11.6

earnest phoenix
#

How would I be able to make a web hook that outputs discord’s status? Like, if there’s outages or lags on the website it states it sends to the web hook.
@astral yoke

https://discord.js.org/#/docs/main/stable/class/WebhookClient

#

wrong thing

#

that

#

It comes out with (node:4366) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of null
@golden condor

what do you not understand about it? guild is null - which is an indicator that the message was in a dm

golden condor
#

I told it not to do anything if it is a dm

storm bluff
#

help

earnest phoenix
#

luffy, recheck your syntax, it tells you where the mistake is

#

cxllm, you obviously didn't if it hit the error

storm bluff
#

no

#

that

golden condor
#

if (message.channel.type == "dm") return message.channel.send(Sorry, you can't use commands here, please go to a server to use Corynth commands.);

storm bluff
#

this err