#development

1 messages · Page 1231 of 1

warm marsh
#

It's just the same as unbinding the listener after the event has been called.

native osprey
#

So do you know what the wrong are?

fervent goblet
#

omg

#

its because you put bot.login(token;)

warm marsh
#

Send your code in hastebin

fervent goblet
#

remove the ;

warm marsh
#

Plus that will cause some salt

native osprey
#

Ok

#

My bots status is offline still. :/

warm marsh
#

l2c

thick gull
#

client.login(token)

#

remove the ;

native osprey
#

bot.on('ready', () =>{
console.log('This bot is online!');
})

bot.login(token)

thick gull
#

is token your token

#

?

native osprey
#

No.

thick gull
#

put your token there and run it

native osprey
#

oK

quartz jewel
#

@clear arrow Yes I have that badge.

native osprey
#

How to save changes?

warm marsh
#

Control S?

quartz jewel
#

Control + S

#

Like any other text editor.

#

Dumbass.

warm marsh
#

Unless using vim or nano

digital ibex
#

chill mate

earnest phoenix
#

Or directly coding from terminal through node editor weSmart

warm marsh
#
Vim: ESC + :wq
Nano: (control + x) + (control + s)
thick gull
native osprey
#

Visual Studio code

digital ibex
#

why would you do that

#

ctrl s

#

for vsc

warm marsh
#

code913 🤔

#

CTRL + s = save

earnest phoenix
#

Port 443 only accepts HTTPS requests right?

proven lantern
#

is there a way to see if a user is banned from a guild without the Ban Members permission?

warm marsh
#

You don't need ban members to check if someone is banned

#

Just fetch the bans and read the users banned

proven lantern
warm marsh
#

Since when?

thick gull
#

audit logs? maybe

proven lantern
#

this is the first time i checked

earnest phoenix
#

@proven lantern why are you reading discord api docs read docs of your library

digital ibex
#

that is the audit logs, so no, ben

proven lantern
digital ibex
#

because he needed to find out the permissions? and library wack

warm marsh
#

try catch works?

proven lantern
#

@earnest phoenix the docs dont tell me the required permission

digital ibex
#

he's trying to find out if someone is banned w/o needing the ban members perm

earnest phoenix
#

@earnest phoenix the docs dont tell me the required permission
@proven lantern BAN_MEMBERS

#

in MICRO_CASE

proven lantern
#

that's the discord api docs. that's why i was reading those instead of the library @earnest phoenix

digital ibex
#

just ignore him ig

proven lantern
#

also starman showed me it

digital ibex
#

you can't ben, you probably can with oauth2 but thats overcomplicating it. and the bot will have to be in the server

#

what i mean with oauth2, u have their guilds- wait no, it still wont work

#

i dont think u cant without the permission then, unless someone else knows

proven lantern
#

i do have the guild. i want the bot to check if the user is banned before sending them an invite and marking them as invited from my bot

digital ibex
#

then theres no way without the required permissions

quartz jewel
#
digital ibex
#

?

proven lantern
#

maybe i can try to do guild.addMember() and an error will be thrown that i can catch

#

only requires CREATE_INSTANT_INVITE permission and i already have that

digital ibex
#

probably then, idk what that method does so cant rly help with that, sorry

earnest phoenix
#

How do I set up a server webhook with the python library? Like how do I get a token and things

slender thistle
earnest phoenix
#

how does it work with server voting though

slender thistle
#

Uhh

#

It doesn't

#

:p

earnest phoenix
#

h u h

slender thistle
#

The client is just for DBL. DSL is unsupported as of currently

earnest phoenix
#

fair enough, thx shiv

slender thistle
#

There will probably be a "small" rework with the module overall and a possible rename/implementation of DSLClient

earnest phoenix
#

kk

proven lantern
earnest phoenix
#

help meh

#

yes

#

but there are no docs

#

"how to post images"

opaque seal
#

what's a good place to store an array that has to be modified frequently without having to restart the bot

earnest phoenix
#

it says how to use sharex with it in the faq

#

what's a good place to store an array that has to be modified frequently without having to restart the bot
@opaque seal mysql table?

opaque seal
#

I wanted to be able to modify it myself tho

earnest phoenix
#

mysql table is good then

opaque seal
#

It's actually an object with a list of server IDs and expiration dates

earnest phoenix
#

im linux

#

wait

#

imma google

#

nah

#

then use kshare lmao

#

or magiccap

#

magiccap is better

#

you could write the array to file and parse the json..if you dont wanna db

opaque seal
#

Yeah that's what I was thinking because it would be easy to modify it

misty sigil
#

no

#

no

opaque seal
#

I think I'm just gonna use mongoDB tho

earnest phoenix
#

It's actually an object with a list of server IDs and expiration dates
@opaque seal legit sql is perfect for that

misty sigil
#

no json

#

🤮

opaque seal
#

Because JSON files can get fucked up easely

earnest phoenix
#

uh ok

#

i use mongo..easy

opaque seal
#

yeah

#

I think I'm just gonna have a cache for the array of objects and some commands to modify it at this point

earnest phoenix
#

youll be happier setting up mongo...only takes a min

opaque seal
#

I already use mongo for eveything else

earnest phoenix
#

wjats special about the array you dont throw it in db then

opaque seal
#

I wanted it to be easily readable and modifiable but it's fine

near ether
#

is it possible to get ratelimited without receiving a DiscordAPIError?

earnest phoenix
#

how i can send image

opaque seal
#

is it possible to get ratelimited without receiving a DiscordAPIError?
yeah

#

I think so

earnest phoenix
#
embed.setImage("local image")
opaque seal
#

You need embed.attachFiles

earnest phoenix
#

(node:13218) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
embed.image.url: Not a well formed URL.

#

wut

#

oh

opaque seal
#

and then embed.setImage('attachments:...');

#

Check the discord.js guide

#

it's explained well there

eternal osprey
#

hey guys

#

how do i fix this undefined error i embeds

#

cities/countries ranked by: RAIN
California, Colombia 7.347, -72.946
undefined
California, El Salvador 13.441, -88.463
undefined
Liberty Park, IL 42.265, -89.117
undefined
National Mall, DC 38.89, -77.023
undefined
San Diego, Costa Rica 9.901, -84.001
undefined
Hiroshima, Japan 34.39, 132.441
undefined
Hiroshima 34.547, 132.792
undefined
Phoenix, MD 39.516, -76.617
undefined
Ho Chi Minh City 10.745, 106.695
undefined

#

i know that the embeds have a value and name

earnest phoenix
#

uhh

proven lantern
#

is there an event that is triggered when a user that is banned gets an invite to the guild and tries to join? maybe in the warn event?

    console.log(`warn: ${info}`);
});```
nothing else looks right
https://gist.github.com/koad/316b265a91d933fd1b62dddfcc3ff584
Gist

GitHub Gist: instantly share code, notes, and snippets.

thick gull
#

i know that the embeds have a value and name
@eternal osprey the value is undefined

#

thats it

#

your code is putting an undefined variable

slender thistle
#

There's no such event, Ben

earnest phoenix
#

ah

#

my false

#

show code @eternal osprey

slender thistle
#

That's handled by the client internally

eternal osprey
#

i knoq

proven lantern
#

@slender thistle thanks

eternal osprey
#
 const title = "**Cities/countries ranked by: ** " +`**${skytext}**`;
      let embed = new Discord.MessageEmbed()
                              
                              .setTitle(title);
        locations_found.slice(0, 10).forEach(location =>
        {
          
        embed.addField(
           `${location.current.observationpoint}  ${location.location.lat}, ${location.location.long}`,
           
          );
          ```
#

behid the ,

#

there was annother variable

#

but i removed it as it was not necessary

thick gull
earnest phoenix
#
.addField(`${location.current.observationpoint} ${location.location.lat}`, `${location.location.long}`)

@eternal osprey ??

eternal osprey
#

hey

earnest phoenix
#

huh ?

eternal osprey
#

would that work tho

#

what is so confusing:?

earnest phoenix
#

the ``

#

u forgot

eternal osprey
#

no lmao

#

look close

earnest phoenix
#

@eternal osprey trust me it will work

#

just try it

quartz kindle
#

Yes

drifting wedge
#

Can I get the ranking of someone’s level with mongo!

#

?

#

It could just be who has the most Xp

earnest phoenix
#

@quartz kindle is there any image cdn

eternal osprey
earnest phoenix
quartz kindle
#

The correct way is "name","value" but you did "name,value"

eternal osprey
#

and i have made no backup

earnest phoenix
#

yes

eternal osprey
#

you can use zrtl+z right?

earnest phoenix
#

yes

#

lol

#

comedy gold

eternal osprey
#

yeaah

#

i agree

earnest phoenix
#

huh ?

#

@quartz kindle how ur bot grow so big

eternal osprey
#

all i wanna know is how to remove the undefined

#

like value("")

quartz kindle
#

@eternal osprey i told you how

earnest phoenix
#
.addField("title", "value")
eternal osprey
#

i know

#

but that gives ugly formats

earnest phoenix
#

that maybe from ur API

eternal osprey
#

one is white and big

earnest phoenix
#

ok wait

#

imma show u this

eternal osprey
#

other is normal

quartz kindle
#

Thats how it works

#

One is the title the other is the value

eternal osprey
#

so there is not any way to fix that.

earnest phoenix
#
.addField("title", "value", true)
#

try this

#

it makes values inline

eternal osprey
#
  `${location.current.observationpoint}  ${location.location.lat}, ${location.location.long}`, true,```
#

so this

earnest phoenix
#
  `${location.current.observationpoint}  ${location.location.lat}`, `${location.location.long}`, true)
#

wait

#

no

eternal osprey
#

yeah i got it

#

let me try

earnest phoenix
#

that

#

try it

#

i edited

eternal osprey
#
California, Colombia  7.347, -72.946
true
California, El Salvador  13.441, -88.463
true
Liberty Park, IL  42.265, -89.117
true
Long Beach Island, NJ  39.774, -74.123
true
Minneapolis, NC  36.1, -81.987
true
San Diego, Costa Rica  9.901, -84.001
true
Hiroshima, Japan  34.39, 132.441
true
Hiroshima  34.547, 132.792
true
Alexandria, AL  33.771, -85.883
true
Warsaw, MO  38.245, -93.386
true```
earnest phoenix
#

._.

#

show code

#

what u have done

eternal osprey
#
embed.addField(
           `${location.current.observationpoint}  ${location.location.lat}, ${location.location.long}`, true
           
          );
          ```
earnest phoenix
#

BRUH

#
           `${location.current.observationpoint}  ${location.location.lat}`, `${location.location.long}`, true
#

How many times

#

._.

quartz kindle
#

Why dont you put the name in the title and both coordinates in the value?

eternal osprey
#

also possible

earnest phoenix
#

._.

cerulean ingot
#

does anyone know of a way i could code with a friend

pure lion
#

yes

earnest phoenix
#

github

pure lion
#

or

cerulean ingot
#

i mean like

eternal osprey
#

Cities/countries ranked by: RAIN
California, Colombia 7.347
-72.946
California, El Salvador 13.441
-88.463
Liberty Park, IL 42.265
-89.117
Long Beach Island, NJ 39.774
-74.123
Minneapolis, NC 36.1
-81.987
San Diego, Costa Rica 9.901
-84.001
Hiroshima, Japan 34.39
132.441
Hiroshima 34.547
132.792
Alexandria, AL 33.771
-85.883
Warsaw, MO 38.245
-93.386

Command hosted for Pokehub`s community!

cerulean ingot
#

live code

eternal osprey
#

this is good enough

#

😉

#

thanks

earnest phoenix
#

Yes

pure lion
#

what text editor do you use?

earnest phoenix
#

but use , true

cerulean ingot
#

vsc

eternal osprey
#

vsc\

pure lion
#

use the liveshare ext

cerulean ingot
#

but i dont like the liveshare

earnest phoenix
#

sudo apt-get install git

pure lion
#

tough

#

neither do i

earnest phoenix
#

github

#

use github

pure lion
#

bro

cerulean ingot
#

b r u h

pure lion
#

he means live

earnest phoenix
#

i take that back

#

oh

#

idk

#

but github is tha best for team working

pure lion
#

sudo apt-get install git
windows machines dont have apt

earnest phoenix
#

and sudo

pure lion
#

neither do mac

#

no need for sudo

earnest phoenix
#

i use linux :/

#

i do need

pure lion
#

epic

earnest phoenix
#

:))

#

you could use c9

pure lion
#

what is c9?

earnest phoenix
#

cloud 9 realtime multi user ide

modest plaza
#

Cool

earnest phoenix
#

i made a version...but mine sucks

#

could never get editing at same time working right...had to lock other users out until other guy was done typing

wintry elk
drifting wedge
#

me

#

@wintry elk

wintry elk
#

ok ask

#

@drifting wedge where are you?

#

ask

drifting wedge
#

with mongo db

#

how can i toggle moduels?

#

modules?

wintry elk
#

mongo database?

faint prism
#

Well it calls itself mongodb

wintry elk
#

i don't know in mongo database if you ask me in mysql i answer

outer perch
#

can anyone suggest me a database without a daily access limit online for free?

solemn latch
#

thats not possible 🤔

wintry elk
#

yes i want ask why this server not make arabic room?

faint prism
outer perch
#

cuz firebase went down for me in like 6h because my bot got in 40 servers all of a sudden

river thistle
#

java or js

#

lmao

#

json library

faint prism
#

Javascript object notation library, duh

river thistle
#

indeed

quartz kindle
#

@outer perch firebase should not go down with only 40 servers lol

#

You get 50k reads and 20k writes per day

trim saddle
#

@quartz kindle i require your services

quartz kindle
#

Thats a lot, you can easily make a bot in tens of thousands of servers with those limits

trim saddle
#

can i set attributes of an already thrown error

quartz kindle
#

I believe you can

outer perch
#

it went down for real before 3pm

#

it said Quota Exceeded in the logs

quartz kindle
#

The youre using it wrong

#

For example, make sure youre not making a query on every single message

trim saddle
#

i'm trying but i keep getting
TypeError: Cannot set property name of [nothings here i think the error is anonymous] which has only a getter

outer perch
#

For example, make sure youre not making a query on every single message
@quartz kindle I got into that, fixed the code at those problems

#

but now I gotta wait til 12am

earnest phoenix
#

why do you need a new prop on already thrown error?

trim saddle
#

changing the error name

quartz kindle
#

@trim saddle it should work, can you show your code?

earnest phoenix
#

you could make your own object with neq name and error as value?

trim saddle
#
try {
// ...
await cmd.exec.bind(this)(ctx).then(() => {
    this.cmdsUsed++                    
    this.emit("commandExecute", ctx, timer)
    })
}
catch (e) {
    e.name = "EXECUTIONERROR"
    this.emit("commandError", ctx, e)
}
#

there's a try up there

outer perch
#

I need help real fast now

#

I noticed my bot gets the server prefix everytime a message is sent

#

if the msg doesn't have the prefix, it returns

fluid orbit
#

any idea how can i get mongoDB ping?

outer perch
#

how do I do a custom prefix so?

trim saddle
#

set a string somewhere

outer perch
#

I know people get DBs in a json file and run it there

faint prism
#

any idea how can i get mongoDB ping?
@fluid orbit Get a Date object before and after a database call, and return the ms of the difference

outer perch
#

but that means the file can get heavy

trim saddle
#

or just use a db

outer perch
#

I am using the DB

trim saddle
#

json isn't a good way to store things

outer perch
#

the problem is the number of accesses

earnest phoenix
#

hellp gays , any one know to let bot stable in room 24h !

fluid orbit
#

@fluid orbit Get a Date object before and after a database call, and return the ms of the difference
@faint prism i was doing that but i though there's a better way, thank you :D

outer perch
#

my DB shuts down at 50k requests

#

per day

faint prism
#

uh

outer perch
#

imagine a request per msg

faint prism
#

what is your DBMS?

earnest phoenix
#

pay for a service then

faint prism
#

Mine does that

outer perch
#

what's dbms

faint prism
#

A database management system?

outer perch
#

Firebase

#

Cloud Firestore

earnest phoenix
#

a droplet is $5 a month...you can use mongo as much as you want

faint prism
#

I use mongodb Atlas

outer perch
#

I can't afford anything

faint prism
#

And I upsert db records on every new msg basically

#

It's free

#

Also, sqlite is free too

quartz kindle
#

@trim saddle do something like this then ```js
} catch (err) {
if (err instanceof ValidationError) {
alert("Invalid data: " + err.message); // Invalid data: No field: name
} else if (err instanceof SyntaxError) {
// (*) alert("JSON Syntax Error: " + err.message);
} else {
throw err; // unknown error, rethrow it (**)
}
}

earnest phoenix
#

gaus

#

i need to let music bot 24h on room

#

hows that

sudden tulip
outer perch
#

but what about the request limit?

quartz kindle
#

@outer perch you shouldnt be fetching the prefix on every message

#

Thats not only bad for rate limits but also extremely inneficient

#

You should always cache your prefixes

outer perch
#

I'm kind of a newb with node.js

#

how do I cache so?

sudden tulip
#

just define the prefix in a json file

drifting wedge
#

how can i get an arg and put it in mongo?

sudden tulip
#

wait

#

nvm

drifting wedge
#

like when the bot joins a server

outer perch
#

I had that

sudden tulip
#

but fr tho

drifting wedge
#

how can i run a command when the bot joins the server?

sudden tulip
outer perch
#

but I have a setprefix command

#

to customize the prefix per server

earnest phoenix
#
"images": [
    {
      "height": null,
      "url": "https://i.scdn.co/image/ab6775700000ee85a5c332287a6524252b50188c",
      "width": null
    }
  ],

"images": [], then fail. how can I do it

quartz kindle
#

@outer perch create a variable for prefixes, or even use the guilds themselves

earnest phoenix
#

so if it is empty

outer perch
#

wha-

quartz kindle
#

For example, lets say you store your prefixes in guild.prefix

#

When you receive a message, check if message.guild.prefix exists

earnest phoenix
#

juat grab all guilds and there prefix on bot start...then use those values and update in memory and db when that command is run

quartz kindle
#

If it does use it, if not, fetch it from the database and attach it to the guild, so it gets reused the next time

outer perch
#

but don't the variables reset at the app update?

quartz kindle
#

Yes, if it doesnt exist, you fetch it from the database

outer perch
#

hoo

#

I understood everything so

#

I'll only need the juice now

#

ty

earnest phoenix
#

if bot restarts it fetches from db

outer perch
#

I understood

#

I just need to get aquainted with caching

#

I didn't learn it at school

quartz kindle
#

Once you get the hang of it its very easy

outer perch
#

ikr

misty sigil
#

json libraries

outer perch
#

I understood the theory

#

now it'll come to my mind everytime i think about something similar

quartz kindle
#

Every time you get data from the db, ask yourself: do i need this data to be fresh every time? Or can i have a copy of it in a variable for fast access?

outer perch
#

true

sudden tulip
#

can anyone pleeeeeeeeease tell me how tf u shard in discord.py 1/2 my bot doesnt work now

outer perch
#

never thought of having a copy to use later

drifting wedge
#

how can i make like if prefix not found from mongo db, use this prefix

valid frigate
#

make a constant that has a default prefix

faint prism
valid frigate
#

if the database returns nothing use the default prefix

sudden tulip
#

thats it

#

bruh

#

im actually stupid

faint prism
#

lol

#

always check the docs first

sudden tulip
#

i was looking at the wrong docs

#

oml

faint prism
#

l0l

drifting wedge
#

can anyone help me?

#

im trying to do server prefixes with mongo db python

earnest phoenix
#
  "images": [{
      "height": null,
      "url": "https://i.scdn.co/image/ab6775700000ee85a5c332287a6524252b50188c",
      "width": null
    }],

with

  "images": [],

how do i distinguish the two

#

"images": [], will give an error message.

valid frigate
#

yeah i said earlier that first you should check if your database has an entry for the guild's custom prefix, it it doesnt, use your default prefix instead

earnest phoenix
#

images.length > 0

valid frigate
#
let prefix = "!"

let query = database.find({ idk })
if query != null { prefix = query.guild_custom_prefix }
#

this is one approach

drifting wedge
#
let prefix = "!"

let query = database.find({ idk })
if query != null { prefix = query.guild_custom_prefix }

@valid frigate im using python

earnest phoenix
#

🥄

valid frigate
#

its the same concept

#

have a variable then replace that variable if there is an entry in the table/collection

#

also that isnt valid syntax in any language trolllaugh

sudden tulip
#

🧛

#

yay

#

my discord bot is sharded now

misty sigil
#

so is mine

drifting wedge
#

😦

sudden tulip
#

i had the js and c# sharded

#

not the python part

drifting wedge
#

is it hard to shard a bot?

earnest phoenix
#

what kind of frankenbot you writing

sudden tulip
#

welp

#

the js part i had forever

#

then i did a bunch of stuff in c# and was just lazy to rewrite the js

valid frigate
#

to shard a bot is simple because most libraries provide an easy interface for it

sudden tulip
#

and the python bit is part of my school project

valid frigate
#

iirc djs has shardingmanager, eris has sharding options in the client config

sudden tulip
#

were i learn a lang from scratch

earnest phoenix
#

so you run 3 seperate instances with same bot token?

sudden tulip
#

mhm

#

on my server

#

eventially ill just write everything in c#

#

im just lazy

valid frigate
#

thats at least 3 shards

#

3 versions of the same bot is strange

drifting wedge
#

i have a question tho

sudden tulip
#

when i find motivation ill rewrite everthing in c#

drifting wedge
#

forget it

sudden tulip
#

but my server is a ThinkSystem SR550 Rack Server

valid frigate
#

you have been presented with an opportunity little have a chance to have

sudden tulip
#

i got it maxed out for free too

#

lmao

valid frigate
#

university?

sudden tulip
#

my uncle runs a coperate data center

valid frigate
#

trollartistic 👍

sudden tulip
#

and they were tossing them out

valid frigate
#

oh yeah i pay $7.50 a month for vpses in sf, france and australia oooooooooooh

#

not cost effective

sudden tulip
#

^very affordable

earnest phoenix
#

thats a little better than my $5 droplet

sudden tulip
#

thats what i had for a long time

#

is the r610

valid frigate
#

yeah

#

well to be fair ive had some weird behavior on the vpses

#

but i dont store anything sensitive on them so if they yoink it im fine

thick gull
#

i had the js and c# sharded
@sudden tulip wtf/ what kind of bot are you making

#

3 language ? ? ??

sudden tulip
#

i already explaned

thick gull
#

oh

#

i c

sudden tulip
#

yea

valid frigate
#

they cant all be on the same sharded connections can they

#

that would be impossible unless

outer perch
#

@quartz kindle I know I have to cache and all, but could you give me a js syntax example?

#

sometimes it gets hard to think

#

my mind got stuck 😂

indigo flax
outer perch
thick gull
#

the arrows

#

my brain

outer perch
#

tru

thick gull
#

one is sending data that one is going the right way but the other one ? ? ? ?

earnest phoenix
#

just think of the cache as the returned object from db

drifting wedge
#

like how do i write stuff to mongo

earnest phoenix
#

you have it in memory use it instead of making calls everytime

outer perch
#

how do I make a caching object

earnest phoenix
#

if the command is run to set prefix awt in db and refresh object with new values

outer perch
#

just a random object?

earnest phoenix
#

forget about the word cache

outer perch
#

damn

earnest phoenix
#

yea just store in memory

#

the object...if set prefix is used ...make db call and refresh your in mem object

#

that way youre only making requests when needed

outer perch
#

I understood the theory

earnest phoenix
#

so on bot start grab the data and use it.....if set prefix is used update db and fetch new values

drifting wedge
#

like how do i write stuff to mongo
@drifting wedge

outer perch
#

I need the practice

earnest phoenix
#

or dont fetch new and keep object in mem up to date

outer perch
#

I've never created an object

pure lion
#

WARNING THERE IS A QT UP THERE^

outer perch
#

ty, I guess

pure lion
#

@outer perch what lang/lib?

outer perch
#

js

pure lion
#

And what's up

#

Js, discord.js?

outer perch
#

yep

pure lion
#

Issue

#

?

outer perch
#

caching prefixes to stop fetching the DB so much

pure lion
#

Oh

#

Basically

#

I think you can extend the Message class

outer perch
#

oh

pure lion
#

But also you'd need an empty object

outer perch
#

right

pure lion
#

Or a map

outer perch
#

I just don't know how to start

pure lion
#

Basically

#

using a map, when the prefix is called for the first time then get it from the db and write it to the map under a guild ID

#

Then use an if statement or a ternary operator

outer perch
#

right

pure lion
#

and when the prefix is updated just update the map

earnest phoenix
#

he doeant know what an object is i doubt hes gonna use map

#

no offense

outer perch
#

I use objs

pure lion
#

let prefix;
prefix ? map.get('guild ID') : //db query here

outer perch
#

but don't create them

#

oh

#

forgot I could use ?

pure lion
#

It's really useful

outer perch
#

what does map do there, @pure lion?

earnest phoenix
#

ill fix it for $5 venmo

unique patio
#

Sad.... I'll teach for free; it's library read-up.

#

I got time.

earnest phoenix
#

have fun

unique patio
#

Okay $5

outer perch
#
let prefix;
    const ref = db.collection('servidores').doc(message.guild.id),
        map = new Map();

    prefix ? map.get(message.guild.id) : ref.get('prefix');

    map.set(message.guild.id, prefix);```
Will this work? @earnest phoenix @pure lion
earnest phoenix
#

yo i need help

#

when i do print("No") it says no

#

ok i quit

#

im not stupid

#

no

outer perch
#

maybe the last line is wrong

earnest phoenix
#

move last line below new map

#

and it might possibly work

outer perch
#

but prefix will be undefined

unique patio
#

Prefix is undefined

outer perch
#

oh, that's why he goes to the DB right after

#

true

unique patio
#

it will flag on your ternary wrong

outer perch
#

ah

unique patio
#

Lots wrong there

#

Re-do

outer perch
#

check the code so

unique patio
#

Try a small demo on that code example alone elsewhere

#

like jsfiddle

#

make sure you're using it right. 🙂

earnest phoenix
#

time to eat gl

outer perch
#

I used that once

unique patio
#

I'd also wouldn't, map; arrays are just as easy/efficient for this purpose.

#

with loops

outer perch
#

I still think about the objects

unique patio
#

JS is cool with arrays handling like "objects"

#

You can var Person = ["name":"jake", "age": 36];

console.log(Person.name);

#

Do lots and in regards to sorting/etc; slum through it with the tried and trued for/while loops.

#

For su pport EC6 is where I like to keep it.

sudden geyser
#

Are you mistaking [] for {}

#

At first it looked like Swift but objects in JS are like dictionaries/keys & values

unique patio
#

Nope

#

You can use arrays like that still

#

Otherwise {} to define objects but not necessary here

sudden geyser
#

I got a syntax error when I tried it.

unique patio
#

Oh let me fix

#

I'm not in my IDE

outer perch
#
let prefix, custom = '+';
const map = new Map();
map.set('1234', custom);
prefix = map.get('1234');
console.log(prefix);
#

I tried this

#

it works fine

unique patio
#

oh wait yeah I meant my curly's

#

I was doing an array in an object

outer perch
#

I just need to set at the right moment

unique patio
#

Let me correct myself with a better example, yikes... lol

 var CTS = {
        Project: {
            Name: "CTS",
            Storage: "CTS_",
            isTouchScreen: false
        }
};

#

You can go deep with the objects... was tongue tied for a moment there

#

You just want to store guilds registered too?

outer perch
#

does this seem fine?

prefix ? map.get(message.guild.id) : ref.get('prefix').then(() => {    map.set(message.guild.id, prefix); });
#

You just want to store guilds registered too?
@unique patio I only want a prefix per guild

#

when changed

#

if it's the default, do nothing, if custom prefix, check for it

unique patio
#

So each guild has their own prefix, and you want to manage accordingly?

#

same commands, just diff prefixes

outer perch
#

yeah

unique patio
#

but checks if guild

#

ohhh lmfao

#

You'd obtain the values they've set however you do that. Raw-file, DB

#

however you do that, so assuming you got the retrieval down-pat;

#

Initiating a check would be a matter of pulling all the guild settings to JSON format.

#

and setting the guild ID as your identifier in an object; you could have this essentially written like

Guilds.Settings[guildid].prefix

#

Then what you could do, is when you get message!!!!

#

Check the guild fast with a quick guild.id call and if it's a registered value !== undefined you see if the prefix values match.

#

Here's how I sort my code in a nut-shell fast.

#
//Server.js (main js)
client.on('message', (receivedMessage) => {
    if (receivedMessage.author == client.user || receivedMessage.author.bot || !receivedMessage.content.startsWith(Config.COMMAND_PREFIX)) return;
    Command.Check(receivedMessage);
});
//Command.js (confirm command and send them off)
function Check(receivedMessage) {
    var splitCommand = receivedMessage.content.substr(1).split(/\s+/);
    // Command Check
    if (typeof PublicCommands[splitCommand[0]] == "function") {
        PublicCommands[splitCommand[0]](splitCommand.slice(1), receivedMessage);
    } else if (typeof Aliases[splitCommand[0]] == "function") {
        Aliases[splitCommand[0]](splitCommand.slice(1), receivedMessage);
    }
}
dense nest
#
@client.command()
async def role(ctx):
  for user in list(ctx.guild.members):
    try:
        for role in guild.roles:
          if role.name == "everybody":
            await ctx.guild.add_roles(role)
            print (f"{user.name} roled in {ctx.guild.name}")
    except:
          print (f"{user.name} has failed to be riled in {ctx.guild.name}")
  print ("Action Completed: mass role")```

Im trying to make a bot to mass role my server. It's not working. No errors, just fails.
outer perch
#

hmm

unique patio
#

Is that python?

dense nest
#

Ye

unique patio
#

Oh boy, too rusty

dense nest
#

Lol

unique patio
#

I would have loved to hop on it

#

started noticing my syntax out of date there

earnest phoenix
#

are you forgetting to log bot in ?

dense nest
#

?

#

Wdym

#

Lmao

earnest phoenix
#

with token

dense nest
#

No?

#

I'm a pretty good bot dev lmao

#

I just can't figure this out

earnest phoenix
#

looks like it

dense nest
#

As im a bit rusty with the API .-.

unique patio
#

lol

#

Yeah not sure of the API in python looks fun

dense nest
#

The only nice thing is cogs

#

I just don't know node

unique patio
#

I just know how to run it!

#

lmfao; JS is mostly used so it's cool

dense nest
#

Ye

#

Ive heard it's more stable than python for discord o.O

unique patio
#

Yeah NodeJS is a solid platform for web-developments/CLIs

#

all sorts, very powerful module

dense nest
#

Im trying to learn it for web stuff

unique patio
#

It'd be do-able if you comfy with the python

#

100%; Javascript is very nice to look at in comparison

dense nest
#

Yea

#

Im pretty good with C# and I've noticed similarities

unique patio
#

lol

earnest phoenix
#

if you know c# use discord.ts its much nicer than js

unique patio
#

I convert c# programs to javascript all the time

#

it is yo

#

lol

earnest phoenix
#

and ts is similar to c#

dense nest
#

Mk

#

Might try that

worthy glacier
#

why is it that when i do console.log(serverdefault[key]) it returns the correct value but when i do return or await it returns a object promise

unique patio
#

async?

worthy glacier
unique patio
#

look into async

#

and its uses in javascript

dense nest
#
async def role(ctx):
  for user in list(ctx.guild.members):
    try:
        for role in guild.roles:
          if role.name == "everybody":
            await ctx.guild.add_roles(role)
            print (f"{user.name} roled in {ctx.guild.name}")
    except:
          print (f"{user.name} has failed to be riled in {ctx.guild.name}")
  print ("Action Completed: mass role")```


Im trying to make a bot to mass role my server. It's not working. No errors, just fails.
unique patio
#

Hmm

#

You've got indentation errors

#

Muahahahaha

#

famous last words

dense nest
#

Ye the indenting is fucked in that message

#

Not in the code editor tho

unique patio
#

no newline at end of file?

thick gull
#
import javax.swing.JOptionPane;
public class GUIStick {

    public static void main(String[] args) {
        
        int x = 0;
        int y = 4;
        while (x < y) {
                JOptionPane.showConfirmDialog(null, "Do you want to close this box?","You can't close me",JOptionPane.YES_NO_OPTION);
                
        }
    }
}

Basically, what this program does is every time the integer "x" is of less value than "y", the script inside the unit of code will continue to run. It basically creates an un-closable text box that wont go away from your screen until you forcefully kill it in task manager. Right now, it only opens one box. I would like it to open around 5 of them at once. Do you know how to make it open 5 of these boxes?

#

this isn't mine

#

this is for a friend

earnest phoenix
#

sounds like a virus

unique patio
#

It is, and I won't help; lmfao

outer perch
#
const ref = db.collection('servidores').doc(message.guild.id);

    let prefixes = new Object();

    prefixes = { 'guildID': '+' };

    if (!prefixes[message.guild.id]) prefixes[message.guild.id] = await ref.get('prefix');

    const prefix = prefixes[message.guild.id];
#

I did this

#

now I gotta wait til 12am to check if this will work

unique patio
#

Wicked, does it run; lookin over it now

#

wait why?

outer perch
#

exceeded quota

unique patio
#

For what?

earnest phoenix
#

that wont work anyway

outer perch
#

requesting the database too much

#

that wont work anyway
@earnest phoenix why?

#

I can't test it 😦

unique patio
#

Do what I do, don't request it.

#

See it as it comes in

#

and filter from there, it's the only way on high scale

thick gull
#

sounds like a virus
@earnest phoenix i mean i didnt read it lmaoo

earnest phoenix
#

youre loomi g for guild.id but in your object the key is guildId

outer perch
#

the value will be the prefix

earnest phoenix
#

yea 16252674884 will not == guildId

unique patio
#

Doesn't client.servers

#

return what you want?

outer perch
#

It could

unique patio
#

You should

#

it's stored already

#

or grab on the go

#

(for low memory solutions)

outer perch
#

forgot to set maybe

#

how do I set values to an Object?

silver lintel
#

ive got a ping.js which is a command and how to i link it to app.js? im a noob

unique patio
#

import it

silver lintel
#

how do i do that

unique patio
#

exports.StringDistance = StringDistance;

#

in this case stringdistance being your function and you'd in the file you'd wanna call it

#

say, main.js

silver lintel
#

mhm

outer perch
#
const array = message.content.split(' '),
        commandName = array[0].slice(prefix.length).toLowerCase(),
        args = array.slice(1);
    const command = bot.commands.get(commandName) || bot.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName));
try {
        command.execute(bot, message, command, args, db, prefix, prefixes);
    }
    catch (err) {
        console.error(err);
    }
unique patio
#

const { GetPatternNumber, IDSearch, NameSearch, GetItemCustomizations, pad, GetDescription, isInt } = require("../Utilities/Search");

#

some like that you know?

#

The items inside the curly's are references to the objects imported in the "sidefile.js"

outer perch
silver lintel
#

thanks

unique patio
#

np

#

For dynamic commands I gave you it and it's low low complexity when put into full scale.

outer perch
#

check this last one first

unique patio
#

I'm talking thousands of commands in a blaring second

#

This is how commands look.

PublicCommands = {
    help: function (args, receivedMessage) {
        // Initiate Command
    }
    math: function (args, receivedMessage) {
        // Initiate Command
    }
    kick: function (args, receivedMessage) {
        // Initiate Command
    }
};

This is what initialy input looks like, on message received!

client.on('message', (receivedMessage) => {
    if (receivedMessage.author == client.user || receivedMessage.author.bot || !receivedMessage.content.startsWith(Config.COMMAND_PREFIX)) return;
    Command.Check(receivedMessage);
});

This is how you sort if it's a command or not, and other parameters; depending on your use of the bot and pseudo classes.

function Check(receivedMessage) {
    var splitCommand = receivedMessage.content.substr(1).split(/\s+/);
    // Command Check
    if (typeof PublicCommands[splitCommand[0]] == "function") {
        PublicCommands[splitCommand[0]](splitCommand.slice(1), receivedMessage);
    }
}

#

That's all you need, and don't split that way, it really don't help with new-lines/etc; when people make mistakes.

#

Think less; do more is what this should tell you and all.

rapid dawn
#

Yo, I have a question about verifying as dev. Do they only want your ID document or also a selfie or something else?

sweet kestrel
#

anyone know how to fix it?

#

My music command not working

unique patio
#

Yes include PyNaCi

#

pip install PyNaCl

#

easy fix

stable nimbus
#

Anybody use MySQL and could help me debug something?

unique patio
#

😐 maybe

stable nimbus
#

Well I'm not sure what went wrong but it is no longer reading results[0].<column_name>

earnest phoenix
#
let trackIMG = `https://i.scdn.co/image/${activity.assets.largeImage.slice(8)}`;

var colorThief = new ColorThief();

colorThief.getColor(trackIMG)
  .then(color => { console.log(color) })
  .catch(err => { console.log(err) })
internal/fs/utils.js:269
    throw err;
    ^

Error: ENOENT: no such file or directory, open 'https://cdn.discordapp.com/avatars/257062280779268097/a_10d8776f2f0893cebe8f4c3995077824.gif?size=1024'
    at Object.openSync (fs.js:462:3)
    at Object.readFileSync (fs.js:364:35)
    at new CanvasImage (C:\Users\axe12\Desktop\autimatic bot\node_modules\color-thief\js\color-thief.js:49:22)
    at ColorThief.getPalette (C:\Users\axe12\Desktop\autimatic bot\node_modules\color-thief\js\color-thief.js:144:22)
    at ColorThief.getColor (C:\Users\axe12\Desktop\autimatic bot\node_modules\color-thief\js\color-thief.js:111:30)
    at Request._callback (C:\Users\axe12\Desktop\autimatic bot\commands\bilgi\spotify_bilgi.js:122:24)
    at Request.self.callback (C:\Users\axe12\Desktop\autimatic bot\node_modules\request\request.js:185:22)
    at Request.emit (events.js:315:20)
    at Request.<anonymous> (C:\Users\axe12\Desktop\autimatic bot\node_modules\request\request.js:1154:10)
    at Request.emit (events.js:315:20) {
  errno: -4058,
  syscall: 'open',
  code: 'ENOENT',
  path: 'https://cdn.discordapp.com/avatars/257062280779268097/a_10d8776f2f0893cebe8f4c3995077824.gif?size=1024'
}
#

color-thief module

unique patio
#

Hmmmm did you accidentally break your table?

#

If I do recall it's sensitive like that, might have a red-field somewhere making the search defective.

#

Been many years though can't say how it is now.

stable nimbus
#

I didn't.

unique patio
#

Are you making a proper selection for your results?

#

@earnest phoenix yeah your link is broken

stable nimbus
#

I do
if (!results[0].userid) as my bot is meant for roleplay, I need it to search that coloumn where the userid is equal to a mentioned user.

#

I may not be defining it correctly in the selection.

unique patio
#

in file fs.js (openSync) failed with that URL listed there.

#

"no such file means you tried to open a bad/faulty URL

#

A bit beyond me but can't you work with unions and do a cleaner-pull

#

but still not the answer you want; not entirely sure why the search isn't work assuming you got it all setup right and are making connection or doing the expressions right from program.

stable nimbus
#

Not sure either. I might just rewrite the whole command.

#

Which never hurts as it might just fix it.

#

Which is weird.

earnest phoenix
#

it looks like youre trying to open a url and not a local file...does fs support that

drifting wedge
#

should i rewrite my bot is d.js?

#

its python rn

#

or maybe just redo it?

earnest phoenix
#

why switch

drifting wedge
#

well i mean i could just make a new bot

#

but i want to learn js

earnest phoenix
#

i switched from js to ts...but if your bot works i cant see why switch python to js

drifting wedge
#

so maybe just make a new one

#

once im done with my python bot

earnest phoenix
#

that always works

mental willow
#

can anyone see an obvious reason to why this command is not running

@bot.command(pass_context=True)
async def level(context):
    print("leveling")
    author1 = context.message.author.id
    author = (author1,)
    print(author)
    sql = "SELECT xp FROM leveling WHERE userid=?"
    cur.execute(sql,author)
    result = cur.fetchall()

    # Math sorta stuff
    current_level = int(result/1350)

    embeded_message = discord.Embed(name="Your Level", description="Leveling System Version 0.1", color=0xffffff)
    embeded_message.add_field(name=f"Level for:", value=f"<@{author}>", inline=True)
    embeded_message.add_field(name=f"Current XP:", value=f"{result}", inline=True)
    embeded_message.add_field(name=f"Current Level:", value=f"{current_level}", inline=True)
    await context.channel.send(embed=embeded_message)```
earnest phoenix
#

sorry not familiar enough with python to see offhand

#

does the comma after author need to be there

#

author1

safe pier
#

Hi

sudden geyser
#

@mental willow does your code print leveling as you did at the top.

mental willow
#

no it does not @sudden geyser

sudden geyser
#

Then the issue is the command is probably not being recognized.

#

Can you share more of your code (such as the cog if your command is part of one). Preferably on a site like https://hastebin.com in case it's long.

minor quail
#

Any sites that I can host my bot for free?

earnest phoenix
#

heroku

livid otter
#

i want to users only send images to channel code

#

please help me

sudden geyser
#

Confused. Could you explain what you mean.

livid otter
#

The bot will delete when users type a message on a channel whose id is entered.
will only allow pictures

sudden geyser
#

What library are you using

livid otter
#

discord.js

sudden geyser
#

What you could do is listen to the message event and see if the message instance contains at least 1 attachment (<Message>.attachments). I don't know how to check if the message contains an image in particular, as it's just an attachment (image, file, video, etc.) You could check the size or the extension to combat it.

wheat valley
#

Mrb

delicate shore
#

oh no

faint prism
sudden geyser
#

The only time I worked with ML was in Swift

silver lintel
#
let newEmbed = new Discord.MessageEmbed()
        .setColor('#f4e542')
        .setTitle("Current Prefix set to:")
        .setDescription(args[1])
        .addField("Forgot the prefix?", "Mention the bot `@Electric prefix`")
        .setFooter(`Server: ${message.guild.name}`);
        message.channel.send(newEmbed);
``` my embed isnt working
faint prism
hollow saddle
#

@silver lintel how is it “not working”

silver lintel
#

its not sending

#

and it like stops the program

#

because stuff after it doesnt happen

hollow saddle
#

Could you show more of the surrounding code? Any errors logged in the console?

silver lintel
#

wait i fixed it

#

because logs

#

thank you

hollow saddle
#

Yes, logs are a valuable resource marioThumbs

drifting wedge
#

can anyone help with pillow and pasting in a users avatar?

#
profile_bytes = Image.open(profile_bytes)
            profile_bytes = profile_bytes.resize((150, 150));

            bigsize = (profile_bytes.size[0] * 3, profile_bytes.size[1] * 3)
            mask = Image.new('L', bigsize, 0)
            draw = ImageDraw.Draw(mask)
            draw.ellipse((0, 0) + bigsize, fill=255)
            mask = mask.resize(profile_bytes.size, Image.ANTIALIAS)
            profile_bytes.putalpha(mask)

            output = ImageOps.fit(profile_bytes, mask.size, centering=(0.5, 0.5))
            output.putalpha(mask)
            output.save('output.png')```
#
fundo.paste(output,(86, 66),output)```
#

ive imported bytesio from io

#

and giving me error:

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: UnboundLocalError: local variable 'profile_bytes' referenced before assignment

#

in line profile_bytes = Image.open(profile_bytes)

delicate shore
#

Why was my bot was killed

modest crane
#

by killed you mean reconnected?

zenith knoll
#

How do u check if the bot has a permission?

earnest phoenix
delicate shore
#

by killed you mean reconnected?
@modest crane yep

restive shell
#

@zenith knoll

if(!message.guild.me.hasPermission(["PERMISSION_HERE"])) return message.channel.send("❌ | I dont have permission to do this!")
earnest phoenix
#

please help

modest crane
#

@modest crane yep
oh

delicate shore
#

it says Discord ASKED us to reconnect

modest crane
#

that's normal

zenith knoll
#

@zenith knoll

if(!message.guild.me.hasPermission(["PERMISSION_HERE"])) return message.channel.send("❌ | I dont have permission to do this!")

@restive shell k

delicate shore
#

ok

zenith knoll
#

why does it say

#

(node:4720) UnhandledPromiseRejectionWarning: Error: FFmpeg/avconv not found!?

earnest phoenix
#

my guess is it wasnt installed?

zenith knoll
#

but it is...

earnest phoenix
#

hmm

#

did you try turning off and back on again

zenith knoll
#

heres a ss

#

so

#

it joins cv

#

just

#

no sound

#

and error

restive shell
#

did you edit the environment variables ?

zenith knoll
#

wdym

#

did you edit the environment variables ?
@restive shell like adding ffmpeg to the PATH?

restive shell
#

yes

zenith knoll
#

how?

#

lol

#

i mean

restive shell
#

wdym lmao

zenith knoll
#

like

restive shell
#

you don't know how ?

zenith knoll
#

how to get ffmpeg

#

like

#

heres what i mean

restive shell
#

oh easy

zenith knoll
#

I installede in my bot

#

but not PC?

restive shell
#

1 sec

zenith knoll
#

brb

restive shell
#

yes you need it on your vps | pc

zenith knoll
#

the snapshot?

#

this?

#

oops

restive shell
#

remove it please lmao

#

wait I will show you

zenith knoll
#

k

#

do i popen it?

#

im new to music bot :(

restive shell
zenith knoll
#

k thanks

restive shell
#

no problem

earnest phoenix
#

hey i WAS right!

#

what debugging skills

zenith knoll
#

no problem
@restive shell sorry for ping, but do i need static?

#

or dev

restive shell
#

idrk lol

zenith knoll
#

lol

restive shell
#

I don't have a music bot

zenith knoll
#

im goin with the latest git version static

restive shell
#

but I did the static thing

#

and it worked

zenith knoll
#

k

#

git version or release?

restive shell
#

1 sec let me check

zenith knoll
#

im using git bc apparently its newer?

restive shell
#

just do the source code

zenith knoll
#

uhhhhh

#

it sayd

#

git or release

restive shell
#

idk sorry as I said before I don't have a music bot xD

zenith knoll
#

ok

#

Sphinix OMG THANK U

delicate shore
#

How to check how many lines are there in a message

restive shell
#

Sphinix OMG THANK U
@zenith knoll ofc !

#

How to check how many lines are there in a message
wdym ? xD

delicate shore
#

Like this

#

First line
Second line
Third line
Fourth line

#

Is there any way my bot can see that if lines are more then 5 then it deleted the msg

#

I just wanna know can bot see like lines

zenith knoll
#

Sphinx I followed ur spotify

restive shell
#

oh sorry idk about that

#

Sphinx I followed ur spotify
thanks lol a_pp_cuteshake

earnest phoenix
#

How to check how many lines are there in a message
@delicate shore Use regex to match all line terminators

delicate shore
#

@delicate shore Use regex to match all line terminators
@earnest phoenix
Sorryw what ?

earnest phoenix
#

Regular expression can be used to match all line terminators such as \n that can't be seen in a formed string

near veldt
#

lol

earnest phoenix
#

Is there an API or NPM package that allows me to convert a .PNG or .JPG into a .GIF with a floating animation of some sort?

#

Floating animation?

#

Can you show an example of that "floating animation"?

opal plank
#

@earnest phoenix or use multi line and word boundary \b

#

¯_(ツ)_/¯

earnest phoenix
#

Still all works

opal plank
#

indeed

#

convertin png into gif?

#

why tho

#

why would you gif a static image?

earnest phoenix
#

the floating animation thing is just an example, i just need to know if something exists that allows me to animate pngs and make them a gif

opal plank
#

so you want to compose one?

#

with mutliple pics?

#

if so i guess ffmpg might do the trick

#

its good at everything tbh

#

¯_(ツ)_/¯

earnest phoenix
#

Just use canvas and gifencoder and make several frames with Infinity loop

#

ok thanks

restive shell
earnest phoenix
#

account info

#

like creation date somewhere

restive shell
#

I do have that

#

For the bank

earnest phoenix
#

or copy the users tag when clicking on the username

restive shell
earnest phoenix
#

like when you click on my name it copies “Constantin#4200”

restive shell
#

Oh yes

#

I will do the account age + account status a_pp_cuteshake thank youu

hazy sparrow
earnest phoenix
#

@hazy sparrow like i said learn how to code before trying to make a bot

#

@restive shell that's a frickin awesome image

cinder patio
#

You have to click on the image to see what it says though

delicate shore
#

<channel>.setRateLimitPerUser()

#

The time is in ms or s

#

Means we have to enter in ms or s

cinder patio
#

seconds

delicate shore
#

Ok

earnest phoenix
#

@delicate shore wait that is a thing in discord.js

delicate shore
#

Maybe

#

I was just guessing

#

I'll read the docs brb

earnest phoenix
#

what the fu

delicate shore
earnest phoenix
#

i literally typed out the whole URL on mobile and you pinged me with a screenshot angeryBOYE

#

@delicate shore is that slowmode

delicate shore
#

Heh

#

Yes

earnest phoenix
#

ig

restive furnace
#

yes

earnest phoenix
#

lemme see what it does through my awesome eval command

delicate shore
#

Ok

restive furnace
#

changes the slowmode

#

lul

delicate shore
#

@earnest phoenix can you please eval following code

msg.guild.leave()

earnest phoenix
#

@earnest phoenix can you please eval following code

msg.guild.leave()
@delicate shore lmfao

#

Try

#

It

#

@delicate shore good idea

#

Let him eval it

#

@earnest phoenix nickname lol

#

Yes who tf did that

#

Let him eval it
@earnest phoenix if i eval that all the shit my bot stored about my server in cache will be gone and i have some special shit for the support server so if the bot leaves and the cache is deleted i would have to add the shit again and you just made me type a biggo paragraph on mobile because you milked a weird joke too many times and it is not funny anymore

#

Just test it

restive furnace
#

no

earnest phoenix
restive furnace
#

only the message guild

#

and dont spam that emoji kthx

earnest phoenix
#

I will

#

Its an good emote

restive furnace
#

ok 🔨

earnest phoenix
#

🤡 🤡 🤡

pure lion
#

a

leaden shoal
#

I’m just wandering if there’s any like learning stuff I can read or watch to get a better understanding of discord bot linking to dashboards

pure lion
#

What lang?

restive furnace
pure lion
#

Shut^^

#

It's not going to be of much use

restive furnace
#

mostly for dashboards JS & HTML, or only JS is being used.

pure lion
#

Yes but it's the wrong js

restive furnace
#

how so?

leaden shoal
#

Ye but how do I make it so you enable and disable commands and change like prefix and stuff

restive furnace
#

rest api

#

there is template of that in gh

pure lion
#

nodeJS is not frontend js, they're the same lang but they are very slightly different in use

restive furnace
#

and yeah i meant on raw JS as NODE.js

#

(React, Vue etc.)

earnest phoenix
#

It's not going to be of much use
@pure lion w3schools has two versions of javascript tutorials one for node.js and one for browser javascript

#

var Discord = require('discord.io');
var logger = require('winston');
var auth = require('./auth.json');
// Configure logger settings
logger.remove(logger.transports.Console);
logger.add(new logger.transports.Console, {
colorize: true
});
logger.level = 'debug';
// Initialize Discord Bot
var bot = new Discord.Client({
token: auth.token,
autorun: true
});
bot.on('ready', function (evt) {
logger.info('Connected');
logger.info('Logged in as: ');
logger.info(bot.username + ' - (' + bot.id + ')');
});
bot.on('message', function (user, userID, channelID, message, evt) {
// Our bot needs to know if it will execute a command
// It will listen for messages that will start with !
if (message.substring(0, 1) == '$') {
var args = message.substring(1).split(' ');
var cmd = args[0];

    args = args.splice(1);
    switch(cmd) {
        // $ping
        case 'ping':
            bot.sendMessage({
                to: channelID,
                message: 'Pong!'
            });
        break;
        // Just add any case commands if you want to..
     }
 }

});

#

is this code correct????????

#

also use hastebin for big blocks of code

#

ugh im so new to all this coding

modest crane
#

use discord.js or eris

pale vessel
earnest phoenix
#

ok

#

dyno says you joined the server today

#

yeah

#

cool

#

welcome to hell

#

lol

#

it says i dont have a discord.js module

#

what to do?

#

install it

#

npm install discord.js

#

npm is what we use to install modules in node.js

#

oh ok

near veldt
#

i shrunk my mute command down from a wopping 120+ lines to a wopping 90 lines

earnest phoenix
#

npm ERR! JSON.parse Failed to parse json
npm ERR! JSON.parse Unexpected token “ in JSON at position 1 while parsing near '{“name”: “Sidron-bot”...'
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.

#

what does this mean guys?

near veldt
#

oh

#

i

#

t h i n k

#

your json

#

isnt formatted properly

#

hence the unexpected token

#

"

earnest phoenix
#

soo how do we fix it??

near veldt
#

well

#

json files are configured by
{
"name" : "input",
"other" : "example"
}

#

i think u gotta shift enter twice then up arrow once to then start writing between
{

}