#development

1 messages Β· Page 1541 of 1

rustic nova
#

you need the emojiMention

#

which you can get with adding a \ before a emoji

#

Adding the ![nao_happy](https://cdn.discordapp.com/emojis/564144181635973120.webp?size=128 "nao_happy") for example would add that emoji to the message then (if your bot is in that server with the emoji of course)

austere zealot
#

ok tq

lusty quest
#

any suggestions for a Backup if systemchannel is not aviable? want to send a message in there if someone invites the bot, but im not sure what would be a good backup.

pale vessel
#

Don't send anything

#

(seriously)

lusty quest
#

well want to have the dude who invited the bot to run a setup command to make sure it will work and not shit itself

austere zealot
lusty quest
#

alternative i will just make the bot cry around on command if its not setup

austere zealot
#

@rustic nova srry for lemon_ping but is this it? :cookieeat:

rustic nova
#

nope

austere zealot
#

id went away

rustic nova
#

it should be <:emoji_name:id>

#

again, easily being able to get it by using \ before emojis

#

also, you need to send the \emoji to be able to see the full emoji mention

austere zealot
#

ohh

pale vessel
earnest phoenix
#

Hello, if my bot cannot find the command when prefix + command_name is typed, if I write a code to say command not found, will there be a problem?
Please tag when you reply.

lyric mountain
#

it can cause a ton of spam

#

people 60% the time write commands wrong or with one letter off

#

so...well...a lot of spam if they keep trying

gilded olive
#

CommandNotFound eh's...are a 50/50

earnest phoenix
misty sigil
#

no

#

but people will hate your bot

earnest phoenix
#

Thanks, I will not add. πŸ™‚

delicate shore
#

hi

#

Wasup gamers

distant cobalt
#

so um, js client.on('guildMemberRemove', member => { const currentGuild = member.guild.id }) when the member leaves the server, it cant seem to track what server it left

misty sigil
#

theres a guild property too

#

oh wait it doesnt

#

well

#

try console.logging member

distant cobalt
misty sigil
#

log the member

distant cobalt
#

yeah, but what i want it to do is get the guild id that the user left

misty sigil
#

log the member and see what properties it has

distant cobalt
#

ok

distant cobalt
earnest phoenix
#

do u need to log join/leaves in a channel ?

misty sigil
distant cobalt
misty sigil
#

it is?

earnest phoenix
#

i can help

misty sigil
#

thats literally part of debugging??

earnest phoenix
#

do you database?

#

easy with a db

distant cobalt
#

but it's a public bot, so i need to check so it doesn't log a user from another server

distant cobalt
earnest phoenix
#

lol

#

use sql

misty sigil
#

ok so log member and show me the output

mellow kelp
#

ew quick.db

misty sigil
#

@earnest phoenix quick.db is a wrapper for sql

distant cobalt
#

for

client.on('guildMemberAdd', member => {
    const currentGuild = member.guild.id
})``` getting the id works
earnest phoenix
#

i dont use quick db

distant cobalt
#

but not for js client.on('guildMemberRemove', member => { const currentGuild = member.guild.id })

misty sigil
#

ok so

#

log the member

pale vessel
misty sigil
#

flazepe help

pale vessel
#
  1. Ping
misty sigil
#

thanks

distant cobalt
#

Alll i need is to get the guild's id that the user left from

misty sigil
pale vessel
#

You need the guild members intent

misty sigil
#

they have it

#

they mentioned it works for guildMemberAdd

pale vessel
#

log it

misty sigil
#

log the member

distant cobalt
misty sigil
#

...

solemn latch
#

Same way you log anything

pale vessel
#

Use console.log()

misty sigil
#

how did you get bot dev without knowing how to log something

earnest phoenix
#
  client.logger.info(`${member.guild.name}: ${member.user.tag} has joined the server`);```
distant cobalt
trim saddle
#

@pale vessel can you help me make an audit log class

earnest phoenix
#

replace lol

distant cobalt
#

i need help with guildmemberremove

misty sigil
#

@distant cobalt console.log(member)

#

that fucking simple

distant cobalt
earnest phoenix
#

log on console

#

read the docs

misty sigil
#

???????????????

#

you log the member for debugging

pure lion
#

bro is this guy for real

earnest phoenix
pale vessel
misty sigil
#

🧠

trim saddle
pure lion
#

@distant cobalt your brain is a singularity

#

go and learn js

trim saddle
#

and i'm lazy

pure lion
#

for gods sake

pale vessel
#

I don't know how audit logs work

solemn latch
pale vessel
#

Never dealt with them

pure lion
#

there are docs flazepe

misty sigil
#

learn how they work then

pure lion
#

😏

misty sigil
#

twat

earnest phoenix
pale vessel
#

Say that to skull

#

I don't need em

misty sigil
#

oh ok fair enough

trim saddle
#

i'm reading the docs

pale vessel
#

What about it

distant cobalt
#

so i did it, now what?

pale vessel
#

Check your console after that event is triggered?

distant cobalt
#

yeah i did

pale vessel
#

Nothing?

misty sigil
#

see if theres a guild property?

distant cobalt
#

yeah

misty sigil
#

is there an id property

distant cobalt
#

i don't think so

misty sigil
#

show full guild

distant cobalt
#

it just says id

distant cobalt
misty sigil
#

thats the guild id

distant cobalt
#

k

#

now wut?

misty sigil
distant cobalt
#

k

pale vessel
#

Well, do whatever you want with it?

distant cobalt
#

yeah but

#

i use quick.db

#

then i use this

#
const currentGuild = member.guild.id```
#

i use quick.db to check if a guild's leave message is enabled or not

#

But it says that it's disabled

#

even tho that i enabled the guild leave message

trim saddle
distant cobalt
#

@pale vessel

livid lichen
#

Unhandled rejection error! TypeError: Object prototype may only be an Object or null: true Anyone know what this means? Some of my commands aren't working because of this error!

trim saddle
trim saddle
livid lichen
#

I googled it but nothing related came up. I checked Discord.js docs.

trim saddle
#

can you provide the line that errored

livid lichen
#

@trim saddle Wth it came from this line let BotMessage = await msg.reply("Pinging!");. Should I show the full error?

trim saddle
#

yes

livid lichen
#

"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: 2)"

#

"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."

#

The rest is a bunch of ats.

trim saddle
#

. that's the standard text for any unhandled rejection.

livid lichen
#

Oh

#

Big message :(

gilded olive
#

post on like hastebin/pastebin/mystbin

livid lichen
#

You know what imma find an alternative way.

#
    let BotMessage = await msg.reply("Pinging!");

    BotMessage.edit({
      embed: {
        title: "Pong!",
        description: [
          "**Responce time: **: `" +
            (BotMessage.createdAt - msg.createdAt) +
            "ms`"
        ].join("\n"),
        color: "#0099ff",
        timestamp: new Date()
      }
    }).catch(() =>
      BotMessage.edit(
        "Unknown error occurred. Do I have permision to Embed Links?"
      )
    );
``` This is the full code.
sacred aurora
#

need help with regex

#

how can i regex string that contain any number from 1 to 10

#

not 0

#

i've tried [1-10] and its just get 1 and 10

#

hm

earnest phoenix
#

10 is just a 1 and a 0

#

isn't valid as a range

solemn latch
#

[1-9]|10

ebon belfry
lusty quest
#

out of Ram

trim saddle
#

@ebon belfry your project died from using all the ram

ebon belfry
#

O_O

trim saddle
#

optimize it to prevent it

ebon belfry
#

Dang

lusty quest
#

PC or Server?

ebon belfry
lusty quest
#

what lib did you use and what did you bot do?

ebon belfry
#

Well, I use a Repl.It IDE. When I get this error, the bot goes offline

solemn latch
#

disabling loading all members and or presences can save a huge amount of ram.

trim saddle
#

there's your problem, you don't get a lot of ram from repl

lusty quest
#

yea bcs you run out if ram

#

do you use canvas as example?

ebon belfry
#

Is there any way I can get more ram on Repl.It?

trim saddle
#

make your code less stressful on resources, usually sticking to async functions, don't cache everything, try to avoid unused variables

lusty quest
#

buy a VPS

pale vessel
#

Downl-

trim saddle
#

get off repl and get a vps

solemn latch
#

replit has a $5 a month plan that gives you 2gb of ram

ebon belfry
#

Oh

solemn latch
#

its not the best, but easy way to solve it if you dont want to bother with VPS's

ebon belfry
#

Well, everyone is upset and it's a real problem to me because my bot is in over 800 servers

lusty quest
#

did you use normal D.js?

ebon belfry
#

I use the discord.js package

trim saddle
#

yeah you probably shouldn't use repl when your bot grows extensively

lusty quest
ebon belfry
#

const discord.js = require('discord.js')

#

Ok!

trim saddle
lusty quest
#

you will save some ram, but some stuff will be a bit more annoying

trim saddle
#

4GB for $10/mo

ebon belfry
#

Thanks for the help :)

solemn latch
#

you should only get what you need.

#

$3 a month for a gig, which is double what you have now

ebon belfry
lusty quest
#

lol i pay 56€/Month for 64GB ram and 6C / 12T

solemn latch
#

and you can upgrade gg vps's easy

trim saddle
#

you got a fat bot 8?

ebon belfry
#

The issue is that there is no point of getting a VPS if I earn no money from my bot.

lusty quest
#

no, but one that uses ML and this fryed my old 10€ Digital ocean VPS

solemn latch
#

then djs light is probably the route you want to go.

#

using it properly will dramatically decrease ram usage.

earnest phoenix
#

a ton of people don't get any kind of revenue from their bot

trim saddle
#

you never know until you try

ebon belfry
#

Ok! I never even knew that existed laughbounce

solemn latch
#

most small to medium sized bots lose money.

lusty quest
#

if you want to generate income from bots, the bot has to be extremely Unique and reliable. if the bot gets popular you get maybe some income but also competition of other guys trying to copy your bot

ebon belfry
#

Yea, another thing is that I don't really have any costed features

trim saddle
#

i legit run a bot in almost 60k guilds and haven't gotten a cent from users

ebon belfry
#

Ok, thanks! I will look into discord.js-light

lusty quest
#

got me from 300MB ram down to 95MB ram with about 100 Guilds back then

trim saddle
#

mainly because i didn't paywall anything people just don't like tipping i guess

solemn latch
#

technically, made some money on my bot from galaxygate affiliates.
got a few signups off my bot linking it.

lusty quest
#

i dont like adding paywalls, i think about adding softlocks or something like this

trim saddle
#

actually

#

i blame it on my dumb ass

#

i didn't paywall

lusty quest
#

like shorter cooldowns if you pay or something in this way

trim saddle
#

but i vote/boost locked instead

lusty quest
#

if you pay you get 2x the Votes SMUG probably against the rules but i bet someone does it

trim saddle
#

thing is i locked up singular commands

lusty quest
#

i have a hard time to think about stuff that i could lock behind a paywall or get some fair way to monetize the bot a bit

slender thistle
trim saddle
#

well repl does encourage bot hosting

#

but they prefer webapps

#

plus since you're not paying for it, it's not gonna tailor to your needs

lusty quest
#

Discord Bots eat way more resources than a Website (unless your Blog as example blows up)

earnest phoenix
#

it's not trash you're just misusing the service πŸ€·β€β™‚οΈ

it's like cooking a chicken in the microwave and then complaining it didn't come out right

drifting wedge
#

for electron, how do i remove the top bar

#

and add a custom icon for the hotbar?

mellow kelp
#

i think there was an option for that on the browser thing

earnest phoenix
#

set the frame to false in BrowerWindow options

restive furnace
lusty quest
#

well the thing is 90% of the Users that Host Bots on Repl.it either use JS or py and they eat ram like Chrome does bcs of poor optimisation

#

the rest are competent people

restive furnace
#

true true, but if they were interested to not eat so much resources, they might even beat me

drifting wedge
#

i mean i dont want the frame

#

but i want the like controls

#

like close, miniize etc

#

so frame false doesnt work

earnest phoenix
#

you'll have to build your own top bar

#

in your renderer

drifting wedge
#

mhm

#

and to like graf the window around?

#

move*

#

typo lmfao

earnest phoenix
#

set the -webkit-app-region: drag in the css of the top bar

drifting wedge
#

lemme try! ty

earnest phoenix
#

Line 53 is having problems any idea why?

sudden geyser
#

Well what problems is it having

earnest phoenix
#

Cannot read staff properly @sudden geyser

sudden geyser
#

command is undefined probably

earnest phoenix
#

Oh it’s mods found out lol

#

Btw thanks for tryna help

solemn latch
#

making white lightning eh?

earnest phoenix
#

Traceback (most recent call last):
File "c:/Users/jusmi/Desktop/MoBot/bot.py", line 293, in <module>
client.load_extension(f'cogs.{filename[:-3]}')
File "C:\Users\jusmi\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\bot.py", line 663, in load_extension
self._load_from_module_spec(spec, name)
File "C:\Users\jusmi\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\bot.py", line 609, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.fun' raised an error: FileNotFoundError: JSON file wasn't found

#

i have the json file

distant cobalt
#

Can anyone give a link for a list of fonts for canvas

quartz kindle
#

there isnt one

solemn latch
#

canvas uses your system fonts right? or any you add yourself

quartz kindle
#

yup

drifting wedge
#

can anyone help me with electron packager?

#

like do i need to prefix it with npm?

#

like i dont get it

earnest phoenix
earnest phoenix
#

thanks

#

it was in a different directory

opal plank
#

271GB going down the drain cuz corruption

eternal osprey
#

hey guys

#

how would i create a function with levels?

#

Like level 1 = the bot only sends emojis

#

level 2 = only gifs etc

#

would that need cases?

opal plank
#

huh?

mystic idol
#

hey guys

#

who do python ?

eternal osprey
#

so if my command for example is !case1

mystic idol
#

check with roles @eternal osprey

eternal osprey
#

it only performs the code withing case1

#

and if i do !case2

#

it only runs case2 and stops case1

eternal osprey
mystic idol
#

@eternal osprey if someone have that specific role he can send emojis for example

eternal osprey
#

at all.

livid lichen
#
const ErrorEmbed = new Discord.MessageEmbed()
        .setTitle("Error!")
        .setDescription(`Error shouting. Here's the error: ${err}`)
        .setFooter("Shout Command Failed", process.env.bot_logo)
        .setColor("#0099ff");
      
      msg.reply(ErrorEmbed)
```Is their anything wrong with this? I don't understand this error at all!! `UnhandledPromiseRejectionWarning: TypeError: Object prototype may only be an Object or null: true`
mystic idol
#

then what was your question ? @eternal osprey

livid lichen
#

msg.reply()

eternal osprey
#

i want to switch through cases and events within those cases

mystic idol
#

so you when you run case 1 for example the bot allow only emojis ?

#

is that what you meant ?

eternal osprey
#

so if i use !case1 it will run the code within the case1

#

and if i use !case2 it runs only the code within case2

#

and stops case1

mystic idol
#

you need database then

eternal osprey
#

why

mystic idol
#
case1: disabled
case2: disabled

if you run case 1 the bot will change case1: enabled then go and check on_message

eternal osprey
#

exactly what i need!

mystic idol
#

i can explain more if u want

regal creek
mystic idol
#

you may use activate and deactivate commands @eternal osprey

eternal osprey
#

I know, question is how.

mystic idol
#

which language you coding with ?

eternal osprey
#

javascript

mystic idol
#

i do python but i will explain it

crimson vapor
#

alright

#

big brain time

eternal osprey
mystic idol
#

for example :
?activate case 1
you need to have case 1 in data base so u can change the case 1 from disabled to enabled

crimson vapor
#

node js I need to tell if 2 screenshots are the same, the issue is that it runs on an event and sometimes it gets called very quickly and doesn't have time to cache the buffer. how can I force one function to end before another starts, or an equivalent solution

#

@quartz kindle big brain answer from you?

quartz kindle
#

promises

drifting wedge
#

how can i compile electron into an exe?

crimson vapor
#

I don't think I can await a fs.watch()

drifting wedge
#

ive been trying for like 3 hours

quartz kindle
#

download the electron sdk, it already has an exe

drifting wedge
#

like my electron program

mystic idol
#

big brain tim πŸ˜„

crimson vapor
#
  fs.watch('poggers path', {}, (e, s) => {
    if (s === 'screenshot.png' && fs.existsSync(file)) handleFile()
  })```
#

any way for me to force handleFile to finish before the next event happens?

#

I don't think so

mystic idol
#

thats not what he ask for @crimson vapor

crimson vapor
#

huh

mystic idol
#

did you know what was the question of awsome ?

crimson vapor
#

no I don't know what they were asking

quartz kindle
#

what does handleFile() do?

#

show code

drifting wedge
#

like tim

#

how do i make my electron project into an exe

crimson vapor
#
// Function to watch the file
function handleFile () {
  // Check if it exists
  const exist = fs.existsSync(file)
  if (!exist) { return customError('The handleFile function was called, but no file exists') }
  // Check if we already did it
  // IK this is inefficient but idk how else to do this
  const check = fs.readFileSync(file).buffer
  // If its the last file, just return
  if (check === lastFile) return
  else lastFile = check

  // Get the settings
  const { save } = settings.get('config')

  // Save the file
  switch (save) {
    case 'clipboard': return saveClipboard()
    case 'imgur': return saveImgur()
    case 'local': return saveLocal()
    case 'custom': return saveCustom()
    case 'PyroCDN': return savePyroCDN()
    default: return customError(`Save method ${save} is not accepted.`)
  }
}```
#

tim

quartz kindle
#

you just add your code and then run the exe

mystic idol
#

@crimson vapor lol awsome thought you gonna help him

drifting wedge
#

wdym

mystic idol
#

@eternal osprey you still here ?

crimson vapor
#

nah ive got my own code to figure out

mystic idol
#

πŸ˜„

earnest phoenix
crimson vapor
#

Tim how would I make it queue

proven lantern
#

switch/case should never be used in JS

crimson vapor
#

why not KEKW

earnest phoenix
#

what

#

lol

drifting wedge
#

ive tried for like 5 hours lol

#

howwwww

proven lantern
#

it creates too many bug

crimson vapor
#

how are there bugs

mystic idol
#

is anybody here do python ?

drifting wedge
#

i do

#

wassup

earnest phoenix
#

switch/case isn't buggy, it's your code that's your buggy

quartz kindle
mystic idol
#

im just asking @drifting wedge πŸ˜…

crimson vapor
#

Tim do you know how I would do what you said?

quartz kindle
crimson vapor
#

I sent

mystic idol
#

explain the code to him

crimson vapor
#

its commented

#

kekw

proven lantern
mystic idol
#

he meant what the command do @crimson vapor

crimson vapor
quartz kindle
crimson vapor
#

sometimes the fs.watchFile is calling two times because of the way mac takes screenshots

quartz kindle
#

what do these do?

crimson vapor
#

ill post the shortest one

#

sec

#
function saveLocal () {
  // Create a file name and path
  const filename = createFileName(new Date())
  const filePath = `${app.getPath('documents')}/screenshots/` + filename
  // Make the path if it doesn't exist
  if (!fs.existsSync(`${app.getPath('documents')}/screenshots`)) {
    fs.mkdirSync(`${app.getPath('documents')}/screenshots`)
  }
  try {
    // Rename the file
    fs.renameSync(file, filePath)
  } catch (err) {
    // If it errors, notify the user
    return customError(err.toString())
  }
  notifSaved()
}```
solemn latch
#

oo, uploading to all the image hosters

mystic idol
#

@quartz kindle you seems Mr.brilliant in this server πŸ˜„

quartz kindle
#

all the sync functions are blocking so they wont let any other part of your code run until they are finished, so im still not seeing anything that would cause issues

solemn latch
#

tims the one you go to when no one knows. :p

crimson vapor
#

hmm

quartz kindle
#

what does notifsaved do?

eternal osprey
#

hey how would i switch between 2 cases? Like if someone uses !case1 it performs the whole code within the case, but if someone types !case2, it only performs the code within case2 and stops case1 from running

crimson vapor
#

creates a new electron Notification and sends it

#
const notifUpload = () => new Notification({ title: 'Screenshot Uploaded', body: 'Screenshot link has been copied to your clipboard' }).show()```
proven lantern
#
  var price;
  switch (fruit) {
    case 'orange':
      price = 2.99;
      break;
    case 'apple':
      price = 1.24;
      break;
    case 'cherry':
      price = 3.55;
      break;
    default:
      price = 1.11;
  }
  return 'My fruit costs ' + price;
}```

vs 

```function getPrice(fruit) {
  var fruits = {
    orange: 2.99,
    apple: 1.24,
    cherry: 3.55,
    default: 1.11
  };
  return 'My fruit costs' + (fruits[fruit] || items['default']);
}```
eternal osprey
crimson vapor
quartz kindle
#

no its not?

proven lantern
#

maps are super fast

eternal osprey
#

you basically only told me to make an activate/disable command. I can't do anything with it

crimson vapor
#

not code

#

like

#

writing it

#

more chars and imo harder to read

#

ig less efficient isnt a good phrase to use

mystic idol
eternal osprey
#

i still have no clue how to begin.

mystic idol
#

do you know how to work with databases ?

eternal osprey
#

yeah

crimson vapor
#
function idk(type) {
  ({
    "a": a(),
    "b": b(),
    "c": c(),
    "d": d(),
  }[type] || default) ();
}```
#

ewww

solemn latch
#

i dont think he wants a toggle feature, looks like he wants to check which command is run?

mystic idol
#

then you should know what i was talking about @eternal osprey

eternal osprey
#

a toggle function is what i need.

eternal osprey
mystic idol
#

yeh

eternal osprey
#

okay got it

mystic idol
#

but if u want to enable only one case ,in your command you should change the statements of the other cases from enabled to disabled

crimson vapor
#

are you toggling commands?

#

is that what you are doing

eternal osprey
crimson vapor
#

imo use disabled as an array

if(disabled.has(cmd.name)) return;```
solemn latch
#

is there a reason you dont just have one command?
!setWhatever enabled or !setWhatever disabled

eternal osprey
mystic idol
#

in python it would be easier tbh

solemn latch
#

its like 2 lines in js

mystic idol
#

idk how js work πŸ˜„

crimson vapor
#

js is literally english

solemn latch
#

if(arg === "enabled"); //setdb variable to true
else //setdb variable to false

eternal osprey
#

i actually have learned c++ for a bit. But damn it was way too hard imo.

solemn latch
#

if you want to get fancy you can also have another check for if no arg was provided and just invert the status.

restive furnace
#

messing with memory is fun

solemn latch
#

nothing is hard when you make it easy! ;p

earnest phoenix
restive furnace
#

yes, int x = ((int*)((char*)((int*)(void*)0)));

earnest phoenix
#

i cant count how many times i broke my code with dangling pointers

restive furnace
#

that's gonna try to read from 0x0 in ur RAM and segfault

#

also to fix dangling pointers (mostly), use std::unique/shared/weak_ptr

drifting wedge
#

can anyone help me make my electron project into an exe?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

drifting wedge
#

ye but i cant get it to work

earnest phoenix
#

...use electron-builder

#

πŸ‘οΈ πŸ‘„ πŸ‘οΈ

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

hiiiiiiiiii

#

i haven't seen you in such a long time

#

omfg

drifting wedge
earnest phoenix
#

how come

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

there should be a boilerplate on their website

sage bobcat
#

One message removed from a suspended account.

drifting wedge
#

ik but i cant get it to work at all

#

gimme a min

#

i removed it

#

lemme install it

#

npm i electron-builder?

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

but yes

coral token
earnest phoenix
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

lmfao

#

mood

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

earnest phoenix
#

i'm most likely going to fail 2 if i don't start doing assignments but i just cant get myself to do it

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

drifting wedge
#

wdym save as dev?
@earnest phoenix

earnest phoenix
#

save it as a dev dependency

drifting wedge
#

wot?

#

in the dependencies in pkg.json

#

i mean package*

#

?

#

this is the console command right?

#

npm i electron-builder

drifting wedge
#

do i do it anyqhere or in direcotry?

#

that works

#
electron-builder : The term 'electron-builder' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or 
if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ electron-builder -v
+ ~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (electron-builder:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException``` @earnest phoenix
#

this is the error

#

that always always always happens

earnest phoenix
#

try running with npx

drifting wedge
#

wdym?

#

npx install?

#

it doesnt exist

earnest phoenix
#

πŸ‘οΈ πŸ‘„ πŸ‘οΈ

drifting wedge
#

i dont do jsssss

#

AHHHH

earnest phoenix
#

npx electron-builder

drifting wedge
#

worked

trim saddle
drifting wedge
#

worked tho

mellow kelp
#

i just left my headset on my spacebar and crashed vscode because of the huge column count KEKW

earnest phoenix
#

Is there a way to change the python code to node.js?

cinder patio
#

rewrite it in node.js

mellow kelp
#

manually

cinder patio
#

there's no converter or something... actually there probably is but I wouldn't rely on it

earnest phoenix
#

Um... I'm a python user and I don't know much about node.js, but I wonder what code my code works with in node.

mellow kelp
#

you would have to rewrite it from scratch

earnest phoenix
#

Oops... okay

cinder patio
#

They are two completely different languages, different semantics, different syntax, different libraries

#

So if you want to convert your bot to node.js you would have to learn javascript and do it manually

crimson vapor
#

Someone ping Erwin

mellow kelp
earnest phoenix
#

LMAO

#

Why you guys doing this?

mellow kelp
#

npm is awesome

earnest phoenix
#

Oh my bad LOL

#

True

mellow kelp
earnest phoenix
#

Uh lol

solemn latch
#

Is-is-odd? It determines if it is a package is odd?

mellow kelp
#

yes

earnest phoenix
#

Lol

opal plank
#

npx just runs ts natively

#

transpiling it beforehand will yield the same thign

earnest phoenix
#

uh

#

I need help, lol

#

npx is used to execute packages

opal plank
#

not only, no

earnest phoenix
#

Let me send the code

#

i know it isnt only used for it

#

Having problems with this

opal plank
#

unless you using it for very specific stuff like tarballs, npx does absolutely nothing in the bot context other that running most things in js or ts code

earnest phoenix
#

yes but erwin

#

Yo guys can someone help me lol

#

the goal was to execute electron-builder's CLI

#

which is a package

opal plank
#

which si doable with node

earnest phoenix
#

fuck off

opal plank
earnest phoenix
#

...

opal plank
#

neither are you a mod not are you sure what we are talking about

earnest phoenix
#

@earnest phoenix you fuck off

#

you're a whitename with barely two entire brain cells KEKW

opal plank
#

its still odd to use npx for electron

earnest phoenix
#

Says the guy that also has a white name idiot

opal plank
#

electron should be executable from node

earnest phoenix
#

but it isn't used for electron

#

Now that’s what you call lose brain cells

quartz hawk
#

cringe

scenic kelp
#

can you guys shut up for a sec

earnest phoenix
#

it's used for electron-builder

opal plank
#

you can still run electron apps from node

earnest phoenix
#

erwin

#

Yo guys can you guys help?

scenic kelp
#

@earnest phoenix they don't need to move to general

earnest phoenix
#

electron-builder

scenic kelp
#

they're talking about code stuff

earnest phoenix
#

Oh mb

opal plank
#

correct

scenic kelp
#

just wait to ask your question for a little while

earnest phoenix
#

But it’s flooding the chat so I can’t get help...

opal plank
#

electron-BUILDER doesnt need to be run with npx

earnest phoenix
#

But it’s gonna be glossed

#

Bruh auto correct

#

don't you realise you're the one flooding chat with your annoying pictures of your code

opal plank
#

^^

scenic kelp
#

stop please

earnest phoenix
#

but it's easier than doing node node_modules/electron-builder/cli/cli.js

opal plank
#

you can run electron builder with node, eys

earnest phoenix
scenic kelp
#

final warning: be nice

earnest phoenix
odd stratus
scenic kelp
#

calling people dumb and stupid does absolutely nothing

opal plank
#

the way you run electron doesnt need to be sued with npx, npx simply executes the file its meant to

earnest phoenix
opal plank
#

you could use node directly to run electron on

earnest phoenix
#

yes but this isn't running electron

earnest phoenix
bronze vault
opal plank
#

it is

#

node can run electron natively

slender thistle
#

Development is for help/discussions regarding coding. Spamming the same question isn't considered "discussion" per se, unlike what these two are doing.

opal plank
#

in the same website you can see node examples of electron being run

earnest phoenix
opal plank
scenic kelp
#

like i said @earnest phoenix, if there's a discussion going on just wait to ask for a little while

earnest phoenix
#

No ones gonna scroll up and check after tho @scenic kelp

opal plank
#

electron uses js as a bunch of dependencies, its only right to assume it uses js to run a bunch of its stuf

earnest phoenix
#

but this isn't related to running electron

scenic kelp
#

that's why you wait for a little while to ask again

#

rather than just spamming it over and over

earnest phoenix
#

Alr..

#

it's just pacaking electron from the CLI

opal plank
earnest phoenix
#

okay but that's not what we're talking about

opal plank
#

with cli, yes, but you can run it natively with node

earnest phoenix
#

Well ima just go to the discord.js server

slender thistle
#

Good luck with no traceback provided

#

or actual error message

earnest phoenix
#

the question was how to package their app into an exe (presumably distributable)

opal plank
#

the npx dependency only makes node be able to run it

earnest phoenix
#

oh my god

opal plank
#

you could run it with node alone

#

cli is runnable with node

opal plank
#

rather than using npx, which is a node dependncy

#

using npx for THIS case would only mean to add an extra dependency to your code

#

without a proper use for ti

earnest phoenix
#

unless you're on an ancient version of node, npx should be prepackaged no?

opal plank
#

then, ues

#

yes

#

which most people wouldnt

#

if they are using es5 or lower, then yes, im on the wrong here

earnest phoenix
#

wh a t

#

even the official docs say to prepend npx

opal plank
#

if they arent using es5+ to run electron

earnest phoenix
opal plank
#

you are able to run node directly to run electron apps

#

from es5 and above

#

the only reason i see to use npx in this case would be if they are using old node versions

#

quote me if im wrong, but es5 is the minimum version to run electron on natively

#

node can compile electron code

earnest phoenix
#

i still dont see how running electron with node is relevant here

opal plank
#

its adding an extra dependency without need

earnest phoenix
#

it isn't

opal plank
#

npx is the same as running an app

#

but with extra steps

earnest phoenix
#

electron-builder is already their dev dependency

opal plank
#

correct, so why is npx a need?

#

when they can do node ../modules

earnest phoenix
#

yes

#

it's easier to type

opal plank
#

./node_modules/.bin/electron-builder --prepackaged <packed dir> is a much easier thing to do without bloating apps with extra depeendencies

earnest phoenix
#

npx electron-builder -w instead of node ./node_modules/electron-builder/whatever... -w to build for windows

#

it's the same thing

opal plank
#

cd .. folder

#

node ../path

#

without the need of extra dependencies bloating apps

earnest phoenix
#

it's still the same amount of effort πŸ‘οΈ πŸ‘„ πŸ‘οΈ

opal plank
#

one of them wouldnt bloat the app with extra dev depes

earnest phoenix
#

what

opal plank
#

i wouldnt usually bitch about this, but its the same case of installing a full app as dependecy to run a single thing

#

which is the case here

#

you're asking to install npx to run electron-builder, witch doesnt require npx

#

its simply an extra dependency

earnest phoenix
#

npx comes preinstalled on node 8+

#

it isn't an extra dep

opal plank
#

you do need to install npx

#

dont yo?

earnest phoenix
#

no

earnest phoenix
#

as per the image i sent twice now

opal plank
#

are you 100% sure you need npx?

#

im fairly certain you need to install npm i npx

earnest phoenix
#

erwin oh my god

opal plank
#

i dont see anything here related to it being integrated in node

earnest phoenix
#

third time

opal plank
#

thats interesting, my bad then, npx seems to be bundled with node 8

#

npm specifically

#

i had to install it since i begun using node older than that

earnest phoenix
#

i'm using node 15

#

never had to install any extra tools

#

everything works smoothly out of the box

opal plank
#

alright, my bad

errant perch
#

does channel cache reset when the bot restarts discord.js

solemn latch
#

Channels should get cached anyway. But yes.

errant perch
#

how long would it take for the channel to cache after the bot turns on

drifting wedge
#

can anyone help me get a custom electron icon?

solemn latch
errant perch
#

ok thank you

quartz kindle
#

the bot starts with all channels cached

solemn latch
#

Oh

#

So the ready event is after channels are cached?

quartz kindle
#

yes

errant perch
#

o

quartz kindle
#

the initial guild create events include all channels

distant cobalt
#

So i'm making a channel, but what do i put in permissionoverwrites?

#
message.guild.channels.create(`Total Members: ${message.guild.memberCount}`, { type: 'voice', permissionOverwrites: , reason: 'New channel added for fun!' });```
sterile lantern
#

hmm

#

not too sure

#

its up to you

drifting wedge
#

how do i get a custom electron icon?

sterile lantern
#

electron?

drifting wedge
#

it keeps saying its not working

#

"β€’ default Electron icon is used reason=application icon is not set"

sterile lantern
#

i has no clue

#

also,

#

would it be possible to extract

drifting wedge
#
  const win = new BrowserWindow({
    width: 800,
    height: 600,
    icon: __dirname + '/chess.png',
    webPreferences: {
      nodeIntegration: true
    },
  })
  win.loadFile('index.html')
}```
sterile lantern
#

.csv data

drifting wedge
#

yes

sterile lantern
#

and then fetch something from it

drifting wedge
#

what language?

#

but yes

sterile lantern
#

js

#

discord.js

#

basically

#

if i specify the discord_id

#

i want it to show

drifting wedge
#

well u cant with discord js ofc u can use a lib

sterile lantern
#

the "name" and "type" value for the discord_id

drifting wedge
#

u can use djs with it

#

but like djs is a module, not the lang

#

like u can have other modules

sterile lantern
#

yea

#

but how would i do it

#

is there a npm package

#

time to google

distant cobalt
#

So i'm making a channel, but what do i put in permissionoverwrites?js message.guild.channels.create(`Total Members: ${message.guild.memberCount}`, { type: 'voice', permissionOverwrites: , reason: 'New channel added for fun!' });

sterile lantern
#

thats up to you like i said

#

channel.updateOverwrite(channel.guild.roles.everyone, { VIEW_CHANNEL: false });

#

thats an example

sterile lantern
#

i found this for csv's but

#

how would i only get the information of one row

#

so essentially

#

if i specified a discord_id

#

it would show the name and type values associated in the csv

#

ping if u reply kthx

distant cobalt
#
promptMsg.react('1️⃣').then(() => promptMsg.react('2️⃣'));

            const filter = (reaction, user) => {
                return ['1️⃣', '2️⃣'].includes(reaction.emoji.name) && user.id === message.author.id;
            };

            promptMsg.awaitReactions(filter, { max: 1, time: 20000, errors: ['time'] })
                .then(collected => {
                    const reaction = collected.first();

                    if (reaction.emoji.name === '1️⃣') {
                        message.reply('**Voice Channel** type selected. Setting up server stats...');
                        message.guild.channels.create(`Total Members: ${message.guild.memberCount}`, { type: 'voice', permissionOverwrites: (channel.guild.roles.everyone, { VIEW_CHANNEL: true }, { MANAGE_CHANNEL: false } , { MANAGE_PERMISSIONS: false } , { CREATE_INVITE: false} , { CONNECT: false }, { SPEAK: false } , { VIDEO: false} , { USE_VOICE_ACTIVITY: false} , { PRIORITY_SPEAKER: false}, { MUTE_MEMBERS: false} , { DEAFEN_MEMBERS: false } , { MOVE_MEMBERS: false}), reason: 'New channel added for fun!' });
                    } else if (reaction.emoji.name === '2️⃣'){
                        message.reply('**Text Channel** type selected. Setting up server stats...');
                    }
                })
                .catch(collected => {
                    message.reply(':redtick2: Time ran out! **Cancelling...**')
                });```
lyric mountain
#

You need some steel cylinders, a valve, some steel and high octane fuel

carmine magnet
#

word + word != sentence

earnest phoenix
#

Hey so, I've been writing code rules to contribute to the discord mobile syntax highlighting but I'm stuck at something, is it possible to like match all the template expressions that are wrapped between template strings instead of having to iterate through it to match them one by one?

lyric mountain
#

Afaik you need to iterate all matches

earnest phoenix
#

So if I want it to dm the user the reason what do I do?

somber wigeon
#

@fiery trellis

fiery trellis
#

??

earnest phoenix
#

Anyone?

lyric mountain
#

Get the user object -> get the private channel -> once open, send the message

quartz kindle
#

you can send directly to the member

#

target.send()

drifting wedge
#

is there anything wrong with this? ```html
<html>

<head>
    <title>Chess</title>

    <link rel="stylesheet" src="style.css">
</head>

<body class="page" style="background-color: #202020;">

    <div class="board page">
    <h1>test two</h1>
</div>
    <script src="script.js"></script>
</body>

</html>```

#

?

#

the css doesnt seem to be doing anything

past ferry
#

Thonk Is this relates to bot development somehow?

#

Or It's allowed here

sudden geyser
#

It's allowed

past ferry
#

oh ok

zenith terrace
#

afaik you cant have a space in a div class

quartz kindle
#

in link tags

quartz kindle
#

its 2 classes

drifting wedge
#

OHHHHH

#

ty

zenith terrace
#

oh

#

ok

halcyon kite
#

hey guys so is it possible to split items into multiple parts so i dont go above the discord limit? heres my items thing

let items = db.fetch(message.author.id, { items: [] });```
#

i just want it to where it slices it in half or something

agile lance
#

.trim[0] will trim the first word

#

so you can like

halcyon kite
#

so like items.trim[0]

#

0 is the amount its triming correct?

#

or the limit

agile lance
#

let e;
e = a.trim[message.length / 2]
message.reply(e)

#

and that should send the first half

#

0 will trim the first part

halcyon kite
#

oh ok

agile lance
#

.split works differently I believe

#

I would refer to docs as well

halcyon kite
#

ok

quartz kindle
#

.trim[0] doesnt make sense

#

trim is a function, not an array

#

.trim()

#

and what it does is remove excess spaces and line breaks from the beginning and end of the string

agile lance
#

i use [] and it works fone

#

fine.*

quartz kindle
#

??

agile lance
#

then again my code is weird

#

if i use say

#

.trim[0];

#

It works as normal

quartz kindle
agile lance
#

my code is just weird

#

bc in my code for even stuff like my database

#

ill do say

fringe pendant
#

did you invent your own language

agile lance
#

database.fetch("userIDs").trim[0];

agile lance
quartz kindle
#

that makes 0 sense

halcyon kite
#

yeah .trim[0]

#

wont work lol

agile lance
#

.trim[0] works for me

#

idk

halcyon kite
#

i tried other things too

agile lance
#

let me do eval real quick

halcyon kite
#

lol

quartz kindle
#

it cant work for you, it doesnt exist

agile lance
#

and see if i’m mistaken it for another function/array

fringe pendant
#

are you getting a json object and getting the 0 index of an array inside the object called "trim" or something

#

because .trim[] isn't a thing

agile lance
#

Huh I am mistaken it for another array

halcyon kite
#

hm

agile lance
#

Probably something I use alot

quartz kindle
agile lance
#

must find out what function it is

halcyon kite
#

hm

#

so wait

agile lance
#

[that isnt my bot btw, just a friends bot i use eval with bc im lazy to make it myself xD]

halcyon kite
#

wait so for embed

#

how would that work

#

i want it to send a part of it

#

hm

quartz kindle
#

embeds have a 2048 limit on description and 1024 limit on fields

#

and a total combined limit of 6000 per embed

halcyon kite
#

yeah im using field

#

lol

agile lance
fringe pendant
#

@agile lance can you show us what your code looks like, im very intrigued

agile lance
#

its pretty basic

#

but im lazy and dont do stuff like

#

setTimeout

halcyon kite
#

hm

#

wait i has idea

agile lance
#

I have a function so i have to do is: "w(time in seconds)"

fringe pendant
#

well im just curious how you're using .trim[0] and it works

#

is there a snippet for that

agile lance
#

like a function snippet?

#

i just use a promise

fringe pendant
#

like copy and paste those few lines

agile lance
#

do something like

fringe pendant
#

if you want

halcyon kite
#

yeah none of this is working

#

it says its not a function

agile lance
#

function w(x) {
if (isNaN(x)) return console.log("X is a invalid number. Can not continue function!")
return new Promise(setTimeout(() { }, x * 1000)
}

#

something along those lines

fringe pendant
#

ok so where's the .trim[0]

halcyon kite
#

oK wait so if its

#

.trim(message.length / 2)

#

shouldnt it cut in half

#

?

agile lance
#

for my db for cash and stuff

#

i do

halcyon kite
#

oh wait it just gets rid of spaces

agile lance
#

Never throws a error

fringe pendant
#

and what does db.fetch("Balance_" + message.author.id") return

agile lance
#

the users balance

#

Say like 500 coins

#

I can ss the output too

fringe pendant
#

πŸ€”

#

sus

agile lance
fringe pendant
#

I feel like you're just catching the error or something and ignoring it, which gives the impression that .trim[0] is actually doing something

halcyon kite
#

but its not spliting half of the things

fringe pendant
#

take the .trim[0] out and see if the output changes

halcyon kite
#

look heres what it does

agile lance
#

alr

fringe pendant
#

I don't think .trim() takes an input does it

halcyon kite
fringe pendant
#

like it's not .substring()

quartz kindle
halcyon kite
#

:/

#

than what does

#

:/

agile lance
#

.split probably

halcyon kite
#

.split hm

#

is it a thing @quartz kindle

fringe pendant
#

removes leading/trailing spaces and newline characters

quartz kindle
#

slice, substring and substr are for cutting strings

halcyon kite
#

oh

dusky sundial
#

"The trim() method removes whitespace from both ends of a string"

halcyon kite
#

so slice

quartz kindle
#

split is for converting a string into an array

agile lance
#

same output without .trim[0] @fringe pendant

#

But no error at all

#

Unless the db catches the error and works around it

fringe pendant
#

yeah so it's doing nothing, and somehow you're avoiding the error

agile lance
#

might be the db developers

#

It catches the error before outputted or something

fringe pendant
#

πŸ€·β€β™‚οΈ

quartz kindle
agile lance
#

i’ll have to see

agile lance
#

considering its a new bot

#

my other one i dont have a db on

quartz kindle
#

can you show the code for the balance command?

agile lance
#

ok

#

let me open my code editor

#
  name: 'bal',
  run(client, message, args, discord) {
    const db = require('quick.db')
    let your_bal = db.fetch(`Cash_${message.author.id}`).trim[0];
    if(your_bal == null) your_bal = 0;
    const embed = new discord.MessageEmbed()
    .setColor('RANDOM')
    .setTitle('Balance')
    .setDescription(`**You have a balance of: ${your_bal} dollars.**`)
    message.channel.send(embed)
  }
}```
quartz kindle
#

that makes absolutely 0 sense

#

the only way that would work is if the database fetch returns an object containing a trim key with an array lol

halcyon kite
#

this is not working

#

slice, substring and substr

#

dont seen to split

quartz kindle
#

they dont split

#

they cut

halcyon kite
#
const Pokemon = db.get(user.id);```
#

ik

#

im trying to cut it

#

this is not cutting tho

#

:/

quartz kindle
#

show code

halcyon kite
#

Ok

#
let box = db.fetch(`blacklist_${message.author.id}`)
    

    if(box === 1) return message.channel.send(`${message.author} you are blacklisted! so you cant do this command! fill this out if you think this is unfair: https://forms.gle/EdYtdHNj4E5eLpnJ9 `)
    let start3 = db.fetch(`ustart_${message.author.id}`)
    if(start3 === 0) return message.channel.send(`${message.author} you need to do the command +start`)
    let user = message.mentions.users.first() || message.author;
    const Pokemon = db.get(user.id);
    if(Pokemon === null) Pokemon = "Nothing"
    
    const Embed = new MessageEmbed()
    .setColor('RANDOM')
    .setTitle(`Pokemon.exe`)
    .addField("pokemon:", Pokemon)
    message.channel.send(Embed);```
#

thats code

#

now it sends this error

quartz kindle
#

wheres the slice/subtr/substring?

halcyon kite
#

ph yeah

#

oh wait imma re add

#

hold

#
let box = db.fetch(`blacklist_${message.author.id}`)
    

    if(box === 1) return message.channel.send(`${message.author} you are blacklisted! so you cant do this command! fill this out if you think this is unfair: https://forms.gle/EdYtdHNj4E5eLpnJ9 `)
    let start3 = db.fetch(`ustart_${message.author.id}`)
    if(start3 === 0) return message.channel.send(`${message.author} you need to do the command +start`)
    let user = message.mentions.users.first() || message.author;
    let Pokemon = db.get(user.id);
    if(Pokemon === null) Pokemon = "Nothing"
    
    const Embed = new MessageEmbed()
    .setColor('RANDOM')
    .setTitle(`Pokemon.exe`)
    .addField("pokemon:", `${Pokemon}`.slice(0))
    
    message.channel.send(Embed);
#

done

#

i tried adding the ` there to see if that works

#

@quartz kindle

#

but it didnt

quartz kindle
#

slice(0) basically means cut nothing

#

lol

halcyon kite
#

lol

#

imm dumb

#

wait so 1 will cut in half?

#

or will 2

quartz kindle
#

no

halcyon kite
#

??

quartz kindle
#

there is no half

#

its indexes

#

slice(start,end)

halcyon kite
#

oh

quartz kindle
#

0 is start

halcyon kite
#

wait so like

#

.slice(0, 2)

#

?

quartz kindle
#

that would return 2 characters

halcyon kite
#

ok

#

hmmmm

#

i guess i want it to return 500 characters

quartz kindle
#

for example ye

halcyon kite
#

ok thonks man

#

:D

serene shard
#

(node:11) UnhandledPromiseRejectionWarning: Error: getaddrinfo EAI_AGAIN top.gg
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26)
(Use node --trace-warnings ... to show where the warning was created)
(node:11) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:11) [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.

#

what the error

#

am confused

#
bot.on('ready', () => {
    setInterval(() => {
        dbl.postStats(bot.guilds.size/*, bot.shards.Id, bot.shards.total*/);
    }, 18000000);
});
#

is the only thing i have top.gg related

lyric mountain
halcyon kite
glacial pagoda
#

HElp

#

How Do I Fix

#

Everything Seems Good

pale vessel
#

id is a user

#

only members have the roles property

#

change users.first() to members.first()

glacial pagoda
#

ok

#

It Works!

#

Thanks!