#development

1 messages · Page 1340 of 1

fluid basin
#

well uh I'm talking about the bot

#

like if you randomly allocating stuff

#

or have super inefficient code

earnest phoenix
#

Minecraft takes so much memory for no reason

fluid basin
#

such as 91829308129083 listeners

pulsar bone
#

store the message object in a database @pulsar bone
@earnest phoenix how

earnest phoenix
#

discord.js?

pulsar bone
#

yes

earnest phoenix
#

you'll need a database like quick.db or mongodb

ionic dawn
#

or mysql blacklol

earnest phoenix
ionic dawn
earnest phoenix
#

@pulsar bone you can just store the message object in the database and access it later when you need it

#

example for quickdb:

db.set("messageObjectIWillNeedLater.object", <message>);
dark grove
#

I am very new to coding but I tried to follow the discordjs guide as much as I could. After deciding that i want my bot to be somewhat of a music bot I tried to add Voice but now my else statements are broken

sly bison
#

@old cliff btw you can use repl.it it's a good free hosting websites and u can make it 24/7 without paying and it gives 24-26 GB of free memory (Project Will Be Public If U Don't Pay Tho) But U can put a random project name if u don't want it to be open source and u can hide your token with .env file if u know how to use it

ionic dawn
#

Wait, can you storage objects in sql?

earnest phoenix
#

@sly bison wrong

ionic dawn
carmine summit
#

Yep

earnest phoenix
#

@sly bison they don't give 24 GB of free memory they only give you 512 MB per repl else they'll go bankrupt because that's more than enough for almost anything so people won't pay for stuff

carmine summit
#

Its nice for low hosting

#

Low budget

earnest phoenix
#

yeah

ionic dawn
#

Just used mysql cause its easier than mongo

sly bison
#

@earnest phoenix why when I do my bot info command it says 24gb tho?

earnest phoenix
#

they do show that because they host multiple repls on the same computer

#

iirc

carmine summit
#

I once ran an infinite loop in replit

sly bison
#

Ah

#

My bad

#

I'm dumb then

earnest phoenix
#

but if your individual repl goes above 512 MB they'll kill the process

#

I'm dumb then
@sly bison yeah we know

tacit creek
ionic dawn
#

while(true) w_elonlaugh

carmine summit
#

Yes

#

It didn't crash tho

tacit creek
#

Hehehe

earnest phoenix
#

this emoji exists? 🈹

#

ok why are we shitposting

tacit creek
carmine summit
#

Imagibe shitposting in stackoverfloe

#

Yeah I should prob do that

pulsar bone
#

can someone send me the example code for collecting message from user and converting it to embed

carmine summit
#

I might also sneak in a lil rickroll

earnest phoenix
#

can someone send me the example code for collecting message from user and converting it to embed
@pulsar bone spoonfeeding

#

we won't just give you code

stoic hull
#

can someone send me the example code for collecting message from user and converting it to embed
@pulsar bone Use args.

carmine summit
#

Args wtf

stoic hull
#

args.join(' ')

#

lol.

pulsar bone
#

@pulsar bone spoonfeeding
@earnest phoenix call it whatever its easy for me to learn that way

earnest phoenix
#

that's bad

#

you won't learn anything if we just give you code

ionic dawn
#

Well, copy pasting isnt that bad if atleast you read it after doing it

stoic hull
#

^

ionic dawn
#

If you dont you are not programming, you are copying like an ape

#

And calling yourself a programmer

marsh bluff
#
bot.on('message', () => {
  send(new Discord.MessageEmbed()
    .setDescription(message.content))
}```
carmine summit
#

Only copy paste codes if you know what every line does, and why it is there.

marsh bluff
#

not working code btw

pale vessel
#

bruh

carmine summit
#

Its bcu

#

You didn't define message

pale vessel
#

cursed code

marsh bluff
#

cursed code

#

as all my bots are

carmine summit
#

Yeah also cursed

#

Btw is send a function????

marsh bluff
#

i just copy paste tens of function all over my code

earnest phoenix
#

Btw is send a function????
@carmine summit yes

carmine summit
#

No as

#

Is it defined

stoic hull
#

That code isnt even closed.

earnest phoenix
#

it's a method of the TextChannel object and methods are just functions

tame kestrel
#

Remember to be at least slightly helpful, and not just talk smack on code. Everyone learns, they're asking help for a reason. thumbsupforyou

ionic dawn
#

Well... you are not even specifying a channel to send it

carmine summit
#

Yep

#

Send can't be a function

earnest phoenix
#

I'm drunk

pale vessel
#

yes it can

carmine summit
#

message will go indefined

marsh bluff
#
bot.on('message', message => {
  message.channel.send(new Discord.MessageEmbed()
    .setDescription(message.content)
  );
});
pale vessel
#

yes

marsh bluff
#

Dont tell me bot is not defined

pale vessel
#

perfect

carmine summit
#

Yes

stoic hull
#

Close the damn code.

pale vessel
#

) moment

carmine summit
#

Don't tell me you defined it as client

marsh bluff
#

oh wait

earnest phoenix
#

there should be a closing bracket at end

ionic dawn
pale vessel
#

parenthesis xd

carmine summit
#

Yes

earnest phoenix
#

you are only closing the arrow function

carmine summit
#

Lol

#

)

marsh bluff
#

👍

carmine summit
#

There we go

marsh bluff
#

now i deserve a bot developer role

#

where should I sign?

carmine summit
#

You're an official api abuser

ionic dawn
#

sign for what

#

For dumbo coder?

marsh bluff
#

for bot developer role?

carmine summit
#

No

ionic dawn
#

Oh for that

carmine summit
#

You cannot

marsh bluff
#

ah damn dumbo coder is another category?

carmine summit
#

That code is bs

marsh bluff
#

thought its the same

carmine summit
#

It just repeats ecery message

old cliff
#

@old cliff btw you can use repl.it it's a good free hosting websites and u can make it 24/7 without paying and it gives 24-26 GB of free memory (Project Will Be Public If U Don't Pay Tho) But U can put a random project name if u don't want it to be open source and u can hide your token with .env file if u know how to use it
@sly bison yeah I know about that

carmine summit
#

As an embed

ionic dawn
#

@marsh bluff with that joke and that code I can tell you are an experienced comedian

marsh bluff
#

thanks

ionic dawn
marsh bluff
#

that's what i do for a living

#

post shitty code on stack overflow and gain points for bread

ionic dawn
carmine summit
#

Congratulations you are now an official API abuser. You just made a bot that repeats every message as an embed ClapClap

ionic dawn
#

Who? @marsh bluff

marsh bluff
#

what

minor radish
#

lol

ionic dawn
#

@carmine summit I remember you about the DaddyBot, his only function is reply with 'Hi im daddy' whenever someone say hi

marsh bluff
#

wait he did just that and got a bot developer role?

ionic dawn
#

Cursed english ohmy

carmine summit
#

Alright

#

Bye

#

I just lost a braincell

#

Thanks

marsh bluff
#

only one?

#

i would be sad about that

earnest phoenix
#

@marsh bluff lmao stop I'm laughing to death no sarcasm

marsh bluff
#

thanks my mission of making people laugh from my terrible comedy is completed

#

i can go finish my russian literature test now

earnest phoenix
#

lmfao

half briar
#

~help

#

~adminhelp

#

pls help

#

~help

ionic dawn
#

lol

#

You don't need to use any command to ask for help

#

just ask your question

earnest phoenix
#

if you need help with programming ask here

zenith terrace
#

What is that cursed code I just read, I just went here for boredom and saw that zoomeyes

surreal sage
#

What are the ${...} called inside a `

pale vessel
#

template literals

ionic dawn
#

@surreal sage you can add code inside CatBlush

earnest phoenix
#

not entirely correct but ok

ionic dawn
#
message.channel.send(`Hi ${message.author}`)
pale vessel
#

k

earnest phoenix
#

it's mostly used for putting the values of variables inside strings
you can't put full on complex code inside it
stuff like if statements won't work

pale vessel
#

just use ternary

ionic dawn
#

well

earnest phoenix
#

i love annoying vo1d he's qt

ionic dawn
#

im sure noone will put a complex function or whatever inside

pale vessel
earnest phoenix
#

im sure noone will put a complex function or whatever inside
@ionic dawn i did once

#

@celest axle this the wrong channel

ionic dawn
#
let yes = []
yes.push('no')
surreal sage
#

@ionic dawn i know but how is it called

ionic dawn
#

do I look like a real programmer? oh pls

restive furnace
#

an array

slender thistle
#

Sphinx
Is there any way to remove the annoying Next/Previous topic in the sidebar? Using basic theme

ionic dawn
#
message.guild.members.cache.get(id).displayAvatarURL();
``` why isnt this working ![lol](https://cdn.discordapp.com/emojis/529455569711661066.webp?size=128 "lol")
pale vessel
#

member.user.displayAvatarURL() cry

tired panther
#

Why is that not working? want it for sharding, ping me

next flax
#
    at Object.run (C:\Users\Pujya Kumar\Desktop\ThunderUpdated\commands\music\play.js:11:38)
    at Client.<anonymous> (C:\Users\Pujya Kumar\Desktop\ThunderUpdated\server.js:101:17)
    at Client.emit (events.js:315:20)
    at MessageCreateAction.handle (C:\Users\Pujya Kumar\Desktop\ThunderUpdated\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\Pujya Kumar\Desktop\ThunderUpdated\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\Pujya Kumar\Desktop\ThunderUpdated\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (C:\Users\Pujya Kumar\Desktop\ThunderUpdated\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (C:\Users\Pujya Kumar\Desktop\ThunderUpdated\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
    at WebSocket.onMessage (C:\Users\Pujya Kumar\Desktop\ThunderUpdated\node_modules\ws\lib\event-target.js:125:16)
    at WebSocket.emit (events.js:315:20)
(node:15728) 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)
(node:15728) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

#
const { manager } = require("erela.js");
const { Client, Collection } = require("discord.js");
const client = new Client()
module.exports = {
  name: "play",
  category: "Music",
  description: "Play Music",
  usage: "play <url or name>",
  run: async (client, message, args) => {
    const res = await client.manager.search(
      message.content.slice(6),
      message.author
    );
 
    const player = client.manager.create({
      guild: message.guild.id,
      voiceChannel: message.member.voice.channel.id,
      textChannel: message.channel.id,
    });
 
    player.connect();
 
    player.queue.add(res.tracks[0]);
    message.channel.send(`Enqueuing track ${res.tracks[0].title}.`);

    if (!player.playing && !player.paused && !player.queue.length)
      player.play();
 
    if (
      !player.playing &&
      !player.paused &&
      player.queue.size === res.tracks.length
    )
      player.play();
  }
}
    ```
#

whats the issue

marble juniper
#

you may have messed up the initalisation a bit

next flax
#

can u help me checking it?

marble juniper
#

you can get support for erela.js there

#

its the discord server of the maker of erela.js as well

next flax
#

oke

#

that server is dead @marble juniper

marble juniper
#

@next flax doesn't mean you don't get support

#

you still get responses

next flax
#

yes but

#

still

marble juniper
next flax
#

that thunder named person had same error

marble juniper
#

not a lot of people in here know erela.js

#

actually only a few do

#

so its better you ask in thier server and wait for a response

#

cuz they know erela.js

next flax
#

hm

marble juniper
#

they can give better support

misty sigil
#

@tired panther regarding #development message : I'd recommend using a webhook instead. You can just post the message to it from anywhere, from any shard.

earnest phoenix
#

o

tardy hornet
#
let user = bot.snipe.users.get(channel.sender);

error:
TypeError: Cannot read property 'get' of undefined

#

how do i define get?

earnest phoenix
tardy hornet
#

ty

faint prism
#

users is undefined and therefore has no properties like get()

tardy hornet
#

i made a snipe command

#

and i want in the author to send the pfp of the person who sent the deleted message, how do i do that

tired nimbus
#

If you relay audio from one voice connection to another
will

const audio = connectionA.receiver.createStream('User');
connectionB.play(audio, { type: 'opus' });

work?

#

this is something I did test but it doesnt work for me thats why im asking if the format allows for the connection to be streamed into a channel

earnest phoenix
#

How can I make my discord bot detect if someone voted for it on top.gg?

#

Cuz I wanna give like some kind of prize every time someone votes

#

Discord verification queue

#

How to increase

#

Automatically??

#

Is there certain api I need to use?

bleak crypt
#

I need a bot that only asks "new created" accounts to be verified.

#

⚠️ NEW ACCOUNT created 13 hours, 48 minutes and 5 seconds ago⚠️

#

This kind of accounts ^

umbral zealot
#

Sure, you can see the date an account was created on

bleak crypt
#

Note, NOT all accounts / new joining members. Only new created accounts.

umbral zealot
#

depending on the library

bleak crypt
#

I need a bot that add a role to this kind of users "non-verified"

umbral zealot
#

Are you making a bot or looking for a bot?

bleak crypt
#

Letting them verify themself before they can access the server.

earnest phoenix
#

Write an if statement to check if an account was created like 24 hours ago if not return

bleak crypt
#

@umbral zealot Both. Is there a existing bot for that?

umbral zealot
#

If you're not writing the bot yourself you're in the wrong channel, ask in #general

pale vessel
#

that's-

earnest phoenix
#

I will ask for help on a non-dbl issue, your bot always gives missing permissions error and the bot restarts in 6 hours.When the bot restarts, timed commands such as the draw are reset, if there is any help, dm come please

pale vessel
#

you can ask here

umbral zealot
#

@earnest phoenix "your bot" what bot?

pale vessel
#

this channel is for any development topic, mainly discord bots

earnest phoenix
#

discord bot

umbral zealot
#

Who's bot?

pale vessel
#

whose?

earnest phoenix
#

not available on the server

pale vessel
#

who is?

umbral zealot
#

What fucking bot are you talking about, mate, we have no idea.

earnest phoenix
#

just me

charred kindle
#

...then go to the support server for the bot?

earnest phoenix
#

I'm talking about error my bot says missing permisions and closes

umbral zealot
#

Then why did you say "your bot always gives..."

charred kindle
#

Then give it the permissions

umbral zealot
#

god people are so confusing sometimes.

charred kindle
#

If it says missing permissions give it the permissions it needs

earnest phoenix
#

I'm using google translate I'm not sure about anything I wrote

umbral zealot
#

Give it permissions, or check that it has permissions before executing the command

humble wasp
umbral zealot
#

if it doesn't have permissions, tell the user it doesn't have them.

charred kindle
#

sigh

humble wasp
earnest phoenix
#

My bot is a public bot, I can't be sure if anyone gives it so I need a return system or an error debugger. I want help from it.

umbral zealot
#

@humble wasp message.client.commands is undefined.

humble wasp
#

i having trouble with array

#

rn

umbral zealot
#

no you're having trouble with message.client.commands being undefined, so message.client.commands.array() tells you it can't read the property array of undefined where message.client.commands is what's undefined.

humble wasp
#

So what i need to do huh?

modest smelt
#
@client.command()
async def leaderboard(ctx):
  with open('pointspotd.json', 'r') as json_file:
    lead = json.load(json_file)
  embed = discord.Embed(title = "Leaderboard", description = "This the leaderboard in The Calt Server.")
  for item in sorted(lead.items(), reverse=True, key = lambda p: p[1]): 
    idofuser = int("{0}".format(*item))
    points = int("{1}".format(*item))
    user = client.get_user(idofuser)
    embed.add_field(name = f"{user.mention}", value = f"Points: {points}", inline = False)
  await ctx.send(embed = embed)
```Do you know what is wrong with this?
Nothing is sending, no errors.
umbral zealot
#

no idea, it depends what message.client.commands is supposed to be?

charred kindle
#

Define message.client.command

#

Are you using discord.js?

earnest phoenix
#

@umbral zealot Too many commands and I can't see where the error came from

humble wasp
#

Define message.client.command
@charred kindle Ye thanks that really helped (no)

charred kindle
#

importing correctly

#

Well that’s a subset of discord.js

umbral zealot
#

@earnest phoenix then add proper error handling in your commands, so that you know where it comes from.

charred kindle
#

So if discord.js is not required/imported/used correctly

earnest phoenix
#

Well, can you send an example command?

charred kindle
#

You aren’t defining message.client

umbral zealot
#

message.client is valid in discord.js. But message.client.commands doesn't exist in discord.js. it's not a thing. discord.js doesn't konw what "commands" are.

humble wasp
#

@umbral zealot So when the command is calling it supposed to reply all the bot commands that it have

earnest phoenix
#

Well, can you send an example command?
@umbral zealot

umbral zealot
#

I can't send you anything @earnest phoenix because I litearlly have no idea what your bot does, what language it's in, or what library you're using.

earnest phoenix
#

js

upper crescent
#

hey

earnest phoenix
#

I'm using javascriprt discord.js

umbral zealot
boreal iron
#

lmao

pale vessel
#

where is it pointing to

upper crescent
#

lmao

humble wasp
#

So how i define it?

pale vessel
#

lmao

umbral zealot
#

No idea

earnest phoenix
#

@umbral zealot javascriprt discord.js
〈Evie.Codes〉bugün saat 17:27
@humble wasp this is

umbral zealot
pale vessel
#

wut

boreal iron
#

So how i define it?
@humble wasp Define an array with commands the BOT supports.

humble wasp
#

javascript and discord.js is all different codes

@umbral zealot javascriprt discord.js
〈Evie.Codes〉bugün saat 17:27
@humble wasp this is
@earnest phoenix

umbral zealot
earnest phoenix
#

What the fuck

umbral zealot
#

I fucking hate the quote system, with every fiber of my body.

earnest phoenix
#

JavaScript is a programming language, discord.js is a discord api wrapper

pale vessel
#

it'll get better with the new inline reply

#

soon™️

umbral zealot
#

yeah I hope so

earnest phoenix
#

Man this chat 👁️

boreal iron
#

Or better define an object.

humble wasp
#

@humble wasp Define an array with commands the BOT supports.
@boreal iron waitWhat

umbral zealot
#

@humble wasp we have no idea what client.commands is supposed to be, you're using it, what do you Think it's supposed to be? Where did you read that this was a thing?

earnest phoenix
#

Just define a new property on the client object with the value of a new collection

humble wasp
#

The bot is writed on discord.js commando

faint prism
#

I only write bots in esoteric languages

earnest phoenix
#

Writing bots in binary moment

boreal iron
#

@humble wasp Looking at the commands.forEach function your command needs to be a valid object, containing name , aliases and description properties

upper crescent
#

hey so i wanted to ask when something or someone is tagged
it has some charcters over the ID in my knowledge the chars are <>@#! is there anything else than this exists when something is tagged ??

earnest phoenix
#

No

upper crescent
faint prism
#

hey so i wanted to ask when something or someone is tagged
it has some charcters over the ID in my knowledge the chars are <>@#! is there anything else than this exists when something is tagged ??
@upper crescent there is a "mentions" property typically

umbral zealot
#

user mentions are only <@id> or <!@id> there is no other way to tag a user.

pale vessel
#

don't forget & for roles

faint prism
#

Isn't it @! ?

earnest phoenix
#

for channels

upper crescent
#

yeah i meant that only @faint prism

umbral zealot
#

eh could be @! actually

pale vessel
#

nah

umbral zealot
#

I don't exactly parse mentions manually I let my lib do it 😄

upper crescent
#

no when a channel is mentioned is it #

earnest phoenix
#

<@id> => mobile
<@!id> => PC

pale vessel
#

yes

faint prism
#

<@!id> => nickname

#

iirc

pale vessel
#

<#id> - channel
<@id> - mention
<@!id> mention with nick
<@&id> - role

earnest phoenix
#

@!

boreal iron
#

@humble wasp For example:

[{
   name: 'command1',
   aliases: 'cmd1',
   description: 'the fuck I do'
},
{
   name: 'command2',
   aliases: 'cmd2',
   description: 'the fuck I do here, too'
}]
upper crescent
#

I don't exactly parse mentions manually I let my lib do it 😄
i am using discordgo

pale vessel
#

the fuck you do

faint prism
#

I like this

#

ooooaah is that go lang?

upper crescent
#

yes

earnest phoenix
#

Funni

upper crescent
earnest phoenix
#

What does the dictionary consist of
@slender thistle the keys are id numbers and the values are their scores

faint prism
#

I doubt many here write in golang

pale vessel
#

so sort the dict by value xd

slender thistle
#

Can you people respond any later

earnest phoenix
#

Wot

faint prism
#

I respond the next day sometimes

#

Or hell, sometimes I quote from msgs that I dig up in the search that are years old

earnest phoenix
#

Question... Can you put a Check onto an event? so say like i wanted the bot to add roles only to users who join a certain guild? D.PY

pale vessel
#

y e s

earnest phoenix
#

Of course

upper crescent
#

I doubt many here write in golang
GWcorbinMonkaGIGA

faint prism
#

Question... Can you put a Check onto an event? so say like i wanted the bot to add roles only to users who join a certain guild?
@earnest phoenix

if (condition) {
  ...
} else if (alternativeCondition) {
  ...
} else {
  ...
}
pale vessel
#

vysion does

#

noctember too

upper crescent
#

nice

#

i am just a newbie in this

earnest phoenix
#

Auger listing all conditions possible

faint prism
#

😉

earnest phoenix
faint prism
#

elif

earnest phoenix
#

L Y N X, there are parameter returned when the event emits

#

Use those to do the thing you want

#

thank you

boreal iron
#

cought ifelse( explode )

#

or better ifnotelse( exit() )

earnest phoenix
#

SyntaxError moment

boreal iron
#

shhh, there's no syntax error, it's just u doing something wrong

humble wasp
#

@humble wasp For example:

[{
   name: 'command1',
   aliases: 'cmd1',
   description: 'the fuck I do'
},
{
   name: 'command2',
   aliases: 'cmd2',
   description: 'the fuck I do here, too'
}]

@boreal iron Whaaaaaaaaaaat???????????

compact echo
#

So I'm trying to make a typescript discord bot and I have this as my command class, https://srcb.in/503db304bb, but when I try to do the options, it doesn't work. Any advice?

tardy moth
#

Haw create a bot with hwo application or site

#

With phone

compact echo
#

wdym

quartz kindle
#

@compact echo you need to declare the class properties before you can initialize them

compact echo
#

Sorry, I'm learning typescript 🙂

#

Wait

#

What do you mean by declare properties before you can init them?

quartz kindle
#
class XYZ {
    abc: string;
    constructor(somedata: string) {
      this.abc = somedata
    }
}
compact echo
#

oh

#

Oh do I have to declare it outside of the contructor

quartz kindle
#

ye

compact echo
#

k

earnest phoenix
#

How can I be active 24/7 my bot

pale vessel
#

rent a vps or a server and use a process manager

#

don't use free services

compact echo
pale vessel
#

ok

compact echo
#

lots of tuts on it

earnest phoenix
#

I shouldn't use it for free

#

@pale vessel

pale vessel
#

yes

blissful coral
#

:)

earnest phoenix
#

@earnest phoenix https://repl.it/ then use https://uptimerobot.com/ if you want
@compact echo uptimerobot not work for glitch

Get up to 50 website, port or heartbeat monitors for free. When something happens, we'll notify you via email, SMS, Telegram, Slack or many more ways.

pale vessel
#

yesss

#

gg good

blissful coral
#

gg best one

#

Glitch is bad

earnest phoenix
#

😆

boreal iron
#

@humble wasp What - what?

pale vessel
#

don't use glitch, they can delete your project if they find out you host a bot

boreal iron
#

Already gave you the example how your commands array has to look like.

earnest phoenix
#

I have trick for glitch

#

😄 😄

pale vessel
#

share it somewhere else

earnest phoenix
#

Lol

blissful coral
#

Lets not talk about it

#

:)

earnest phoenix
#

Trick not owned by me

#

So

#

I can't

compact echo
#

don't use glitch, they can delete your project if they find out you host a bot
@pale vessel wait they do? lol I host like 10 bots on it ;-;

modest smelt
earnest phoenix
#

Boost use?

blissful coral
#

Yes they do

#

LMAO

modest smelt
#

Pls help

earnest phoenix
#

@compact echo use boost?

compact echo
#

nope

#

My friend created a pinger that works

modest smelt
#

Can I get hell

#

Help

blissful coral
#

If someone knew the answer they would respond

#

stop asking the same thing over and over please

modest smelt
#

😦

earnest phoenix
#

My friend created a pinger that works
@compact echo pinger means uptimerobot

compact echo
#

nope, not that

earnest phoenix
#

Not web.

faint prism
#

why are you using json

compact echo
#

It's a discord bot

earnest phoenix
#

I know

#

This trick

#

Lol

pale vessel
#

it's against their tos to use pinging services

earnest phoenix
#

Same here

#

@pale vessel wtw u owner of tos vision by me

modest smelt
#

@faint prism this is a private boy

earnest phoenix
modest smelt
#

Bot

earnest phoenix
#

Boy

#

Lol

#

lol

faint prism
#

and?

modest smelt
#

I’m only going to use in one server

faint prism
#

why are you using JSON is my question

earnest phoenix
#

🤣 🤣

modest smelt
#

Because I don’t want to learn database right now

earnest phoenix
#

json is easy to use for small servers

#

yeah

modest smelt
#

Bobthegod is working with me

boreal locust
#

How to uptime bot 24/7?

earnest phoenix
#

mhm

#

Nope

#

How to uptime bot 24/7?
@boreal locust use a hosting website

modest smelt
#

mhmhmhmhmhmhmhmhmhmhmhmhmhmhmhm

fringe pendant
#

@boreal locust host it somewhere or leave your computer on 24/7

earnest phoenix
#

Spammer

modest smelt
#

I use aws

earnest phoenix
wicked sapphire
#

Could I make an eval command that I can only run? With my bot.

faint prism
#

using a sqlite database at least is a quick solution

modest smelt
#

Yeah Ik

#

But the code works

earnest phoenix
#

Could I make an eval command that I can only run? With my bot.
@wicked sapphire make it so if checks the id number

#

I have 5 min to go

modest smelt
#

It just doesn’t send anything

faint prism
#

Could I make an eval command that I can only run? With my bot.
@wicked sapphire yeah, but be careful you lock it down. Otherwise someone can abuse it

earnest phoenix
#

😄

boreal locust
#

@boreal locust use a hosting website
@earnest phoenix that free hosting website?

earnest phoenix
#

heroku

#

aws

modest smelt
#

@earnest phoenix that free hosting website?
@boreal locust u can use aws

wicked sapphire
#

Anyone know how to make a calculate command, without eval()?

earnest phoenix
#

Dyno hours

#

😄

boreal locust
#

@boreal locust u can use aws
@modest smelt ok

modest smelt
#

@faint prism so how should I proceed with JSON

faint prism
#

Without JSON

pale vessel
#

Anyone know how to make a calculate command, without eval()?
@wicked sapphire you can use a library, depends on what programming language you use

earnest phoenix
#

@earnest phoenix that free hosting website?
@boreal locust 100%

modest smelt
#

Bruh

earnest phoenix
#

Huhh

quartz kindle
#

if people want to use json, let them use it lol

earnest phoenix
#

@modest smelt your pfp GWsetmyxPeepoCry

#

boreal locust
#

@boreal locust 100%
@earnest phoenix where?

earnest phoenix
#

@faint prism json is not the only problem

#

we tried just defining a dictionary

#

with everything that was in the json file

#

and it didn’t work

#

Glitch give 1000hours/month

#

10k when

compact echo
pale vessel
misty sigil
#

Glitch give 1000hours/month
@earnest phoenix only for static sites

compact echo
#

It doesn't 😭

#

I know

quartz kindle
#

should work

#

i'd import discord.js and make client:Discord.Client

compact echo
#

hmm

#

Ok

quartz kindle
#

else it will complain that client has no properties and methods

compact echo
#

Well I have a client class already

quartz kindle
#

so just do client:ClientClassHere

compact echo
#

Ok

quartz kindle
#

just so its not any

compact echo
#

k

faint prism
#

the dictionary can use user ids. Only store what's needed

pale vessel
#

wut

#

oh

#

that guy earlier

modest galleon
#

Store have nothing free

earnest phoenix
#

@earnest phoenix only for static sites
@misty sigil it's work 24/7

buoyant aspen
#

quick question ppl... I want to edit the contents of a file that was committed a while ago, and had commits made on top of it. Is there a way I can amend a commit by hash?

earnest phoenix
#

@outer topaz

modest smelt
#

So how can i use json?

outer topaz
#

Yes

slender wagon
faint prism
#

Don't strictly check mime type or include text/html or approved ones

slender wagon
#

how do i turn that off

faint prism
#

google it idk off the top of my head

slender wagon
#

mmk

stoic girder
#

If anyone has suggestions about what can be added to improve a simple application bot, give them to me. CatDance (just ping me please)

compact echo
#

@stoic girder Can I see it?

pale vessel
#

depends on the bot itself

compact echo
#

^

stoic girder
tired panther
compact echo
#

@tired panther give more detail

#

message is not defined

#

that is the error

tired panther
#

yes but is defined xD

compact echo
#

cause your command handler most likely does not include it

faint prism
#

but it isnt

compact echo
#

Exactly

slender thistle
#

Bumping my question:

Sphinx
Is there any way to remove annoying Next/Previous topic sections in the sidebar? I'm using the basic theme

compact echo
#

@tired panther show me your command handler

tired panther
#
    command.execute(message, args, Discord, client  );
compact echo
#

is message defined in that file

tired panther
#

yes

#

client.on('message', message => {

#

all other commands work

#

but the sharding one does not

#

I want to send a message in another shard

compact echo
#

@tired panther Don't ghost ping. I saw that

tired panther
#

i thought u went away sorry

compact echo
#

i don't know why sry

tired panther
#

xD, but any ideas why it is not working

compact echo
#

nope

tired panther
#

I want to send a message in another shard
@tired panther

#

any ideas of that?

misty sigil
#

just use a webhook.

compact echo
#

^^

tired panther
#

I do not want to use a webhook, whats the alternative

#

my bot is an reminder

misty sigil
#

why not use a webhook

tired panther
#

and making for every guild a webhook uff

#

any ideas \no one a idea?

harsh reef
#

When is top.gg search gonna fixed?

pale vessel
#

soon™️

#

team is aware iirc

#

¯_(ツ)_/¯

harsh reef
#

Cool

#

Can you give any estimated time?

earnest phoenix
#

I'm idling here need help with js pingg me

pale vessel
#

no

drifting wedge
#

how can i literally put together strings?

#

int?

#

so like int1 + in2 = int1int2

#

like literally put them together not add them

tender needle
#

@drifting wedge Parse them as strings before concatenating

drifting wedge
#

ok ty

dark grove
#

can anyone help for a sec? need to make my bot send out a message greeting everyone who joins the server but it tells me that

solemn latch
#

djs?

dark grove
#

yes

solemn latch
#

in v12 i belive your missing the cache

dark grove
#

oh like

tulip ledge
#

Alright so I have this string wich is the user's current inventory:
1:4,2:3 for example, then I have an array of objects with the items to be added like this:

[
{
   itemid: "2",
   amount: 1
}, {
  itemid: "1",
  amount: 2
}
]

Now I have this function to basically add these items into the inventory:

  static addMaterialsToInv(items, string = "1:4,2:3") {
    let newInventory = [];
    let currentItems = string.split(",");
    for (let i = 0; i < currentItems.length; i++) {
      let item = currentItems[i].split(":");
      for (let j = 0; j < items.length; j++) {
        if(item[0] === items[j].itemid) {
          let newAmount = parseInt(item[1]) + items[j].amount;
          let newItem = `${item[0]}:${newAmount}`;
          newInventory.push(newItem)
        }
        else newInventory.push(`${item[0]}:${item[1]}`)
      }
    }
  }

now this works fine if there's only 1 item, but if there's more then 1 item it will return this:
1:6,1:4,2:3,2:4 when it should only return 1:6,2:4 any idea on how to fix this?

dark grove
#

.cache at the end?

solemn latch
#

cache on your channel manager

#

(channels)

dark grove
#

thanks a ton, works now

earnest phoenix
#

what's concatenating

tulip ledge
#

item + item

#

basically adding up

#

but then with strings

#

so u get
"hello" + "bye" = "hellobye"

earnest phoenix
#

@tulip ledge Is it like, 1,4 === itemId,amount?

tulip ledge
#

1:4 = itemid:amout basically

#

1 is the id
4 is the amount

earnest phoenix
tulip ledge
#

the issue is that the for loop loops twice when there's 2 drops and then it checks like thi: id:1 === id:2? No, add 1:4 to the list even tho 1:6 is already there but I don't know how to fix that issue

#

Tim would say alakazam and it's fixed lol

#

help pls

boreal iron
#

gimme a sec

#

working on it

tulip ledge
#

ight ty

earnest phoenix
#

DISCORD APP DOT COM?

#

how did discord give you that link for a message

tulip ledge
pale vessel
#

it's still used in the client

maiden steeple
#

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'filter' of undefined

#

ı got this error

#

how can ı solve it

tulip ledge
#

code?

#

We aint gonna do much without code

misty sigil
#

^

#

apart from say you done <undefined>.filter

boreal iron
#
[{
    itemid: "2",
    amount: 1
},
{
    itemid: "1",
    amount: 2
}]

static addMaterialsToInv(items, string = "1:4,2:3")

Increasing itemid 1 by 4 and 2 by 3, right?

tulip ledge
#

no no no

#

the string is what the user currently has

#

the array with objects is what it needs to add

boreal iron
#

oh

tulip ledge
#

So it should become: 1:6,2:4

boreal iron
#

alright

tulip ledge
#

@maiden steeple send code

boreal iron
#

expecting the entered string is in format id:amount,

earnest phoenix
tulip ledge
#

no not rlly it should return a string

#

So like id: 1and amount: 2 it should increase the 1 in the string with 2 so it should result in 1:x+2 if u get what I mean

earnest phoenix
#

Oh

#

Lemme make that

tulip ledge
#

I got that to work but it does weird stuff when u have multiple objects in the array

maiden steeple
#

.addField(`**Toplam Üye ・** ${message.guild.memberCount}\n**Aktif Üye ・** ${message.guild.members.filter(m => !m.user.bot && m.user.presence.status !== "offline").size}\n**Taglı Üye ・** %{message.guild.members.filter(m => m.user.username.includes(tag)).size))\n**Sesteki Üye ・** ${message.guild.channels.cache.filter(count)}`) and the error is UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'filter' of undefined

tulip ledge
#

message.guild.members.cache

#

U need to use cache if ur using V12

#

So it should be message.guild.members.cache.filter(...)

earnest phoenix
#

hi

#

i have a problem

tulip ledge
#

o/

earnest phoenix
#

//queue command
const player = bot.music.players.get(message.guild.id);
if(!player || !player.queue[0]) return message.channel.send("No song currently playing.")

          let index = 1;
          let string = "";
          
             if(player.queue[0]) string += `_**Currently Playing**_\n ${player.queue[0].title} - **Requested by ${player.queue[0].requester.username}**. \n`;
            if(player.queue[1]) string += `_**Rest of queue**_\n ${player.queue.slice(1,10).map(x => `**${index++})** ${x.title} - **Requested by ${x.requester.username}**. \n`).join("\n")}`;
          
          const embed = new RichEmbed()
             .setAuthor(`Current Queue for ${message.guild.name}`, messgae.guild.iconURL
            .setThumbnail(player.queue[0].thumbnail)
             .setDescription(string)
                  
    return message.channel.send(embed);
          //done
#

this one

tulip ledge
#

please us codeblocks

earnest phoenix
#

when im doing it in my music bot it shows error

tulip ledge
#

and thats just code, please provide an error

earnest phoenix
#

please us codeblocks
@tulip ledge how?

misty sigil
tender needle
#

```js
code
```

tulip ledge
earnest phoenix
#

and thats just code, please provide an error
@tulip ledge syntax error

tulip ledge
#

can u give the full error?

earnest phoenix
#

alr

tulip ledge
#

are you using discord v11?

tender needle
#

Provide all possible information so people know what's up. Just saying "I get an error" doesn't give us enough information on your problem.

earnest phoenix
#

its discord.js

tulip ledge
#

I think I see the issue

.setAuthor(Current Queue for ${message.guild.name}, messgae.guild.iconURL
.setThumbnail(player.queue[0].thumbnail)

If u open brackets you need to close them too

#

Also isn't iconURL supposed to be called as a function?

earnest phoenix
#

There is no template string's `

tender needle
#

messgae.guild.iconURL

#

message* @earnest phoenix

tulip ledge
#

theres so much wrong with that code lol

earnest phoenix
#

rewriting the whole code is better than find every single error

tender needle
#

There is no template string's `
@earnest phoenix There is, it didn't show up cause he copied it from his previous message which wasn't using a code block

earnest phoenix
#

but he has to type the correct code else ban

#

missing ) after argument list
at Module._compile (internal/modules/cjs/loader.js:703:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
at Module.load (internal/modules/cjs/loader.js:628:32)
at Function.Module._load (internal/modules/cjs/loader.js:555:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:826:10)
at internal/main/run_main_module.js:17:11

#

error

#

@earnest phoenix you're missing a )

#

fuck you auto-correct

#

what line

tender needle
#

but he has to type the correct code else ban
@earnest phoenix i agree

#

what line
@earnest phoenix you tell us

earnest phoenix
#

how do you do that?

#

what line
@earnest phoenix the error shows that

tulip ledge
#

I already told u

#

And we don't see what line

#

you can see it in the error

tired panther
#

sugchannel.send(embed: ${suggestmessage})

#

the think is there `

#

how can I access correctly suggest message

summer wedge
#

@boreal iron you can use for of

#

for (let i of array)

sudden geyser
#

oh god I thought that was java for a second

tulip ledge
#

@boreal iron .=???

boreal iron
#
static addMaterialsToInv(array = [{ itemid: "2", amount: 1 }, { itemid: "1", amount: 2 }], string = "1:4,2:3")
{
    let output = "";
    let items = string.split(",");
    
    for(let a = 0; a < array.length; a++)
    {
        for(let b = 0; b < items.length; b++)
        {
            let element = items[b].split(":");
            
            if(array[a].itemid == element[0])
            {
                array[a].amount += parseInt(element[1]);
                break;
            }
        }
    }
    
    for(let c = 0; c < array.length; c++) output += array[c].itemid + ":" + array[c].amount + ",";
    
    return output.substr(0, (output.length - 1));
}
#

Short PHP flashback, sorry

tender needle
#

yikes

summer wedge
#

bruh php

#

dont use that

tender needle
#

still don't understand why php decided to use . for concatenation

summer wedge
#

^

#

after I code php for a week

#

I start adding dots in js

tender needle
#

😂

tulip ledge
#

@boreal iron is it supposed to be +=?

tender needle
#

I remember when I switched to python for a project, I kept adding semicolons and curly brackets

boreal iron
#

nah u can use concat... edited the post already

summer wedge
#

@boreal iron is it supposed to be +=?
@tulip ledge thats a valid operator

boreal iron
#

I know I could use for loops, William, but reading my post will answer this

it's just there because I'm too lazy to write for loops

summer wedge
#

for of is lazy enough

#

it's the only way you should be looping arrays and objects

boreal iron
#

writing one term forEach is faster in typing

summer wedge
#

then function () etc is faster than just for (i of array) ?

tulip ledge
#

@boreal iron undefined1:24

tender needle
#
items.forEach(function(item) {})

// can use this instead
items.forEach(item => {})

@boreal iron

boreal iron
#

Imma also not using arrow function expressions, because I dont like to

tender needle
#

as soon as i posted my msg

summer wedge
#

or

boreal iron
#

oh forgot to close );

summer wedge
#
for (let i of array) console.log(i);
boreal iron
#

@tulip ledge

#

gonna update it real quick

#

typing in Notepad++, so no hints if you forgot to close it or not :)

#

let's call it hardcore

hollow saddle
#

Imma also not using arrow function expressions, because I dont like to
Arrow functions are considered better practice

summer wedge
#

notepad++ bruh

#

strongly recommend sublime

hollow saddle
#

Anything other notepad++ lol

#

vscode's good too

summer wedge
#

this is mine

boreal iron
#

I dont care what they are considered

#

I'm coding since 14 years and I'm not gonna change my style

summer wedge
#

that's bad

hollow saddle
#

Serious question then

#

Do you still use var?

summer wedge
#

^

fringe pendant
#

Considering you're using notepad++ I believe you're not willing to change

#

lol

boreal iron
#

yes KEKW

summer wedge
#

lmao never use var

earnest phoenix
#

@tulip ledge Mate

boreal iron
#

bet I'm getting rid of it in updates and newer code

hollow saddle
#

Ah so you are willing to change

#

Good on you then

#

None of this is a jab at you either, just trying to encourage better practces

summer wedge
#

I also started with notepad++ 7 years ago, would strongly recommend the transition to sublime text 3

tulip ledge
#

euhm @earnest phoenix yours returns 1:4,2:3 the same string

boreal iron
#

Well I write that for demonstration purposes for Chicken...

tulip ledge
#

ye FakE's one didnt work either lol

boreal iron
#

Didn't say it's performance optimist or for 2020

#

wut

#

of course it does pogey

tulip ledge
#

nope urs returned undefined1:14

boreal iron
#

gimme a sec

#

don't even have colors in the editor brrr

hollow saddle
#

Another reason to switch to an actual code editor

boreal iron
#

pfff no risk no fun

tender needle
#

How do rate limits work? Do you store in a database when the last command was executed and compare or smth?

tulip ledge
#

@earnest phoenix

  static addMaterialsToInv(items, string) {
    let newInventory = [...items];
    string.split(",").map(itemIdentifier => {
        if (items.some(item => item.itemId === itemIdentifier.split(":")[0])) {
            newInventory.find(i => i.itemId === itemIdentifier.split(":")[0]).amount += parseInt(itemIdentifier.split(":")[1]);
        } else {
            newInventory.push({
                itemId: itemIdentifier.split(":")[0],
                amount: parseInt(itemIdentifier.split(":")[1])
            });
        }
    });
    let sortedItems = [];
    let itemIds = string.split(",");
    while (itemIds.length) {
        sortedItems.push(newInventory.find(i => i.itemId === itemIds[0].split(":")[0])), itemIds.splice(0, 1);
    }

    return sortedItems.map(i => i.itemId + ":" + i.amount).join(",");
  }

Returns the same thing as string -> 1:4,2:3

#

Ok nvm I found the issue

#

You were using itemId with a captical I, I was using itemid

earnest phoenix
#

Yep

tulip ledge
#

alright ty very much

earnest phoenix
#

Np

fringe pendant
tender needle
#

@fringe pendant Thanks

summer wedge
#

if your api is nodejs, it's super easy to introduce a rate limit

fringe pendant
#

^

compact echo
pure lion
#

I want to host a second domain on my nginx server but it always redirects to the other server I have active

misty sigil
#

are you using cheddar's vps

pure lion
#

No I'm using mine

#

Check cedars cf for the domain name

boreal iron
#

@tulip ledge Found my issue btw and updated the message even if you don't need it anymore smirk
forgot to parseInt() the amount... lol

misty sigil
#

idk cedar's cf

pure lion
#

It is

#

Oh

#

Aren't you added?

misty sigil
#

uhhh naw

pure lion
#

Eh

crimson vapor
#

language?

earnest phoenix
#

discord.js

compact echo
#

i think you can use jimp

crimson vapor
#

make a canvas, then get a random word and then draw the word on the canvas

compact echo
#

or use jimp

crimson vapor
#

ye

earnest phoenix
#

Thanks for this

compact echo
#

np

earnest phoenix
#

@compact echo heyo

#

there's a section on how to install it

#

and how to trouble shoot it

#

in quick.db npm page

compact echo
#

@earnest phoenix Heyoooooo, I've seen it, doesn't work 😭

earnest phoenix
#

what's the error message?

compact echo
#

It says to do this

#

Mac

Install: XCode
Run: npm i -g node-gyp in terminal
Run: node-gyp --python /path/to/python2.7 (skip this step if you didn't install python 3.x)
Run: npm i quick.db

boreal iron
#

None of this is a jab at you either, just trying to encourage better practces
huh don't worry, I'm cool and too old to change anythign anyways :D

compact echo
#

I have XCode, but the problem is that it's an old version because

#

my mac is an old version

earnest phoenix
#

Have you tried to install it with force flag?

compact echo
#

How do you do that?

#

-force?

#

--force?

earnest phoenix
#

npm i quick.db -f

compact echo
#

k

#

nope still an error

#

😭

earnest phoenix
#

Same error?

compact echo
#

nm

#

It added it but gave an error

#

hmm

#

whatever

tired panther
#
 client.shard.broadcastEval(
      `
            const sugchannel = this.guilds.cache.get('${sguild}').channels.cache.get('${schannel}');
            if (sugchannel) {
   const suggestmessage = new Discord.MessageEmbed();
    suggestmessage.setTitle("A new Suggestion:");
    suggestmessage.setDescription("${args.join(" ")}");
    suggestmessage.setAuthor(
      message.author.username + "#" + message.author.discriminator,
      message.author.displayAvatarURL
    );
    suggestmessage.setFooter(
      "ID: " + message.author.id + " Name: " + message.author.username
    );
    suggestmessage.setTimestamp();
       
      sugchannel.send(suggestmessage)
true;
 }else {
false;
 }
`)
#

does not work

#

I am stuk on this since 4 hours

earnest phoenix
#

Elaborate on "does not work"

tired panther
#

what do u mean?

#

me or sb else?

earnest phoenix
#

What doesn't work exactly and what's it supposed to do?

#

You

tired panther
#

It would send a message in another shard

#

but the embed message is not been sent

#
const suggestmessage = new Discord.MessageEmbed();
    suggestmessage.setTitle("A new Suggestion:");
    suggestmessage.setDescription(args.join(" "));
    suggestmessage.setAuthor(
      message.author.username + "#" + message.author.discriminator,
      message.author.displayAvatarURL
    );
    suggestmessage.setFooter(
      "ID: " + message.author.id + " Name: " + message.author.username
    );
    suggestmessage.setTimestamp();
client.shard.broadcastEval(
      `
            const sugchannel = this.guilds.cache.get('${sguild}').channels.cache.get('${schannel}');
            if (sugchannel) {
   
       
      sugchannel.send(suggestmessage)
true;
 }else {
false;
 }
`)
``` thats my code
earnest phoenix
#

You realize you're using ' instead of `

tired panther
#

hmm

earnest phoenix
#

I meant around the template literals

tulip ledge
tired panther
#

It can send in the right channel

earnest phoenix
#

OMEGALUL Wot

tulip ledge
#

how?

radiant vigil
upper elm
#

so I'm trying to add mongodb to my bot so i can keep currency values and stuff whenever I update the bot

const {Schema, model} = require('mongodb');

const Guild = Schema({
    id: String,
    prefix: {
        default: ']',
        type: String
    }
});
``` so I do this, and I get `TypeError: Schema is not a function` (djs)
tulip ledge
#

if(message.author.id !== id) return;

upper elm
#

How can I make a command available to only one person? I program in discord.js
@radiant vigil if (msg.author.id === 'id of person you want here')

tired panther
chilly bison
#
if(message.author.id !== "138029731655188480") return message.reply("go to hell");
tired panther
#

@tulip ledge

chilly bison
#

@radiant vigil ^^

earnest phoenix
#

Schema is a constructor not a function @upper elm

tulip ledge
#

u need to do new Schema

tired panther
#

No one any idea?

upper elm
#

ok thanks

tulip ledge
#

like we said earlier... ur using ' instead of backticks

upper elm
#

wow

#

TypeError: Schema is not a constructor

radiant vigil
#

Thanks @chilly bison and @upper elm

upper elm
#

np

chilly bison
#

np

#

ez

tulip ledge
#

I was literally the first one to give him the answer .--.

#

Where's my thank you?

upper elm
#

lmao

#

oof

chilly bison
#

oh yeh lol

#

@tulip ledge thank you

tulip ledge
#

ight I'm getting distracted again I should go study history

chilly bison
#

on behalf of him'

tulip ledge
#

cartography.....

upper elm
#

alr chickendev gl on whatever test or whatever

earnest phoenix
upper elm
#

ok

#

so do i have to install mongoose? what's the difference, and do i need mongodb

#

sorry for all the questions

earnest phoenix
#

mongodb is a dependency used by mongoose

upper elm
#

ooh ok

tired panther
#
client.shard.broadcastEval(`
const sugchannel = this.guilds.cache.get('${sguild}').channels.cache.get('${schannel}');
if (sugchannel) {
   
       
sugchannel.send(suggestmessage)
true;
}
else {
false;

}
`)
```How do i access suggestmessage when it is not in the ` ``?
boreal iron
tulip ledge
#

yes ur code style is weird to me

boreal iron
#

But way faster

tulip ledge
#

forEach(function()) why not an arrow function?

tired panther
#

Nobody knows sharding?

boreal iron
#

huh I said don't use foreach

tulip ledge
#

Oh shit it is

#

Guess I'll use that lol

boreal iron
#

I said I'm too lazy to write for loops but updated my post

tulip ledge
#

I'm gonna clean it up a lil tho

boreal iron
#

Array mapping and finding will cycle the whole array always, mines will break if id match is done

tulip ledge
#

u can use the break keyword in if statements? Nani o.O

#

I thought it was only for switch case

boreal iron
#

Oh... yeah and I missunderstood your array actually are the items, that's why there was an error in version 1

sharp thicket
#

@tulip ledge no

tulip ledge
#

ye I noticed too

sharp thicket
#

i dont think so at least

boreal iron
#

nope, there's a for loop before

tulip ledge
#

oh

#

I see

sharp thicket
#

what @boreal iron ??

boreal iron
#

break, breaks the first loop

sharp thicket
#

bruh

#

break is used in switch()

#

so it only executes the code for one case

earnest phoenix
#

@tired panther js client.shard.broadcastEval(`(() => this.channels.cache.get(${schannel}) ? this.channels.cache.get(${s.channel}).send(${suggestmessage}) : null)()`);

tired panther
#

for what is the ? @earnest phoenix

sharp thicket
#

huh

boreal iron
#

welp another PHP flashback then, it used to be an alias there

tulip ledge
#

its a ternary operator

sharp thicket
#

its like an if statement @tired panther

earnest phoenix
#

Conditional operator to check if the channel is available on that shard

tulip ledge
#

<statement> ? if true do this : if false do this

tired panther
#

let me try

chilly bison
#

@tulip ledge history AngryNordVPN

#

lol

tulip ledge
#

yup getting distracted again .--.

boreal iron
#

But it doesn't matter, since does what is suppost to do

tulip ledge
#

I hate history so much tho... Why can't they just give me computer science

#

I hate how belgium doesn't give computer science untill u go to college or uni

tardy hornet
#

i have a snipe command, and i want it to put in the .setAuthor the user that sent the message that got deleted.

tulip ledge
#

like the computer science we get now is word and excel ....

earnest phoenix
#

Computer science is poggers and nothing else

boreal iron
tulip ledge
#

yeah I didn't see the for loop there

#

It's odd tho

boreal iron
#

break; is used in any loop

earnest phoenix
#

No

boreal iron
#

"can be"

tulip ledge
#

Why does that break break the first for loop and not the one it's nested in?

boreal iron
#

nope, the one it's nested in, not the first one

#

that would be break 2;

tulip ledge
#

oh u said it broke the first for loop

boreal iron
#

huh did I?

earnest phoenix
#

break 2?

boreal iron
#

maybe not spelled correctly

sharp thicket
#

@boreal iron i dont watch yt vids

boreal iron
#

shame on me

tired panther
#

*@Voltrex Master#0001* I am so thank full u solve by problem which i stuck for 4 hours

earnest phoenix
#

Np

sharp thicket
#

thats outdated prob @boreal iron

tulip ledge
#

stop distracting me D:

modest smelt
#
@client.command()
async def leaderboard(ctx):
  with open('pointspotd.json', 'r') as json_file:
    lead = json.load(json_file)
  embed = discord.Embed(title = "Leaderboard", description = "This the leaderboard in The Calt Server.")
  for item in sorted(lead.items(), reverse=True, key = lambda p: p[1]): 
    idofuser = int("{0}".format(*item))
    points = int("{1}".format(*item))
    user = client.get_user(idofuser)
    embed.add_field(name = f"{user.mention}", value = f"Points: {points}", inline = False)
  await ctx.send(embed = embed)
```Do you know what is wrong with this?
Nothing is sending, no errors.
boreal iron
#

huh yeah, said something different than I meant lol

earnest phoenix
#

idk py sorry

boreal iron
#

happens

sharp thicket
#

for(var i = 0; i < 10; i++){
//loop code
}

earnest phoenix
#

My name is a fact

#

Always has been 🔫

vernal rivet
#

very

boreal iron
#

thats outdated prob
@sharp thicket What's outdated?

earnest phoenix
#

OMEGALUL What are you guys even talking about

vernal rivet
#

thats my question as well

boreal iron
#

I don't even know myself pogey

sharp thicket
#

the break; in an if statement

earnest phoenix
#

What

vernal rivet
#

"

#

:

boreal iron
#

The break is still inside the loop

vernal rivet
#

its technically correct

#

but you usually don't use it in a for loop

tired panther
#

@earnest phoenix did not work xD
I incidently ran my alpha bot, which does not have sharding

  ```js
client.shard.broadcastEval(

(() => this.channels.cache.get(${sguild}) ? this.channels.cache.get(${schannel}).send(${suggestmessage}) : null)())```

sharp thicket
#

run it on the one that has sharding

tired panther
#

error:

SyntaxError: Unexpected identifier
    at Client._eval (C:\Users\shahn\3D Objects\Botcode\sharding\node_modules\discord.js\src\client\Client.js:391:17)
    at ShardClientUtil._handleMessage (C:\Users\shahn\3D Objects\Botcode\sharding\node_modules\discord.js\src\sharding\ShardClientUtil.js:185:82) 
    at process.emit (events.js:327:22)
    at emit (internal/child_process.js:876:12)
    at processTicksAndRejections (internal/process/task_queues.js:85:21)
sharp thicket
#

🤦‍♂️

vernal rivet
#

?

tired panther
#

this error comes

sharp thicket
#

yes u revealed r name

boreal iron
#

but you usually don't use it in a for loop
@vernal rivet Usually not, but if you have one (need) match only, break will end the loop which dramatically decreases your script runtime

vernal rivet
#

you put your code in a string. why ;-;

#

yes

#

i know what break does

sharp thicket
#

lol

tired panther
#

so whats the problem?

boreal iron
#

You but Korabi still wonders about it

sharp thicket
#

maybe ur bot does not have sharding

vernal rivet
#

code in string = me sad

tired panther
#

@sharp thicket it has sharding , indeed

sharp thicket
#

@boreal iron im not really ok cuz of personal life

#

well can you read your error?

tired panther
boreal iron
#

huh ok, so you got it now? it's basically correct all I wanted to say

sharp thicket
#

well can you read your error?
@sharp thicket

tired panther
#

but I can not conclude any thing

earnest phoenix
#

Also the break is not needed at all

sharp thicket
#

yes

#

use

#

i++

#

or whatever var name is

vernal rivet
#

break; just exits out of the scope. it similar to return, but doesn't return a type, and doesn't actually exit out of the method/function shrug you usually don't need to use it that often

earnest phoenix
#

Not related

vernal rivet
#

i use ++i, and i am cool dogekek

boreal iron
#

The break is not needed, but if(i == 3) break; it would be

tired panther
#
 client.shard.broadcastEval(`(() => this.channels.cache.get(${sguild}) ? this.channels.cache.get(${schannel}).send(${suggestmessage}) : null)()`)
``` thats the code and then the erorr comes, [#development message](/guild/264445053596991498/channel/272764566411149314/)
sharp thicket
#

well can you read your error?
@sharp thicket

boreal iron
#

U still quote urself lol

tired panther
#

yes the link ⤴️

sharp thicket
#

i know

vernal rivet
#

but why is it in a string? does broadcastEval require a string?

earnest phoenix
#

@tired panther js client.shard.broadcastEval( `(() => this.channels.cache.get("${sguild}") ? this.channels.cache.get("${schannel}").send("${suggestmessage}") : null)()`);

tired panther
#

yes

earnest phoenix
#

Try

#

@vernal rivet Evaluations require a string as a parameter

#

It iterates through all shards with the same thing

vernal rivet
#

PandaSouless tbh thats stupid, but at the same time i guess it makes sense.

sharp thicket
#

yes

earnest phoenix
#

If that doesn't work i got a big brain idea