#development

1 messages · Page 691 of 1

quartz kindle
#

without a master process for example, which node-cluster requires

#

and all other forking things

earnest phoenix
#

is there a way to set background image with a link

#

using canvas constructor ?

#

atm i can only set Images using path const image = await fsn.readFile('./profile/profile.png');

quartz kindle
#

you need to download the image

earnest phoenix
#

theres no way to like

#

read('link')

#

?

quartz kindle
#

you can use node's http, or a package like node-fetch and request

lunar narwhal
#

Have you considered swapping to html and then using a headless browser to render the image?

earnest phoenix
#

can

#

ok

quartz kindle
#

you dont need a headless browser, you can download it directly into node's memory

lunar narwhal
#

oh thats not what I meant

#

I mean bail on canvas entirely

#

and just write your stuff in html

#

and then use a headless browser to render that to whatever format you need

quartz kindle
#

isnt that like, adding a whole new layer of complexity for something very simple?

lunar narwhal
#

hmm depends

#

but yea if It can be done in canvas then its better

#
  • i feel like people are more comfortable writing html than drawing in canvas
quartz kindle
#

so you'd rather write an html element, style it with css, add an img element with a remote url, then snapshot the rendered page, and return it to node?

lunar narwhal
#

yea ...

#

maybe I just suck at using canvas lmao

#

but i feel like I can do much more using css idk

quartz kindle
#

lmao

#

canvas can do a lot more than css, but yes, its harder to use

#

its worth the effort to learn it tho

#

my bot uses it to generate complex images from user data

#

so i had to learn it pretty well

lunar narwhal
#

my bot does something similar so I'll look into it

quartz kindle
#

can you show a sample image?

lunar narwhal
#

yea sure

#

it displays stats for a game

quartz kindle
#

looks very doable in canvas

#

scarra is washed up tho

lunar narwhal
#

lmao true

amber fractal
#

Faker is more washed up

lunar narwhal
#

I dont think faker plays team fight tactics Kappa

quartz kindle
#

so washed up that he just won another lck title, also this should probably move to #memes-and-media

earnest phoenix
#

is there a way

#

to like make the triangle

#

a solid

#

?

#

so no sides

#

like a circle ish

quartz kindle
#

what triangle?

earnest phoenix
#

like round edges

quartz kindle
#

a triangle with round corners?

earnest phoenix
#

sorry

#

rectangle

#

LOL

quartz kindle
#

you need to use arc

#

its a bit more complicated

earnest phoenix
#

hm

edgy orchid
#

It sends it multiple times, and when I write to the bot it sends it once again but only one time...

#

help

quartz kindle
#

dont use sendMessage

#

also, that message shouldnt even send

#

you make the entire message lower case, then you check if it starts with prefix+"Rules" which contains an uppercase

#

you made msg a global variable

#

its being interfered with other messages all the time

edgy orchid
#

I just took and wrote rules really fast bc what it actually send is another thingy

hidden cargo
topaz fjord
#

It's deprecated

#

it won't work for much longer

hidden cargo
#

ok

topaz fjord
#

using send is recommended

quartz kindle
#

@hidden cargo your problem is that you made msg a global variable

hidden cargo
#

In what version does it stop working? @topaz fjord , @quartz kindle But it WORKS for me...

quartz kindle
#

in the next version

#

v12

hidden cargo
#

ok

quartz kindle
#

just because it works, doesnt mean you should use it

#

and even then, why use two different ones?

hidden cargo
#

ok, bc I did, and I asked what the problem was by making msg a global variable...

quartz kindle
#

the problem is that on every single message you get, they turn msg into something different

hidden cargo
#

Can you give an example?

topaz fjord
#

Using "But it WORKS for me" as an excuse it just dumb

quartz kindle
#

person 1 uses command: msg becomes what person1 said
person2 uses command: msg becomes what person2 said
if person1's command did not complete yet, person1's msg is now what person2 said

hidden cargo
#

yes @topaz fjord, but it felt like he missed that I said it works... for me atleast. @quartz kindle Soo you say that person 2's command is what person 1 used if it isn't done when he writes it?

quartz kindle
#

the opposite

#

a global variable only exists once, if you have multiple people using commands at the same time, they will keep changing each other's variable

hidden cargo
#

ok, are gonna test that now

restive light
#

const client = new Discord.Client(); const ayarlar = require('./ayarlar.json'); var prefix = ayarlar.json, client.on('ready', () => { console.log(Julia is online); }); client.on('message', msg => { if (msg.content.toLowerCase() === 'Julia') { msg.channel.sendMessage('yes?'); } if(!msg.contest.startsWith(prefix)) { return; } if (msg.content.toLowerCase() === prefix + 'help' ) { msg.reply('I will get new commands!') } }); client.login('token');

Indentifier 'client' has already been declared<<

hidden cargo
#

meaning? @quartz kindle what should I change it too

edgy orchid
#

asd

quartz kindle
#

a local variable

#

var const let

edgy orchid
#

nice changed name on us ;D

topaz fjord
#

var

#

ew

hidden cargo
#

so "var msg = message.content.toLowerCase();"?

topaz fjord
#

@restive light do you set ```js
const client = ...

restive light
#

yes

quartz kindle
#

for example yes, but i'd recommend using const or let

#

var is very old and has some issues

restive light
#

const client = new Discord.Client();

topaz fjord
#

no I mean anywhere else than that

restive light
#

o no

#

only in the beginning of code

#

so i dont know what is the issue in code

topaz fjord
#

Is that all the code

restive light
#

yes

hidden cargo
topaz fjord
#

@restive light line 3 where you define prefix

#

you put a comma instead of a ;

restive light
#

in another file "ayarlar.json"

topaz fjord
#

no

quartz kindle
#

@hidden cargo yes

topaz fjord
#

here northi

#

after .json there's a comma

#

it should be a ;

quartz kindle
topaz fjord
#

yes

#

Thanks for the arrow

#

@restive light

restive light
#

alright it works

#

thanks

amber fractal
#

var has use cases

#

as does let and const

topaz fjord
#

var is gey

amber fractal
#

still has use cases

#

changes how scopes work

quartz kindle
#

they dont even try anymore wtf

#

DISPSLAY

unique nimbus
#

Isnt Asus chinese

quartz kindle
#

taiwanese i believe

unique nimbus
#

ah

#

I mean a spelling mistake it okay

quartz kindle
#

not like this

#

a preinstalled software in the control panel

unique nimbus
#

Then its fucking everywhere

#

google isnt always correct

earnest phoenix
#
exports.run = async(bot, message, args) => {
  const discord = require("discord.js")
  const db = require("quick.db")
  const resp = db.all();
  resp.sort((a, b) => (a.data < b.data) ? 1 : -1);
  let paginatedItems = resp.slice(0, 10);

  let lbEmbed = new discord.RichEmbed()
  .setTitle('Leaderboard')
  .setColor('RANDOM')
let i = 1
  paginatedItems.forEach(paginatedItem => {
    let user = (paginatedItem.ID.charAt(8) + paginatedItem.ID.substr(9)).toString();
      lbEmbed.addField(i++, `${bot.users.get(user).tag} | ${paginatedItem.data} Rupees.`);
  });
  message.channel.send(lbEmbed)
}

exports.help = {
    name: 'leaderboard',
    aliases: ['lb']
}``` I also have this in my ready event;
```js
module.exports = bot => {
  bot.guilds.forEach(guild => {
      guild.fetchMembers();
  });
}```
#

the error is:

amber fractal
#

you shouldnt fetch all members

#

fetch as needed

opaque eagle
#

You misspelled require in require("quick.db")

earnest phoenix
#

nvm that

#

but

opaque eagle
#

Also what Steven said

earnest phoenix
#

mute?

#

Besides that

#

why is the tag undefined

#

since I fetched the users

#

are you sure

#

also it could be that the user left the guild

#

didn't i already tell you to use fetchUser

#

and you didn't know how to implement it because you don't know how to work with promises

topaz fjord
#

does the db object have the property .tag

earnest phoenix
#

Hey, how its named: That you drop images and they go on your server like YOURDOMAIN.COM/img/01 and you can access them by the link?

topaz fjord
#

an image server?

earnest phoenix
#

what

#

Maybe

amber fractal
earnest phoenix
#

Yes @amber fractal

#

Or this

#

a CDN

#

Yes, but...?

#

what

#

How

#

how what

#

i can't read your mind

#

How do you create it?

#

I mean...

#

If I have an VPS

#

Can I create an own one in html, js?

#

buy a vps, buy a domain, link domain dns with vps, put images on your vps, place a webserver (nginx or apache or whatever you prefer) on your vps to serve image content

#

@earnest phoenix I got it linked

topaz fjord
#

just send image data back when you request the url

earnest phoenix
#

@earnest phoenix but I wanna create an thing that if I upload an image it goes to the server

#

And gives me an link

opaque eagle
earnest phoenix
#

an actual uploader or a server for sharex?

opaque eagle
#

I think it's an actual uploader

earnest phoenix
#

Ok thanls

#

Thanks

#

i don't even want to bother with explaining on how to do that because chances are they wont understand half of it

amber fractal
#

oh wait

#

that exists? lol

#

I made my own

#

oh wait

#

that is way more complicated than what I have for no reason mmLol

urban maple
#

Can we play Fortnite scums now

#

Anyone want to play scrims

topaz fjord
#

no

#

and wrong channel

west raptor
urban maple
#

What do you mean

#

Off topic

west raptor
#

this is the development channel...

urban maple
#

So

west raptor
#

off-topic is for other dicussions

urban maple
#

Where Fortnite topic

#

What section

#

In the discoed

loud salmon
#

@urban maple wrong fuckin server my dude

#

this isnt a place for scrims

urban maple
#

Why not

loud salmon
#

because this is a server about programming

#

not fortnite

urban maple
#

1 v 1 me bitch

loud salmon
#

-m @urban maple I dont like that attitude | 1 day

gilded plankBOT
#

tickNo That member is already muted...

topaz fjord
#

gets told the rules
gets mad at the rules

#

classic white name

loud salmon
#

ok

#

who fucking stole my mute

topaz fjord
#

dream

loud salmon
#

@west raptor

#

smfh

topaz fjord
opaque eagle
#

Hi dream

loud salmon
#

I was gonna mute them

opaque eagle
#

Mute dream for punishment

loud salmon
#

nah

topaz fjord
#

i support this action

opaque eagle
#

Also why spend time monitoring this server like a hawk

#

like dream wasn't even talking here when that happened

opaque eagle
#

oh nvm didnt see that

#

I make a highlight bot DM me when certain trending words show up... words that attract stars and mutes...

amber fractal
#

wait hold up

broken shale
#

what markdown GWmythicalGrandCat

amber fractal
#

it's slightly more dark

broken shale
#

that's the color of the embed they set

amber fractal
#

ye ye I know

broken shale
#

change 'RANDOM' to that color

amber fractal
#

I didnt know it was an embed

broken shale
#

it is

amber fractal
#

because no side bar, guess it's just the same color of the embed tho :P

#

Lol but on light mode that looks dumb

#

but who uses that

broken shale
#

yep that's the downside

amber fractal
lusty dew
#

Any ideas why it’s sending that instead of the user create message?

#

Here’s my code:

topaz fjord
#

no code

lusty dew
#

I was providing it smh

#

Safari was being slow

inner jewel
topaz fjord
#

log what res it

#

in the command

lusty dew
#

It is gonna be null

#

I already know this

#

I cleared the db before testing it

#

And checked what res was already

inner jewel
#

at least on that if

lusty dew
#

How so?

amber fractal
#

you already used res

inner jewel
#

because it'll throw on the first line if res is null

#

(null).get() doesn't exist

lusty dew
#

Hm true

#

So I should move my if statement?

topaz fjord
#

it may return an empty object

lusty dew
#

Isn’t empty the same thing as saying null though?

topaz fjord
#

no

lusty dew
#

Smh really.

inner jewel
#

also use Date.now() instead of message.createdTimestamp

topaz fjord
#

^

#

if it returns an empty object just comapre their lengths instead of null check

inner jewel
#

also

        remain = daily_tstamp + daily_cd - message.createdTimestamp

1- don't use global values
2- if daily_tstamp or daily_cd are undefined it'll send the 00 message

lusty dew
#

Okay...

topaz fjord
#

constructive criticism is an unintended side effect of asking for help mmLol

lusty dew
#

I’m not mad or anything kek

#

So could I do something like

topaz fjord
#

also

lusty dew
#

if(eco.length && user.length === 0){...}

topaz fjord
lusty dew
#

Yea

#

That’s why I’m changing it

topaz fjord
#

just check res.length

lusty dew
#

But I have two things

topaz fjord
#

and if its zero execute the code in the iff statement

lusty dew
#

User and Economy

#

And I need both to not be empty objects

#

So if they are I create them

#

Ah I can use the increment method

#

Duh.

topaz fjord
#

yes

#

increment 25 times mmLol

lusty dew
#

Hm?

#

No

#
await user.increment('balance', {by: 25})
#

You can tell it how much to increment by

#

I think I did that right kek

#

@topaz fjord it does return null though

amber fractal
#

uh

#

but you already used res

#

so it wouldnt matter what it was at the if

#

you used it twice

#

so it would error before it ever reached the if

lusty dew
#

Yea.

#

I’m trying to fix that

#

I got the create entry for the tables down

#

Now I need to fix that

floral bloom
#

If I have code on GitHub, how would I make my bot use it?

#

Ping with response please.

grim aspen
#

the worst way is to use heroku

unique wagon
#

Get a server lol

grim aspen
#

not helping

unique wagon
#

Oh I see the question now lol

#

Hmm idj

#
  • idk
#

Does that even exist?

broken shale
#

@floral bloom You mean like host it or make it run

floral bloom
#

Make it run.

#

@broken shale

broken shale
#

Well did the owner have any documentation on it/how to set it up

floral bloom
#

No, I want to know if it's possible?

broken shale
#

It depends on your knowledge of that specific language it's written in, how their code is structured and if you are capable of incorporating it into your code

floral bloom
#

I don't think you understand.

inner jewel
#

git clone and run

#

fetch from raw.githubusercontent

floral bloom
#

I am making my code on GitHub. I want to run the code that is on GitHub so that my bot does what the code says.

inner jewel
#

many options

floral bloom
#

Okay, so it is possible then?

#

Okay cool.

modern elm
#

@floral bloom Hey, whats up bro! Long time not see :D...you probably don't remember me tho

floral bloom
#

Nope, I don't.

unique wagon
#

uhhh how long were u muted.....?

floral bloom
#

Who?

unique wagon
#

Unicode.

modern elm
#

@floral bloom Maybe you remember me as Bowtieman? FireBobb? God?

floral bloom
#

Bowtieman, yes.

modern elm
#

Thats me :)

#

You were in BB-8s Debugging server, right?

#

Also, for anyone who can help:
I have a test help command that uses reactions to navigate through it, but the inly thing working atm is deleting the message, im not able to remove reactions or edit the message it would seem...

Link to code:
https://hastebin.com/tiforemode.js
No Errors.

modest escarp
#

Hello

weary lark
#

anyone wanna help me with some js backend, my brain be fucked atm lol

vital lark
#

@weary lark im a js backend boi

#

what u need

weary lark
#

i followed berrys tutorial of makin a dashboard, i got like the basics of it workin, now idk how to make pages for the users guilds using express lol

vital lark
#

don't you use Discord's OAuth API?

weary lark
#

ye i do

vital lark
#

how about passport

weary lark
#

passport uh i used that on another project before

#

but not on this one yet

vital lark
#

can you give me the console log for guild

#

wait

weary lark
#

its basically like dis: {name: "guildname", icon: "yeah", so: "on"}

inner jewel
#

just check if icon == null

weary lark
#

i did do dat

inner jewel
#

instead of checking if the url is /null.whatever

weary lark
#

and it replaces that with a hat

vital lark
#

yea natan u take care of this

weary lark
#

oh yeah

inner jewel
#
var url = a
if(url == "https://..." + ... + "/null.png) url = b```
->

var url = icon == null ? b : a;```

weary lark
#

worked, thanks for that suggestion

earnest phoenix
#

Anyone wanna make a polling bot with me

#

It'll be for polls directly on discord with extra features

unique wagon
#

What language?

floral bloom
#

Why won't this work? It says Cannot read property 'something' of undefined. 'something' is anything after the third . in the code. So message.author.id gives error Cannot reas property 'id' of undefined.. Whatever is first is the error.

exports.run = async(client, message, args) => {
  if (message.author.id !== "370381633305575426") {
    return;
  }
  await message.channel.send({embed: {
    color: client.color,
    title: "Bot restarting...",
    timestamp: new Date()
  }});
  
  client.config.restart.server = message.guild.id; // Set the restart server
  client.config.restart.channel = message.channel.id; // Set the restart channel
  client.fs.writeFile("./config.json", JSON.stringify(client.config), (err) => console.error); // Save the config.json file
  
  client.destroy();
  process.exit();
};
#

Ping with response, please.

warm marsh
#

console.log client, message, and args @floral bloom

#

Maybe you're passing them in the wrong order.

#

Also, ```js
client.fs.writeFile("./config.json", JSON.stringify(client.config), console.error);

floral bloom
#

@warm marsh Thank you! I forgot to put one thing in the list of things to export.

unique wagon
#

How in the heck do i change the status on python discord. (presence). Ive looked everywere.

floral bloom
unique wagon
#

Ok thanks!

robust acorn
#

pymongo: when attempting to connect to database with pymongo.MongoClient(url), returns error: The DNS operation timed out after 20 seconds
pings are welcome.

unique wagon
#

what db are u using

robust acorn
#

mongodb

#

python

unique wagon
#

Thought so, And is it on the same device?

robust acorn
#

mongodb is a web database and does not require any installations.

#

I tried putting incorrect passwords and it returns same error.

#

prob another thing causing error?

unique wagon
#

Hmmm not from my experiences.

robust acorn
#

It works fine on pc, but does not work on mobile (with python installed)

unique wagon
#

I mean yes mongodb is a web database, but I am sure to use pymongo u need software

#

oh....

#

hmmm...

#

Mobile, you mean android?

robust acorn
#

yup

#

I whitelisted all ips. so that wouldnt matter

unique wagon
#

Hmm.......

robust acorn
#

I tried creating new users and that didnt work either

#

pretty weird...

unique wagon
#

Is the device connected to the network?

#

i mean that could be related.

robust acorn
#

its not my wifi, its pretty fast

unique wagon
#

yes but is it connected?

robust acorn
#

network is good, I even tried using vpns like 8.8.8.8

#

it is connected

#

not a wifi issue.

valid frigate
#

8.8.8.8 isnt a vpn

robust acorn
#

the google one

unique wagon
#

And DNS is network related.

robust acorn
#

whatever its called

valid frigate
#

yes google dns

unique wagon
#

So, try without ur vpn

#

and see if that works

robust acorn
#

yeah thats what I thought...

#

I did

unique wagon
#

hmm

robust acorn
#

like 100 times, actually.

#

are there any alts in connecting?

unique wagon
#

Did you type one thing wrong incorrectly?

robust acorn
#

Im attempting to connect with the string

#

nope

unique wagon
#

hmm...

robust acorn
#

I made sure everything was perfect.

unique wagon
#

that is strange, what python are u using?

#

(like the app)

robust acorn
#

I use the connection string with usename:password format, are there any alts in connecting?

#

3.7

unique wagon
#

and is pymongo installed?

robust acorn
#

pydroid 3

#

pymongo and dnspython is installed

unique wagon
#

Ok that is strange. Two seconds.

robust acorn
#

ok

unique wagon
#

Have you messed around with any DNS settings?

robust acorn
#

on the phone?

#

nope

#

its using the default DHCP connection

#

I whitelisted all ips..

unique wagon
#

One person said they had the same problem with the ip 8.8.8.8

robust acorn
#

it has to do with the string or connection... i dont see anything wrong..

unique wagon
#

Is that related?

robust acorn
#

I mean I tried like 100 times without dns, and I tried using dns which didnt work either

unique wagon
#

I can only thing of ur vpn.

#
  • think
#

A DNS timeout is probably the result of a networking issue. It could either be transient ( just a passing thing ) or either your machine running the code needs a configuration check that DNS protocols are allowed, or the Atlas instance is not running. Please also ensure you added your client application host address to the whitelist of allowed Atlas clients, or similarly allowed access from that machine. – Neil Lunn

valid frigate
#

you're sure the password is correct

robust acorn
#

yes

valid frigate
#

ok

robust acorn
#

the user is also correct

valid frigate
#

assuming it's just on your phone

#

id try turning off anything that changes your dns, etc

robust acorn
#

im using default stuff DHCP

#

with a single ip address

valid frigate
#

interesting

unique wagon
#

Yes it is,

robust acorn
#

ikr, ive been trying to get this to work for like hours

unique wagon
#

hmm, do you have another phoneto test it on without vpn?

robust acorn
#

not that its avaiable...

#

my phone doesnt have vpn

#

I even tried using mobile data to connect

#

wait, let me try something

#

nope

#

didnt work

#

I tried using 3 wifi networks

#

no vpns set up

unique wagon
#

oh I thought u said it did

robust acorn
#

using spectrum wifi + router that makes fake 5G wifi and 2.4G

#

bandwith

#

Ill show you the string formatting

#

it works on my pc so...

#

mongodb+srv://{username here}:{password here}@techcon-bot-p6ssu.mongodb.net/techcon-bot?retryWrites=true

#

the collection/database is techcon-bot i think

#

this format works on my pc so there shouldnt be any reason not to work on another device...

#

@unique wagon, is the formatting right? is there an alternate?

unique wagon
#

oh.

#

Maybe try getting rid of the ?retryWrites=true

robust acorn
#

sure ill try that

#

doesnt seem to work...

#

yeah returned same error

unique wagon
#

oof

robust acorn
#

any alt links?

#

or any other form of authencation?

unique wagon
#

I am not sure, maybe someone will work out a solution, I'll keep looking but maybe try researching the problem?

robust acorn
#

I tried researching for a long time, none of the solutions worked...

unique wagon
#

oof...

#

idk

#

it is strange

robust acorn
#

do you know if there is any other form of authencation for pymongo?

#

like this is using MongoClient

unique wagon
#

I think its using mongomotor

robust acorn
#

mongomotor?

slim heart
robust acorn
#

I did lol. it looks really complicated

unique wagon
#

it is lol

#

yes i think

robust acorn
#

cmon. I have like so many lines of code... dont want to migrate connecting format... lol

#

ill research some more on MongoClient

earnest phoenix
#

Hey, do you know how to save an drag to upload file in HTML?

#

how can i add music commands on a system bot

pure creek
#

Dragging a file to your browser triggers a redirect so maybe you could catch the redirect, use regex to check if the location is a filename and if so cancel the redirect and upload the file? I’ve never looked into it so I may be way off but that’d be my first instinct @earnest phoenix

pine jacinth
unique wagon
#

Hello! I wanted to add a server infomation for discord python.
Showing like how much ram is used on the server and a graph of drive speeds and stuff. How can i do that?

earnest phoenix
#

message.member.nickname ? message.member.nickname : message.author.username is true?

#

how can i add music commands on a system bot

stray garnet
#

@earnest phoenix do u even know coding?

earnest phoenix
#

no

stray garnet
#

the purple line is the button

#

@earnest phoenix then learn it lol

earnest phoenix
#

k

#

LMAO

stray garnet
#

without u cant do anything

#

js is great

earnest phoenix
#

TNX

stray garnet
rugged bramble
mossy vine
#

it will return the promise coming from .send

#

either put the message.channel.send on a new line, or put a semicolon after return

rugged bramble
#

still don't return

mossy vine
#

oh wait

#

im stupid lol

rugged bramble
#

why?

late hill
#

Is the value 0

#

Or NaN/undefined

#

Because NaN < 25 would be false

#

If it is actually 0 then that part of code probably isn't being executed

#

Which we can't help you with unless you provide more of your code

#

Try logging money right above that line

sinful lotus
#

if (!isNaN(money) && money < 25)

#

basically if money is a number, it will check the money if its less than 25

#

if its not a number then instant return

rugged bramble
#

the bug continues idk why

sinful lotus
#

what is your current code rn

late hill
#

Because it's probably undefined then

sinful lotus
#

do some console.log() as well

#

isNaN will do the job if its undefined

late hill
#

If it's undefined the result will be false

#

Which means it won't return his message

sullen sapphire
#

is this a bug?

#

ive used CSS in the bot Description

slim heart
#

It’s your css likely doing whatever it is

sullen sapphire
#

ok 😄

earnest phoenix
#

how do i kill all bot instances lol d.js node.js

slim heart
#

Like shards?

earnest phoenix
#

my bot is running 2 times

#

but i cant find the terminal

slim heart
#

Turn off auto-restart and run a restart command so that both processes are killed

earnest phoenix
#

found it

slim heart
#

Then start it back up after a few seconds

earnest phoenix
#

'sudo killall node'

#

in console

slim heart
#

That’s

#

Ok then

sinful lotus
#

@late hill isNaN fixes the undefined

#

isNaN(undefined) //true

#

since I included ! on it

#

this will instantly return

late hill
#

o

stray garnet
#

@sullen sapphire deutsch?

#

any1 can help me?

loud salmon
#

@modern sable yardim die user dank

#

wait this is development

#

jk

modern sable
#

uhh

knotty steeple
#

specific question

#

how would i do "proper loading" in node.js

quartz kindle
#

what do you mean?

knotty steeple
#

can i not just load stuff immediately to use later so i have a reason to use a loading screen mmulu

quartz kindle
#

you want a loading screen where? in your bot?

#

or are you working on a desktop app?

knotty steeple
#

cli

quartz kindle
#

what are you loading? images/files?

knotty steeple
#

files yes

quartz kindle
#

you can load them whenever you want, doesnt need to be at the beginning

knotty steeple
#

ill just do a settimeout loading screen for looks

buoyant lake
#

hey, is it easy to make a discord bot that allow me to type !timeleft and it will show me how many days/hours to a weekly event?

mossy vine
#

yes

buoyant lake
#

or is there any bot available already that can solve my problem

#

ok

west spoke
#

it's fairly easy

knotty steeple
#

it can basically be a

#

weekly reminder

west spoke
#

^

knotty steeple
#

so a reminder bot but do it every week

jade thistle
#

Where and when exactly do i put the code when developing a bot? followed 3 tutorial articles and i still dont know how.

knotty steeple
#

what code

jade thistle
#

of the bot i want

mossy vine
#

lmao

knotty steeple
#

what you do is dependent on language

jade thistle
#

i use js

mossy vine
#

where do i put the code
in a js file if youre using js

buoyant lake
#

oh the bot will include a command to provide countdown timer before the weekly event started

knotty steeple
#

generally you would make a command handler

#

and use it

jade thistle
#

@mossy vine aight

west spoke
#

Try python @jade thistle

#

its p simple

knotty steeple
#

python has more complicated stuff than js wym

west spoke
#

Easier to use and define variables

knotty steeple
#

import discord.ext.command thing thing

west spoke
#

from my experience

knotty steeple
#

const discord = require("discord.js")

west spoke
#

from discord import *

#

ez

jade thistle
#

is "const discord = require("discord.js")" something node.js?

west spoke
#

since ext is under discord/

#

not node

#

just normal js

jade thistle
#

ok

mossy vine
#

no

#

its node specific

knotty steeple
#

its node

#

s m h

mossy vine
#

require doesnt exist in browser

west spoke
#

hey I haven't done a bot in js yet reeeee

knotty steeple
#

what do you use in browser

buoyant lake
#

any suggestion on how to develop this bot to solve my problem 🤣

#

first step

#

so i don't get lost

mossy vine
#

script src

knotty steeple
#

o

#

o yea

#

i dont do browser js mmLol

west spoke
#

@buoyant lake google "simple discord bot <language>" and try to find one that shows it in detail

#

start with the basics

mossy vine
#

programming language*

west spoke
#

I'm used to dbl knowing what people mean by language

#

fml

weary lark
#

english

knotty steeple
#

"what language do you use"

"english"

west spoke
#

english is a programming language

weary lark
#

lmao

west spoke
weary lark
west spoke
knotty steeple
#

thats eso langs

#

idk the

#

word

west spoke
#

it works tho

buoyant lake
#

what do you call a bot that shows the time left before an event if you type a command

#

countdown bot?

quartz kindle
#

there are reminder bots

#

which are similar, idk if they show you the time left, some might do

#

you can try looking for reminder bots, countdown bots, schedule bots or something like that

#

i believe a few already exist

buoyant lake
#

well, tbh i only want one function not the extras..

#

maybe i'll try to develop myself

#

a simple that set timezone, weekly event and the time left before the weekly event started, just 3 commands

#

but i'm just afraid that it's costly to develop a bot like this

broken shale
#

depends if you self host or buy a vps

quartz kindle
#

if you do everything yourself its mostly free

#

except the hosting, if you chose to go for a good vps

#

self-hosting, glitch, heroku, and some other weird shit are free

#

google and amazon are free for 12 months

#

an entry level vps (better than all of the above) you can find for $3 a month

mossy vine
#

@fiery birch

fiery birch
#

cyber i appreciate you

#

a lot

#

i havent had a ban in ages

mossy vine
#

and other hilarious jokes

fiery birch
earnest phoenix
#

i like had no ban ever lmao

abstract crow
#

i change change tahat for youho jk me not funny

modern elm
#

For anyone who can help:
I have a test help command that uses reactions to navigate through it, but the inly thing working atm is deleting the message, im not able to remove reactions or edit the message it would seem...

Link to code:
https://hastebin.com/tiforemode.js
No Errors.

#

Please Ping or DM me, as this chat fills up quick lmao

earnest phoenix
#

idk where to put this 😦

#

which bot counts msgs without premium

#

Unicode, that link is invalid

#

+2

#
const authorizationKey = '',
      webhookID = '',
      webhookToken = '';

const express = require('express'), // 
      app = express(), // 
      bodyParser = require('body-parser'), // 
      morgan = require('morgan'), // 
      { RichEmbed } = require('discord.js'), // 
      { WebhookClient } = require('discord.js'), // 
      hook = new WebhookClient(webhookID, webhookToken); 

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(morgan('combined'));

app.post('/vote', (req, res) => {
    var authorization = req.headers.authorization;
      
    var bot = req.body.bot;
    var user = req.body.user;
    var type = req.body.type;

    if (!bot || !user || !type || !authorization) {
        res.setHeader('Content-Type', 'text/plain'); 
        res.statusCode = 403;
        return res.end('MISSING_PARAMS'); 
    };
      
    if (authorization != authorizationKey) {
        res.setHeader('Content-Type', 'text/plain'); 
        res.statusCode = 403;
        return res.end('WRONG_SECRET'); 
    };

    if (type === 'upvote') {
        var embed = new RichEmbed({
            color: 3447003,
            title: `Yeni bir oy alındı!`,
            description: `<@${user}> bota DBL üzerinde bir oy verdi!`,
            timestamp: new Date()
        });
        
        hook.send({ embeds: [embed] });

        res.statusCode = 200; 
        return res.end('OK');

    } else if (type === 'test') {
        var embed = new RichEmbed({
            color: 3447003,
            title: `Başarılı!`,
            description: `DBL test başarılı Votehook düzgün şekilde çalışıyor!`,
            timestamp: new Date()
        });
        
        hook.send({ embeds: [embed] });

        res.statusCode = 200; 
        return res.end('OK');

    }

})

Vote.

#

@earnest phoenix

tawny oar
#

🤦

earnest phoenix
#

🤦

#

🤦

stray garnet
#

lol?

earnest phoenix
#

no, lolipop :d

#

🤦

stray garnet
#

WTF? LOL

earnest phoenix
#

sadasdasdas

#

No

#

@earnest phoenix i eat your name

#

what I'm trying to do is to vote with webhook @earnest phoenix

#

@earnest phoenix d:

tawny oar
gusty tartan
#

Does default guild icons have a hash ?

inner jewel
#

no

earnest phoenix
loud salmon
#

2nd one @earnest phoenix

earnest phoenix
#

^

#

actually no that looks like garbage

#

oh shit

#

lmao wrong chat

#

sorry bout that

#

@tawny oar not minimodding..

earnest phoenix
#

added new pattern in the blank space

amber fractal
#

why does it need tts

earnest phoenix
#

TTS is inherent in that server

#

It's a private server so basically everyone has permissions

#

`- bots @user* Shows all bots of that user, includes bots in the queue.

  • owner / -owners @bot`

how to do this?

slender thistle
#

Do what exactly

lusty dew
#

Any idea why this is happening

#

All I’m doing is:

#

moment(member.joinedAt).format('DD [days ago]')

earnest phoenix
#

`- bots @user* Shows all bots of that user, includes bots in the queue.

  • owner / -owners @bot`

How to recreate these orders?

lusty dew
#

Which should be way more then 30 days

mossy vine
#

@earnest phoenix use an api

lusty dew
#

He’s probably trying to do what Luca does maybe?

earnest phoenix
#

I know that, but I can't find anything on it. @mossy vine

lusty dew
#

Where you can get the bots the owner has

earnest phoenix
#

@lusty dew

inner jewel
earnest phoenix
#

No, I'd like to redo these two orders.

lusty dew
#

Why the random ping

earnest phoenix
#

I've already looked at this.

#

moment.utc(member.joinedAt).format('DD [days ago]')

lusty dew
#

Could have said that in the ping instead of just pinging me...

#

Thanks though

earnest phoenix
#

np

lusty dew
#

Didn’t work though

earnest phoenix
#

Yo im getting a discord bot made any1 now any good things or features I can add to it anything

slender thistle
#

You don't have to spam the same message

quiet rapids
#
  • you might get either muted or kicked for spamming idk
lusty dew
#

How can I make a reload command?

#

Like if I do:
-reload eventName
Or
-reload commandName
It’d reload the command or event specified

quartz kindle
#

unpopular opinion: pm2 is a piece of shit jesus effin christ

dusky geode
#

That is unpopular

mossy vine
#

@quartz kindle other times i see you talking about how great pm2 is, what happened lol

quartz kindle
#

its great for simple things, but once you want to interact with its api and do shit with it, then oh my god

#

like

#

pm2 has cluster mode, and vancy funcions for scaling, like pm scale process +1 to add a new instance

#

except the scaling doesnt update process.env, not even in the new process

#

so then you have x processes running an outdated process.env that shows the old process count

#

and my lib requires knowing how many processes are running lol

#
process 1: instance 0, processes 2;
process 2: instance 1, processes 2;

scale +1;

process 1: instance 2, processes 2;
process 2: instance 2, processes 2;
process 3: instance 2, processes 2;```
#

like wtf

lusty dew
#

Were you talking to me?

quartz kindle
#

no lol

lusty dew
#

Oh okay

#

Bout to say well rip there goes my command idea

quartz kindle
#

reloading a command is easy, if you use separate files for each command

sturdy basin
#

Anyone need js help?

topaz fjord
#

if someone needs help they'll ask

hollow prawn
#

what do when your bot restarts but doesn't have any crash errors/issues

lusty dew
#

@quartz kindle I got that part done I think

#

Now I’m just trying to figure out how to tell if I’m reloading a command or an event

lusty dew
#
if(client.settings.bot_dev.includes(message.author.id)) {
                const input = args[0]
                switch(input){
                    case 'Event'.toLowerCase():
                      try{
                          delete require.cache[require.resolve(`../events/${args[1]}.js`)]
                          message.channel.send(`Sucessfully reloaded event: ${args[1]}`)
                        }catch (err) {
                          message.channel.send(`Unable to reload: ${args[1]}`)
                        }
                    case 'Command'.toLowerCase():
                      try{
                          delete require.cache[require.resolve(`./${args[1]}.js`)]
                          message.channel.send(`Sucessfully reloaded: ${args[1]}`)
                        }catch (err){
                            message.channel.send(`Unable to reload: ${args[1]}`)
                        }
                    }
#

Any idea why this

#

Sends both and doesn’t reload the event specified

mossy vine
#

because it fails, but also runs the send

#

try {
delete
} catch {
send 'error'
}
send 'success'

lusty dew
#

I wonder why it fails

#

The file exists

#

Any idea why it’s fail?

inner jewel
#

you're missing a break

#

if it's an event it'll always run both

lusty dew
#

Ah okay

#

Okay well it says it successfully reloaded the event but it didn’t output the change I made in the file when I made the event run

inner jewel
#

did you re-require it?

shut rose
#

how can I make a bot that makes an animated channel
?

earnest phoenix
#

what

bright hearth
#

Joe do I hire bot

shut rose
#

a bot that changes the name of the channel

#

all time

earnest phoenix
#

you don't

#

because that's api abuse

shut rose
#

what's

#

w?

#

i dont understand

lusty dew
#

@inner jewel wdym?

shut rose
#

Can I pass a server so you understand what I say?

earnest phoenix
#

no

#

i already told you that you don't create ""animated channels""

#

it's API abuse

shut rose
#

okay

lusty dew
#

Hey cry is that discord or some other platform in the ss?

earnest phoenix
#

discord

lusty dew
#

Canary?

shut rose
#

and that the state changes every time?

earnest phoenix
#

stable with beautifuldiscord

shut rose
#

state of the bot

#

is abuse?

earnest phoenix
#

what

lusty dew
#

Oh cool

shut rose
#

and this is abuse?

#

the status?

mossy vine
#

yes

#

has to be at least 12 seconds

shut rose
#

a okay but the api abuse is reportable

#

can you report me for api abuse, i'm new to this

earnest phoenix
#

yes

shut rose
#

??

#

a okay

#

and if it changes every 10,000 ms is fine

#

?

mossy vine
#

its 10k ms right now

#

set it to 15k or something

shut rose
#

okay

#

Anything automatic at 15k or more?

earnest phoenix
#

well

#

no

#

each endpoint has it's own ratelimits

#

the endpoint to change your presence is generally set at x requests/y seconds

shut rose
#

I have not understood very well because I speak little English

earnest phoenix
#

so people calculate the minimum amount that's allowed before you get ratelimited

shut rose
#

I have not understood everything very well

earnest phoenix
#

ok

shut rose
#

someone knows how to speak a little spanish?

#

someone speak's a little spanish

#

?

modern elm
#

@shut rose Yo hablo espanol eyesBOOM

shut rose
#

esque necessito ayuda

modern elm
#

con que

#

cual es la problema

shut rose
#

con lo del api abuse

#

que no entiendo

modern elm
#

que no entiendes

shut rose
#

porque quiero hacer un bot que canvie el nombre de un canal cada unos ms

modern elm
#

ah

shut rose
#

y me han dicho que eso es api abuse

modern elm
#

si

#

porque es

#

como se dice ping eyesBOOM

shut rose
#

que tienen que ser 15k ms

modern elm
#

es pidiendo mucho informacion cada uno ms y eso crea lag

#

y te pueden banear de discord para cosas asi

#

porque es considerado como

#

"DDoS"

shut rose
#

aaa

modern elm
#

:(

shut rose
#

puedo pasarte por privado

#

un discord

modern elm
#

sip

shut rose
#

y que veas claramente de lo que hablo

modern elm
#

que si

#

por DM

earnest phoenix
#

you're providing false information

#

it isn't considered as a ddos

#

that's not even what a ddos is

modern elm
#

I misunderstood

#

at first

#

but he showed me what he meant

lusty dew
#
client.loadCommands = (callback) => {
        client.commands = {};
        fs.readdir('./commands/', (err, files) => {
            if (err) {
                client.log(`Error loading commands : ${err}`);
                return;
            }
            files.forEach(file => {
                require(`../commands/${file}`).load(client);
            });
            // console.log(Object.values(client.commands))
            callback();
        });
    };
    client.loadEvents = (callback) => {
        fs.readdir('./events/', (err, files) => {
            if(err){
                client.log(`Error loading events: ${err}`)
                return;
            }
            files.forEach(file => {
                if(!file.endsWith('.js')) return;
                require(`../events/${file}`).load(client)
            })
            callback()
        })
    }```
*Btw for anyone who can help me with my reload command this is my cmd & event handler and if needed I’ll resend my reload cmd code*
knotty steeple
#

so

#

whats the problem

modern elm
#

With my code or his?

knotty steeple
#

@lusty dew

modern elm
#

oh :(

lusty dew
#

Mk

#

Well it’s not reloading the event or cmd properly

#

It says it has but ofc it hasn’t outputted the new changes

modern elm
#

For anyone who can help:
I have a test help command that uses reactions to navigate through it, but the inly thing working atm is deleting the message, im not able to remove reactions or edit the message it would seem...

Link to code:
https://pastebin.com/RK9MGZbM
No Errors.

earnest phoenix
#
    else if (message.content.toLowerCase === 'fuck'){
      message.delete(1000)
      message.channel.send(`Please watch your language, ${message.author}`)
    }```
#

why wont this command work

knotty steeple
#

what about it doesnt work

#

Just saying "I get an error" doesn't give us enough information on your problem

earnest phoenix
#

the bot does not reply to it

#

or deete the message

#

it just doesnt do what it is supposed to

#

because you're using toLowerCase as a property, not a function

#

oh

#

how do i fix that

modern elm
#

lmao

#

add parentheses

earnest phoenix
#

you should probably backtrack and learn js first

#

im sorry.. im a beginner

#

else if (message.content.toLowerCase() === 'fuck'){ like this?

idle basalt
#

yes like that

earnest phoenix
#

thanks. finally a nice person 🙂

#

yep that looks good

#
    else if (message.content.toLowerCase() === 'fuck'){
      message.delete(1000)
      message.channel.send(`Please watch your language, ${message.author}`)
    }
    else if (message.content.toLowerCase() === 'shit'){
      message.delete(1000)
      message.channel.send(`Please watch your language, ${message.author}`)
    }```
#

it only works if message starts with it

#

also you can get syntax highlighting if you write ```<language>
code
```

idle basalt
#

that problem originates from a different part of your code

earnest phoenix
#

so like ```csharp
bool e() {return false;}
```
would look like

bool e() {return false;}
idle basalt
#

btw a cool trick is ['word1, 'word2'].includes(message.content.toLowerCase() so you can just make an array of words instead of a ton of repeated code

earnest phoenix
#

oh

#

ok

idle basalt
#
    if (['word1', 'word2'].includes(message.content.toLowerCase())){
      message.delete(1000)
      message.channel.send(`Please watch your language, ${message.author}`)
    }```would look like this
#

and you just add words to the array instead of making a new else if every time

#

not to discourage you or anything, but youd need a much more sophisticated system to implement a strong chat filter

earnest phoenix
#

also, before you waste too much time, word filters are useless and you shouldn't spend your time and effort on them

#

they'll always be bypassed no matter how hard you try

idle basalt
#

i just said that but in a nice way 🌚

lusty dew
#

Wasn’t there always limitations with making swear filters because people could bypass it numerous ways?

idle basalt
#

ye its way too easy to get around them

lusty dew
#

I’ve only thought of a few ways out of the many problems there are

idle basalt
#

you can use an overcomplicated regex to match different joiner chars

#

its just too much effort for a negligible reward though

#

basic chat filter is enough for most people

earnest phoenix
#
    ['fuck', 'shit'].includes(message.content.toLowerCase() {
      message.delete(1000)
      message.channel.send(`Please watch your language, ${message.author}`)
    }```
idle basalt
#

you forgot the if part

#

its not an if statement right now so its just a syntax error

earnest phoenix
#

it says it is a property

idle basalt
#

if (...)

lusty dew
#
  1. Delete spaces when reading the content (if possible) so they can’t do F U C K to bypass it
  2. When the bot reads the content make it all lowercase with toLowerCase() (if possible)
earnest phoenix
#

ph

#

uhhhhh

#

im so dumb

#

sorry

idle basalt
#

np youre new youll learn all this stuff

#

cant just delete spaces because what if their sentence is something like "i went to the car wash it was great"

#

that would ban sh it from wash it

#

youd need to check if there are letters around

earnest phoenix
#
    else if (['fuck', 'shit'].includes(message.content.toLowerCase() {
      message.delete(1000)
      message.channel.send(`Please watch your language, ${message.author}`)
    }```
idle basalt
#

you forgot two closing parens

lusty dew
#

I mean washit isn’t a word though?

idle basalt
#

so youre not gonna match sh*it?

#

because thats not a word either

lusty dew
#

Eh true

idle basalt
#

if you delete all the spaces youd be left with giant strings

#

i assume youd look for the "bad words" within it

lusty dew
#

True.

earnest phoenix
#

where is closing parens

idle basalt
#

it will all be jumbled

#

if (...)

lusty dew
#

That’s true.

idle basalt
#

each paren you open has to close

#

you only closed toLowerCase()

lusty dew
#

Didn’t think that far ahead 😂

idle basalt
#

you forgot to close includes( and if (

#

so youre missing two parenthesis after toLowerCase()

#

install this tool called a linter. it will help you find syntax errors like these

lusty dew
#

Eslint is a good one

#

Especially when using vsc

idle basalt
#

yea

earnest phoenix
#

linter is taking a long time to download

lusty dew
#

Yea

idle basalt
#

its a complicated program

lusty dew
#

Sometimes they do

idle basalt
#

it has to read all of your code and search for all kinds of errors

earnest phoenix
#

what does linter do

idle basalt
#

now im worried that you just installed some random shit called "linter"

lusty dew
#

Helps you point out erroring lines

idle basalt
lusty dew
#

That actually helps you setup eslint didn’t know that

earnest phoenix
#

best case scenario is that there'll be 1,114,112^1990 ways to bypass the word filter

idle basalt
#

djs.guide is op

lusty dew
#

I used another source

idle basalt
#

i cant even remember what i used

earnest phoenix
#

no i did npm install eslint

lusty dew
#

Yea

#

eslint will take time to download dw

earnest phoenix
#

sorry english is not my first language

lusty dew
#

It took mine 2-3 minutes to install

earnest phoenix
#

ok. linter is installed what now

lusty dew
#

Though I had shitty internet

idle basalt
#

read the thing i linked like 3 times now haha

lusty dew
#

Read the guide

earnest phoenix
#

ok

lusty dew
#

It will help you setup the things you need

#

Okay now to go finish the billion things I need to do to finally push my new update

#

😂

earnest phoenix
#

so i just did the maths

#

this is the amount of ways that can be used to bypass a word filter on discord

#

on a best case scenario

lusty dew
#

Uhm

earnest phoenix
#

that number could be doubled with three letter words

lusty dew
#

That’s a lot of numbers

earnest phoenix
#

yeah

lusty dew
#

And I can only think of three ways to bypass the filter

#

😂

earnest phoenix
#

unicode has a possible 1,114,112 characters, power that by an estimate of the character limit

#

most calculators will overflow on that because it's so huge

lusty dew
#

Yea people could do fuuck

#

And bypass the filter

earnest phoenix
#

it's why making a word filter on discord is useless

lusty dew
#

Yea

#

I wonder if there is a way to make an nsfw filter for images

idle basalt
#

there is

lusty dew
idle basalt
#

some bots have that

lusty dew
#

Really

idle basalt
#

none of them are really all that great

#

but you can give it a shot

earnest phoenix
#

im just going to fix it later

#

it's reasonable for example in minecraft as the charset is limited and the character limit is 256

idle basalt
#

i think most of the apis are paid though

lusty dew
#

Not like I want to add it to my bot cause it’s basically pure nsfw

idle basalt
#

you can always make your own image recognition tool

lusty dew
#

But it was just a thought

idle basalt
#

but yes that kind of thing does exist

earnest phoenix
#

making your own recognition tool by yourself would take ages

#

even if you used an AI service like tensorflow

idle basalt
#

100%

lusty dew
#

I saw a npm package called is-nsfw or smth and it works okay

#

But it isn’t the best