#development

1 messages ยท Page 807 of 1

earnest phoenix
#

@wide ruin if you use basic template "hello-express" you have an exemple

quartz kindle
#

so its just index.html on glitch, without any server side code

earnest phoenix
#

Lol wait

wide ruin
#

It has a JS file yeah

earnest phoenix
#

Go here

#

Tim

quartz kindle
#

but its browser js, not server js, right?

earnest phoenix
#

You can see the basic template

quartz kindle
#

like a js file you include in your html file

earnest phoenix
#

No

#

This is a server

quartz kindle
#

im asking him

earnest phoenix
#

Powered by js

#

OH

wide ruin
#

@quartz kindle wdym

#

It's a JS file that loaded in with a script

quartz kindle
#

but its loaded in the html file, right?

wide ruin
#

Yeah

quartz kindle
#

so thats browser js

#

you need to use server-side code

#

like server-based js file

wide ruin
#

How would that be set up?

quartz kindle
#

you have to rebuild your website into using a webserver library like express

#

instead of html files

wide ruin
#

So there's literally no way to pick up a request

quartz kindle
#

not without server side code

wide ruin
#

Can't I just add the code for server side?

quartz kindle
#

you do it by rebuilding your website into using a webserver

#

for instance, instead of index.html

#

you will have an index.js file, that must be set as the "main" file in your package.json

#

and then in that js file, you need to use a library like express

#

configure a route like app.get("/")

#

and then run the server on glitch's port like app.listen(process.env.PORT)

#

and then from that app.get() part, you will receive requests, and inside that request you can send html files

#

or you can configure static files

#

but the main entry point will be the js webserver, not the html file

#

when people open your website, your webserver receives a request and the decides what to do with it and what to send

#

instead of glitch automatically sending them your html file

modest maple
#

once you get the idea of it it is soooooooo much nicer

wide ruin
#

Can I not just add a new file?

#

And add a throttle and stuff

quartz kindle
#

no

modest maple
#

its really not as hard as you think

quartz kindle
#

you must explicitly tell glitch to use your server

#

"hey glitch, i want all requests to be handled by my webserver instead of you sending a file automatically"

wide ruin
#

Wouldn't that work if if I did a /receive.html file?

quartz kindle
#

no

modest maple
#

das not how dat works

quartz kindle
#

an html file doesnt do anything on its own

#

when you open a website that has an html file, your browser downloads the file, then opens it

wide ruin
#

Ok

quartz kindle
#

an html file never does anything on the server

modest maple
#

if it really is too much for u, you can always use a basic framework

wide ruin
#

Is it possible to do it the other way?

#

Loading the page gets the most recent post with an image

quartz kindle
#

if you can access this page from your browser, yes

#

a page that automatucaly gives you the most recent post

wet iron
#

hey

#

I have a question

#

how can I send a gif

#

in an embed

#

?

earnest phoenix
#

as in, upload it and then put it in an embed or?

quartz kindle
#

as in, a file in your computer, or an url

wet iron
#

url

wet iron
#

I tried image

#

but i realized

#

that gif isnt a n image

quartz kindle
#

gif is an image

modest maple
#

yes

#

that would work for set_image ^^

wet iron
#

but it loaded

#

and

#

loaded

#

and never loaded

modest maple
#

is the url ur using a direct link or not

#

if it isnt it will never load

wet iron
#

Its tennor

#

its tennor

modest maple
#

whats the link

quartz kindle
#

try using a direct link instead

quartz kindle
#

yes

modest maple
#

tennor images dont seem to load properly

#

now time to remove that link from test command

tight plinth
#

how can I search members of a guild if I only have their username?

quartz kindle
#

are the members cached?

tight plinth
#

yes

modest maple
#

the member object will have the name

tight plinth
#
console.log(message.guild.members.cache.find(user => user.username === 'Timo Aardappel'))
quartz kindle
#

guild.members.find() or guild.members.cache.find() if v12

modest maple
#

itterate through

prime cliff
#

@wet iron this is for development not gif spamming

tight plinth
#

this return undefined

modest maple
#

@prime cliff it was todo with the issue

quartz kindle
#

members gives you a member object, not a user object

#

member objects dont have usernames

prime cliff
#

tipsFedora carry on then

quartz kindle
#

they have nicknames

#

if you want to check for both, you can do this

#

.find(member => member.nickname === "some name" || member.user.username === "some name")

tight plinth
#

hm

topaz fjord
#

very cool

#

Tim the smart boy

tight plinth
#

ye, tim is smart

quartz kindle
#

lul

#

/blush

tight plinth
#

smart enough to get some working code

twilit rapids
#

or read the docs

topaz fjord
#

basically

tight plinth
#

I cant read them without dying lmao

topaz fjord
quartz kindle
#

this is a strike-through message

twilit rapids
#

:pepewhip:

wet iron
#

@quartz kindle thanks it worked!

quartz kindle
#

๐Ÿ‘

unborn steeple
#

it says message.author.hasPermission is undefined

#

is not a function*

wise orbit
#

Anyone know why I get this error every time when my bot is connecting and how to fix it? (djs v12)
AbortError: The user aborted a request.

quartz kindle
#

message.author is a user object, not a member object

unborn steeple
#

How do i get the authors permissions?

quartz kindle
#

use a member object instead

unborn steeple
#

i dont understand it

quartz kindle
#

message.member

unborn steeple
#

oh

earnest phoenix
#

@wise orbit it means that you have a bad connexion

#

D.js has a timeout for long requests

wise orbit
#

๐Ÿค” okay,I see, I think restarting the router will do me good
thank you

earnest phoenix
#

There is a client option for that

#

restRequestTimeout

#

Upgrade it to test it

wise orbit
#

ty

earnest phoenix
#

np

boreal hemlock
#

anyone want to build me a bot

earnest phoenix
#

In minecraft?

boreal hemlock
#

truth I am new

#

I need for discord

#

a stock bot but not like others

#

I have a system I built I want to add to it

#

making it different than all others

earnest phoenix
#

Smh people trying to tag everyone

boreal hemlock
#

sorry is that bad

quartz kindle
#

we dont build bots for people, especially not for free

#

here we help each other with bot programming, learning and doing things ourselves

crimson vapor
#

for most people, the bots are a project, right? mostly for fun

lyric mountain
#

@crimson vapor mine's a hobby

earnest phoenix
#

For some reason when i enter (domain)/img/file in my browser i can pull it up

but my bots not embedding it
Does anyone have any ideas?

crimson vapor
#

probably just not loading

earnest phoenix
#

ya thats what im trying to figure out NGNLthonk why will it load in browser bot not on discord

crimson vapor
#

I mean its probably just taking forever

lyric mountain
#

Isn't your image too heavy?

earnest phoenix
#

and i wouldnt think. One sec

#

500x300
800kb

lyric mountain
#

Have you tried loading the gif as a file and sending it?

#

Instead of embedding on an embed

earnest phoenix
#

No i havent. But that gives me an idea (not for the bot im wondering if the file is downloadable now)

#

Ill try that in a bit ๐Ÿ™‚

lyric mountain
#

Ah

earnest phoenix
#

oof

lyric mountain
#

Welp

#

Seems like server-side issues

#

Since you can load the gif in the browser, so it's not issues on your side

earnest phoenix
#

Lol idk what i did though
the ports open and i turned off the firewall to test NGNLthonk

#

anyway, ty!

lyric mountain
#

You're welcome

mystic violet
#

Could someone help me get started with CSS of the bot page?

#

not sure where to start tbh

lyric mountain
#

Do you know how css work already?

mystic violet
#

Yeah alittle bit, I can do some stuff with it like gradients and others

#

I just wanna set the background to dark theme

lyric mountain
#

Just add a <style></style> tag at the end of your long desc and put your css inside it

earnest phoenix
#

hmm incog worked
but doesnt help the bot

lyric mountain
#
<style>
	body {
		background-color: #212125
	} 
</style>
#

Use F12 if you need to get classes and ids for the elements

mystic violet
#

Okay thank you ๐Ÿ™‚

lyric mountain
#

Ah, btw

#

Some styles will require a !important tag after it

#

So if it seems not to show your changes try to add it to the style parameter

quartz kindle
#

or try learning css specificity instead of abusing !important lul

lyric mountain
#

That also works

#

The issue is that there are important tags on the page's styles

#

So it overrides your changes

quartz kindle
#

yeah some of them have it lul

earnest phoenix
#

!important !important

lyric mountain
#

!rllyimportantcodewhatever

earnest phoenix
#

lol

#

css is very !important

amber fractal
#

I only use !important on top.gg

lyric mountain
#

Stopping to think, is it possible to inject css on github?

quartz kindle
#

not afaik

#

only on github pages

steel heath
#

you can install some extensions like Stylus and change website's css

#

you can even use premade ones online so it's cool but I don't like any of em

quartz kindle
#

yeah but thats only for you

earnest phoenix
#

@lyric mountain Dont know if you care but i looked at logs and found the issue
it was ModSecurity falsey identifying discord and my cdn

#

took maybe a minute to fix

lyric mountain
#

Hm, that could be it

#

I'm glad you could fix it

forest mirage
#

client.guilds.get('544677366455336974').fetchInvites().then(i => message.channel.send(`discord.gg/${i.code}`));

#

Anyone know whatโ€™s wrong with this?

#

Trying to eval and have my bot create an invite for the id

lyric mountain
#

Why is i.code inside the string?

forest mirage
#

Isnโ€™t that the invite code?

lyric mountain
#

I mean, why not concat it?

last willow
#

how do you make the bot not tell when someone joins/leaves the server

crimson vapor
#

if you are fetching more than one, wouldn't there be multiple?

#

so you would need to choose one?

earnest phoenix
#

Donโ€™t program it in frosty

last willow
#

it was already in

#

when i invited it

lyric mountain
#

@last willow onMemberJoinEvent and onMemberLeaveEvent

earnest phoenix
#

Oh if itโ€™s not your bot

#

Hmm you could change the welcome channel

#

Then hide it

lyric mountain
#

^

last willow
#

ooff wrong chat

#

lol

#

was trying to get help on the invite manger discord lol

lyric mountain
#

Lol

earnest phoenix
#

Lol

lyric mountain
#

Admins, give us pikachu emote asap

earnest phoenix
lyric mountain
#

Not those, I mean THE pikachu emote

earnest phoenix
#

This one?

#

If you're cool you have PikaDab

lyric mountain
#

Dat

earnest phoenix
#

I donโ€™t have dab

lyric mountain
#

Srry

earnest phoenix
#

^

slender thistle
#

HTML/CSS:
Should I have a div with width: 100% and then create my table inside that div
or
Should I just set the table's width to 100% with display: flex and only align the table to center

lyric mountain
#

Depends on what you're doing

#

For some sort of command list or just some random info it's better to have an adaptive table

slender thistle
#

Actually, I'll need some other stuff around the table so I might go for a div

warm marsh
#

@lyric mountain what Noah done was correct with I.code in the string, it's called a template literal.

#

@forest mirage fetchInvites returns a collection thus will require the .first used on it before .code is available.

#
let invites = await client.guilds.get("id").fetchInvites();
let first = invites.first() || false;
if (!first) return;

// then use first.code
forest mirage
#

Ah, thanks

warm marsh
#

There might be a few problems with what I sent, been awake far too long.

#

Also apologise for the mention. Both of you.

forest mirage
#

Donโ€™t apologize! I appreciate your help nonetheless myy_LoveHi

floral bloom
#

Discord.js
I want to have a bot make a transfer of messages from one server channel to another, how would I do this while keeping the messages in order?

neat ingot
#

best way to implement a math 5 * 4 / (3 + 2) - 1 type command? obviously i dont want to eval anything given to me by a users input. should i regexp and parse for number and mathematic operators only? should i split each as its own argument and then validate that each are numbers / math ops? how would you do it? @ anyonewhocares

slender thistle
#

Do you think it's possible that there's a module that handles that?

lime jewel
#

Discord.js
I want to have a bot make a transfer of messages from one server channel to another, how would I do this while keeping the messages in order?

For each message:
await client.channels.get("ChannelID").send("Message") @floral bloom

floral bloom
#

@lime jewel I'm sorry, I mean how do I get the messages from first to last and send them to another server?

neat ingot
#

oh probably yea

#

that seems very overshare @floral bloom

#

like, for what reason?

#

and then like, how far back are you trying to go?

#

what if a particular message already got sent?

#

are you trying to do this for all channels?

#

#datamining?

finite bough
#

what if someone is getting anxieties

floral bloom
#

like, for what reason?
Because it is a roleplay channel for a friend and they want it saved because the channel may be deleted.

and then like, how far back are you trying to go?
January 31st, 2020, 23:49 (EST) [32 days]

what if a particular message already got sent?
What do you mean by this?

are you trying to do this for all channels?
No, only one channel.

#datamining?
Huh?

@neat ingot

neat ingot
#

maybe that will help

#

it wont be quick to get the past 32 days of messages though

#

and you would need to wait till it had them all before you started sending to a new channel

#

and then your gona have to send them with an embed or something to show the user who said the things avatar and username in

#

or some other formatting to highlight such

floral bloom
#

Thanks! I'll look into it. ๐Ÿ™‚

neat ingot
#

np ๐Ÿ™‚

honest pebble
#

nevermind ๐Ÿคทโ€โ™‚๏ธ

earnest phoenix
#

Can anyone help me

#

Regarding making my own starboard bot

#

im tryna figure that out rn

#

K

hoary elm
earnest phoenix
#

thats js ):

hoary elm
#

Starboard guide ^^^

earnest phoenix
#

i think i've mostly got it figured out

#

for dpy

mossy vine
#

the logic is the same

hoary elm
#

Oh you use py

#

My bad

#

For some reason I thought you used d.js ๐Ÿคฆ๐Ÿปโ€โ™‚๏ธ

earnest phoenix
#

o

mossy vine
#

because d.js is the most popular and its usually safe to assume especially around here with so many beginners

hoary elm
#

True

tight plinth
#

Question : isdispatcher.on('end' dispatcher.on('finish'now?

#

With djs v12

hoary elm
#

That I can't help with ๐Ÿ˜ฌ I don't use v12 yet.

tight plinth
#

Oof

mossy vine
#

read docs?

tight plinth
#

Bruh, I'm correct

#

But now I have an other problem

#

My bot can't leave voice channels

earnest phoenix
#

how does d.js execute os commands

#

or can it

hoary elm
#

@earnest phoenix you mean like shell/PowerShell commands?,

earnest phoenix
#

yea

#

like pythons os.exec

tight plinth
hoary elm
#

I've never actually dug into how that works for d.js or if it even can execute them (i would imagine it can)

earnest phoenix
#

well

#

i was gonna say

#

just do whatever the djs equivalent of exit() is

#

to leave a vc

#

;p

hoary elm
#

lol

#

I know what you mean

candid granite
#

How do I get bot developer role?

hoary elm
#

For example to stop the bot with d.js is process.exit() iirc

#

@candid granite add a bot to the top.gg site

#

And get it approved/accepted

earnest phoenix
candid granite
#

how long till it is approved or accepted?

hoary elm
#

2 weeks or longer

#

They get a lot of applications

candid granite
#

oh/.... great

earnest phoenix
#

actually

#

@mental bobcat (684065290845552652)

#

was declined at 635pm, but apparently was added hours earlier

#

so

modest maple
#

They will decline you sooner for small issues like spam desc etc...

earnest phoenix
#

o

#

lemme find another then

modest maple
#

Easy to clear out a bulk amount of bots that way and keep it short

earnest phoenix
#

@floral axle (614845107522240513) added last thurs 2:08pm, declined yesterday 6:12am so i'd still say a week

hoary elm
#

Yeah the 2 weeks or more things was a estimate

#

Last bot I added I waited 3 weeks maybe 2 and a half

#

๐Ÿคท๐Ÿปโ€โ™‚๏ธ

earnest phoenix
#

mine got approved in 6 days

hoary elm
#

That's not bad

earnest phoenix
#

that was only 5 or so days ago, thats why i've been saying a week

candid granite
#

I am trying to change my prefix

#

it's really annoying

#

someone wanna tell me how to make this an uncommon prefix? if (message.content.indexOf(config.prefix) !== 0) return;

hoary elm
#

........

earnest phoenix
#

what

#

no

#

no no no

hoary elm
#

That is NOT the prefix

#

That's what reads if the prefix is part of the message

candid granite
#

oh.. my bad, wrong line

hoary elm
#

config.prefix afaik you should probably be editing the prefix via the config.json

candid granite
#

const prefix = "g!";

hoary elm
#

Change the g!

#

To what you want to use

candid granite
#

yeah, I didn't have that was the problem

hoary elm
#

Oh

#

Lol

candid granite
#

g!help was a big mistake....

#

omfg

earnest phoenix
#

try %help

#

xD

candid granite
#

I made mine log

#

log help

#

anyone know how I can keep my bot online constantly?

slender thistle
#

VPS

candid granite
#

care to elaborate on that?

earnest phoenix
#

VPS or RDP

candid granite
#

how do I use it

mossy vine
#

a server

#

its like a computer

#

and you connect to it with ssh

#

and you set your bot up there

candid granite
#

link?

mossy vine
#

so get used to the command line

earnest phoenix
#

rdp is better to me

mossy vine
#

there are many providers

earnest phoenix
#

easy access

candid granite
#

but which do you use.. link

earnest phoenix
#

vps can be a pain sometimes

mossy vine
#

check pinned messages

earnest phoenix
#

i use both

mossy vine
#

pain thats definitely worth it

earnest phoenix
#

vps for my small bot, rdp for my bigger bot

candid granite
#

which do you use...

mossy vine
#

just check pinned messages

#

see what provider works best for you

earnest phoenix
#

lol

candid granite
#

none of those look good. one isn't even english

earnest phoenix
#

what?

mossy vine
#

lmao

#

then give up

earnest phoenix
#

hands up

candid granite
#

how do I use it?

earnest phoenix
#

youtube can help u with that

finite bough
#

@candid granite use glitch

#

free

#

online editor

modest maple
#

No

#

Glitch is shit

finite bough
#

oml

#

everything I say

#

u deny it

#

first biggers glitch is good

modest maple
#

You can't expect not to have that response when you recommend glitch to someone who can potentially afford a cheap VPS

#

Learning basic command lines takes literally 5 minutes

finite bough
#

what if

#

that guy or girl is not intrested in coding

#

and just wants to try it out

modest maple
#

Then don't go into bot development

#

Bot development library's are NOT beginner friendly and require you to have the basics down before attempting it

quartz kindle
#

for some one with no means of paying, glitch is still probably the best option

#

but if they have money or even access to a card for free trials, then a vps will always be a better option

finite bough
#

tbh

#

I like glitch coz

#
  1. u can edit on phone
#
  1. u dont have to edit and export files
mossy vine
#

you can access a vps on your phone, whats your point

finite bough
#

or commit changes

#

glitch is like

#

on any phone

#

just login on a browser

modest maple
#

Seems like the lazy person's way out

quartz kindle
#

remember the time where everyone had computers and nobody had phones? pepperidge farm remembers

modest maple
#

You can access a VPS via phone altho coding on phone is ๐Ÿคข

finite bough
#

tho

dusky marsh
#

Having version control is a good thing, why would it be a perk to not have to use one.

modest maple
#

^^

#

Pushing shit randomly tends to never end well or be a good thing

#

And if working in a team makes life hell

quartz kindle
#

eh, i dont version control my bots lul

dusky marsh
#

smh

modest maple
#

Smh

#

Tim you were our god, now thy hath been sullied

#

That's Shakespeare enough ish

quartz kindle
#

i was always a heretic, you just chose to believe what you wanted to believe

finite bough
#

jesus = tim

#

lmao

quartz kindle
#

jesus is my actual nickname in some servers lol

marble juniper
#

why are the only persons defending glitch the persons who know nothing

finite bough
#

persons

#

yes

earnest phoenix
#

Count bots?

summer torrent
#

which language do you using

flat pelican
#

@modest maple Can you not trashtalk at stuff here please

summer torrent
#

use filter()

flat pelican
#

Glitch isn't "shit" when you use it correctly

#

shitting on a service only because it's free is stupid

quartz kindle
#

if the member is a bot

summer torrent
#

^

quartz kindle
#

also, it will only work on cached members

summer torrent
#

example
filter(member => member.user.bot)

earnest phoenix
#

member.user?

quartz kindle
#

yes

earnest phoenix
#

What will this return?

quartz kindle
#

a member object contains information about the member in the guild, like nicknames, roles, etc

earnest phoenix
#

Ok

quartz kindle
#

a user object contains information about the person's account, like username, tag, if its a bot or not

summer torrent
#

use .size for get count

quartz kindle
#

you can get the user from a member by member.user

summer torrent
#

@ocean frigate stop react spam pls

flat pelican
#

it's funny to play with reactions isn't it

#

no, it's not

slender thistle
#

That was a hint to stop if you didn't get it

ocean frigate
#

I already got it

earnest phoenix
#

Anyways letโ€™s keep this channel for bot developement

steel heath
#

@modest maple wow that was rude

charred jetty
#
client.snipy[`${message.channel.id}`] = {content: `${message.content}`,sender: `${message.author.tag}`};5:16 PM

TypeError: Cannot read property 'channel' of undefined```
#

I Don't understand it

lofty vine
#

message is undefined

charred jetty
#

It triggers on messageDelete

#
const Discord = require("discord.js");
module.exports = (client, message) => {

  
 client.snipy[message.channel.id] = {content: `${message.content}`,sender: `${message.author.tag}`};
  var fs = require('fs');
  var fileName = './snipe.json';
  

  fs.writeFile(fileName, JSON.stringify(client.snipy), (error) => {
  if (error) {
return console.log('oops')
   }
 });
  



};```
lofty vine
#

๐Ÿค”

charred jetty
#

Did i wrong?

lilac wharf
#

@charred jetty try checking if message#channel is valid since it might be the cause of the issue.

charred jetty
#

Um ok

lethal stratus
#

what commands should I add to my bot

steel heath
#

what if someone's deleting messages in DMs?

lethal stratus
#

context

steel heath
#

you do it like: require("./events/messageDelete.js")(client, message)? or is this not even needed

lethal stratus
#

further context please

#

what are you trying to do, and what's the issue

marble juniper
#

thonk

steel heath
#

there's all you need to know

#

message is undefined

lethal stratus
#

if someone is deleting a message and you want to get the message or something you just set up a messageDelete event to catch those and report or push them to an array

sudden geyser
#

Hero, can you show us where you called that file's function.

lethal stratus
#

it should be no different between DMs and guilds

steel heath
#

yes

charred jetty
#

@lilac wharf message is undefined

steel heath
#

Hero, can you show us where you called that file's function.

charred jetty
#

In server.js

#

client.snipy = JSON.parse(fs.readFileSync("./snipe.json", "utf8"));

#

And the previously given code was in messageDelete.js event

#

Snipe Command is working perfectly

steel heath
#

yes but show us your event handler where you require messageDelete.js event

charred jetty
#

Ok

left delta
#

I am new here

#

how do i get roles

#

and add bots?

steel heath
charred jetty
#

util/eventLoader.js
const reqEvent = (event) => require(`../events/${event}`); module.exports = client => { client.on('ready', () => reqEvent('ready')(client)); client.on('reconnecting', () => reqEvent('reconnecting')(client)); client.on('disconnect', () => reqEvent('disconnect')(client)); client.on('message', reqEvent('message')); client.on('guildMemberAdd', reqEvent('guildMemberAdd')); client.on('guildMemberRemove', reqEvent('guildMemberRemove')); client.on('guildMemberUpdate', reqEvent('guildMemberUpdate')); client.on('guildBanAdd', reqEvent('guildBanAdd')); client.on('guildBanRemove', reqEvent('guildBanRemove')); client.on('voiceStateUpdate', reqEvent('voiceStateUpdate')); client.on('messageDelete', reqEvent('messageDelete')); };

sudden geyser
#

well that's why. the first argument would be message.

charred jetty
#

?

sudden geyser
#

as you're doing client.on('messageDelete', reqEvent('messageDelete'));, it's being treated like client.on('messageDelete', (message) => reqEvent('messageDelete')(message)), which, the first argument for the function in that file is client. So client is the message instance, rather than the message variable.

charred jetty
#

Did i switched those?

#

message => client
And client => message

sudden geyser
#

No, message is nothing.

#

and client is message.

#

You can use an easy workaround by using something like reqEvent('eventName').bind(client) so it gets called like (client, message).

charred jetty
#

Ok

#

Ohk

#

That's why i was unable to send the client to the event.js

left delta
#

why are bots not allowed to respond to non-commands?

sudden geyser
#

because it's annoying (in this server at least)

slender thistle
#

Imagine you send "hello" in a Discord channel and you get spammed with 20+ bots responding

charred jetty
#

Lol

left delta
#

I see, well my bot says if you use I am {] it replies''

mossy vine
#

so dadbot

#

you managed to show everything but the error

steel heath
#

ikr

mossy vine
#

just

#

dont send the entire stacktrace

earnest phoenix
#

have you tried reading it

#

because it says well and clear what's the issue

#

and what does the error say

modest maple
#

Have you considered the idea that string for server1 may not equal string for server2

earnest phoenix
#

Reading comprehension

#

understand what you read

#

because the error quite literally

#

says what you did wrong

steel heath
#

I like how we "help" people here like

#

not telling them what method/function they could use to fix their errors

#

we just tell them to read and understand

#

this doesn't work for turkish peep but somehow it works for u

earnest phoenix
#

i often push people to figure it themselves; beacause they can and that's how you learn

steel heath
#

it's in a field

modest maple
#

Well do you know what a character is

#

You can't have more than 1024 characters in a string for a feild

#

Field

earnest phoenix
#

pushing people to figure out things themselves produces amazing results and you can see that anywhere where schools adapted that way

steel heath
#

probably emojis or something that changes between different servers

#

maybe users?

earnest phoenix
#

truncate it

#

find the last few characters before it crosses 1024 characters and replace them with, for example, dots

#

wat

#

yes and...?

#

store that in a variable

#

then truncate it

#

and boom

#

profit

#

im not at home so i cant help you with code examples because theyre a pain on mobile

#

but there are plenty of truncation examples on google

#

search for it a bit

zenith orchid
#

@earnest phoenix use filter()

#

Example
Message.guild.roles.filter(role => role.name !== "@everyone").map(a=> a).join(" - ")

cold lion
#

My Web-Site Giving 404 UNKOWN error

earnest phoenix
#

@zenith orchid i think you can leave out that .map

#

@cold lion then the site you requested doesnt exist

cold lion
#

@earnest phoenix I can only see the site

quartz kindle
#

what site

cold lion
earnest phoenix
#

Wait

quartz kindle
earnest phoenix
#

so you request top.gg and it gives you a 404

cold lion
#

ye tim

quartz kindle
#

until your bot is approved, only you can see it

earnest phoenix
#

That means the bot page on top.gg wasnt found, the bot isnt on top.gg

cold lion
#

Tim

earnest phoenix
#

@quartz kindle if the bot is unverified it hands out a 403 unauthorized

cold lion
#

How approved

quartz kindle
#

did you apply?

earnest phoenix
#

-bots @cold lion

gilded plankBOT
earnest phoenix
#

he did

quartz kindle
#

then wait about 1-2 weeks

#

you will receive a message from Luca saying if it was approved or not

cold lion
#

okay thanks for info

#

โค๏ธ

quartz kindle
#

๐Ÿ‘

earnest phoenix
#

he didnt say no homo oliypls

#

i use quick.db but mongodb is good too

zenith orchid
#

@earnest phoenix Ha,

ebon wyvern
#

i use mongodb and its good

zenith orchid
#

Because server roles (names) very much.

#

Use substring

#

And use Google.

tight plinth
#

How to make a bot self-deaf with djs v12 power?

grim aspen
warm marsh
#

Google?

tight plinth
warm marsh
earnest phoenix
#

Use lmgtfy

summer torrent
#

yes

#

npm i

#

wdym

quartz kindle
#

mongoose is an ORM for mongodb

#

you need to have mongodb installed somewhere as a server

#

or use something like Atlas or Mlab which is like an online mongodb database you can connect to

earnest phoenix
#

@earnest phoenix no go to the console and type npm i name
name = name of the module(mongoose or sqlite3 or another)

#

I think yes

finite bough
#

@earnest phoenix on glitch

earnest phoenix
#

Omg...

finite bough
#

just click add package and search the name

slender thistle
#

rtd

earnest phoenix
#

@earnest phoenix

#

Yes

lyric mountain
#

he's american, you should use imperial units

#

else you might scare him

finite bough
#

or u can use ur no game no life skillz

lyric mountain
#

I recommend sqlite

summer sedge
#

sqlite is great

lyric mountain
#

sqlite is an embedded database

summer sedge
#

but it usually does not server the same purpose as mongoose

lyric mountain
#

just make a text file and rename the extension to .sqlite

#

depends

#

will you store a realtime data of all the people on earth?

#

if not, probably not too much

summer sedge
#

sqlite

#

lighter and easier to use

#

You use nodejs right?

#

Read that

#

a lot of useful info

#

as well as some examples to use

lyric mountain
#

mine has over 80k entries just in the member table, and weighs just a little more than 2.5 MB

summer sedge
#

My bot is in just a handful of servers

lyric mountain
#

yep

summer sedge
#

lemme check

lyric mountain
#

the database doesn't weigh anything considerable

#

it's the entries that add to it

summer sedge
#

4.4 mb in total

#

across all 3 files

lyric mountain
#

still fits in a CD-ROM

summer sedge
#

a cdrom fits 700mb

#

so of course

lyric mountain
#

sqlite doesn't have a server

#

the file itself is the database

#

idk if glitch is volatile or not

summer sedge
#

what is glitch?

lyric mountain
#

if it's volatile then you'll not be able to use embedded databases

#

what is glitch?
@summer sedge free host

earnest phoenix
summer sedge
#

I don't trust free hosts ๐Ÿ‘€

lyric mountain
#

yeah, there's a reason for glitch.com be blacklisted in some webservices

#

but still, for small bots it's enough

summer sedge
#

you call the npm
then you call your database

#

hang on lemme show you an example

lyric mountain
#

create a file.txt
rename extension to .sqlite
???
profit

summer sedge
#
const SQLite = require("better-sqlite3");
const sql = new SQLite('./scores.sqlite');
const getUsage = sql.prepare("SELECT * FROM usage WHERE command = ?");
const setUsage = sql.prepare("INSERT OR REPLACE INTO usage (command, number) VALUES (@command, @number);");
lyric mountain
#

js creates the file if it not exists iirc

summer sedge
#

yes it does

#

it will spit out errors if your tables are not set up

#

so just make sure you set up your tables

lyric mountain
#

laughs in JPA

summer sedge
#

yes/no

#

You call the sql in the very beginning

lyric mountain
#

to use a database you must make a query

summer sedge
#

then you can either call your database right after, or when you need it in your code

lyric mountain
#

see that "SELECT * FROM ..."?

#

that is a select query, which will bring all fields from table X

slender thistle
#

Learning SQL on the go isn't fun

summer sedge
#

in the case I mentioned you can call your database from anywhere with
getUsage or setUsage

#

since it's predefined

#

I learnt sql on the go

#

it's pretty fun

lyric mountain
#

Learning SQL on the go isn't fun
@slender thistle it is

#

seeing your project gain life is awesome

summer sedge
#

^

slender thistle
#

Debatable but subjective

lyric mountain
#

Ok, now I start My warn command. Thankd
@earnest phoenix remember to check which field types sqlite supports

summer sedge
#

npm i better-sqlite3 --save

lyric mountain
#

Ultimate question: You put new SQLite. What do I install that with?
@earnest phoenix are you on ubuntu?

#

^

#

just run the npm command unicorn sent

finite bough
#

BRUH

summer sedge
#

npm i better-sqlite3 --save

#

this

finite bough
#

@earnest phoenix glitch right?

lyric mountain
#

create a table calles warns

#

add its fields (id, warns, userid)

#

then use a query to manipulate it

tight plinth
#

can someone help me? My play command can't detect queue, even if it's exported from index.js

wheat jolt
#

uhm

earnest phoenix
#

Hello my bot have a problem, when I put "Neotux'Bot | In $ {client.guilds.size} servers) in the ready.js (for status) it puts me (Neotux'Bot | In undefind servers)? Why ?!

tight plinth
wheat jolt
#

share the code @earnest phoenix

tight plinth
#

@earnest phoenix client.guilds**.cache**.size

#

beaause of discordjs v12

earnest phoenix
#

Oki thank's you i test

wheat jolt
#

Do you have v12?

tight plinth
#

I think he have

earnest phoenix
#

yes

#

v12

tight plinth
#

im right lol

earnest phoenix
#

and this ".cache." is in all code for this ?

tight plinth
#

wait a sec

earnest phoenix
#

Oki

tight plinth
#

here you go

late hill
#

your parameters are wrong

earnest phoenix
#

And how to send a Name of servers ?

late hill
#

command.execute(client,message,args,dbl,queue) > execute(client,message,args,queue)

#

so the queue in your case is actually dbl

tight plinth
#

rly

late hill
#

yes

#

naming/types don't matter in js for parameters

tight plinth
#

o

late hill
#

only the order does

tight plinth
#

I didnt know

#

beacause every other commands are fine

#

I will verify, but i think u are correct

#

and yes, you are

outer niche
#

Ok

tight plinth
#

another question : with djs v12, this ```js
let response;
try {
response = await message.channel.awaitMessages(msg => 0 < msg.content && msg.content < videos.length + 1 && msg.author.id == message.author.id, {
maxMatches: 1,
time: 10000,
errors: ['time']
});
} catch(e) {
return message.channel.send("โŒ Video selection timed out.")
}

twilit rapids
#

check what the error is?

#

console.log(e)

tight plinth
#

apparently no messages are detected

summer sedge
#

why not catch the error?

#

You even defined it

neat ingot
#

im having this strange issue where my bot awaiting reactions seems to be shared amongst instances of things. like, if im awaiting a reaction for one thing, its cancelling the other. but this didnt happen before today and I havent changed anything with the reactions at all?!

summer sedge
#

errors: ['time']

neat ingot
#

its triggering the completion of the other awaiting reactions with no reaction collected

#

so confuzed ๐Ÿ˜„

tight plinth
#

it just returns message propriety

#

no errors

#

NO ERRORS

#

help

#

plz

earnest phoenix
#

How to create a embed in v12 ? but i have this error

#

RichEmbed is not defined

summer torrent
#

MessageEmbed()

earnest phoenix
#

^

#

i cant

#

i actually cant

#

@earnest phoenix you typed setColor in lowercase

#

it's not .setcolor, its .setColor(color)

#

Thank's you i start in v12

neat ingot
#

ooohhh it seems my discord.js has updated from 1.5 to 1.6 lol

#

hmm

earnest phoenix
#

It's been .setColor in v11.5.1 too...

#

@neat ingot wtf

#

d.js version 1.5

neat ingot
#

11.5*

earnest phoenix
#

that makes more sense

neat ingot
#

๐Ÿ˜›

#

musta been when i rebuilt my containers, will need to check the package.json and hardcode 11.5.1 till i switch to 12 ๐Ÿ˜„

earnest phoenix
#

npm i discord.js@11.5.1

#

lul

neat ingot
#

i dont run npm install, my docker compose file does ๐Ÿ˜›

#

i dont have any node modules for the project locally

#

well i do, but inside a container somewhere

candid granite
#

wow..

neat ingot
restive furnace
#

i think it means if theres newer version (not major update) it auto updates. (even tho theyre not fully compatible) like ^1.23 you put, and then it finds 1.24 version and installs it automatically. thats what i think.

quartz kindle
#

11.6 should be compatible with 11.5, what was the problem?

mossy vine
#

@neat ingot do you have any idea why my container (only when ran with docker compose) exits after a few seconds with code 0? (i know this is vague and stuff but if you need more info lmk)

neat ingot
#

reactions were buggy af @quartz kindle
i have confirmation reactions that the user checks to confirm like, healing (it costs credits to heal) for example. and i also have enemies that spawn, which you need to trigger reactions to battle. for some reason it was sharing the reactions

#

like, if i reacted to heal it would trigger the spawn message reactions as having no emoji

#

only happened after container updated from 11.5->11.6 ๐Ÿ˜„

#

@mossy vine look for the error message in the log. if you dont have -d when you docker-compose up containername it will auto log, if you want to get the log of running containers use docker-compose logs -f containername

mossy vine
#

wait does docker-compose up need a containername??

torpid valve
#

What is good site to learn discord.js?

mossy vine
#

the d.js documentation

#

but learn js first

#

oh is this a joke

#

hang on

#

@neat ingot can docker not deal with symbolic links

#

or whatever theyre called

neat ingot
#

its doesnt need one no, but you can give one if your only wanting to stop or boot a specific container

#

i havent has any issues with my containers linking together, if thats what you mean?

mossy vine
#

no

#

In computing, a symbolic link (also symlink or soft link) is a term for any file that contains a reference to another file or directory in the form of an absolute or relative path and that affects pathname resolution.Symbolic links were already present by 1978 in minicomputer ...

#

so my project structure is

neat ingot
#

oooooohhh

#

depends how you structure things

#

i umm

#

sec

mossy vine
#
master/ (name of project)
monorepo/ (main folder)
  docker-compose.yml
  master/ (symlink to ../master/
  [symlinks to all other projects]
neat ingot
mossy vine
#

i move the docker-compose out of the directory, and now its working

neat ingot
#

im minding ./main-bot/src from the docker projects rool folder into /dekbot/src within the container

#

which is the path you set in the dockerfile

#

like umm

mossy vine
#

yeah that still really isnt what i mean lol

neat ingot
#

lmao

#

ok

mossy vine
#

but i think i got it so

neat ingot
#

np ๐Ÿ™‚

mossy vine
#

if my container is running a webserver, and in my docker compose file i have ports: -8000:8000 shuoldnt i be able to access it at localhost:8000?

neat ingot
#

yes

mossy vine
#

oh cool

#

doesnt wrok

#

unless i fucked up soemthing really badly

neat ingot
#

i have a seperate nginx container to reverse proxy

#

but yes, you can

#

my nginx container exposes port 80 and such

#

which redirects to internal ports

mossy vine
#

yeah i cant access it

#

im running a webserver in a container

#

says its listening on 127.0.0.1:8000

#

its dockerfile exposes port 8000

#

and in docker compose i have 8000:8000

#

sick

quartz kindle
#

whats the advantage of running containers instead of running your stuff directly in your vps?

mossy vine
#

it feels good

quartz kindle
#

lmao

mossy vine
#

haha

#

im a genius

neat ingot
#

^ this guy gets it

mossy vine
#

i figured it out

#

shouldve been listening on 0.0.0.0:8000

neat ingot
#

i was hinking that

#

youi dont need to set the ip on the server

#

just port

#

and it autos to 0000

mossy vine
#

@quartz kindle i dont think im actually going to be benefitting from its advantages for a good while, but instead of headaches when rewriting -> headaches when writing

neat ingot
#

you can also make your containers share an inner network if they want to speak to one another without exposing ports 'to the wild' ๐Ÿ™‚

mossy vine
#

how lmao

#

isnt that just by http://containername?

modest maple
#

docker is pretty neet

neat ingot
mossy vine
#

thats wild and i absolutely dont understand it

neat ingot
#

add the first one to your service

#

and the bottom one at the very bottom of your file

#

any 'service' you make, give them that network id and they will share it ๐Ÿ™‚

mossy vine
#

what is that driver field btw

neat ingot
#

i honestly cant remember ๐Ÿ˜„

#

adding network was a random decision when i was figuring how to set it up

#

i remember reading it at the time but idk now ๐Ÿ˜„

mossy vine
#

but right now if i yeet up a different service it can access this webserver service at https://containername right?

neat ingot
#

idk if they have to share the network or not, but thats what i do

#

or rather

#

no s

#

just http:

#

i assume they would share a network by default ๐Ÿ˜„

#

but you might want things on a diff network for some reason

warm marsh
#

Pretty sure that's not how containers work, Unless you're using some third party website e.g. codeanywhere even still they just give you a name.

sterile minnow
#

has someone a idea how to count all members that are in all voice channels or other said a "Total members in all voice" count with Discord.js 11.5.1?

summer torrent
#

reduce()

sterile minnow
#

?

summer torrent
#
message.guild.channels.filter(a => a.type === "voice").reduce((a, b) => a + b.members.size, 0)```
sterile minnow
#

okay i try it

#

thy it works

tight plinth
smoky spire
#

Did you link the wrong message

tight plinth
#

This is just to show it doesn't work

smoky spire
#

I don't see you fetching messages anywhere

tight plinth
#

Line 44

summer sedge
#

that is not a fetch

#

that just waits for a response

tight plinth
#

Still don't work

#

Same problem

zenith orchid
tight plinth
#

that just waits for a response
@summer sedge if I give a response, nothing happens and it logs message propriety

sudden geyser
#

What version of Discord.js are you using, Lumap?

quartz kindle
#

he said v12 lol

sudden geyser
#

oof didn't see

#

I don't think maxMatches is a thing.

#

Try using max instead @tight plinth

#

I tested it myself and it seems to work.

wide ruin
#

how do you get a py bot to not say ??? as the status?

#

its not added yet but cant remember where it is

modest maple
#

you have it in this server

wide ruin
#

i dont

modest maple
#

i meant it as you need to have it in this server

wide ruin
#

i know

#

but theres code you have to do once its added right?

modest maple
#

no

wide ruin
#

there used to be tho right?

earnest phoenix
#

no

modest maple
#

nope

wide ruin
#

hmm

#

ok thanks

quartz kindle
#

there is code for server count, so it doesnt show N/A

#

but for status there is no code, all it needs is to be in this server

wide ruin
#

oh yeah, what was that in py?

#

for server count

quartz kindle
wide ruin
#

thanks

tight plinth
#

OK I'll try

#

And... It works!

digital ibex
#

Hi, how would you make a user resolver in eris?

#

im kinda stuck

earnest phoenix
#

lib

supple wagon
#

oh

#

ok

#

im at school at the moment

#

this is a school chromebook

#

sorry lol

earnest phoenix
#

@modern sable um do you guys do stuff about names like this

modern sable
#

yup, ty

digital ibex
#

i was mini modding :)

earnest phoenix
#

ngl i i use compact mode so i thought #general was just @digital ibex spamming xd

#

cuz i didnt see any other names

digital ibex
#

lol

earnest phoenix
#

cuz
hanging indents

digital ibex
#

also, does anyone here use eris who can help me make a command handler

#

o

honest perch
#

how would one make a bot overlap a gif over the persons profile picture

earnest phoenix
#

language?

honest perch
#

java script with discord js

earnest phoenix
#

hm. i'm honestly not sure, as i dont use js

hoary elm
#

i mean i use JS but im honestly not even sure about that one (Overlaping the Avatar)

earnest phoenix
#

does a port of PIL exist?

smoky spire
#

use an image manipulation lib like canvas or something

summer torrent
#

use canvas

honest perch
#

ok i figured it out but i only works when you tag a user. errors when you dont tag anyone

#

let target = message.mentions.users.first() || message.guild.members.get(args[0]).user || message.author;

hoary elm
#

@honest perch make it default to the message author if no one is mentioned

#

Will avoid the error

#

Or just make it return

#

Or provide a message telling them to mention someone

amber fractal
#

The error comes from trying to get the property user of undefined most likely

honest perch
#

ok i did this instead let target = message.author || message.guild.members.get(args[0]).user || message.mentions.users.first(); and it works

amber fractal
#

Well

#

It will always message.author

#

Doesnt solve the problem

#

The other ones will never run

#

If you mention someone it will still be the author

honest perch
#

^

hoary elm
#

Yeah not I meant like if(!target) { target = message.author

honest perch
hoary elm
#
let target = message.mentions.users.first();

let user = target

if (!target) target = message.author

@honest perch something like this

Not saying this is gonna work as is you will have to do some editing ๐Ÿคท๐Ÿปโ€โ™‚๏ธ

honest perch
#

thanks

#

it works

prime cliff
#

let user = target WaitWhat

hoary elm
#

Yeah that's irrelevant

#

I was just thinking that

#

Lol

#

IDEK what I was trying to do with that ๐Ÿค”

topaz fjord
#
let target = (message.mentions.users.first()) ? message.mentions.users.first() : message.author;
#

better version mmLol

hoary elm
#

That works to.

topaz fjord
#

ternary > *

copper cradle
#

//true

smoky spire
#

Or just

let target = message.mentions.users.first() || message.author;
topaz fjord
#

that too

amber fractal
#

They seem to want to allow by id too

#

So you could use ternary for that then ors for the rest

topaz fjord
#

you can chain ternary

amber fractal
#

Yes, but why would you for that

sudden geyser
#

or even wrap it around parentheses then .id

also chaining ternary just makes it harder to read

amber fractal
#

Making it more complicated

tulip iron
#

Does anyone know a way to put matplotlib plots in discord embeds without saving the file?

outer niche
#

How can I make like an owner only command

prime cliff
#

Are you even a developer lol

earnest phoenix
#

they're a help vampire

prime cliff
#

if (user.id == 443181357246447617)

earnest phoenix
#

people tend to... ignore them in this channel now

grizzled raven
#

you know, the escape key is useful for improving readability

earnest phoenix
#

they've been told about a thousand times to learn the language before working with it and they still don't do it lol

#

and also to read docs... which oh what a surprise they also don't want to do

grizzled raven
#

what are docs

earnest phoenix
#

idk man

#

something imaginary i guess

grizzled raven
#

then why is everyone making a big fuss about it

#

everyone knows you learn code like english you dont look up every word in the coding dicrtipnary ๐Ÿ™„๐Ÿ™„

main badge
#

hey

earnest phoenix
#

hi

vernal yoke
#

Hi guys ๐Ÿ‘‹๐Ÿ–

grizzled raven
#

j

copper cradle
#

@outer niche learn the language, then try to do stuff

#

we're not here to spoon feed you

#

someone had to tell 'em

quartz kindle
#

hes already been told that countless times

topaz fjord
#

@tulip iron why not just save it to the tmp directory

#

it'll get auto cleared by the system

#

also what matplotlib module