#development

1 messages · Page 661 of 1

tight heath
#

and chill

#

so uh yeAH

earnest phoenix
#

guys who write bot on Python, also know the game minecraft, help pliz

hybrid ruin
#

A little of both, what's your question? @earnest phoenix

earnest phoenix
#

I want to do to chat minecraft automatically was copied in chat discordъ

#

@hybrid ruin

hybrid ruin
#

Made in Java, perhaps take inspiration from there

#

I don't know py well enough to help nor spoonfeed you

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

does this happen when a user hasn't even touched the economy and they do the balance command?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

green patrol
#

?help

earnest phoenix
#

if(!gold === null) gold= 0;

#

try that

#

I think that should work

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

on top of the message.channel.send

#

Once again I'm not sure, but it should work

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

yeah I wasn't sure that would work with your case

#

I added it to my bot when the user was 0 and it said null

#

and it worked for me

valid frigate
#

why is the NOT operand before gold

#

id imagine if (gold !== null) gold = 0;

tranquil drum
#

Why is there an object newGold that’s being defined bet never referenced

#

Lol vysion your condition would set gold to 0 if it’s not null

quartz kindle
#

^

#

newGold is created but never used, so no new entry is ever created in the database, it will keep getting empty values

tranquil drum
#

It looks like you want to replace const newGold with gold

#

So the new gold object is actually stored by gold instead of newGold

earnest phoenix
#

how to get icon server with api ?

tranquil drum
#

what library?

#

REST API is GET /guilds/{guild.id} and the icon field will have the icon hash

earnest phoenix
#

js @tranquil drum

valid frigate
#

do you mean the actual discord api or djs

tight heath
#

d.js: Guild#iconURL

tranquil drum
#

^

valid frigate
slow crypt
#

What is code for making the bot join vc in JavaScript

topaz fjord
earnest phoenix
#

Yeah trying to make a bot that I can control

#

I wanna see if I can make it appear to be sentient.

#

Can I have help with that?

near ether
#

How can I check if someone has voted for my bot in the last 12 hours? I’ve tried googling and such but I can’t really find much. I know checking who voted in the last 24 hours is documented, but what about 12?

pale marsh
#

@near ether doesn't the vote endpoint return the time a user voted?

#

@earnest phoenix what languages do you use?

#

Also I think it's better to ask in #topgg-api neelio

near ether
#

Gotcha

#

Ty

earnest phoenix
topaz fjord
#

css

earnest phoenix
#

how

pale marsh
#

@earnest phoenix google how to set a background image with css

earnest phoenix
#

I did

mossy vine
#

lol

topaz fjord
#

is that an embed I saw

earnest phoenix
#

Yes.

late hill
#

@sage bobcat Don't know if you managed to get it working already but another issue I see that no one else has mentioned yet is that you're searching for a Gold document with the userID property, while the ones you're adding have userId

pale marsh
#

Change .bg with whatever class you want to have the background

#

In your case maybe change it to body idk

topaz fjord
#

change it to .bg to body

pale marsh
#

body without .

earnest phoenix
#

It worked!

#

Thanks so much!

topaz fjord
#

so

#

uh

#

those who use lavalink

#

how do you know which bands to edit for your audio effects

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

inner jewel
#

@topaz fjord

topaz fjord
#

oh

#

Thanks

halcyon nymph
#
  if(message.author.bot) return;
  var content = message.content;
  if(!content.startsWith(botconfig.prefix)) return;
  var args = content.split(' ');
  switch([args[0]]) {
    case 'ct!help':
      if(message.author.id == message.guild.owner.id) message.channel.send(HELPembed);
      else {
        message.author.send(HELPembed);
      }
      break;
    }
  }
)```
#

anyone have any idea why this isn't working?

#

discord.js

inner jewel
#

switch([args[0]])

#

you're switching over an array containing the first element of args

halcyon nymph
#

why does that not work?

#

I'm still passing in a string?

inner jewel
#

no

#

you're passing an array

halcyon nymph
#

so what do I need to do to make it a string

inner jewel
#

not make it an array

#

args[0] is a string

halcyon nymph
#

oh

#

im really dumb

tight mulch
#

Hello! 👋🏻 does anyone know how to make a connection from website to a discord bot? So it’s like you get a code from the website and then you write !verify (code) and gives you a role? Please ping me if you know

tranquil drum
#

insert the verification code in a db or some data source that the bot can read and you should be good

#

bot looks at the data source for the verification code and if it sees it, it gives the role and makes sure the verification code can't be used again?

tight mulch
#

Uhum... I will try.

opaque eagle
#

How would that feature help verify users anyways

lusty dew
#

Does anyone know a npm package that would get system information on the bot? Like CPU Usage, Mem usage, etc

earnest phoenix
#

so i have this function here

function ConfigureChild(Parent) {
    Parent.child.on('close',(c,s)=>{Parent.onClose(c,s)});
    Parent.child.on('message',(m)=>{Parent.onMessage(m)});
    Parent.child.on('error',(e)=>{Parent.onError(e)});
    Parent.child.stdout.on('data',(d)=>{Parent.onStdout(d)});
    Parent.child.stderr.on('data',(d)=>{Parent.onStderr(d)});
}```
Which configures a child process to send its stdout and stderr to a certain function on the parent object. This works great for processes that i spawn with child_process.fork and set to an ipc.

I am trying to set it up for my bot shards, and by default the sharding manager sets the pipes to inherit, not ipc, which makes this code not work, because Parent.child.stdout is undefined. How can i tell the sharding manager to change its settings when spawning the process?

End goal: capture stdout and stderr of shards
#

(ping me if answer)

cyan marten
#

Anyone help with discord.js?
I want an embed that takes the color of the message.author or the mentioned user

mossy vine
#

get the hoisted roles color

cyan marten
#

like message.guild.me.DisplayHexColor but for someone

#

stop trolling

#

my dad works at discord

#

he can ban you >:((((

mossy vine
lusty dew
#

I am trying to convert os.uptime() into the format 00:00:00 (hour, min, sec) using moment

#

but when I try I just get 00:00:00

#

and the bot has been online for like 10m now

#

what I am doing:

let os = require("os")
let moment = require("moment")

message.channel.send(moment(os.uptime).format("HH:mm:ss")
#

Oh wait

#

Nvm 😅

#

I forgot to put () after uptime

#

forgot uptime was a method

fathom meadow
#

Hi

#

How can ı created Csgo server infos bot

scenic vapor
#

@fathom meadow There probably a tutorial on the web. If not, just use a bot that already does this.

fathom meadow
#

Ok

#

Thx

earnest phoenix
#

how does a full eval command?

tight heath
#

eval()

scenic vapor
#

Henlo quick question:

let prefix;

Server.findOne({serverID: message.guild.id}, (err, server) => {
      if(err) console.log(err);
      prefix = server.prefix;
 });
 console.log(prefix);

I'm trying to declare the var prefix through that but whenever I log it outside, it returns undefined although when console.log(prefix) is placed inside of Server.findOne()... it returns the correct prefix. Any help is appreciated, thank you! (I might be doing something unbelievably stupid sorry lol)

west spoke
#

You haven't defined the prefix yet

heady zinc
#

@fathom meadow hi good sir, while it may look like console.log(prefix) is executed after everything else, it's probably not the case, as findOne() is asynchronous and your code assigning the prefix is only executed when called back

#

so basically, console.log() is executed before your assignment

#

that's also why it returns the correct data when you place it inside KKsip

scenic vapor
#

oh

heady zinc
#

to make it work as intended, you can just put the relevant code inside the callback

scenic vapor
#

do I have to await for prefix?

earnest phoenix
#

he left

heady zinc
#

or await findOne() if its possible (as in, if a promise is returned)

scenic vapor
#

Okay, I'll attempt that, thank you a ton

#

btw you pinged the wrong person

heady zinc
#

oh

#

well thanks god they left aomegablobsweats

#

btw, may i ask what database module you're using?

scenic vapor
#

await worked, thanks!

#

It's mongoose

#

MongoDB*

#

Mongoose is the lib im using for everything

heady zinc
#

that's good, all mongoose methods return a promise, so you can await everything and avoid the confusing callbacks issues

scenic vapor
#

thank you paradox

topaz fjord
#

pawadowo

heady zinc
#

you're welcome, i once fell into the callback hell before as well, so im more than happy to help others getting out of it :)

smoky mica
#

when can't you use a try catch command in discord.js?

tight heath
#

because it's a promise

#

.catch()

#

yw

sick cloud
#

so how do you actually record voice in a vc

#

like is there some sort of trick or event or what

pale marsh
#

Yes there's usually an event where you receive raw PCM data that you can store

sick cloud
#

would you know what it'd be in discord.js master

amber fractal
#

But you could probably make it yourself, if you know how... Which I dont mmulu

topaz fjord
#

I think jda can mmLol

amber fractal
#

And then use 90% more ram and cpu mmLol

topaz fjord
#

not really

#

optimization is key

earnest phoenix
#

no

#

😦

sick cloud
#

alright how do you reference the GNU GPL v3 license in the package file?

#

is it something like gpl

loud salmon
#

@earnest phoenix we don't spoon feed here.

earnest phoenix
#

ok

rocky fable
shadow copper
#

is there a website that helps people who don't know how to make a bot? if there is tell me pls because I have no idea how to make a bot

inner jewel
#

the library docs

slim heart
inner jewel
#

and the language docs

shadow copper
#

oh thxs

spare goblet
#

@rocky fable what language and what library ?

just grab the actual number minus this guild's membercount

magic smelt
#

How can I remove user reaction from message ( Only one user reaction )

When I am using message.reactions.remove(user) it sends me Unhandled Rejection TypeError: message.reactions.remove is not a function at Client.<anonymous> (./bot.js:328:21) at processTicksAndRejections (internal/process/task_queues.js:85:5)

shy rose
#

discord.js?

magic smelt
#

yes

shy rose
#

k one sec

#

.reactions is a collection youl need to call the .remove on the reaction object within

magic smelt
#

ok

#

thx

steel cloak
#

if its not too difficult to explain whats the best way to make a command cooldown in js

tranquil drum
#

you can store the last time the command was run successfully and check if enough time has passed

steel cloak
#

ahh okay thanks

spare goblet
#

store in cache uwu, like use a set() or map()

sick cloud
#

hi so uh, can you somehow select an element in jquery through what it's set as

tranquil drum
#

what do you mean

#

you should be able to $('selector query')

sick cloud
#

i'm used to .class or #id

#

dunno what you'd use for content

tranquil drum
#

oh like what the text inside of it is

sick cloud
#

yeah

#

it's the only way i see of selecting it as it's just a p element with no id or class

inner jewel
#

.left-container > .column > p should do it

sick cloud
#

and jquery could pick that up?

tranquil drum
#

ya

inner jewel
#

if it uses regular css selectors yes

tranquil drum
#

its a valid css selector query

sick cloud
#

alright

spare goblet
#

@earnest phoenix please don't send irrelevant messages in here ty blobsmilehappyeyes

tranquil drum
#

also document.querySelector() would work too

sick cloud
#

alright

#

yeah the div p thing broke

tranquil drum
#

what are you trying to do lol

#

you can def select it with the query Natan posted document.querySelector('.left-container > .column > p')

sick cloud
#

yeah it selects it

#

but it replaces it all

tranquil drum
#

oh

#

do $('.left-container > .column > p')[0]

sick cloud
#

the edit buttons and stuff are in a p inside the same div

#

ah ok

tranquil drum
#

its a different element but if you do any calls on the result of that query you're going to do that for all elements that match that query

sick cloud
#

understandable

#

adding [0] seems to break it

tranquil drum
#

lol

#

$('.left-container > .column > p').first() maybe

#

i dont use jquery very often,

#

if you're just changing text tho you could do document.querySelector('.left-container > .column > p').innerText = 'blah blah';

sick cloud
#

ay that works

#

and yeah

#

perfect

tranquil drum
valid frigate
#

cough

#

how do i listen for when someone leaves/joins a voice channel

earnest phoenix
#

in

#

w h i c h

#

l i b r a r y

valid frigate
#

havent you seen me before her elmao

#

djs

earnest phoenix
#

yes i remember which library everyone here uses by heart

valid frigate
#

pog champ

#

thanks

earnest phoenix
#

Is there a way to remove all the spaces/blanks in a string in JS?

sick cloud
#

@earnest phoenix if you have access to regex: str.replace(/ /g, '');

frozen granite
#

does anyone here (who is experienced with mysql and node.js/discordjs) have a few moments to give me a hand with something? ping or dm me ♥

warm marsh
#

@frozen granite What is that thing you require help with?

frozen granite
#

uhh what's the best way to explain this

#

give me 1 sec i'll get back to my pc

hallow olive
#

eyy what this mean

#

my bot is offline becuz of it

#

@frank blaze

frozen granite
#

you dont have discord.js OMEGALUL

hallow olive
#

i installed it

#

again

#

but its not working

frozen granite
#

i'm sorry I have no idea

hallow olive
#

when i try to instlal it in the full page console

#

idk if this some private info

#

so

#

im not gonna try to show it here

#

if anyone is trusted

#

or is a moderator of discord bot list

#

pls help

warm marsh
#

you have to add it via the package.json.

twin kestrel
#

Hi all! I get an error when trying to start my Discord bot (I was programming using another shards bot and it didn't give any problem, today I changed the token to pass it to the original version and it gives me this error)

    at Shard.once (/var/www/html/Filo/node_modules/discord.js/src/sharding/Shard.js:88:39)
    at Object.onceWrapper (events.js:315:30)
    at emitOne (events.js:116:13)
    at Shard.emit (events.js:211:7)
    at Shard._handleExit (/var/www/html/Filo/node_modules/discord.js/src/sharding/Shard.js:272:10)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)```
earnest phoenix
#

remove shard ;-;

twin kestrel
#

It is not a valid solution for me

#

I need the shards to work

earnest phoenix
#

Just to be sure:

class something{
constructor(){
this.ok;
}
}
class oof extends something {
constructor(){
super.ok = “ko”;
}
test(){
return super.ok;
}
}

Does oof.test() returns “ko”?

twin kestrel
#

whut?

earnest phoenix
#

i just wanted to know how do super work.

#

does*

twin kestrel
#

I tried to remove this part of my code and it stopped giving error

setTimeout(() => {
    console.log("\r\n\r\n\r\n\x1b[30m[\x1b[33m⚠\x1b[30m]", "\x1b[0m[Sistema]", "\x1b[0mTodos los sistemas van a reiniciarse en unos instantes.\r\n\r\n\r\n")
    manager.broadcastEval("process.exit()");
}, 2678000000);```
#

Is it for having put too many milliseconds?

earnest phoenix
#

I sometimes get that error too and it’ll be gone after i restart the project

#

for some reason

twin kestrel
#

The thing is that the error returns to me when restarting and before I did not

#

Thanks also ^^

indigo geyser
warm marsh
#

@earnest phoenix

class Something {
    constructor() {
        this.ok;
    }
}

class Oof extends Something {
    constructor() {
        super.ok = "ko";
    }
    test() {
        return super.ok;
    }
    static get test() {
        return super.ok // Will be undefined.
    }
}

Oof.test // Return undefined
let test = new Oof().test(); // Will call the test function.
mossy vine
#

except it doesnt work @warm marsh

warm marsh
#

Explain?

mossy vine
#

you need to call super() in the Oof contructor

#

and both result in undefined

topaz fjord
#

isn't it super()

mossy vine
#

@topaz fjord you mean super().ok ? no

#

i dont think you can modify supers properties

topaz fjord
#

You can't

#

Quick google

#

dis is why js is bad lang

mossy vine
#

however properties of Something are accessible in Oof under this

#

also why do you define test() twice @warm marsh

warm marsh
#

Static method and non static.

#

Could name it whatever you wish.

mossy vine
#

this will work as intended

class Something {
    constructor() {
        this.ok = "ko";
    }
}

class Oof extends Something {
    constructor() {
        super()
    }
    test() {
        return this.ok;
    }
}

console.log(Oof.test) // Return undefined
let test = new Oof().test() // Will call the test function.
console.log(test)
topaz fjord
#

Yes

mossy vine
#

@earnest phoenix you cant modify properties of super, however properties of super are available under this

late hill
#

yes

#

super properties are modified using super methods

#

Pretty sure that works

#

And kind of makes sense ig

mossy vine
#

or you could modify this.<supers property>

twin kestrel
#

Hi all! Sorry if I bother

I have the following code to check if my bot has permissions to send messages:

  if (!message.guild.me.hasPermission("SEND_MESSAGES")) return;

The problem is that if they have another role that denies these permissions it gives me a permission error in the console, how can I solve this? (I have the permission check in the message event)

spare goblet
#

@twin kestrel Check channel permissions, that's the only issue blobthumbsup
so in message listener check message channel permissions overwrites and all

twin kestrel
#

Okay, i try

rocky fable
#

How to make can ignore the number of users on this DBL server?
node.js

earnest phoenix
#

wat

frozen granite
#

he wants his bot to ignore the amount of users in this server

coarse vapor
#

ok so

#

idk how to use node so i cant give code

earnest phoenix
#

???WTF

coarse vapor
#

take the length of bot.members and then subtract the length of get_guild(264445053596991498) (members)

hollow saddle
#

node.js can mean many different libraries

#

Which lib are you using

coarse vapor
#

in py: len(bot.get_all_members()) - len(bot.get_guild(264445053596991498).members)

#

@rocky fable which lib

opaque eagle
#

Works in both discord.js and eris:```js
bot.users.size - bot.guilds.get("264445053596991498").memberCount

peak quail
#
const Discord = require("discord.js");
const botconfig = require("../../config.json");
const { RichEmbed } = require("discord.js");

module.exports = {
    config: {
        name: "userinfo",
        Description: "Zeigt dir Infos von einem User",
        accessableby: "User",
        aliases: ["ui"]
        
    },
    run: async (bot, message, args) => {
    
        if(message.author.id !== botconfig.OwnerID) return;
        
    let user = message.mentions.users.first() || message.author;
    let Muser = message.mentions.members.first() || message.guild.members.get(args[0]);
    let userinfo = new Discord.RichEmbed()
    .setAuthor(message.author.username)
    .setColor("RANDOM")
    .addField("Username", `${Muser.user.username}#${Muser.user.discriminator}`, true)
    .addField("Status", user.presence.status,true)
    .addField("ID", `${Muser.user.id}`)
    .addField("acc erstellt am", `${Muser.user.createdAt}`, true)
    .addField("Höchste rolle", `${Muser.highestRole}`, true)
    .setThumbnail(Muser.avatarURL)
     message.channel.send(userinfo);
    

}}```
why `.setThumbnail` dosen´t work ?
coarse vapor
#

lemme see

#

im not too sure

stone dust
#

everything works in the embed aside from the thumbnail?

peak quail
#

👀

coarse vapor
#

that >>?<<string may be the issue

topaz fjord
#

If the user doesn't have one it won't show

coarse vapor
#

try it on me

#

or the bot itself

stone dust
#

could always just add a log statement to ensure that it contains the correct value

#

missing semicolon wouldnt do it either would it?

peak quail
#

@coarse vapor and ? did you test it ?

coarse vapor
#

i use dpy

#

but i have seen that the difference between ?string and string can be an issue in some languages

stone dust
#

nullable i guess

coarse vapor
#

@peak quail GuildMember does not have .avatarURL

#

however, type User does

stone dust
#

oh yeah

#

you would want to access the user property of the guild member then

peak quail
#

hmm

coarse vapor
#

[reading the docs of a language i dont even use... very fun]
How i found out:

> .mentions
  > MessageMentions
    > .members
      > COLLECTION: Snowflake, >>GuildMember<<
        > GuildMember.avatarURL doesnt actually exist
    ```
quartz kindle
#

@opaque eagle that will likely return a negative value lul

coarse vapor
#

w0t

opaque eagle
#

why

#

users are rarely uncached so it should be fine right

quartz kindle
#

users is obtained from guildmembers

#

it will only cache according to cached members

#

afaik

covert kernel
#

Hey

#

so for python

#

The example shows the module dpl

#

dbl*

#

whats the package name

cursive dagger
#

Dblpy I believe

covert kernel
#

ok

#

ty

#

yup

#

it was

#

ty

opaque eagle
#

Where r u evaling that @quartz kindle

quartz kindle
#

nw.js console

opaque eagle
#

oh

stray garnet
tranquil drum
#

not sure if this is the issue but ◀ is different from ⬅

#

looks like the filters are filtering for different emojis

stray garnet
indigo geyser
#
@bot.command()
@commands.has_permissions(Kick_Members=True)
async def kick(ctx, member: discord.Member=None):
  if not member:
    await ctx.send('''**Nope**
    
*Use:* ***`"kick @someone`***''')
    return
  await member.kick()
  await ctx.send(f'{member.mention} has been kicked!')

it tell me I don't have the kick members permission but I have it, pls help

inner jewel
#

does the bot have the permission?

slender thistle
#

kick_members

indigo geyser
#

thanks

slender thistle
#

Capitalization matters

indigo geyser
#

ok thanks

#

@inner jewel yes

soft plaza
#

can you use md in embed footer?

west spoke
#

md?

slender thistle
#

Markdown and no

west spoke
#

Ah

soft plaza
#

ok thanks

indigo geyser
#
@bot.event
async def on_member_join(member):
  if guild.id == 578548442687864832:

is there any way to do that if guild.id? (I know this is wrong)

mossy vine
#

the member object has a guild

indigo geyser
#

member, guild?

slender thistle
#

member variable, being instance of discord.Member, has a property guild

indigo geyser
#

mmh... ok

#

thanks, I resolved doing member.guild

abstract crow
#

Would there be a way that I can use Express.JS variables to an external HTML file? Like instead of me making EJS files I use html, css, etc. But my server.js file has a variable that I want to pass to an external HTML file. Is that possible?

languid dragon
#

read html file using fs

#

.replace()

#

send fs read as text

#
// express async .get() =>
const html = await fs.readFileSync(path, "utf8");

html.replace(/{variable_name}/gi, "new value");

res.send(html); 
#

that's how i did it, IIRC

abstract crow
#

What would I do in my HTML file?

#

Just an id="blah" and then variable?

languid dragon
#
<div>{variable_name}</div>
#

after parsing it would be

<div>new value</div>

(following from the example)

abstract crow
#

Ah gotcha

pale marsh
#

@abstract crow why not use something like ejs instead?

amber fractal
#

Ejs bad

opaque eagle
#

^

pale marsh
#

Since when? thonk

sick cloud
#

is it possible to make a custom rpc for a program that doesn't have one?

amber fractal
#

Isnt that what prople did with things like vscode?

sick cloud
#

i guess so

#

but how is what i want to know

#

i wanna add rpc to my art program, medibang! paint pro

topaz fjord
#

@sick cloud

sick cloud
#

i know about the rpc client thing and it's super useful

#

hooking into programs though

opaque eagle
#

I mean if Discord can tell what programs you open, I don't see why you can't build a cli tool in the background that auto-starts RPC whenever u open that app u wanna make rpc for

scarlet phoenix
#

Why not just add rpc to the program MegaThonk

sick cloud
#

literally what i'm trying to do @scarlet phoenix??

scarlet phoenix
#

That was a response to eslint

sick cloud
#

oh ok

hybrid ruin
#

Despite of my bot having the highest role in the hierarchy and admin perms, it's unable to change any roles' perms and returns ContextException instead, "Missing Permissions"

sudden geyser
#

code where it's breaking?

hybrid ruin
#

I don't seem to get an error any more, but it's not showing anything in any audit logs

#
r.getManager().setPermissions(newRoleSettings).queue();```
`r` being a Role object, `newRoleSettings` being a long from a Role it's trying to copy settings from
steel cloak
#

In discord.js is there a way to get full user count (in all guilds) without bots.

warm marsh
#

filter out bots

steel cloak
#

yeah but how?
I found this code
client.guilds.members.filter(member => !member.user.bot).size;
but client.guilds.members returns undefined

warm marsh
#

Yes.

#

I don't think guilds has prop members

#

client.users.filter(user=> !user.bot).size;

#

or any other method of filtering you wish.

hollow saddle
#

Guilds has a members property

warm marsh
#

<Guild> has I don't think <Guilds> does.

steel cloak
#

client.guilds returns <Guild>
or at least thats what the documentation says

hollow saddle
#

Yes it does

#

And guild has a members property

warm marsh
#

returns a snowflake of all the guilds

hollow saddle
#

Oh shoot yeah

#

You’d have to map it if you wanted to use guilds

warm marsh
#

client.guilds.reduce((prev, guild) => prev + guild.members.filter(member=> !member.user.bot).size, 0);

hollow saddle
#

Yeah

steel cloak
#

oh wow okay I think im gonna go with the easier option lol
thanks tho

warm marsh
#

Lol

pale marsh
#

@warm marsh no spoonfeeding GWowoKannaGun

sick cloud
sudden geyser
#

math 100

amber fractal
#

There can be 3 guilds on that shard tho, no?

sick cloud
#

9 shards for 3 servers

tranquil drum
#

or 3 guilds on the 9th shard

spare goblet
#

Maybe the presence is a lie shruggies
or planning on making 1 shard per guild bahahaha

sinful lotus
#

keep in mind about "performance" consideration on that code

#

on small scale, should be fine but on scaled applications weirdsip

agile birch
#

sa

fading wigeon
#

@sick cloud y u hatin

halcyon nymph
#

Hi, anyone familiar with discord.py, can you explain how I can use discord.Client.edit_channel_permissions() the api reference isn’t really clear on it

fading wigeon
earnest phoenix
#

@halcyon nymph I cant find that in the discord.py library, but it would probably be something along the lines of await client.edit_channel_permission(perms)

#

Do you have the link to that section?

mossy vine
#

what is the best solution to "build" several javascript files in one?

sudden geyser
#

cyber what do you mean

earnest phoenix
#

As the docs state:
await client.edit_channel_permissions(channel, target, overwrite=None)
Where channel is the channel to edit, target is the member/role to edit perms for, and overwrite being the perms

I'm surprised this isnt in the discord.py read the docs ref, which makes me wonder if this is actually from the old version which isnt supported now (v.0.16.x and lower)

#

Oh, looking at the link, it is from the unsupported version

#

@halcyon nymph edit_channel_permissions is no longer supported as the library has migrated to v1.0.0+ (most recent is 1.2.3)

mossy vine
#

@sudden geyser i want to have my code in multiple files (so i can maintain it more easily) but distribute 1 file at the end

halcyon nymph
#

@earnest phoenix Oh, is there a new way i can edit channel perms for a specific role?

sudden geyser
#

Well it's kind of hard to understand how you specifically want them built, but just require the files within your main file while splitting them.

If you mean something like commands in separate files, you could use the fs module

slender thistle
#

The target parameter should either be a Member or a Role that belongs to the channel’s server.

earnest phoenix
#

I've looked at channel.edit, so you might want to look around there with the permission overwrites, but I cant be exactly sure as I haven't used it myself.

#

Though channel.edit only seems to have the sync permissions arg so idk

slender thistle
#

You both are looking at different versions

mossy vine
#

@sudden geyser require doesnt work when distributing for web iirc, but i would still prefer writing multiple files and distributing one

slender thistle
halcyon nymph
#

I'm confused, because my version of discord.py definitely has edit_channel_permissions as a runnable command?

earnest phoenix
#

🤔

slender thistle
#

Yes

halcyon nymph
#

I just don't know how to use it

earnest phoenix
#

Did i hear python?

slender thistle
#

How are the docs not clear on this

halcyon nymph
#

not clear is shorthand for I can't find where it's mentioned at all

slender thistle
#

I linked it like twice

#

Are you sure you are looking at the right docs

earnest phoenix
#

(channel, name=newname, permissions=permission.overwrite,

slender thistle
#

Not helping at all

sudden geyser
#

I don't know anything about web stuff so I can't help you there think

earnest phoenix
#

Version 0.16.x is no longer supported

#

Of discord py

slender thistle
#

If you aren't going to help with it, don't

halcyon nymph
#

Okay, i might've been on the wrong thing

slender thistle
#

It still works

earnest phoenix
#

Yep

earnest phoenix
#

Use this..

#

The site is very well

slender thistle
#

You were on the wrong docs.

earnest phoenix
slender thistle
#

So why keep mentioning that it's not "supported"

halcyon nymph
#

@earnest phoenix so... how do i specify permissions?

slender thistle
#

rtfd

#

There's even an example

earnest phoenix
#

@halcyon nymph are you in the discord py server?

halcyon nymph
#

no

earnest phoenix
#

You might want to try there for help regarding the library in particular

slender thistle
#

d.py doesn't provide support for 0.16.12

earnest phoenix
#

@slender thistle that's what I've been saying lmao

#

It's not supported

slender thistle
#

d.py server doesn't provide help for it. The version itself works still

earnest phoenix
#

Meaning if you need help with old stuff, you'll have to migrate to the new docs

slender thistle
#

👌

earnest phoenix
slender thistle
#

The definition of "supported" was the problem here

#

It's outdated, not officially supported but still works

earnest phoenix
#

Whether you took it as one or the other, mine was still correct. It doesn't receive support and most of the code doesnt work

slender thistle
#

Which things for example don't work except from default channels?

earnest phoenix
#

Last time I used that version, bot.send_message stopped working at some point for me

slender thistle
#

Even though it works

#

All it really does is get .id from provided channel object and send whatever you tell it to

earnest phoenix
#

If things work for you, they might not work for others. Either way, if someone needs help its probably better to point them to the latest updated version that is supported, and that definitely does work, than providing support for an outdated version which might not even work for them

slender thistle
#

True about the last sentence, but not all errors are library's shit code, still. If we are talking about client.send_message from 0.16.12, it by itself does what it is meant to. If you don't provide it what it needs, that would be your fault

earnest phoenix
#

Though it wasnt RainbowShrug I asked for help in the d.py server when it happened, as it was only happening for one command at the time. Code was correct in the old version, but because of the library migrating, it just started breaking and wouldn't send the message.

#

The help I got was to migrate to avoid that happening to any other bot commands

slender thistle
#

Surely it's not the library's issue as I used async version for a while and it worked just fine

#

And since you were actually migrating, obviously there would be one issue or another, so if it didn't work for you, it's no surprise to me

earnest phoenix
#

No, at that point, I was using 0.16.12, I hadn't even heard of migrating. And it still stopped working. This was like, mid-June

#

Up until then, for 3 months or so, it was working decently

slender thistle
#

Last or this year?

earnest phoenix
#

This year

slender thistle
#

Let me actually test it thonkku

earnest phoenix
#

To be safe I figured I might as well migrate. Idk if it works now, since I haven't used the old lib in over a month. But at that point, one command out of what I had just stopped working completely

slender thistle
#
import discord
from discord.ext import commands

bot = commands.Bot(command_prefix='test ')

@bot.event
async def on_ready():
    print(f'it works - {discord.__version__}')

@bot.command()
async def test():
    await bot.say('It works!')

bot.run(token)

just tested and it works ¯_(ツ)_/¯

unique nimbus
#

if its on rewrite it would be

@bot.command()
async def test(ctx):
    await ctx.send('It works!')
slender thistle
#

Yes, but the topic was 0.16.12 version

unique nimbus
#

ah

slate igloo
#

im looking to learn js to make a bot for my server, you guys got a preferred learning website? is w3schools good enough?

grim aspen
#
#

and google

slate igloo
#

cheers dude :)

mossy vine
#
#

tutorial, guide, documentation

slate igloo
#

thanks!

slender thistle
#

Not the full traceback

pallid zinc
#

const keyv = new Keyv('./prefix.sqlite');

#

Err on this line

#

Err


throw new ERR_INVALID_ARG_TYPE(name, 'string', value);7:01 PM

^7:01 PM

7:01 PM

TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received type undefined7:01 PM

at validateString (internal/validators.js:125:11)7:01 PM

at Module.require (internal/modules/cjs/loader.js:632:3)7:01 PM

at require (internal/modules/cjs/helpers.js:22:18)7:01 PM

at loadStore (/rbd/pnpm-volume/db1ffd3b-edf4-4166-8949-e213164599e4/node_modules/keyv/src/index.js:18:15)7:01 PM

at new Keyv (/rbd/pnpm-volume/db1ffd3b-edf4-4166-8949-e213164599e4/node_modules/keyv/src/index.js:38:22)7:01 PM

Jump to

at Object.<anonymous> (/app/index.js:33:14)7:01 PM

at Module._compile (internal/modules/cjs/loader.js:701:30)7:01 PM

at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)7:01 PM

at Module.load (internal/modules/cjs/loader.js:600:32)7:01 PM

at tryModuleLoad (internal/modules/cjs/loader.js:539:12)```
dusky marsh
#
const keyv = new Keyv('sqlite://path/to/db.sqlite')
pallid zinc
#

It will also give same result

west spoke
#

that's why java is fuckin gay
'The "id" argument must be of type string. Received type undefined'
@pallid zinc

pallid zinc
#

Err has been changed

west spoke
#

The one before.

#

The one you posted.

#

If you would read, you would know

pallid zinc
#

Ok

indigo geyser
#
@client.event
async def on_message(message):
	await client.process_commands(message)

Client Object has no attribute Command
Why?

slender thistle
#

Wrong part of code

warm marsh
#

Did they change member.addRole() in discord.js@12.0.0-dev?

pallid zinc
#

That does it mean (node:13839) UnhandledPromiseRejectionWarning: Error: SQLITE_CANTOPEN: unable to open database file

hollow saddle
#

@warm marsh yeah in v12 roles are now a GuildMemberRolesStore so to add a role would be member.roles.add()

warm marsh
#

Thanks!

mossy vine
#

@warm marsh as far as i see yes, its now <GuildMember>roles.add()

#

oh im slow

warm marsh
#

Is there updated docs or something?

mossy vine
#

yes

warm marsh
#

...

mossy vine
#

v12-dev is master in docs i think

warm marsh
#

Ok

#

Thanks!

mossy vine
opaque eagle
#

Why would you want that

mossy vine
#

so i can write code in multiple files (easier to maintain) and still distribute 1 file

tranquil drum
#

but webpack

mossy vine
#

why should i use webpack over this tho

tranquil drum
#

i like it since it can bundle your entire project not just js

topaz fjord
#

webpack is cool

old geyser
#

So I have an issue with my .awaitresponce script. For the most part it works.. however, now that the bot is in more servers, each server is over writing the .awaitresponce of the other servers, how can i set it up on a per server basis?

tranquil drum
#

what does awaitresponse do?

quartz kindle
#

show code

tranquil drum
#

^

old geyser
#

.then(() => {

message.channel.awaitMessages(response => response.content === 'test', {

max: 1,

time: 30000,

errors: ['time'],

})

.then((collected) => {

message.channel.send(`The collected message was: ${collected.first().content}`);

})

.catch(() => {

message.channel.send('There was no collected message that passed the filter within the time limit!');

});

});

#

For example

tranquil drum
#

is message.channel being overridden?

old geyser
#

Each is set to their own guild id

#

But I thibk it might be

tranquil drum
#

where is message.channel defined

old geyser
#

Was just wondering how I can make it so it doesn't if two or three servers trigger it

#

Just before it sends the message

tranquil drum
#

can i see

mossy vine
#

@tranquil drum i mean, i only need to bundle js so i dont see why i would need it ¯_(ツ)_/¯

tranquil drum
#

fair enough lol

old geyser
#

PokeSpawn = client.getSpawn.get(message.guild.id); if (PokeSpawn) { channel = PokeSpawn.spawn_channel; } else channel = message.channel.id; embed = new Discord.RichEmbed() .setTitle(`A wild pokémon has appeared!`) .setDescription(`Guess the pokémon by typing its name.`) .setImage(`https://profoak.net/img/discord/pokemon/${Pokemon.id}.png`) .setFooter(`Guessing correctly will award your Starter Pokémon with ${RandomXp} XP`) .setColor(Type.color); client.channels.get(channel).send(embed) .then(() => { client.channels.get(channel).awaitMessages(response => response.content.toLowerCase() == Pokemon.name.toLowerCase(), { max: 1, time: 30000, errors: ['time'], })

languid dragon
#

oh my god why does it look like that

old geyser
#

I'm on mobile

devout chasm
tranquil drum
#

saves file size by emitting carriage returns poggers

languid dragon
#

uhm im dipping

old geyser
#

Copied from github

#

So not sure why it pasted it like that

tranquil drum
#
PokeSpawn = client.getSpawn.get(message.guild.id);
if (PokeSpawn) {
    channel = PokeSpawn.spawn_channel;
} else channel = message.channel.id;
embed = new Discord.RichEmbed().setTitle(`A wild pokémon has appeared!`).setDescription(`Guess the pokémon by typing its name.`).setImage(`https://profoak.net/img/discord/pokemon/${Pokemon.id}.png`).setFooter(`Guessing correctly will award your Starter Pokémon with ${RandomXp} XP`).setColor(Type.color);
client.channels.get(channel).send(embed).then(() => {
            client.channels.get(channel).awaitMessages(response => response.content.toLowerCase() == Pokemon.name.toLowerCase(), {
                max: 1,
                time: 30000,
                errors: ['time'],
            })
#

same code just formatted

old geyser
#

For the mean time I've had to set a "global cooldown" using set() to prevent other servers from over riding it

tranquil drum
#

whats the scope of this?

#

of channel

#

this is in some sort of message listener right

old geyser
#

Yeah

tranquil drum
#

idk lol you could try and store the actual channel object in a const or something

quartz kindle
#

if so, you're defining it in the global scope, so it will get overridden by every message

tranquil drum
#

^

earnest phoenix
#

how can i make it send a webhook to my discord when someone votes

topaz fjord
#

You would have to set up your own server for the discord bots webhooks and trigger the discord one from that

earnest phoenix
#

how about making it log to console when someone votes?

#
dbl.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});```
#

would that work?

mossy vine
#

yes

slender thistle
#

dbl.webhook.on 👀

earnest phoenix
#

it errors when i do that

#

dbl.webhook.on('vote', vote => {
TypeError: Cannot read property 'on' of undefined

quartz kindle
#

well did you create a webhook?

earnest phoenix
#

i just want it to log to console when someone votes

quartz kindle
#

const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });

#

assuming your machine/vps can receive connections on port 5000

earnest phoenix
#

so without using dbl.webhook.on i cannot log votes to console?

quartz kindle
#

not in real time

earnest phoenix
#

but would what i posted above work?

quartz kindle
#

dbl.on(vote) no, its not a thing

earnest phoenix
#

i mean

#
dbl.on('vote', vote => {
  console.log(`${vote.user} just voted!`);
})```
amber fractal
#

it wont work

quartz kindle
#

dbl doesnt have vote events

#

only the webhook does

earnest phoenix
#

dam

amber fractal
#

you're listening for an event that will never fire

quartz kindle
#

dbl itself only has posted and error events

#

the webhook has ready and vote

mossy vine
#

what would be the best way to tell if a script tag has loaded and the code in there has executed?

#

i guess simply calling a function on the bottom of the file would work?

valid frigate
#

yeah basically

#

most of the time though, you shouldn't even need a function since the script will terminate itself at the end

wheat jolt
#

Does someone know how I can give roles to a user when he is added in a guild with oauth guilds.join

#

?

valid frigate
#

if this is front end, you could listen for window.onload() but it's a wild guess

hushed berry
#

@Alex T.js#0001 you can specify an array of role IDs when creating the member

earnest phoenix
#

Is there anyway to have discord.js bot create a server?

#

@celest spear

#

Id just ask here

#

These people are smart

hollow saddle
#

It’s possible but a bot can only create one if it’s on less than 10 guilds

earnest phoenix
#

and what Phoenix said.

topaz fjord
#

.createGuild will is removed in d.js master

#

so you wont be able to use it once v12 drops

mossy vine
#

you can still just send the http request manually tho

topaz fjord
#

or that

mossy vine
#

i dont see why they removed createGuild

topaz fjord
#

v12 removes all methods/properties that can be used by selfbots

#

.createGuild was one of them

#

@mossy vine

mossy vine
#

ah

#

i see

earnest phoenix
#

bots can create guilds too

#

as long as their guild count is under 10

mossy vine
grim aspen
earnest phoenix
#

im blind ok

#

🙃

amber fractal
#

bruh

mossy vine
#

i like to think that these are alts of dbl members just trolling us

amber fractal
#

same

#

tf is an hq life bot script

mossy vine
#

</offtopic>

tranquil drum
#

Someone give them the hq life bot script

amber fractal
#

it sounds like he's trying to cheat a bot lmao

mossy vine
#

yeah

tranquil drum
#

Bruh they just want the script

earnest phoenix
#

they want to give life to a bot

#

tldr make an AI

#

duh

amber fractal
#

ah, why didnt we think of that

tranquil drum
#

The secret AI sauce

earnest phoenix
#

while True:
print("OOF")
continue

#

Who can defeat the spam?

mossy vine
#

ctrl + c

#

alt + f4

#

shutdown now

#

power outage

earnest phoenix
#

W-w-w-w-w-windowwws

unique nimbus
#

simple if its in a linux terminal ctrl+z

#

you can just yeet it from task manager

earnest phoenix
#

Linux is too simple

mossy vine
#

@unique nimbus ctrl + c in linux as well

#

halts the script

unique nimbus
#

oh

#

m8 idrk linux

earnest phoenix
#

🤖

indigo geyser
#
@client.event
async def on_message(message):
	
	dm = 0

	if message.content == '*dm':
		
		while dm < 1001:
			dm = (dm+1)
			
			emb = discord.Embed(title=None, description=f'I sent you {dm} dms')
			
			await message.author.send(content='HAHAHAHAHAHA 27th JULY HAHAH', embed=emb)
			await asyncio.sleep(0.5)
``` when you have nothing to do
mossy vine
#

isnt the ratelimit 5 messages per 5 seconds

earnest phoenix
#

we love an api abuse queen 👑

indigo geyser
#

@earnest phoenix that bot is private

earnest phoenix
#

and that matters how

mossy vine
#

so it doesnt use the api?

indigo geyser
#

But only i see it

amber fractal
#

uh

#

doesnt matter

#

api abuse is api abuse

earnest phoenix
#

there's no buts lol

#

you're abusing the api

indigo geyser
#

:(

earnest phoenix
#

you're spamming the same endpoint over and over again with no use case

#

ergo api abuse

mossy vine
#

just increase it to like 3-5 seconds and you should be good

indigo geyser
#

But it doesn't bother anyone, only I see it

amber fractal
#

doesnt matter

indigo geyser
#

I can break the Api?

amber fractal
#

spamming the api is bad regardless of who it's sent to

indigo geyser
#

I can't write oof

#

IT IS SENT TO ME

earnest phoenix
#

regardless

mossy vine
#

so it doesnt use the api?

indigo geyser
#

who is sent to

earnest phoenix
#

do you not know what regardless means

indigo geyser
#

Can I create problems for someone?

quartz kindle
#

you create problems for the discord servers

indigo geyser
#

No

#

It is only in my server

mossy vine
#

bro

#

are you ok

indigo geyser
#

And I am alone in that server

mossy vine
#

do you know how an api works

quartz kindle
#

your server is a discord server

indigo geyser
#

It's a private pokecord spam server

quartz kindle
#

its still a discord server

indigo geyser
#

I am the unique member

quartz kindle
#

its still a discord server

indigo geyser
#

Ok

indigo geyser
#

Wow, I will break my server

shy rose
#

looking at you daily weather bot

mossy vine
#

no, you help break discords servers

earnest phoenix
#

Hi guys! Quick question, if I'm "enabling" webhook options, will I stay able to use the request method?

quartz kindle
#

no, you will help slow down the entire discord platform, albeit by a very small amount, but still

shy rose
#

small amount as one user
but lots of users doing it make a big impact

quartz kindle
#

^

indigo geyser
#

@quartz kindle I asked this, thanks for be the unique person able to respond me

mossy vine
#

try setting up a very basic api, and set up a script that spams requests to it. run several instances of the script and see what happens

indigo geyser
#

And why I have to create a server

#

No, it have sense

mossy vine
#

??

#

ok

quartz kindle
#

?

storm sonnet
#

Hello, can i get help getting my bot online please?

#

No one online?

opaque eagle
#

Lang + Lib + Code + Error @storm sonnet

storm sonnet
#

Ok give me a sec

#

Ok im a little confused but ill look up youtube

indigo geyser
#

What is the error?

storm sonnet
#

But thanx for responding and have a good one

indigo geyser
storm sonnet
#

@indigo geyser its ok i just need my bot online

indigo geyser
#

Did you try to develop it?

#

@storm sonnet

storm sonnet
#

Ye

indigo geyser
#

Ok, and why it doesen't go online?

storm sonnet
#

IDK thats why lol

indigo geyser
#

oof

#

What is the error in the terminal?

#

Send a screen

storm sonnet
#

Its says it need coding

#

Oh wait

#

OOF

#

Guess what

#

I just deleted the code that i copied like a retard

indigo geyser
#

Why you copied it

storm sonnet
#

Its my old code

short siren
#

make cool code

storm sonnet
#

Got dang it gotta start again

indigo geyser
#

?

#

It works?

storm sonnet
#

My last code did for a secong till i mess up

indigo geyser
#

Ok, pls send it, so I can help you if it's python

storm sonnet
#

Also ima be honest with ya

#

Im in this server that this teacher helps ya you learn codes so im in position to start making the bot thats why

indigo geyser
#

SEND THE CODE OR WE CAN'T HELP YOU

storm sonnet
#

Got damn it give me a fucking second

#

Dint ya read that i deleted it

#

🤦

indigo geyser
#

Ok, bye

storm sonnet
#

Have a good one

indigo geyser
#

What language is it?

#

The code

#

Python, Js.... ?

storm sonnet
#

Yes

indigo geyser
#

YES WHAT?

#

@storm sonnet

storm sonnet
#

Stop waiting time on me please i dont wanna make you feel mad

indigo geyser
#

But I asked you a simple question

storm sonnet
#

IK

loud salmon
#

if you people are going to keep yelling at each other them im going to start handing out phat mutes k?

#

it stops now

#

ty

indigo geyser
#

Mute me?

storm sonnet
#

NVM ill look it up on youtube plaese stop i dont wanna get in trouble

loud salmon
#

both of you

storm sonnet
#

Im just a code starter

indigo geyser
#

Sorry @loud salmon

loud salmon
#

oi

#

i said stop

indigo geyser
#

I am not screaming now

loud salmon
#

everyone starts somewhere

storm sonnet
#

Ik but im just acting like a little kid cuz its my first time so im sorry that i acted like a kid

#

But im thank full for those who tries to help

#

But ill try my best to get it right

#

Sorry to disturb and have a good one yall

grim aspen
#

you're good

sick cloud
#
(node:9308) UnhandledPromiseRejectionWarning: TypeError: #<Object> is not iterable

what's up here with eris collections?

sinful lotus
#

@sick cloud would be good if you put listners for that

sick cloud
#

it's

sinful lotus
#

so we can have stacktrace and handle that error

sick cloud
#

it's the base code of eris

sinful lotus
#

yas so if its eris fault

sick cloud
#
PS C:\Users\ThatTonybo\Desktop\musicbot> node index.js
(node:9308) UnhandledPromiseRejectionWarning: TypeError: #<Object> is not iterable
    at new Map (<anonymous>)
    at Map.add (C:\Users\ThatTonybo\Desktop\musicbot\node_modules\eris\lib\util\Collection.js:41:19)
    at ExtendedClient (C:\Users\ThatTonybo\Desktop\musicbot\src\ExtendedClient.js:34:35)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
    at startup (internal/bootstrap/node.js:279:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:752:3)
(node:9308) 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(). (rejection id: 1)
(node:9308) [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.
sinful lotus
#

41:19

sick cloud
#

yeah

#

i just don't know how to fix this

sinful lotus
#

what is 34:35 of extended client?

sick cloud
#

this line

sinful lotus
#

try using default maps and add that

sick cloud
#

right i'll just make my own collection then

sinful lotus
#

wait is that an array

sick cloud
#

no

#

its an extended eris collection

sinful lotus
#

oh so prolly custom method then?

sick cloud
#

this.commands = new Store();

store.js

const { Collection } = require('eris');

module.exports = class Store extends Collection {
    constructor() {
        super(Map);
    }

    get(id) {
        const item = this.find((item) => item.id === id);
        return item;
    }
}
#

.add is built into eris' collections

sinful lotus
#

that works like an array from my pov

#

a sec

sick cloud
#

in dapi they said to super(Map)

#

since Map is the base class

sinful lotus
#

collection is a map

sick cloud
#

yeah

sinful lotus
#

you can use the map methods instead and see if that works

#

I doubt the map methods it inherited from original will bork

sick cloud
#

i guess

old geyser
#

@quartz kindle how do I define it so it's not global

sick cloud
#

@sinful lotus do you use eris?

#

or at least do you know how to bind events

sinful lotus
#

I know eris since I used it, from time to time

#

as for how I bind events

let files =  fs.readdirSync('./events')
for (const file of files) {
  const event = require('./events/' + file).bind(this)
  client.on(event.split('.')[0], event)
}

thats basically how I do it
@sick cloud

sick cloud
#

so it just runs the event okay

#

thanks

sinful lotus
#

yeah, error handling goes to the actual event file

sick cloud
#

i kinda can't install node-opus Thinkeng

#
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:289:12)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:962:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)```
sinful lotus
#

use opus-script

#

good for testinf enviroment

sick cloud
#

it's not for testing

#

i'm installing it onto an actual host machine

sinful lotus
#

windows host machine, kinda rare to see that

#

anyways I think thats an py error

#

idk py stuff

sick cloud
#

yeah it is rare 👀

#

and same

#

idk

sinful lotus
#

prolly sneak on d.js suppprt

sick cloud
#

mkay

candid lynx
#

all people developing bots are using discord.js except for me wtf

grim aspen
#

not everyone uses discord.js

#

i do though

inner jewel
#

@sick cloud python is pointing to python 3.7

#

you need 2.7 for gyp

sick cloud
#

oh

#

how do i change that

west spoke
#

@candid lynx I use py.

Do you use BASIC?

tranquil drum
#

lmao im on java @candid lynx

storm sonnet
#

I got online!

earnest phoenix
#

👌

grim aspen
#

cool

gritty bolt
#

how do I define a certain part of the body in a json response?

#

like pull a certain value?

amber fractal
#

parse it

gritty bolt
#

im using request

tight heath
#

That's the issue

earnest phoenix
#

Lol

amber fractal
#

I use request too

#

you can still parse the response

tight heath
#

Slowest http client jfyi

gritty bolt
#

but then how do I parse it

earnest phoenix
#

JSON.parse

gritty bolt
#

what like am I parsing

#

Yeah I know that but what do I put before the .parse

tight heath
#

You're parsing a string

amber fractal
#

@tight heath only use it when Im lazy or dont want to use node's http requests

tight heath
#

@amber fractal superagent

#

It's like request but better

#

Faster and more precise syntax

#

yw

amber fractal
#

JSON.parse(json-string)

gritty bolt
#

tbh request is slow but native node requests broke on me so im still remaking this command

#

I tried that

#

stupidly

#

i just put json

#

🤦

tight heath
gritty bolt
#

i get this now

earnest phoenix
#

👌

gritty bolt
#

i put JSON everywhere

#

when I was parsing

#

`instead of what I was parsing

tight heath
#

what

gritty bolt
#

i cant explain it

#

its so stupid

tight heath
#

Ok

#

It's okay

amber fractal
#

probably json-string.parse() or something lol

tight heath
#

We all make mistakes

#

Nik was confused why the website is building so slow before he noticed he forgot to actually deploy it

gritty bolt
#

lol

tight heath
#

I literally mistyped success and wondered why .sucess() was not a function

gritty bolt
#

oh shoot i just figured out that my bot is running in 2018

sick cloud
#

JSON.parse(whatever you wanna parse)

usually requests are in the body so parse the response.body or whatever

gritty bolt
#

and it has a command that actually needs a correct year

sick cloud
#

i think

tight heath
#

new Date().getYear()?

gritty bolt
#

no it was pulling a unix

#

and adding 2018 to it

#

so like taking a time

#

adding the year and making a unix

#

but all the unixs were in 2018

#

not 2019

#

request is still slow though

#

oh and fun fact also

#

I didnt put JSON in caps

#

other issue

tight heath
#

Yes but you can dynamically get the current year

#

Literally new Date().getFullYear()

#

Pulls from system time

gritty bolt
#

yeah

#

but I cant really guarantee thats right either

tight heath
#

Why

gritty bolt
#

aws was locking me into CST for a while

#

no idea how nor why

#

it only resolved itself a few days ago

#

after an update

amber fractal
#

well it takes from the system time, so if you're running on a vps you need to account for server location

tight heath
#

@gritty bolt getUTCFullYear()

#

lmao

amber fractal
#

or that

gritty bolt
#

true lol

#

but im still pretty basic with javascript

#

so I didnt know those existed

amber fractal
tight heath
#

No worries

amber fractal
#

Date has a bunch of methods

tight heath
#

That's why I'm here

gritty bolt
#

lesson though here: please dont use w3 schools for html

#

i tried

tight heath
amber fractal
#

Yeah, ravy is customer support

gritty bolt
#

lol

tight heath
#

I actually am

amber fractal
#

ping them all the time

tight heath
amber fractal
#

if you have any question

gritty bolt
#

w3schools told me to write 20+ lines

tight heath
#

For @versed thorn kinda

gritty bolt
#

for what was supposed to be 4 lines

tight heath
#

w3schools is bad

#

use mdn

amber fractal
#

w3schools isnt the best

candid lynx
#

soo as i was saying almost everyone uses discord.js so im switching now

tight heath
#

@candid lynx from?

candid lynx
amber fractal
#

uh

tight heath
#

ohwow

#

Why tho

amber fractal
#

2 different languages

tight heath
#

d.py works and if you know python is a viable option

candid lynx
#

cuz...i hate the indenting in python...

tight heath
#

the lib itself should not be your deciding factor

#

Well any good eslint config in js has the same indentation

amber fractal
#

python syntaxing is pretty uh annoying

tight heath
#

But tbf

#

In JS you can write bad indentation

#

And make eslint make it look good

candid lynx
#

also quick question in js