#development

1 messages · Page 992 of 1

opal plank
#

which OS you using?

#

im assuming its windows

elfin finch
#

@elfin finch you're trying to use forEach on something that either doesnt exist or was not found
@quartz kindle ? How do I fix it, do you need to see my index.js?

quartz kindle
#

yes

dusky mist
#

yes

#

windows

quartz kindle
#

spectral do you have a package.json in your repl.it?

dusky mist
#

yes

quartz kindle
#

does it have discord.js in dependencies?

dusky mist
#

yes

#

v11.4.2

opal plank
#

go into node_modules folder

#

check if discord.js is installed there

dusky mist
#

ok wait

elfin finch
quartz kindle
#

v11 is outdated

opal plank
#

though its highly unlikely that it'd have updated the package without installing it

#

even outdated though

#

his error points towards it not even being installed

dusky mist
#

can i change the depemdencies and put discord.js v12?

opal plank
#

no, uninstall the old version then install the new one

quartz kindle
#

if replit automatically installs dependencies on save, then yes

opal plank
#

npm uninstall discord.js

dusky mist
#

in cmd?

quartz kindle
#

@elfin finch one of your commands does not have aliases

elfin finch
#

Which one?

quartz kindle
#

idk

solemn latch
#

the one without any aliases

quartz kindle
#

if you want to know which one, console.log(f)

#

inside the jsfiles.forEach

hardy vector
#

https://hasteb.in/vajaleyi.js when i do _cc hello hi and try running _hello the custom command i created i recieve an error saying cannot send an empty message but on the GUI in mongo compass i can see it
im a mongo noob
sry

#

pls help

elfin finch
#

if you want to know which one, console.log(f)
@quartz kindle wait what, do i do that in terminal

quartz kindle
#

@hardy vector the problem is most likely in the code that runs the command

#

not the code that saves it

hardy vector
#

oh

quartz kindle
hardy vector
#
        this.on('message', async (message) => {
            const mentionRegex = RegExp(`^<@!${this.user.id}>$`);
            const mentionRegexPrefix = RegExp(`^<@!${this.user.id}> `);

            if (!message.guild || message.author.bot) return;

            if (message.content.match(mentionRegex)) message.channel.send(`My prefix for ${message.guild.name} is \`${this.prefix}\`.`);

            const prefix = message.content.match(mentionRegexPrefix) ?
                message.content.match(mentionRegexPrefix)[0] : this.prefix;

            if(!message.content.startsWith(prefix)) return;

            // eslint-disable-next-line no-unused-vars
            const [cmd, ...args] = message.content.slice(prefix.length).trim().split(/ +/g);

            const command = this.commands.get(cmd.toLowerCase()) || this.commands.get(this.aliases.get(cmd.toLowerCase()));
            if (command) {
                command.run(message, args);
            } else {
                custom.findOne({ Guild: message.guild.id, Command: cmd }, async(err, data) => {
                    if(err) throw err;
                    if(data) return message.channel.send(data.content)
                    else return;
                })
            }
        });``` i added the else statement on to execute the custom cmd
final summit
#

@hardy vector ur in all my servers😂

hardy vector
#

ok

dusky mist
#

oh i noticed that the problem was that node.js version was v6

#

now its solved

hardy vector
#

._.

dusky mist
#

ty tho

hardy vector
#

nodejs v6?

final summit
#

Nice

lusty quest
#

gg

elfin finch
#

@elfin finch
@quartz kindle so after jsfile.foreach i ad console.log(f) and it's gonna tell me which one is wrong?

quartz kindle
#

node.js v6 wtf

opal plank
#

v6?

#

isnt it on v12 rn?

dusky mist
#

yes lmao

lusty quest
#

its ancient

hardy vector
#

^

opal plank
#

holy shit

pale vessel
#

v14

dusky mist
#

it was a long time without using it

quartz kindle
#

@elfin finch it will show all commands loading in your terminal, the last one that shows up before the error is the culprit

elfin finch
#

ok thanks

quartz kindle
hardy vector
#

lmfao

long yew
#

can anyone help?

elfin finch
#

@elfin finch it will show all commands loading in your terminal, the last one that shows up before the error is the culprit
@quartz kindle it stopped at the first command lmao

long yew
#

i wanna make a command that if the user writes .pokemon it shows their pokemon for their user tag

#

from the mons.json file

quartz kindle
#

@elfin finch so open the first command and check if it has aliases

#

if it doesnt, give it some

#

@long yew i already told you how to do it

#

what are you stuck on?

long yew
#

starting it

quartz kindle
#

that doesnt help

#

show code

elfin finch
#

if it doesnt, give it some
@quartz kindle How do i give it some (sorry for the spam im new to this)

quartz kindle
#

your code is doing pull.config.aliases.forEach

long yew
#
case 'pokemon':mmbr```
#

that is all i did

#

so far

quartz kindle
#

which means, pull is the command file. and inside the file it looks for a config property

elfin finch
#

you want me to put pull.config.aliases.forEach on all of the commands?

quartz kindle
#

and inside the config property, its looking for an aliases array

visual brook
#

Someone knows any free Glitch alternatives? repl.it

long yew
#

@quartz kindle is it correct so far?

quartz kindle
#

so your code is expecting all your command files to have something like module.exports.config = { aliases: [a,b,c] }

#

or something similar @elfin finch

#

show what your command has

#

@long yew i assume the switch case is for commands, right? so "pokemon" is the command used

long yew
#

yeah

quartz kindle
#

a switch case works like this:

elfin finch
quartz kindle
#
switch(command) {
  case "a":
    run
    the
    command
    code
    here
    break;
  case "b":
    let bla = something;
    message.channel.send(bla);
    break;
  case "c":
    ... etc
    break;
  ...
}
#

@long yew

long yew
#

o

quartz kindle
#

so under the pokemon case, you get the contents of the json file, get the data from the user id, and send the data, then break;

#

each case is the full code for that specific command

long yew
#
switch(command) {
    case 'pokemon'
     break;
    case "b":
      let bla = something;
      message.channel.send(bla);
      break;
    case "c":
      ... etc
      break;
    ...
  }
#

idk what else to change

switch(command) {
    case 'pokemon'
     break;
    case "b":
      let bla = something;
      message.channel.send(bla);
      break;
    case "c":
      ... etc
      break;
    ...
  }

@long yew

quartz kindle
#

....

#

that was just an example

long yew
#

lol

#

ik

#

idk how

#

to use that

quartz kindle
#

how do you send messages?

elfin finch
#

@elfin finch see
@quartz kindle yes i do see it

solemn latch
#

didnt you swap to a command handler anyway?

quartz kindle
#

@elfin finch your config object has name, description, usage and accessableby

#

but has no aliases

elfin finch
#

oooh

quartz kindle
#

and your code is looking for aliases

elfin finch
#

mhm

#

so i add alisases to the cinfig

quartz kindle
#

yes

#

as an array

#

aliases:[]

elfin finch
#

so i put that at the end of configs? thanks

plucky harness
#

my question is related to sql. i have duplicate values in table the id of them being same. i want to use update command to increase the values of subsequent duplicate values by 1. by that i mean ``id name

#

1 ,uchiha

#

1,uchiha

#

but i want 1 uchiha , 2 uchiha

#

i am bad at explanation

solemn latch
#

AUTO_INCREMENT

#

is what you want

lusty quest
#

set a field to ID and set it to AUTOINCREMENT (SQLITE) and as Primary_KEY

plucky harness
#

the problem is the data already exists with duplicates

lusty quest
#

the auto increment will generate a new ID for every item and Primary_KEY will make it unique

elfin finch
#

aliases:[]
@quartz kindle ok so i just put that at the end of module.exports.config = {

lusty quest
#

(also makes sense to set the id as primary key)

quartz kindle
plucky harness
#

would it work with data which already exists

lusty quest
#

only with new data if you edit the field in the Database

quartz kindle
#

is it sqlite or mysql?

plucky harness
#

what about existing one

lusty quest
#

(there is probably a way for existing data but idk)

quartz kindle
#

or other

plucky harness
#

its postgre

quartz kindle
#

ah

plucky harness
#

the synatx is same though

#

syntax

quartz kindle
#

i asked because sqlite has a hidden _rowid column you could use

#

but not postgre afaik

long yew
#
switch(command) {
    case 'pokemon':
      let pokemon = mons[`${message.author.id}`] = []
      message.channel.send(pokemon);
      break;
  }
})
``` @quartz kindle what is wrong?
plucky harness
#

row_id?

lusty quest
#

export the data then update the database and import it back in and hope it works

quartz kindle
#

@long yew very good you almost did it

#

the = [] part is wrong

#

mons[message.author.id] will return ["pokemon","names","here"] which is an array of pokemons

plucky harness
#

what i did is

#
FROM  
(
    SELECT row_number() over (partition by userid order by userid) AS rn,userid,character
    FROM userdata
) AS idek
where userdata.character = idek.character and userdata.userid = idek.userid```
quartz kindle
#

now to send it as a message you need to join them

long yew
#

ok

quartz kindle
#

so just add .join(", ")

elfin finch
plucky harness
#

but that thing is assigning same id to duplicate values

long yew
#
switch(command) {
    case 'pokemon':
      let pokemon = mons[`${message.author.id}`] = ["pokemon","names","here"]
      message.channel.send(pokemon);
      break;
  }
})``` @quartz kindle so is this correct?
quartz kindle
#

no

plucky harness
#

like 1 = batman,1= batman, 3= superman. although its not assigning the 2nd value

quartz kindle
#

@long yew

mons[message.author.id] will return ["pokemon","names","here"] which is an array of pokemons

#

which means, i am explaining what the value contains, not telling you what to do

elfin finch
quartz kindle
#

@elfin finch show what you did

elfin finch
#
    name: "ban",
    description: "Bans a Users",
    usage: "-ban",
    accessableby: "Admins",
}```
#

i did that and aliases is no longer undefined

#

but forEach is

quartz kindle
#

....

#

no

#

you add

#

an aliases field

#

to the object

#
{
  bla:bla,
  bla2:bla2,
  aliases:[]
}
long yew
#

hmmmmmmmmmmm

quartz kindle
#

@long yew do you know what is an array?

hazy sparrow
long yew
#

yeah

#

well

#

kinda

quartz kindle
#

this is an array: [a,b,c]

#

this is a string: "abc"

#

you cannot message.channel.send([a,b,c]) but you can message.channel.send("a,b,c")

pale vessel
quartz kindle
#

in order to convert an array into a string, you use the .join() function

earnest phoenix
#

lmao

long yew
#

ok

earnest phoenix
#

why use an or operator there?

quartz kindle
#

for example if you do [a,b,c].join(", ") it is converted to "a, b, c"

#

your mons[userid] is an array

pale vessel
#

@earnest phoenix no, why another if statement that does the same thing as the first one

earnest phoenix
#

@earnest phoenix no, why another if statement that does the same thing as the first one
@pale vessel and that

long yew
#
switch(command) {
    case 'pokemon':
      let pokemon = mons[`${message.author.id}`] = [].join(", ")
      message.channel.send(pokemon);
      break;
  }
})``` correct?
quartz kindle
#

so in order to send mons[userid] you need to use mons[userid].join(", ")

long yew
#

hmm

#
switch(command) {
    case 'pokemon':
      let pokemon = mons[`${message.author.id}`].join(", ")
      message.channel.send(pokemon);
      break;
  }
})
```correct?
tulip ledge
#

yes

earnest phoenix
#

why dont react?

@client.command()
async def reaccionar(ctx, *, arg):
    if arg == 'bien':
        new_msg = await ctx.send("Bien")
        await new_msg.add_reaction("721174526930714634")
    if arg == 'mal':
        msg_new = await ctx.send('Mal')
        await msg_new.add_reaction("721174460073377804")
quartz kindle
#

@hazy sparrow you have an extra } at the end

long yew
#

i got that error

tulip ledge
#

Read the error

long yew
#

i did

tulip ledge
#

You did not

slender thistle
#

@earnest phoenix You're not passing an actual emote

long yew
#

ik

#

i don't understand it

tulip ledge
#

command is not defined

earnest phoenix
#

Let's help some people's slonk

quartz kindle
#

how did you define command?

long yew
#

i didn't

quartz kindle
#

then thats the problem?

tulip ledge
earnest phoenix
#

@quartz kindle how you got certified developer

long yew
#

what do i define it to?

quartz kindle
#

filled up some forms

earnest phoenix
#

Let command = any you want

quartz kindle
#

you have to extract the command from the message content

earnest phoenix
#

@slender thistle what?

quartz kindle
#

the same way you did it for your other commands

long yew
#

um

earnest phoenix
#

@quartz kindle if we get bot developer tag then we get certified developer

slender thistle
long yew
slender thistle
quartz kindle
#

@earnest phoenix ^

earnest phoenix
#

Ok

#

Thanks

#

**Certification is currently closed. We are actively working to make an improved system to benefit developers

**

#

Lol

#

@long yew is command not _command

long yew
#

ik i was just wondering

earnest phoenix
#

or change de switch(command) yo switch(_command)

hazy sparrow
#

@hazy sparrow you have an extra } at the end
@quartz kindle at line 24?

earnest phoenix
#

ok

long yew
#

@earnest phoenix what should command =?

quartz kindle
#

@hazy sparrow 22, 23 or 24, one of those is extra, you can remove whichever you want

tulip ledge
#
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
hazy sparrow
#

Ngl thanks

earnest phoenix
#

How's it possible to like make functions that extends from Guild.members?
For example like
message.guild.members.Newest()

#

ynot

tulip ledge
#

guild.members.newest() = code

earnest phoenix
#

Does that even work

#

that wouldnt work

tulip ledge
#

No?

quartz kindle
#

@earnest phoenix you can use prototypes, but the official discord.js way is to use Structures.extends

tulip ledge
#

I know you can edit client objects not sure if you can edit that

earnest phoenix
#

^

quartz kindle
#

i'll show you an example

earnest phoenix
#

K

solemn latch
#

this seems useful

earnest phoenix
#

I don't know why it's happening

long yew
#

Tim

#

so

earnest phoenix
#

@earnest phoenix show your 1369th line

long yew
#

when i write .pokemon

#

it displays them in command handler

earnest phoenix
#

@earnest phoenix I understand.. client.permLevel function xd

#

Lol

long yew
#

Tim u know why?

quartz kindle
#

@earnest phoenix actually nvm, managers are not extensible structures

#

ill show an example for both then

earnest phoenix
#

Oh k

long yew
#

can anyone help?

earnest phoenix
#

@long yew problem?

long yew
#

when i write .pokemon
it displays them in command handler

#
switch(command) {
    case 'pokemon':
      let pokemon = mons[`${message.author.id}`].join(", ")
      message.channel.send(pokemon);
      break;
  }
})```
earnest phoenix
#

That's console not command handler btw

long yew
#

that is my code

#

oh yeah lol

earnest phoenix
#

sa

#

As

#

nbr

scarlet dragon
#

@earnest phoenix Glitch adlı siteden botu kodlıyıp VDS lerden aktif tutuyorum.

earnest phoenix
#

@gleaming glen Bu kanalda Türkçe konuşmak yasak değil miydi?

#

@scarlet dragon vds kaç para

lost herald
#

is there a way to have a general catch in a python file where if an error happens it runs that to send the error to a channel

scarlet dragon
#

@earnest phoenix Değişiyor

earnest phoenix
#

@gleaming glen abi

slender thistle
#

try-except

gleaming glen
#

NO turkish here tho

#

😩

earnest phoenix
#

@scarlet dragon sninki kaç par

quartz kindle
#

@earnest phoenix ```js
// extend an "extensible" structure (these include Message, Member, User, Guild, Channel, Role, etc...)
Discord.Structures.extend("Message", whatever => {
return class Message extends whatever {
xyz() {
return this.content + "zyx";
}
}
});

// extend a manager (extending a manager must be done BEFORE creating a discord client)
Discord.GuildMemberManager.prototype.newest = function() {
return this.cache.sort((a,b) => b.joinedTimestamp - a.joinedTimestamp).first();
}

scarlet dragon
#

@earnest phoenix 60

lost herald
#

yeah but i cant put a try except inside a try

slender thistle
#

why not

earnest phoenix
#

mine is ₺120

lost herald
#

cuz thing says no

slender thistle
#

Also what

lost herald
#

i can try it

earnest phoenix
#

@quartz kindle oh thanks tim, i completely understand it now

slender thistle
#
>>> try:
...     5
...     try:
...             3
...     except:
...             6
... except:
...     4
...
5
3
#

Nesting them works just fine

solemn latch
#

yeah, thats actually super useful tim

earnest phoenix
#

Thanks to tim as always lol

solemn latch
#

im totally doing that for adding/removing/checking balance of users

wheat valve
#

How do you get the amount of server boosts a server has using discord.js

earnest phoenix
#

...

lyric mountain
#

read the docs

quartz kindle
#

im using the prototype method to basically rewrite half of discord.js

earnest phoenix
#

Lol

tulip ledge
#

Mmmh Tim your code I just added it to my code and it sais that it can't send an empty message 🤔

quartz kindle
#

wut

tulip ledge
#
const Discord = require("discord.js");
Discord.GuildMemberManager.prototype.newest = function() {
  return this.cache.sort((a,b) => {b.joinedTimestamp - a.joinedTimestamp}).first();
}
const client = new Discord.Client();
#

message.channel.send(message.guild.members.newest())

earnest phoenix
#

200 iq

#

457897589439583 iq

tulip ledge
#

?

quartz kindle
#

@tulip ledge well, newest should return a Member object

#

you cant send an entire object

tulip ledge
#

Oh

#

Thats why

#

Wait no a whole member object is @tulip ledge right

quartz kindle
#

also, if you put {} around b and a you have to return it

tulip ledge
#

?

quartz kindle
#

my bad lul

earnest phoenix
#

Tims big brain shrunk for a second

tulip ledge
#

(node:45496) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message

earnest phoenix
#

show code

quartz kindle
#

should be either (a,b) => b - a or (a,b) => { return b - a }

tulip ledge
#

newest().tag still gives empty message

quartz kindle
#

Members dont have tags?

earnest phoenix
#

^

#

@quartz kindle wait tim... So if i wanted to do something like
<Message>.content.<function> how would that be?
Like what am i supposed to extend? Or like i need to use a prototype on the Message.content?

#

newest().user.tag is what u need @tulip ledge

quartz kindle
#

Message.content is a string, so you'd need to extend the String prototype itself

earnest phoenix
#

Oh

tulip ledge
#

Ih yeah its a member

earnest phoenix
#

a member doesnt have a tag

#

but a member has a user property

#

K tim thanks

#

which has a tag

tulip ledge
#

(node:15716) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message 🤔

earnest phoenix
#

newest().tag is no
newest().user.tag is yes

tulip ledge
#
Index.js
const Discord = require("discord.js");
Discord.GuildMemberManager.prototype.newest = function() {
  return this.cache.sort((a,b) => b.joinedTimestamp - a.joinedTimestamp).first();
}
const client = new Discord.Client();

message.js
message.channel.send(message.guild.members.newest().user.tag)
earnest phoenix
#

wait what

#

try logging members.newest() to see what it is

tulip ledge
#

????

#

I had to end it

#

It was looping

solemn latch
tulip ledge
#

Oh nvm

#

I know why

earnest phoenix
#

if(message.author.bot) return;

tulip ledge
#
  console.log(message.guild.members.newest())
  message.channel.send(message.guild.members.newest().user.tag)
  // Ignore all bots
  if(message.author.bot) return;

Lul

earnest phoenix
#

let rolesNum = member.roles.cache.size.filter(r => r.id === "264445053596991498"); aint working :/

#

derku

#

You find

#

what the fuck did you think when writing that code

#

*use

tulip ledge
#

Tim is big brain boy

earnest phoenix
#

what the fuck did you think when writing that code
@earnest phoenix i think unicorns tbh

#

@earnest phoenix size is a number, not an array. remove the size thingy and u good

tulip ledge
#

.size waitWhat

earnest phoenix
#

k

#

also you can only get one element when searching for an id so you might aswell use member.roles.resolve(id) or member.roles.cache.get(id)

#

didnt work removing .size

#

whats your current code

pale vessel
#

did you add size

earnest phoenix
#

let rolesNum = member.roles.cache.filter(r => r.id === "264445053596991498")

lyric mountain
pale vessel
#

add size

earnest phoenix
#

@earnest phoenix so that will return an array with one element containing the role you want

#

is that what you wanted?

#

If yes, good

pale vessel
#

oh yeah lol

earnest phoenix
#

wait

pale vessel
#

why did they call it rolesNum

earnest phoenix
#

idk

#

no i want to get number of user roles but get rid of @everyone

lyric mountain
#

oh my

earnest phoenix
#

bruh

pale vessel
#

bruh

#

just role.id !== guild.id

lyric mountain
#

that's like, completely the oposite of what you're doing

tulip ledge
#

bruh x3

earnest phoenix
#

let rolesNum = member.roles.cache.size-1

lyric mountain
#

no

tulip ledge
#

Yes

lyric mountain
#

@everyone role has a different ID for each server

earnest phoenix
#

let rolesNum = member.roles.cache.size-1

tulip ledge
#

So you're doing -1

earnest phoenix
#

^

lyric mountain
#

most libs have a guild.publicRole

tulip ledge
#

Dude

pale vessel
#

everyone is just the guild id

tulip ledge
#

Constantin has better solution

pale vessel
#

but you can -1 if you're not going to view the values

tulip ledge
#

Just do -1

earnest phoenix
#

^^^^

lyric mountain
#

yes, I'm just pointing that getting everyone by ID ain't gonna work

#

I didn't say it was the best option

earnest phoenix
#

@earnest phoenix let rolesNum = member.roles.cache.size-1 do this and u will be fine

tulip ledge
#

yes it will

earnest phoenix
#

unless your cache somehow fucked itself

tulip ledge
#

By ID will work aswell

#

As flazepe pointed out everyone role === guild id

pale vessel
#

only if it's the guild's id

lyric mountain
#

no, hardcoded ID won't work for all guilds

earnest phoenix
#

@earnest phoenix let rolesNum = member.roles.cache.size-1 do this and u will be fine
@earnest phoenix mk

tulip ledge
#

oh u ment hardcoded

lyric mountain
earnest phoenix
#
return class Message extends MessageS{
Exceeds(Length){
return this.content.length > Length ? true : false;
}
}
})

message.Exceeds(1);```
`message.Exceeds is not a function`
![facepalm](https://cdn.discordapp.com/emojis/592992459450220544.webp?size=128 "facepalm")
pale vessel
#

MessageS?

earnest phoenix
#

"Message", MessageS <=

tulip ledge
#

Voltrex

#

I see you're using eval

earnest phoenix
#

Currently following tim's thing

tulip ledge
#

Like Tim said you need to define it before creating a client

earnest phoenix
#

That he showed

lyric mountain
#

oh my, indent that thing plz

tulip ledge
#

So

earnest phoenix
#

@tulip ledge that applies to a manager... Message isn't a manager

tulip ledge
#
const Discord = require('discord.js')
Discord.Structures.extend("Message", MessageS => {
return class Message extends MessageS{
Exceeds(Length){
return this.content.length > Length ? true : false;
}
}
})
const client = new Discord.Client();
#

Oh

#

I didn't know that

quartz kindle
#

extending a structure needs need to be done before the structure is used, so in case of messages, before you receive a message event

#

or it will only be applied to future message events

earnest phoenix
#

Oh so as Many messages get received as currently... So this extend of the structure must be done before the construction of the client?

#

Oh wait nvm i get what you mean... Well this can't be done on a simple eval

earnest phoenix
#

Why does this always return false?


if(!Length){
return "No length was included";
}

if(typeof(Length) !== "number"){
return "Included length isn't a number";
}

return this.length > parseInt(Length) ? true : false;
}

"What".Exceeds(100);```
unborn fulcrum
#

anyone know how I can pin a message that the bot just sent in a text channel when you run a command

#

with discord.js v12

earnest phoenix
#
whatever.pin()
});``` @unborn fulcrum
unborn fulcrum
#

ooo ty <3

digital ibex
#

dont use callbacks

#

use await, callbacks are very slow

pale vessel
#

don't think .then is a callback

earnest phoenix
#

@digital ibex actually no, both response times are same... Just both looks and works differently

pale vessel
#

it's equivalent to await

#

this is a callback```js
hello("yes", (error, res) => {

});```

digital ibex
#

yeah, but u can still use await there, and callbacks are not slow wym?

earnest phoenix
#

await and .then aren't callbacks

digital ibex
#

ik

earnest phoenix
#

They're promise resolvers

pale vessel
earnest phoenix
#

Oh i thought you was confused about the thing i said lol

digital ibex
#

oh wait

#

im dumb

#

oops

hardy vector
#

https://hasteb.in/adisutem.js
it does the role menu but then it crashes and gives me this error at Function.Module._load (internal/modules/cjs/loader.js:879:14)
(node:1704) UnhandledPromiseRejectionWarning: OverwriteModelError: Cannot overwrite ReactionRole model once compiled.
at Mongoose.model (C:\Users\kenra\Desktop\Frosty Rewrite\node_modules\mongoose\lib\index.js:524:13)

earnest phoenix
#

Does anybody know what could be causing the abortErrors? After a simple error?

smoky spire
#

It's an internal server error on discord's end

earnest phoenix
#

how can i use heroku with github?

honest perch
#

huh

heavy anchor
#

how can i use heroku with github?
@earnest phoenix I can explain in DMs

earnest phoenix
#

ok

unborn fulcrum
#

@earnest phoenix I have a similar question but its a little different, mind if I ask?

earnest phoenix
#

Yea

#

@smoky spire are you talking to me or

smoky spire
#

Yes

unborn fulcrum
#

so the question is, how can I add channel permission overwrites for a role that I just created

smoky spire
#

What lib

unborn fulcrum
#

discord.js v12

elfin finch
#
{
  bla:bla,
  bla2:bla2,
  aliases:[]
}

@quartz kindle so i add that inside that part?

unborn fulcrum
#

yea but thats for the general permissions

#

I would like it for a certain channel

smoky spire
#

Get the channel and use GuildChannel#createOverwrite

unborn fulcrum
#

@smoky spire I did that, but my issue is getting the role ID from the role name now

long yew
#

when i write .pokemon
it displays them in console

switch(command) {
    case 'pokemon':
      let pokemon = mons[`${message.author.id}`].join(", ")
      message.channel.send(pokemon);
      break;
  }
})```
smoky spire
#

Just resolve the promise of the create and you have the role object @unborn fulcrum

unborn fulcrum
#

@smoky spire how would I do that exactly?

unborn fulcrum
#

ty

final summit
#

Anyone help me making an api thing cuz iam new to python and i watched some videos and they are all about js or outdated

#

so if someone would help that would be awesome

#

lol

final summit
#

i need like help

#

i dont understand these tutorials

maiden mauve
#

"we lost a lot of good men out there"

final summit
#

like send me the code and explain or something @solemn latch thats what i needed

#

lol

solemn latch
#

that tutorial explains it

final summit
#

but i didnt understand it

#

:p

#

new to py

solemn latch
#

i dont use python

maiden mauve
#

@final summit if your new to programming you either have to learn from stage 1 or reverse engineer simple logic

solemn latch
#

and i understood it

#

also

final summit
#

@maiden mauve boring

#

ughhh

maiden mauve
#

but not knowing why things work is bad

slender thistle
#

Making API? Use Flask or Django

solemn latch
#

how did you read that much, its like a 20 minute read

final summit
#

i read this before

#

and tried myself

#

and it didnt work

solemn latch
#

What didnt work?

final summit
#

the whole thing

solemn latch
#

it didnt work means nothing

#

what was your error

maiden mauve
#

Hmm

#

first push to heroku since updating node/djs

#

and I'm getting a mess of start up errors

solemn latch
#

updating to djs 12?

maiden mauve
#

yeah

#

it runs fine on my local machine

solemn latch
#

a lot of structure changes

maiden mauve
#

are there process env requirements?

solemn latch
#

i wouldnt think any would have changed

maiden mauve
solemn latch
#

does ../errors exist?

maiden mauve
#

I'm thinking maybe the version didn't update in heroku some how

solemn latch
#

idk how heroku works tbh

maiden mauve
#

v12.18.1

#

hrm

pale vessel
#

is your repo private

maiden mauve
#

yes

opal plank
#

pls dont use heroku

#

or glitch

#

for your own sanity

maiden mauve
#

😮

opal plank
#

Heroku is (usually) fine for hosting a random website that won't be constantly getting requests, as it automatically puts the server to "sleep" when it doesn't receive any requests. If you try to do this with a bot, it won't receive any requests, it'll be put to sleep, and the websocket connection will be closed.

maiden mauve
#

It was the easiest thing to set up when I needed a web server

#

I've never had that issue

opal plank
#

like, actually dont use that

maiden mauve
#

in 6 months its never been unresponsive

unborn fulcrum
#

how would I delete a message if it was ever edited in a certain channel? Discord.js v12

opal plank
#

also another quote

maiden mauve
#

like

opal plank
#
  • Bots are not what the platform is designed for. Heroku is designed to provide web servers (like Django, Flask, etc). This is why they give you a domain name and open a port on their local emulator.

  • Heroku's environment is heavily containerized, making it significantly underpowered for a standard use case.

  • Heroku's environment is volatile. In order to handle the insane amount of users trying to use it for their own applications, Heroku will dispose your environment every time your application dies unless you pay.

  • Heroku has minimal system dependency control. If any of your Python requirements need C bindings (such as PyNaCl binding to libsodium, or lxml binding to libxml), they are unlikely to function properly, if at all, in a native environment. As such, you often need to resort to adding third-party buildpacks to facilitate otherwise normal CPython extension functionality. (This is the reason why voice doesn't work natively on heroku.)

  • Heroku only offers a limited amount of time on their free programme for your applications. If you exceed this limit, which you probably will, they'll shut down your application until your free credit resets.

solemn latch
#

^

maiden mauve
#

hah

solemn latch
#

just because you didnt have issues at one point, doesnt mean it wont cause issues later

opal plank
#

try to avoid glitch and heroku as much as possible

solemn latch
#

glitch is already doing what they can to get rid of discord bots, Heroku likely will do the same at some point, since your using them in ways that are unintented

maiden mauve
#

oh wow

opal plank
#

Usually your options are :
spending 5$ or less on a very cheap vps
asking a friend to host it for you on their pc
using a rapsberry pi or another low voltage hardware capable of running a bot
running on your pc and letting it on 24/7

#

for example, i installed linux on my old Wii that i had, running my bot there

#

runs rather smooth for being such an old piece of hardware

maiden mauve
#

I suppose I'll have to run it local til I figure this out

opal plank
#

you can run bots on old cellphones, laptops, old consoles, mostly all new tech is capable of doing that simple task

maiden mauve
#

yeah its a relatively small project with not a lot of demand

opal plank
#

should be fine then localhosting

#

you might wanna use an old hardware if you plan on shutting down your pc every now and then though

#

raspberry pi is a decent option

earnest phoenix
#

That's also the thing. There's no errors @lyric mountain

lyric mountain
#

discord.js I guess?

earnest phoenix
#

maybe 🤷‍♂️ but wouldn't anyone else be having the same issue then?

lyric mountain
#

"maybe"??

#

you're either using discord.js or not

#

anyway, how do you know it is not working?

earnest phoenix
#

yes im using discord js. Because I have it in my main server and it works. but my test server it's not

#

and it has all perms

opal plank
#

wait what

surreal notch
#

I wanted to make a random no. Cmd but the no. That already shown one time that should not come again. In discord.js v12

lyric mountain
#

ok, so you have a car that runs on gasoline during day and beef-power at night?

surreal notch
opal plank
#

i am so confused what the test server has to do with the lang you using

lyric mountain
#

let's go step by step

surreal notch
#

How you became bot dev @earnest phoenix

lyric mountain
#

what programming language are you using?

earnest phoenix
#

javascript

opal plank
#

good

lyric mountain
#

ok, nice

surreal notch
#

Lol

opal plank
#

next

#

which lang?

#

lib*

lyric mountain
#

now, what library?

earnest phoenix
#

discord js

surreal notch
#

Discord.js? And which version @earnest phoenix

pale vessel
#

kuuhaku setup wizard v1.0

lyric mountain
#

ok, looks good

#

now, for the last question

earnest phoenix
#

12

#

latest version

surreal notch
#

Nc

lyric mountain
#

what is the expected result vs the current result?

#

as in, what did you expect to happen that is not happening?

surreal notch
lyric mountain
earnest phoenix
#

I was expecting it to function in ALL servers. It's not. I have it in tow different servers. It works in one. Doesn't work in another

opal plank
#

this might make things a bit more easier

surreal notch
#

But that no. Should not come again

opal plank
#

bigbeef, do you use Visual Code Studio?

earnest phoenix
#

yeah

lyric mountain
#

Math.random is....well....random

opal plank
#

do you know what step debugging is?

surreal notch
lyric mountain
#

it MIGHT get the same result

#

but it's random

opal plank
#

he'll at least see if the code is firing when the triggers an event

earnest phoenix
#

for vsc

surreal notch
#

Ya it's random but I think it will repeat

opal plank
#

yes, for VSC

earnest phoenix
#

yep

lyric mountain
#

that's because random can give the same number again

#

that's how random works

opal plank
#

run the code on a debugger and set a breakpoint on the trigger line

lyric mountain
#

I was expecting it to function in ALL servers. It's not. I have it in tow different servers. It works in one. Doesn't work in another
@earnest phoenix what doesn't work?

#

the bot itself?

surreal notch
opal plank
#

usually on the beggining of your code that you are trying to run

earnest phoenix
#

Yes the bot itself. But i also have all my code to console log but nothing shows up

opal plank
#

to make sure the code is running. From what i've heard you arent getting an error

earnest phoenix
#

yep

opal plank
#

if youa rent getting an error, lets exclude the other possibilities

#

is the code even running?

earnest phoenix
#

yes

surreal notch
lyric mountain
#

no random emotes ultron

opal plank
#

either do step debugging or console.log('test') to make sure it is

earnest phoenix
#

i can use it 100% in one server

opal plank
#

not if the BOT is working on the server

#

if that COMMAND is triggering

earnest phoenix
#

i'm able to run commands as well

opal plank
#

lets say you have a command called ?ban, you should be running the console.log('test) into the ban.js file, or whetever you are running that command on

solemn latch
#

have you given your code yet?
specifically, the command handler pikathink

opal plank
#

if thats out of the way and you know the command is properly being triggered, use the step debugging every major step of your code with breakpoints, that'll tell you where the code is going rogue

#

if you still cant get it after that, post the code of the specific command you are trying to run on pastebin or some other bin website, then send link here

lyric mountain
#

pastebin hastebin

opal plank
solemn latch
#

a woo does rock

lyric mountain
#

have you assigned a subdomain just for that?

opal plank
#

lol

earnest phoenix
#

ok. be back soon

opal plank
#

aight

#

the one better than that is for the discord api status

solemn latch
#

lol

opal plank
#

thank sharon for that one, its hilarious

lyric mountain
regal raven
#

Hmm

kind wharf
#

lol

#

domain or what ? @solemn latch

solemn latch
#

yeah

#

its a domain

kind wharf
#

noice

#

kinda clean domain

opal plank
regal raven
#

Lol

opal plank
#

welcomer 101 client.on('GuildMemberAdd', () ) message.reply('welcome!');

#

done, welcomer, gimme 5$

opal plank
#

can u check not.erwin ?

solemn latch
#

is erwin a tld?

opal plank
#

not sure

solemn latch
opal plank
#

fuck me those are expensive

#

ey thats not too bad

solemn latch
#

i found an amazing domain

#

that i am going to buy now

opal plank
#

what is it?

solemn latch
#

awh

#

nvm

#

one site said $3

#

wouldnt let me buy

#

all the other sites say $600+

#

woo.win

small prairie
#

This error even tho there is a parent

#

it works when im manually using lock perms from eval command

#

and im using await to create the channel and then set it category to a channel and then lock it.

#

its creating and setting parent alright

#

but errors on the third part

#

it shouldnt do that since its await....... right?

#

(this command was made in v11
I changed it to v12
Just the cache and manager thingies
Could something in update have broken it?)

earnest phoenix
#

Figured it out. Thanks whoever helped me. I'm still learning

opal plank
#

me?

earnest phoenix
#

Thank you @opal plank

#

yes

opal plank
#

ey man, anytime

#

😉

hardy vector
#

https://hasteb.in/adisutem.js
it does the role menu but then it crashes and gives me this error at Function.Module._load (internal/modules/cjs/loader.js:879:14)
(node:1704) UnhandledPromiseRejectionWarning: OverwriteModelError: Cannot overwrite ReactionRole model

#

pls help me

earnest phoenix
#

ok, how would one make a Confirmation message on a command ? are you sure you want to do this? etc etc

pure lion
#

@hardy vector what are you trying to do?

hardy vector
#

make a reaction role cmd

amber fractal
#

@earnest phoenix in what lib

earnest phoenix
#

py

hardy vector
#

but when i do that cmd it makes the menu and reacts to it but then it crashes and gives me that error

pure lion
#

@earnest phoenix not entirely sure, await the message author to send a message, check if it's the conformation and then execute shit

pure lion
#

Idk if py has await

#

H

amber fractal
#

define a check function that will check the author id

pure lion
#

but when i do that cmd it makes the menu and reacts to it but then it crashes and gives me that error
@hardy vector lib/code?

amber fractal
#

They have some nice examples

hardy vector
#

JS/i linked code

earnest phoenix
#

it's a Guild.owner only command, i'll check it out rq, tyy

hardy vector
#

@pure lion uh did you figure it out?

#

or no

elfin finch
#

Can someone help me? My clear command works but my kick,ban and meme command don't

pure lion
#

JAJAJAJAJAJAJAJAJ MY JSON FILES CORRUPTED

#

@elfin finch lib/code

#

@hardy vector in a sec

sudden geyser
#

how'd you pull it off

elfin finch
#

here

hardy vector
#

k

#

np

earnest phoenix
#

i really hate reaction work 😂

lyric mountain
#

?

earnest phoenix
#

trying to get the bot to send a Confirmation message before running the command..

solemn latch
#

use a message collector

lyric mountain
#

ah, reaction buttons

pure lion
#

@elfin finch what is img?

elfin finch
#

@elfin finch what is img?
@pure lion ?

earnest phoenix
#

R0taCry why cant this just be easy for my small brain

lyric mountain
#

d.js?

elfin finch
#

the bot does go online

#

it's just those commands no work

pure lion
#

@pure lion ?
@elfin finch reddit

clever tree
#

Could someone help me pls?
I have a problem .content returns : undefined
and response returns:
content: 'no', at one point.

var response = await message.channel.awaitMessages(message2 => message2.content === "yes" || message2.content === "no", {
                        maxMatches: 1,
                        time: 300000,
                        errors: ['time']
                    });

                    console.log(response)

                    console.log(response.content)
elfin finch
#

@elfin finch reddit
@pure lion yes?

pure lion
#

response.content

#

?

#

@pure lion yes?
@elfin finch what is img

elfin finch
#

img - image

clever tree
#

@pure lion Now its the right code xd

pure lion
#

But from what?@elfin finch

solemn latch
#

isnt using awaitmessages blocking pikathink

elfin finch
#

But from what?@elfin finch
@pure lion idk

pure lion
#

IMG needs to be defined

elfin finch
#

isnt it tho

clever tree
#

@solemn latch What do u mean

solemn latch
#

nothing nvm, its not

clever tree
#

xd

solemn latch
#

blocking just means nothing else can happen until its done

pure lion
#

@elfin finch nope

elfin finch
#

oh, how do i define it then (im a nooby coder, sorry for the simple questions)

pure lion
#

Uhhh

#

Get the subreddit image?

pale vessel
#

@clever tree isn't response a collection of messages?

pure lion
#

Assuming that's what it is

pale vessel
#

did you try response.first()?

elfin finch
#

Get the subreddit image?
@pure lion Huh?

clever tree
#

@pale vessel Oh. I will try it out wait.

elfin finch
#

how

pure lion
#

Pass the name of the Reddit const through functions at the top

#

Or include it at the top

clever tree
#

@pale vessel thx ;)

pure lion
#

*sit in the corner cradling legs*

elfin finch
#

uuuhh

#

huh

pure lion
#

@elfin finch in the Reddit command file, make a const and require the Reddit npm

elfin finch
#

how do i download the reddit npm

#

is it npm i reddit

pure lion
#

Omg

#

Istg

#

How are you getting the subreddit

elfin finch
#

uuuh

#

*sparks flying

#

idk

pure lion
#

.-.

#

*dying*

pure lion
#

Oh yeah forgot about you

hardy vector
#

:((

pure lion
#

I'll have a look

#

Sorry :(((

elfin finch
#

*dying*
@pure lion that makes sense but why arent the ban and kick commands working

pure lion
#

@hardy vector uh, the bot can react with custom emojis

#

Just sayin

#

Just ask for an emoji ID

hardy vector
#

ik but thats not my problem

pure lion
#

Okay wait

elfin finch
#

huh?

lyric mountain
#

if you want u can take a look at my pagination lib, it's written in java but might help u figure out how to make yours work

pure lion
#

Big sure, @hardy vector, is it in the docs?

elfin finch
#

@elfin finch in the Reddit command file, make a const and require the Reddit npm
@pure lion i downloaded the reddit npm, why it still no work tho

solemn latch
pure lion
#

I'm literally

elfin finch
#

am i that dumb

pure lion
#

Learn how npm works please

#

Not dumb, you'll know soon

elfin finch
#

but i did get the reddit npm

final summit
#

BRUH npm init

#

Then npm i discord.js

lyric mountain
#

bro tip: use yarn

pure lion
#

@elfin finch IDK, DID YOU?

final summit
#

Then npm i random

pure lion
#

:h:

final summit
#

then make an index

#

. Js

#

Ez

elfin finch
#

@elfin finch IDK, DID YOU?
@pure lion yeah i typed "npm i reddit" into terminal

pale vessel
#

why don't you just use their json response

pure lion
#

Did it install?¿

pale vessel
#

not sure what you want to do with the API though

elfin finch
#

yes it did install

pure lion
#

Epiccccc

elfin finch
#

and?

pure lion
#

In the Reddit file

#

Wait

#

Do you know how to use the Reddit npm?

solemn latch
#

can you make me a 20 point presentation on it @pure lion

pure lion
#

Uh

#

Idk

#

Can I?

elfin finch
#

uuuuh

#

nooooyessno

#

no

pure lion
#

Also did you type exactly "npm i reddit"

#

You're so smart :D

earnest phoenix
#
@bot.command()
async def purge(ctx):
    if ctx.author == ctx.guild.owner:
       embed = discord.Embed(title=":warning: Warning! :warning:", description=("""Are you sure you want to purge this discords prefix?
       Once this servers prefix is purged there is no way of getting it back!"""), colour = discord.Colour(int('ffcc66', 16)))
       await ctx.send(embed=embed)```

Halp ![R0taCry](https://cdn.discordapp.com/emojis/672813458923978803.webp?size=128 "R0taCry")
elfin finch
#

Also did you type exactly "npm i reddit"
@pure lion thanks:D

pure lion
#

@earnest phoenix whats wrong

earnest phoenix
#

i don't know how to add reactions to that

#

💀

pure lion
#

await a message and then react to ir

#

Ir

#

It

#

Idk py tho, so that's all the help I can give rn

elfin finch
#

Also did you type exactly "npm i reddit"
@pure lion was i not supposed to tho

pure lion
#

Yes

#

Ifk

#

Idk

earnest phoenix
#

Fuqk

pure lion
#

Go to the npm website and search for Reddit

elfin finch
#

do i have to set up a const

#

Go to the npm website and search for Reddit
@pure lion i did and it still no work

pure lion
#

Okay yk what

elfin finch
#

what, i should shut up

#

right

pure lion
#

No

#

Lol

elfin finch
#

ok then what

pure lion
#

Look at this

elfin finch
#

yes thats the one i used

#

and i typed npm install reddit

#

into terminal

#

and it downloaded

pure lion
#

Okay then read the docs

#

And how to get subreddit images

elfin finch
#

ok thanks

pure lion
#

Np||m||

#

:)

elfin finch
#

lol

earnest phoenix
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Context' object has no attribute 'add_reaction'

#

i'm lovin' it

pure lion
#

Can I get help with quick.db

wicked pivot
#

hello every time I launch my bot the channelCreate event does this launch normally?

module.exports = async (bot, channel) => {
  if(channel.type === 'dm') return
  let guild = bot.channels.get("534738699628576780").guild
  let chan = `https://discordapp.com/channels/${guild.id}/${channel.id}`
  const entry = await guild.fetchAuditLogs({type: 'CHANNEL_CREATE'}).then(audit => audit.entries.first())
  user = entry.executor

  let embed = new RichEmbed()
  .setDescription(`
> Nom du salon crée : ${channel.name}
> Créé par : ${user}
> ID : ${channel.id}
> Description : ${channel.topic}
> [Aller vers le nouveau channel](${chan})
  `)
  .setColor('#14EB39')
  .setTimestamp()
  .setFooter(`Logs serveur ${guild.name} `)
  WebBlock.send('', {
    username:"Juzoo logs (Channel Create)",
    avatarURL: bot.user.avatarURL,
    embeds:[embed]
  })
}```
#

(v11)

solemn latch
#

i dont understand the question 🤔

earnest phoenix
#

all i got was "every time i launch my bot the channel create function - - - - - "

pure lion
#

Can I get help with quick.db
Pleeeease? :3

wicked pivot
#

how to say, when i launch my bot it is supposed to execute that event ready?

solemn latch
#

you want it to run on startup?

pure lion
#

Does anyone know quick.db :sad:

wicked pivot
#

no no actually, when I launch the bot everything works fine except that it executes the channelCreate event on some channels when no channel is created

earnest phoenix
#

sooo? it creates a channel ?

#

when its launched ?

pure lion
#

I think my brain is going to fall out

earnest phoenix
#

mood

wicked pivot
#

no it does not create any channel just it logs channelCreate while nothing is created

pure lion
#

No lynx, it gets the log of when a channel was created

solemn latch
#

you want it to run on client.on(create_channel ?

wicked pivot
#

I can't make myself understood let it fall

pure lion
#

Woo can you quickdb? I need help

solemn latch
#

i use mysql pikathink

pure lion
#

:sad:

solemn latch
#

whats the error?

wicked pivot
#

I already use quick.db what do you need?

pure lion
#

Wait gimm a sec

#

When someone runs a command I wanna write a string to a db

cerulean lake
#

Can someone teach me how to make a python bot music please. No good tutorials out there are working for me. most of them are unclear or fuzzy videos. and mostly outdated. just dm me if you can help me or ping me here pleeease

earnest phoenix
#

you cannot use youtube tutorials

cerulean lake
#

wdym

#

most of them are fuzzy or unclear

earnest phoenix
#

they're simply outdated and not up to standards

cerulean lake
#

the yt vids

wicked pivot
#

I never use quick.db for this use I doubt I can help you I even doubt that this is possible Detente_ref

cerulean lake
#

ya thats y i asked for someone to teach me

earnest phoenix
#

something as complex music/audio requires a lot of programming knowledge including byte manipulation and buffering

#

no one will teach you for free

solemn latch
#

it looks like you just set it using add @pure lion

earnest phoenix
#

you can teach yourself though

solemn latch
cerulean lake
#

what about making a basic bot?

pure lion
#

@solemn latch but I got errorz

#

what about making a basic bot?
@cerulean lake start with a ping command.

earnest phoenix
cerulean lake
#

can someone teach me how to make a basic bot

pure lion
#

No

cerulean lake
#

:l

pure lion
#

You're a big boy

cerulean lake
#

IDK how

pure lion
#

You can do this

#

Read docs

earnest phoenix
#

my bot isnt starting up

cerulean lake
#

I do

#

I tried 10 tutorials none work

earnest phoenix
#

again, nobody will teach you for free

#

you can teach yourself by following the docs

pure lion
#
  db.prepare(`CREATE TABLE IF NOT EXISTS ${options.table} (ID TEXT, json TEXT)`).run();

this is the error im getting

cerulean lake
#

WHAT DOCS

earnest phoenix
#

otherwise pay for someone's time invested in teaching you

solemn latch
#

do you have a database setup already?

pure lion
cerulean lake
#

cry y would i pay to do that

earnest phoenix
solemn latch
#

people pay thousands of dollars to go to college for programming

#

:p

#

why would people teaching you be free

pure lion
#

do you have a database setup already?
how would i do that?

solemn latch
#

oo

#

theres actually a quick.db support discord

pure lion
#

its almost as if

#

the chat there is dead

solemn latch
#

o

pure lion
#

yeah |:

earnest phoenix
#

Hey

#

Someone know how to use shard ?

pure lion
#

omg its a bunch of dots

#

we should be friends

solemn latch
#

sharding depends on your library

earnest phoenix
#

Djs

#

@pure lion ??

solemn latch
earnest phoenix
#

I have already read that

#

I have sucess to create shard

#

But

#

To get channels, someone Say me it's with broadcasteval but to get users & guilds also?

quartz kindle
#

if you're using the sharding manager, and you have more than 1 shard (which happens at around 1500 guilds)

#

then your bot will be split into more than 1 process, meaning that each process has its own separate memory and contains only a part of the total data

#

including users, guilds, channels, everything

#

in order to join this information, the sharding manager offers two functions, broadcastEval and fetchClientValues

#

what these functions do is they send messages to all shards, and ask them to send their data over

#

the type of data that can be sent is limited tho, they can only send you back simple values such as strings, numbers, arrays, etc. you cannot request a full Channel object for example

earnest phoenix
#

Oh okay

#
bot.shard.broadcastEval(`
    let channel = this.channels.cache.get('543511427651207169');
    if (channel) {
channel.send("test")
    }
`);```
#

Like that to get a Channel?

#

With shard?

tawny obsidian
#

If I want to send embeds and messages through a webhook do I still need to apply for a bot? Or how do I get about that

quartz kindle
#

that will send a message to all processes and tell them "hey check this channel id. if you have it, send a message to it"

tawny obsidian
quartz kindle
#

which is the correct way to send a message to a channel

earnest phoenix
#

Oh okay

#

And to get users and guilds

#

It's the same method ?

quartz kindle
#

yes, but depends what you want to do with them

#

in the example above you're just telling them to send data to the channel, the situation changes a bit if you want them to return data to you instead

earnest phoenix
#

Get users and guilds informations

quartz kindle
#

exactly

#

so for example lets say you want to get a guild's name from a guild id

wicked pivot
#
const WebBlock = new Discord.WebhookClient("id web", "key web")

WebBlock.send(...)```@tawny obsidian
solemn latch
earnest phoenix
#

you don't need to use a whole ass library just for a webhook

#

lol

#

just manually send a request through some shit like wget, curl or postman

quartz kindle
#
bot.shard.broadcastEval(`
  let guild = this.guilds.cache.get("${guild id here}")
  if(guild) { return guild.name; }
`).then(results => {
  console.log(results)
})
#

in this case, results will be an array of responses from all shards

#

something like [undefined,undefined, guild name here ,undefined] if you had 4 shards and the guild was found in one of them

tawny obsidian
#

Yea @wicked pivot im brand spakin new at this so where should I go to start from the very beggining

earnest phoenix
#

Oh okay ! @quartz kindle

#

Thank for you help

small prairie
quartz kindle
#

👍

earnest phoenix
#

Do you know what means @earnest phoenix

#

brunch of dots

small prairie
#

Weird ping