#development

1 messages · Page 569 of 1

quartz kindle
#

@earnest phoenix can you post your full code?

#

the file that has the dropdowns

earnest phoenix
#

alright

#

has to much

#

ill go pastebin

sick cloud
earnest phoenix
#

dm

#

?

quartz kindle
#

just post it here

earnest phoenix
quartz kindle
#

unless it has sensitive content

earnest phoenix
#

no

#

xd

#

not 18+ site

#

xD

quartz kindle
#

that is the current working code?

earnest phoenix
#

yea

quartz kindle
#

or the one with the build error

harsh nova
#

Why don’t you separe the css in another file?

earnest phoenix
#

lazy

#

xD

harsh nova
#

Understandable xD

quartz kindle
#

try this js <%if(user.id === bot.config.ownerID) {%> <a class="dropdown-item" href="/admin"><i class="far fa-user-secret"></i> Admin</a> <%}%>

earnest phoenix
#

instead

#

of admin

quartz kindle
#

yes

harsh nova
#

Are you making a dashboard?

quartz kindle
#

ejs is weird af

earnest phoenix
#

ye

quartz kindle
#

its like php

#

but worse

#

lmao

earnest phoenix
#

Tim

#

config not defined

#

i dont know how to define

#

on ejs

#

;-;

quartz kindle
#

require your bot config file somewhere

dusky steeple
#

I am liking ejs. But I dont know if my dashboard is "good" or "nice looking"

#

can I post links here?

quartz kindle
#

you can just do user.id === require('botconfigfile.json').ownerID

#

i think

dusky steeple
harsh nova
#

What is ejs?

quartz kindle
#

its like php

#

but for js

harsh nova
#

Oh

quartz kindle
#

looks good @dusky steeple

earnest phoenix
#

require is not defined

#

;-;

static oasis
#

const

earnest phoenix
#

<%if(user.id === require('config.json').owner_ids) {%>

#

what i have

sick cloud
#

@dusky steeple isnt that the idiots guide dashboard

harsh nova
#

It is

quartz kindle
#

@earnest phoenix are you using a render function? like .render("yourfile.ejs")

dusky steeple
#

yes but I have modified it extremely

earnest phoenix
#

yes

#

i am

quartz kindle
#

you can pass it through there

earnest phoenix
#

but render is on dashboard

#

not index.ejs

quartz kindle
#

like .render("yourfile.ejs",{config:yourbotconfig})

earnest phoenix
#

then

#

i do

#

config.owners_ids

#

it should work

quartz kindle
#

in your dashboard you do require(botconfig)

earnest phoenix
#

rigfht

quartz kindle
#

then you send the required botconfig with the render function

#

yes

earnest phoenix
#

res.render("index.ejs",{config:config})

#

still

#

config not defined

quartz kindle
#

hmm

earnest phoenix
#

202| <%if(user.id === config.owner_ids) {%>

#

error

quartz kindle
#

check if config is working

#

console.log(config) before the render

earnest phoenix
#

nothing

#

poped up

#

same

#

error message

quartz kindle
#

how are you defining config?

earnest phoenix
#

const config = require("../config.json")

quartz kindle
#

is your config file in the folder before?

earnest phoenix
#

yea

#

one below

#

web/dash.js

#

then

#

config

#

below

#

just config.json

quartz kindle
#

weird

#

how are you running dashboard?

#

node dashboard from the web folder?

earnest phoenix
#

im using glitch for it

#

so

#

node index.js

quartz kindle
#

hmm

#

idk how glitch works, but its possible that if the file is being run from the base folder, not from the web folder, then the require will follow the base path as well

#

try doing require("./config.json")

#

just to see if it works

earnest phoenix
#

did

#

it says

#

can find that module

#

xd

quartz kindle
#

ah rip

#

then idk, the previous one should be working, but if its coming up empty in the console, then something is wrong

#

the config file itself is not empty, is it?

earnest phoenix
#

no

#

u want to join

#

?

quartz kindle
#

try console.log(config.ownerID), right after the require line

earnest phoenix
#

config

#

not defined

#

xd

quartz kindle
#

rip

#

send me the join link in dm

earnest phoenix
#

k

tough flint
#

!p xdr begallasi lula lula

queen sentinel
hushed berry
#

😢

grim aspen
#

switched to python yet having trouble with pip installing discord.py

earnest phoenix
grim aspen
#

using pycharm

pale marsh
#

What's your problem?

dusky steeple
#

anyone know why this

levels: config.levels,
    format: winston.format.combine(
        winston.format.timestamp({
            format: 'dddd, mmmm dS, yyyy, h:MM:ss TT'
        }),
        winston.format.colorize(),
        winston.format.simple()
    ),

outputs like this
Shard: Launching 0 Shards [1 of 1] {"timestamp":"Thursday, 3333 43, yyyy, 7:02:32 TT"}

quartz kindle
#

does winston use moment.js for date formatting?

dusky steeple
#

idk

#

first time ever using winston

quartz kindle
#

full month and full year should be all capital Ms and Ys

dusky steeple
#

this is what I was going for: Saturday, June 9th, 2007, 5:46:21 PM

grim aspen
#

so the problem is it's saying that pip (python installer program) is not a available command for pycharm

dusky steeple
#

linux or windows?

grim aspen
#

pycharm's installed on my mac :/

dusky steeple
#

doing sudo easy_install pip from the terminal doesnt work?

grim aspen
#

thank you

#

it's saying password with a key symbol

#

what do i do there

quartz kindle
#

enter your mac's password

grim aspen
#

oh

quartz kindle
#

duh

grim aspen
quartz kindle
#

is your account not an admin?

grim aspen
#

yes

#

not an admin

quartz kindle
#

you need an admin account

grim aspen
#

well then

ruby dust
#

this incident will be reported

#

nice

grim aspen
#

i'm going to try later tonight on my pc

#

i'll respond if anything happens

empty owl
#

anyone have a quickdb leaderboard command I can borrow

unique iron
#

Did Tehi make the raid

sick cloud
#

@empty owl go beg for code in plexi

#

this isnt the place

supple otter
#

Lmao

empty owl
#

@sick cloud I am its not working

sick cloud
#

then make it yourself

empty owl
#

oof

#

Is there a way to take an array, take the top three, and send it?

hidden ginkgo
#

you can do anything your mind can think up

empty owl
#

AHHHHHH

quartz kindle
#

first you have to actually create the leaderboard

floral bloom
#

So, I'm making a command to take every letter and place |||| after it. How would I do that?

empty owl
#

dude what

#

a spoiler?

harsh nova
#

Split message at space and do a for function?

#

Idk

quartz kindle
#

or just split then join

harsh nova
#

Oh yeah

floral bloom
#

I have:

let  msg = args.slice(0).join("||||")
message.channel.send("||" + msg + "||")

But that only splits each word... I don't know how to split each letter

quartz kindle
#

agrs = message.content.split(" ") (messages split on spaces)

#

just create another variable which equals message.content.split("") (messages split on nothing, ie all characters)

floral bloom
#

Oh, thanks! 👍

#

Woohoo, got it working!

if (command === "spoiler") {
    let msg1 = message.content.slice(9).split("")
    let msg = msg1.slice(0).join("||||")
    message.channel.send("||" + msg + "||")
  }
lusty dew
#

Can someone help me setup a hosting thing on OpenShift?

grim aspen
#

openshift?

#

that's a new one

lusty dew
empty owl
#

hey

#

so I got the top five of my leaderboard

#

let leaderboard = await db.startsWith('userBalance', { sort: true });
for (let i = 0; i < 5; i++) {
console.log(leaderboard[i]);
}

#

and it returns { ID: 'userBalance_235542521894273024', data: 3500 }
{ ID: 'userBalance_268767449288146944', data: 2000 }
{ ID: 'userBalance_439802941906485258', data: 1596 }
{ ID: 'userBalance_345349646253817857', data: 1514 }
{ ID: 'userBalance_282876816736124930', data: 1216 }

#

but I only want the ID and data

#

how would I do that?

#

also if you could, find the id of the person

knotty steeple
#

learn about arrays

empty owl
#

its not an array

#

its an object

knotty steeple
#

im not a dumbass

#

its an array of objects

empty owl
#

fine ill do type of

knotty steeple
#

the objects are in an array

#

if it wasnt an array you couldnt do leaderboard[i]

empty owl
#

oh

#

it actually sent it 5 times

#

and an object each time

knotty steeple
#

leaderboard[i].value

#

value being what you want to get

empty owl
#

oh ok thanks

knotty steeple
#

id or data

empty owl
#

ok\

knotty steeple
#

did you even look at the link

#

maybe

inland drift
#

Hey can someone help me

knotty steeple
#

it doesnt apply here

empty owl
#

oof

knotty steeple
#

"Do not ask to ask."

#

@inland drift

empty owl
#

we are here to serve you

knotty steeple
empty owl
#

kinda

#

thanks

silver lintel
#

im using discord.js 11.4.2 and i dont understand awaitMessages

steel heath
#

use message collectors then

silver lintel
#

what are those?

steel heath
lusty dew
#

Does anyone know an API where I can get random lick gifs?

keen drift
#

imgur maybe

#

can always scrape google

earnest phoenix
#

and get ip banned

#

apply for weeb.sh if you have enough guilds i guess

keen drift
#

google is just going to put a captcha once you hit unhuman rates, it's more than enough to scrape images

iron wharf
#

.

covert tartan
#

Anyone know why my bot OAuth link would be taking people to the wrong redirect uri?

#

the wrong one, and the one i want it to be, are both added in my application as approved urls, and in the full oauth URL im using, the one i want it to be is definitely the one specified as the redirect URI, but it still takes me to the old one

zinc pawn
#
        if(!data[0]) {
             await bot.db.insert({doc}, (err, data) => {
                if (err) console.error(err)
            })
        }
        if(data) {
            curxp = data.xp;
            curlvl = data.lvl
        }
    })
                
    console.log(curxp + "\n" + curlvl)``` it logs undefined for curxp and curlvl?
mossy vine
#

Define them

#

This aint pythonk

quartz kindle
fiery nebula
#

this is not workign

quartz kindle
#

joinedAt is a property of guild member

#

so it only works if target is a member, not a user

#

and it should be target.joinedAt

fiery nebula
#

hmm ok lemme try it

quartz kindle
#

message.mentions.users is a user. you can try message.mentions.members instead, to get a member object

#

and message.author is also a user, instead use message.member

fiery nebula
#

when i try this i get the stats of my own even this user id is from a user of the server

quartz kindle
#

try hardcoding the id to test it

fiery nebula
#

ok

#

it drops into this..

#

but when i do the same select on the db i get a result

quartz kindle
#

can you show all the code again? with the hardcoded id

fiery nebula
quartz kindle
#

thats not what i meant with hardcoded id

fiery nebula
quartz kindle
#

doing that basically does this: "8707050598305".id which is undefined

fiery nebula
#

oh...

quartz kindle
#

i meant put the id in the members.get()

fiery nebula
quartz kindle
#

as a string

#

""

restive bough
#

id is an string

fiery nebula
#

bruh

restive bough
#

bruh

fiery nebula
#

yea works then

quartz kindle
#

so the problem is args

#

console.log args

#

maybe you're using the wrong arg

fiery nebula
#

yea i get a undefined

quartz kindle
#

undefined from args or args[1]?

fiery nebula
#

yea

#

i get the right one from 0

quartz kindle
#

ah ok

fiery nebula
#

thx

quartz kindle
#

👍

restive bough
#

but why are you using var and let

#

weird

fiery nebula
#

tbh i dont really know the datatypes in js

#

only java php

restive bough
#

ok

#

you should

fiery nebula
#

i need to look that up

quartz kindle
#

thats not really related to data types

#

just variable declaration

restive bough
#

yup

#

use const for constant variables

quartz kindle
#

var is old and was the only option for a long time

fiery nebula
#

ok

quartz kindle
#

let and const are new, and have new use cases

restive bough
#

and let for variables you are going to re asign

fiery nebula
#

ah ok

quartz kindle
#

let and const are considered "safer" because they throw an error if you accidentally try to re-declare/replace an existing one

#

when var just does it and possibly screws up your code

fiery nebula
#

ok so i can change all var to let?

restive bough
#

yes

#

or const if your not going to re asign the variable

#

or increase/decrease

quartz kindle
#

the difference between let and const, is that the value of const cannot be changed

harsh nova
#

I noticed process.on error was a thing in node

#

So epic

dusky steeple
#

ugh winston is starting to really make me mad

quartz kindle
#

why use it then :^)

dusky steeple
#

cause I want to learn it lol

quartz kindle
#

xD

dusky steeple
#

I know I have something set up wrong but haven't figured out what yet

restive bough
#

winston thonkku

dusky steeple
#

it works for 1 file correctly but wont for another

#

this one works fine 1logger.log('Shard', Launching ${shard.id} Shards [${shard.id + 1} of ${Manager.totalShards}]);but this one don't lollogger.log('Log', Loading a total of ${client.commandsNumber} commands.);`

#

er

harsh nova
#

How many servers is your bot in

dusky steeple
#

10

#

I know I don't need shards yet

harsh nova
#

You dont need to shard before 2k

dusky steeple
#

just preparing for future

harsh nova
#

Lol

#

Well that good

dusky steeple
#

everyone tell me not to add it yet

#

im like 🖕 I am adding now so I don't have to later

harsh nova
#

Yeah that’s understandable

quartz kindle
#

use 20 shards for 10 guils

#

2 shards per guild = double performance

harsh nova
#

Paired with the matrix.js library

quartz kindle
#

dual channel memory

harsh nova
#

It eill be epic

quartz kindle
#

:^)

#

this is a joke

dusky steeple
#

this works

logger.log('Shard', `Launching ${shard.id} Shards [${shard.id + 1} of ${Manager.totalShards}]`);```
and outputs
`Shard: Launching 0 Shards [1 of 1]` 
but this
```javascript
logger.log('Log', `Loading a total of ${client.commandsNumber} commands.`);```
outputs nothing at all 🤔
quartz kindle
#

what if you remove client.commandsNumber

#

and leave just the string

dusky steeple
#

samething outputs nothing

quartz kindle
#

what if you put "Shard" instead of "Log"

dusky steeple
#

er wrfd

#

that worked

#

so its a problem with Log

quartz kindle
#

then check if winston has specific settings tha need to be configured for each log type

dusky steeple
#

all the other ones I have working fine. Just something with Log

#

wait you can only have 5 levels in winston right?

daring trellis
#

as for ID of user to know his username?

quartz kindle
#

@dusky steeple levels are prioritized from 0 to 7 (highest to lowest).

dusky steeple
#

ok ty. I have 7

#

wasn't sure if that changed though

quartz kindle
#

@daring trellis you want to get a username from an id? which library are you using, discord.js?

daring trellis
#

@quartz kindle yes discord.js

amber fractal
#

Get it from your bots users, or I think you can use the /users/{user.id} endpoint

quartz kindle
#

@daring trellis client.users.get(id).username

daring trellis
#

thanks

dusky steeple
#

hmm my winston is only reconizing 5 levels and not 7

#

take that back

pale marsh
#

Got a python question

#

Let's say I have an async tcp client listening for messages from a server, but at the same time I want to be able to get input from the console. How can this be achieved?

#

So far what I could only manage is get the client to continuously wait for tcp messages and take action accordingly

dusky steeple
#

with a flux compasitor installed 😛 🤔

pale marsh
#

Python async is driving me crasy

#

Huh?

dusky steeple
#

lol just messing around

#

Idk python for crap

quartz kindle
#

i dont know python either, but if your tcp listener is async, you should be able to setup another listener on the console

#

and process both events as they arrive

pale marsh
#

I have no idea how to do that in python

#

In C# it was as easy as not awaiting an async method

#

In python however, idk how to fire an async function without awaiting it

quartz kindle
dusky steeple
#

Ok I can not figure this all. I can use all the levels except 7. Anyone see what I am doing wrong?

const winston = require('winston');

// Logging Levels
const config = {
    levels: {
        Error: 0,
        Debug: 1,
        Warn: 2,
        Data: 3,
        Info: 4,
        Shard: 5,
        Dash: 6,
        Cmmds: 7
    },
    colors: {
        Error: 'red',
        Debug: 'blue',
        Warn: 'yellow',
        Data: 'grey',
        Info: 'green',
        Shard: 'magenta',
        Dash: 'yellow',
        Cmmds: 'cyan'
    }
};

winston.addColors(config.colors);

const logger = module.exports = winston.createLogger({
    levels: config.levels,
    format: winston.format.combine(
        winston.format.colorize(),
        winston.format.simple()
    ),
    transports: [
        new winston.transports.Console()
    ],
    level: 'Dash'
});
pale marsh
#

@quartz kindle that actually helps Thonk

#

Also I think that gave me an idea

quartz kindle
#

i dont see anything wrong there, except for why do you have module.exports in the middle there?

dusky steeple
#

idk

pale marsh
#

I didn't really grasp the concept of "event loops" yet so I think that's where my issue is

dusky steeple
#

i saw it in the tutorial I was watching

quartz kindle
#

i mean, it works, but thats kinda redundant

dusky steeple
#

it's not needed I take it?

quartz kindle
#

because you assign the function to logger and at the same time you export it

#

meaning you can use the function in both the main file and the module file

#

but the function is already exported, so the module file doesnt really do anything else anymore

dusky steeple
#

I take it out though it errors and bot don't start

quartz kindle
#

take out the variable

#

and leave only the module exports

dusky steeple
#

logger.log is not a function 🤔

#

so do it like this? module.exports = winston.createLogger({

quartz kindle
#

yes

dusky steeple
#

ok

quartz kindle
#

this is a normal module file

dusky steeple
#

that didnt error

#

but still having problem can't use 7th level

quartz kindle
#

yeah that wasnt really related to the level 7 problem

#

it just bugged me

#

lmfao

dusky steeple
#

no worries glad you noticed it 😄

daring trellis
#

@quartz kindle clarification, How to find out the user ID which is not in the bot?

quartz kindle
#

about the level 7 thing, i dont know. the configuration looks fine. how are you trying to use it?

dusky steeple
#
logger.log('Cmmds', `${message.guild.name}/#${message.channel.name} (${message.channel.id}):${message.author.username} (${message.author.id}) ran command ${message.content}`);```
quartz kindle
#

@daring trellis if you're using version 11 (stable), you can try client.fetchUser(id)

dusky steeple
#

If I change Cmmds to any other one of the levels it works fine

quartz kindle
#

@dusky steeple level - Log only if info.level less than or equal to this level

#

you have js level: 'Dash'

dusky steeple
#

ah

#

ok

#

so set that to the lowest one

quartz kindle
#

set it to the highest

dusky steeple
#

so set it to Error?

quartz kindle
#

no, i mean

#

highest level

#

7

#

lmao

dusky steeple
#

oh duh lol

daring trellis
quartz kindle
#

try with quotes in id

#

"id"

dusky steeple
#

Worked perfect now 😄 ty

quartz kindle
#

@daring trellis also, fetchuser is a promise

#

so either await fetchuser or fetchuser().then()

daring trellis
fiery nebula
dusky steeple
#

add a ; to that closing bracket for con.query. Not sure if that is actually right or not.

quartz kindle
#

nope

#

add a )

#

to both of them

fiery nebula
#

oh yea

#

thx

restive bough
#

damn

#

how can anyone code in notepad

#

the theme burns my eyes

dusky steeple
#

ewwwwwwwwwwwwwwwwww 😐 🔫

#

why not use something like visual studio code?

#

sublime

#

Webstorm is good if you want a paid ide

#

there is a bunch of them 😄

mossy vine
#

for me the theme i use depends on the environment im in
if im sitting in my dark room, i want a matching dark theme that doesnt burn my eyes out
if im sitting in a public, well lit place, give me that white theme yo, dark is unreadable

restive bough
#

i like sublimes theme

dusky steeple
#

I use dark for everything lol

restive bough
#

not too dark not too light

mossy vine
#

monokai? yeah its great

restive bough
#

yup

fiery nebula
#

yoyo its me, i try to programm that every 10levels the needed xp increases by 100xp and i dont really know how i could implement zhis :/

#

i could make a new collumn in db and make a counter to 10 but i think this is kinda weak

#

(and reset it ever to 0 when its 10)

ruby dust
#

I always wanted to know how to increase the xp per level

fiery nebula
#

per level its easy

#

but idk how per 10 or 5 xd

restive bough
#

ez

mossy vine
#

reqxp = default + (currlvl+1) % 10 * 100

#

something like that

#

no idea if thats actually correct

fiery nebula
#

XD

#

lemme try

restive bough
#

if you are using js

#

you should use %

fiery nebula
#

% = modulo?

restive bough
#

do you want to increase xp on every 5 levels?

fiery nebula
#

10

mossy vine
#

% is modulo iirc

restive bough
#

if (level%10 == 0)

#

this should work

mossy vine
#

again i didnt test shit, i just wrote down an idea

restive bough
#

or the shorter version (!level%10)

fiery nebula
#

okok thx

#

both :PP

dusky steeple
#

Note to self. Dont make a crappy logger so you have to redo it. 🤔

fiery nebula
#

too high iq

viral spade
#

Could you please explain why its not allowed to have a multibot (one bot consisting of multiple bots) for multiple voice connection per server? i dont understand. Is it ok when i put the links only inside the bot, not on the discordbots.org page?

restive bough
#

bruh

#

the moderator said no

#

stop asking

viral spade
#

bruh i wasnt asking for permission

dusky steeple
#

why do you need to do 2 bots for 1 thing?

#

kind of stupid if you ask me

#

1 bot can do what you need

viral spade
#

can 1 bot handle 2 voice connections in a single server at the same time?

mossy vine
#

why couldnt it

dusky steeple
#

why would you need it to

mossy vine
#

does rythm need you to add a different bot for every server? hell no it doesnt

amber fractal
#

I dont think people would invite 2 bots that did the same thing anyways

restive bough
#

bcuz he want's multiple people to use the bot

mossy vine
#

oh wait

#

you mean single server

restive bough
#

or something

dusky steeple
#

make it reconize 1 channel when active and if someone else joins another and tries to use bot send a message sayin it's in use in another channel

mossy vine
#

why would you need single server for multiple connections??

viral spade
#

because two people in the same server might want to use or trigger the bot at the same time

amber fractal
#

Most people have 1 music channel... Or none

dusky steeple
#

^^

mossy vine
#

does any bot actually do that? no. then why would you want it yo

viral spade
#

they will in fact when switching channels, as it can announce leaving and joining channels

amber fractal
#

Im just saying I wouldnt invite 2 bots that did the same thing

dusky steeple
#

I forsee the bot constantly crashing and using unneeded resources for something like that

viral spade
#

its working already

#

i have 4 bots playing in harmony

quartz kindle
#

i mean

amber fractal
#

Seems like earrape to me

quartz kindle
#

that bot

#

thats in second place in votes

#

mudae or something

#

they have multi bots

#

you invite mudae, and then you invite mudamaid to get higher usage limits

mossy vine
#

man mudae from dbl xd

viral spade
#

thats like exactly what my bot does when you add multiples

#

handle more people

quartz kindle
viral spade
#

Thank you very much Tim, once again. Actually i accepted that it is forbidden, and was asking why it is that way...
Now i'm confused.

quartz kindle
#

who said it was forbidden?

restive bough
#

an mod

quartz kindle
#

well which one

restive bough
#

eh

viral spade
#

Xignotic

quartz kindle
#

@coral trellis could we have a clarification?

coral trellis
#

So what I assumed he was asking was that he wanted to switch invites between the current bot on the site to allow all of the bots to be added to servers

viral spade
#

well i was asking both. Nr 1 and if yes Nr 2

quartz kindle
#

so it should be fine if there is one main bot on the website, and the other bots can be invited with just a link, without being in the website

#

or perhaps you can have it in the description

viral spade
#

okey nice. This still counts if all bots are "equal", working independently without any other bot, and the serverstats are calculated by unique servers, not simply added up.

#

I am just asking because i think it would be nice to evenly distrbute the workload of the bots

quartz kindle
#

you could do something like this

#

have 1 bot in the website

#

and in the description, list all bots, including the main one, and their current server usage

#

so a person can chose whoch one they want based on which one has less usage for example

viral spade
#

just, the bot in the website will always gain more servers. Nr 2,3,4.. will have decreasingly less

quartz kindle
#

if they read the descrioption that is

viral spade
#

But i think im gonna ask that again when i actually need it 😃

quartz kindle
#
[insert description tlaking about why your bot is split into multiple bots]

bot 1 (total servers) - invite link
bot 2 (total servers) - invite link
bot 3 (total servers) - invite link```
#

you could design it into something similar to chosing an MMORPG server

#

lmao

#

join server "huehuehe" (20k users online)

#

later on you could just make a website for it

viral spade
#

yeah thats exactly how i did it in my awaiting-approval-state bot today. Just was not sure if that okey

#

Thnaks again very much tim

#

And i have another theoretical question.
If you log into the same bot from two different servers, will discord(js) automatically loadbalance all guilds between all shards of both logins/servers?
If yes: with the shards broadcast functions you can communicate between shards. Can you then communicate only server-intern or accross all shards of both servers at once?

inner jewel
#

discord assigns guilds to shards

#

you can't control that

#

and afaik broadcastEval only works on shards under the same master

quartz kindle
#

^yeah, if you want to split shards into multiple machines, pretty sure broadcast eval will not work

#

you would need to create an internal api or something

viral spade
#

i did it with ipc that supports http connections. this way i should have the same as broadcastEval, just cross-bot and cross-server at once.

#

but sad it doesnt work with intern methods

quartz kindle
#

internal methods only work locally, the only way is to exchange commands and replicate the method remotely

raven bronze
#

Hello, I'm getting this error while trying to host on Heroku!

Running npm install node-js on ⬢ waffle-bot-host... up, run.7761 (Free)
npm WARN discord.js@11.1.0 requires a peer of bufferutil@^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.1.0 requires a peer of erlpack@hammerandchisel/erlpack but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.1.0 requires a peer of node-opus@^0.2.5 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.1.0 requires a peer of opusscript@^0.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.1.0 requires a peer of sodium@^2.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.1.0 requires a peer of libsodium-wrappers@^0.5.1 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.1.0 requires a peer of uws@^0.14.1 but none is installed. You must install peer dependencies yourself.
npm WARN waffle-bot@0.0.1 No license field.```

The reposit is here, if you want to see it. https://github.com/Sublands/WaffleBot
#

Please tag me, when responding!

quartz kindle
#

thats not an error

#

its just warnings, they are normal and can be safely ignored

#

@raven bronze

raven bronze
#

@quartz kindle One problem, the bot doesn't run and returns.

Error: Cannot find module 'discord.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/app/bot.js:1:79)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)```
#

Please tag me, when responding!

quartz kindle
#

@raven bronze discord.js is not installed properly

raven bronze
#

@quartz kindle How can I fix this. zoomeyes

quartz kindle
#

run npm i discord.js

raven bronze
#

@quartz kindle

Running npm i discord.js on ⬢ waffle-bot-host... up, run.9547 (Free)
npm WARN deprecated snekfetch@3.6.4: use node-fetch instead
npm WARN discord-rpc@3.0.1 requires a peer of register-scheme@github:devsnek/node-register-scheme but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.4.2 requires a peer of bufferutil@^3.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.4.2 requires a peer of erlpack@discordapp/erlpack but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.4.2 requires a peer of node-opus@^0.2.7 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.4.2 requires a peer of opusscript@^0.0.6 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.4.2 requires a peer of sodium@^2.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.4.2 requires a peer of libsodium-wrappers@^0.7.3 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.4.2 requires a peer of uws@^9.14.0 but none is installed. You must install peer dependencies yourself.

+ discord.js@11.4.2
added 7 packages from 6 contributors in 1.965s```
quartz kindle
#

good

#

now test the bot again

raven bronze
#

@quartz kindle

2019-02-08T14:51:41.830687+00:00 heroku[worker.1]: State changed from crashed to starting
2019-02-08T14:51:44.642007+00:00 heroku[worker.1]: Starting process with command `node bot.js`
2019-02-08T14:51:45.419755+00:00 heroku[worker.1]: State changed from starting to up
2019-02-08T14:51:47.544081+00:00 heroku[worker.1]: State changed from up to crashed
2019-02-08T14:51:47.526569+00:00 heroku[worker.1]: Process exited with status 1
2019-02-08T14:51:47.445961+00:00 app[worker.1]: internal/modules/cjs/loader.js:583
2019-02-08T14:51:47.445980+00:00 app[worker.1]:     throw err;
2019-02-08T14:51:47.445982+00:00 app[worker.1]:     ^
2019-02-08T14:51:47.445983+00:00 app[worker.1]: 
2019-02-08T14:51:47.445985+00:00 app[worker.1]: Error: Cannot find module 'discord.js'
2019-02-08T14:51:47.445987+00:00 app[worker.1]:     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
2019-02-08T14:51:47.445989+00:00 app[worker.1]:     at Function.Module._load (internal/modules/cjs/loader.js:507:25)
2019-02-08T14:51:47.445990+00:00 app[worker.1]:     at Module.require (internal/modules/cjs/loader.js:637:17)
2019-02-08T14:51:47.445992+00:00 app[worker.1]:     at require (internal/modules/cjs/helpers.js:22:18)
2019-02-08T14:51:47.445993+00:00 app[worker.1]:     at Object.<anonymous> (/app/bot.js:1:79)
2019-02-08T14:51:47.445995+00:00 app[worker.1]:     at Module._compile (internal/modules/cjs/loader.js:689:30)
2019-02-08T14:51:47.445996+00:00 app[worker.1]:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
2019-02-08T14:51:47.445998+00:00 app[worker.1]:     at Module.load (internal/modules/cjs/loader.js:599:32)
2019-02-08T14:51:47.446000+00:00 app[worker.1]:     at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
2019-02-08T14:51:47.446001+00:00 app[worker.1]:     at Function.Module._load (internal/modules/cjs/loader.js:530:3)```
quartz kindle
#

can you show the contents of bot.js?

dusky steeple
#

need to call discord.js into the file?

raven bronze
quartz kindle
#

looks fine, i guess its heroku being stupid

#

you can try adding discord.js to your package.json and see if heroku installs it automatically

raven bronze
#

I should prob know this, but do I do that (again)

quartz kindle
#
  "dependencies": {
    "discord-rich-presence": "^0.0.8",
    "easy-rich-presence": "^1.3.2",
    "random": "^2.0.13",
    "discord.js":"^11.4.2"
  }```
#

in your package.json file

raven bronze
quartz kindle
#

lol

#

i mean

#

add the discord.js line

#

to the dependencies

#

not create and entire new depencencies section

raven bronze
#

there was no depencencies section to start with

quartz kindle
raven bronze
#

XD oh my oof

quartz kindle
#

@_@

raven bronze
#

@quartz kindle ❤ Thank you so much, XD

#
2019-02-08T15:00:00.456579+00:00 app[worker.1]: Waffles are good!```
quartz kindle
#

👍

#

waffles are good indeed

raven bronze
#

xP

earnest phoenix
#
ERROR Unhandled rejection: Error: Cannot find module './data/client_secret.json'

I keep getting this error, but the file is there

zinc pawn
#
                    if(!data[0]) {
                        await bot.db.insert({doc}, (err, data) => {
                            if (err) console.error(err)
                        })
                    }
                    if(data) {
                        curxp = data.xp;
                        curlvl = data.lvl
                        console.log(curxp + "\n" + curlvl)
                    }
                })``` every time i send a message it just adds a new line to the db with exactly the same information? (nedb) also when it console logs curxp and curlvl, its just undefined
quartz kindle
#

i answered this before

#

data is an array, right?

#

if there is no data, data[0] is undefined, but data is an empty array, which the if interprets as true (because it exists)

zinc pawn
#

so instead of if data i use if data[0]?

#

but here's an example of it written ```{"doc":{"userid":"312617227490951168","serverid":"539058992136323082","xp":0,"level":1},"_id":"FYwDA7d0rmZH3Qm1"}
{"doc":{"userid":"312617227490951168","serverid":"539058992136323082","xp":0,"level":1},"_id":"fFH7N8IQ8OKIuZm3"}

quartz kindle
#

just do an else

#

if(!data[0]) { ... } else { curexp = ... }

zinc pawn
#

yeah i just tried that

#

its just written to the db again

#

every message just writes the same thing...

quartz kindle
#

show the code again, after you changed it to else

zinc pawn
#
                await bot.db.find({userid: message.author.id, serverid: message.guild.id}, async (err, data) => {
                    if(!data[0]) {
                        await bot.db.insert({doc}, (err, data) => {
                            if (err) console.error(err)
                        })
                    } else {
                        curxp = data.xp;
                        curlvl = data.lvl
                        console.log(curxp + "\n" + curlvl)
                    }
                })```
#

rn xp.db is just this: ```{"doc":{"userid":"312617227490951168","serverid":"539058992136323082","xp":0,"level":1},"_id":"FYwDA7d0rmZH3Qm1"}
{"doc":{"userid":"312617227490951168","serverid":"539058992136323082","xp":0,"level":1},"_id":"fFH7N8IQ8OKIuZm3"}
{"doc":{"userid":"312617227490951168","serverid":"539058992136323082","xp":0,"level":1},"_id":"yGqBlnd6jDR9fw7y"}

quartz kindle
#

put a console.log(data) before the if

#

see what comes up in the console

zinc pawn
#

[]

#

well that explains it...

quartz kindle
#

so the find function is not finding anything

heady zinc
#

well

#

does it not find anything because it's embedded into the doc object

zinc pawn
#

o

quartz kindle
#

yeah, try using db.doc.find

#

or idk, is that mongo?

zinc pawn
#

lets see

heady zinc
#

use

#

doc.userid

#

and doc.serverid

#

that's nedb btw, you can find it on npm tim

quartz kindle
#

ah

#

never used it

heady zinc
#

it's quite similar to mongo

#

actually it really looks like a mongo clone hmm

zinc pawn
#
     { userid: '312617227490951168',
       serverid: '539058992136323082',
       xp: 0,
       level: 1 },
    _id: 'RVZmDPBGrJELe52z' } ]
undefined
undefined``` comes from ```                await bot.db.find({doc}, async (err, data) => {
                    console.log(data)
                    if(!data[0]) {
                        await bot.db.insert({doc}, (err, data) => {
                            if (err) console.error(err)
                        })
                    } else {
                        curxp = data.xp;
                        curlvl = data.lvl
                        console.log(curxp + "\n" + curlvl)
                    }
                })```
quartz kindle
#

so data is an array containing doc

#

so the else block should be curxp = data[0].doc.xp

zinc pawn
#

ok

#

finally![ { doc: { userid: '312617227490951168', serverid: '539058992136323082', xp: 0, level: 1 }, _id: 'RVZmDPBGrJELe52z' } ] 0 1

#

ty ❤

quartz kindle
#

👍

amber fractal
#

Yeah, objects inisde of arrays always get me too.

#

Not that that was your problem mmLol

zinc pawn
#

ah just found smth interesting...

#

as soon as level is 2, this happens... ```{"doc":{"userid":"312617227490951168","serverid":"539058992136323082","xp":0,"level":2},"_id":"RVZmDPBGrJELe52z"}
{"doc":{"userid":"312617227490951168","serverid":"539058992136323082","xp":0,"level":1},"_id":"zZGhivwRfoNesEZA"}

#

it writes another one with level 1

#

btw this is my schemas.js const make_xp_doc = function (options = {}) { return { userid: options.userid, serverid: options.serverid, xp: options.xp || 0, level: options.xp || 1 } } module.exports = { make_xp_doc: make_xp_doc } (its how i get doc)

heady zinc
#

it seems it's just writing another one with level 2 instead of overwritting

zinc pawn
#

no, i changed it to level 2, for testing smth

heady zinc
#

that would be because you use the entire doc to find, instead of only userid and serverid

zinc pawn
#

ah

heady zinc
#

that's my guess at least

ruby talon
#

yeet

#

I made my own encryptor, but I can't decrypt yet xD

zinc pawn
#
                    if(!data[0]) {
                        await bot.db.insert({doc}, (err, data) => {
                            if (err) console.error(err)
                        })
                    } else {
                        curxp = data[0].doc.xp;
                        curlvl = data[0].doc.level;
                        console.log(curxp + "\n" + curlvl)

                        let nextlvl = curlvl*(curlvl+1)/2*300;
                        console.log(nextlvl)
                    }``` if i don't use doc to find it, we're back to the issue of it writing the same thing again and again @heady zinc
heady zinc
#

as i said

ruby talon
#

feeding

heady zinc
#

you'll need to do js await bot.db.find({ "doc.userid": message.author.id, "doc.serverid": message.guild.id }, async (err, data => { //your stuff });

zinc pawn
#

oh

heady zinc
zinc pawn
#

that works om ty

ruby talon
#

xD

#

Something wrong with decrypting

zinc pawn
#

might help if you showed the code 😉

ruby talon
#

I'm wroking on it.
Its python btw. idk what ur using.

jaunty stump
#

Anyone have any Ideas on how to have your bot stop crashing from missing permissions?
I can't seem to stop it from happening.

zinc pawn
#

try catch blocks

ruby talon
#

@jaunty stump depends on what language your using m8.

jaunty stump
#

.js

restive bough
#

Aka javascript

jaunty stump
#

yea

heady zinc
#

The fix is an easy one, first check if your bot has permissions to do the action you want to do :)

jaunty stump
#

That is the problem x3
people invite the bot, mess with the perms, the bot will ditect that it needs to do something but it can't because of missing perms and it crashes

zinc pawn
#
                    if(!data[0]) {
                        await bot.db.insert({doc}, (err, data) => {
                            if (err) console.error(err)
                        })
                    } else {
                        let xpadd = Math.floor(Math.random() * 15) + 11
                        curxp = data[0].doc.xp;
                        curlvl = data[0].doc.level;
                        let nextlvl = curlvl*(curlvl+1)/2*300;
                        let newxp = curxp + xpadd

                        await bot.db.update({ "doc.userid": message.author.id, "doc.serverid": message.guild.id}, { $set: { "doc.xp": newxp}}, {}, function(){})

                        console.log(curxp + "\n" + curlvl)
                        console.log(nextlvl)
                        
                    }
                })```

>

```{"doc":{"userid":"312617227490951168","serverid":"539058992136323082","xp":0,"level":1},"_id":"94jjqPipk5cv96jY"}
{"doc":{"userid":"312617227490951168","serverid":"539058992136323082","xp":17,"level":1},"_id":"94jjqPipk5cv96jY"}
{"doc":{"userid":"312617227490951168","serverid":"539058992136323082","xp":41,"level":1},"_id":"94jjqPipk5cv96jY"}
{"doc":{"userid":"312617227490951168","serverid":"539058992136323082","xp":63,"level":1},"_id":"94jjqPipk5cv96jY"}
{"doc":{"userid":"312617227490951168","serverid":"539058992136323082","xp":79,"level":1},"_id":"94jjqPipk5cv96jY"}
#

my update is doing something wrong...

jaunty stump
#

that basically helps with checking to see if a person in the server has the right perms in order to use my bot.

heady zinc
#

no

#

that checks the permissions of any member

#

including your bot

zinc pawn
#

Paradox y'know what's wrong for me?

heady zinc
#

it is as simple as js if (!message.me.hasPermission(['banMembers']) { dont(); }

#

actually don't quote me on that, me isn't a thing anymore on v12 hmm

#

@zinc pawn not really sure, does it insert a new one instead of updating?

ruby talon
zinc pawn
#

yes

ruby talon
#

^^

zinc pawn
#

but with the new value.. @heady zinc

heady zinc
#

that really shouldn't happen at all, so i don't know sorry

zinc pawn
#

are you sure this is right? ```await bot.db.update({ "doc.userid": message.author.id, "doc.serverid": message.guild.id}, { $set: { "doc.xp": newxp}}, {}, function(){})

jaunty stump
#

Still crashing, It is an anti-spam/anti-raid bot, Like I said, I assume people are messing with the bots perms so it can't do its thing and it just gives me this.

heady zinc
#

it should be, it should update the matched document and it shouldn't ever insert if no document has been found unless the upsert option is true

#

djs v12 errors aren't really helpful are they

#

im guessing somewhere in your bot you don't check perms but if it doesn't tell you where...

jaunty stump
#

It doesn't tell me where... it just crashes and gives me that. So I don't know where to put/add the permissions check

last lava
#

Best way to set up a db?

zinc pawn
#
                    if(!data[0]) {
                        await bot.db.insert({doc}, (err, data) => {
                            if (err) console.error(err)
                        })
                    } else {
                        let xpadd = Math.floor(Math.random() * 15) + 11
                        curxp = data[0].doc.xp;
                        curlvl = data[0].doc.level;
                        let nextlvl = curlvl*(curlvl+1)/2*300;
                        let newxp = curxp + xpadd

                        await bot.db.update({ "doc.userid": message.author.id, "doc.serverid": message.guild.id}, { $set: { "doc.xp": newxp}}, { upsert: false }, function(){})

                        console.log(curxp + "\n" + curlvl)
                        console.log(nextlvl)
                        
                    }
                })``` even with upsert: false it still writes a new one... wtf...
zinc pawn
#

@heady zinc just found out smth weird, when it restarts the previous lines disappear leaving only the most recent line?

heady zinc
#

what

zinc pawn
#

so when i send the message this happens: ```{"doc":{"userid":"312617227490951168","serverid":"539058992136323082","xp":122,"level":1},"_id":"94jjqPipk5cv96jY"}
{"doc":{"userid":"312617227490951168","serverid":"539058992136323082","xp":141,"level":1},"_id":"94jjqPipk5cv96jY"}

#

but when i reboot it it gets rid of the old doc, leaving only the most recent

heady zinc
#

wait

#

is that the stuff logged into console?

zinc pawn
#

no, that's in the database

heady zinc
#

ok, what if you try to update by id

zinc pawn
#

I am? await bot.db.update({ "doc.userid": message.author.id, "doc.serverid": message.guild.id}, { $set: { "doc.xp": newxp}}, { upsert: false }, function(){})

#

ohhhhhhhhh

#

ic

heady zinc
#

:)

zinc pawn
#

so its not writing a new line, but its not actually updating either..

heady zinc
#

did you do doc._id or _id

zinc pawn
#

oh that id, i thought you meant like this for some reason heh await bot.db.update({ userid: message.author.id, serverid: message.guild.id}, { $set: {xp: newxp}}, { upsert: false }, function(){})

#

i'll try doc._id 1 sec

heady zinc
#

"doc._id": data[0]._id

zinc pawn
#

ah

#

so i have this now: ``` await bot.db.find({ "doc.userid": message.author.id, "doc.serverid": message.guild.id}, async (err, data) => {
if(!data[0]) {
await bot.db.insert({doc}, (err, data) => {
if (err) console.error(err)
})
} else {
let xpadd = Math.floor(Math.random() * 15) + 11
curxp = data[0].doc.xp;
curlvl = data[0].doc.level;
let nextlvl = curlvl*(curlvl+1)/2*300;
let newxp = curxp + xpadd

                    await bot.db.update({"doc._id": data[0].id}, { $set: { "doc.xp": newxp}}, { upsert: false }, function(){})

                    console.log(curxp + "\n" + curlvl)
                    console.log(nextlvl)
                }
            })``` but it still isn't updating
#

stored like this btw: {"doc":{"userid":"312617227490951168","serverid":"539058992136323082","xp":141,"level":1},"_id":"94jjqPipk5cv96jY"}

heady zinc
#

oh

#

that was my bad, i meant "_id" and not "doc._id"

zinc pawn
#

ok

heady zinc
#

and it's data[0]._id not data[0].id

zinc pawn
#

oh my bad lol

#

its back to doing this... {"doc":{"userid":"312617227490951168","serverid":"539058992136323082","xp":141,"level":1},"_id":"94jjqPipk5cv96jY"} {"doc":{"userid":"312617227490951168","serverid":"539058992136323082","xp":156,"level":1},"_id":"94jjqPipk5cv96jY"}

#

wait what now they have the same id?

heady zinc
#

ok but does bot.db.find({ "doc.userid": message.author.id, "doc.serverid": message.guild.id} returns both of them

zinc pawn
#

\/

#
  db:
   Datastore {
     inMemoryOnly: false,
     autoload: true,
     timestampData: false,
     filename: './xp.db',
     compareStrings: undefined,
     persistence:
      Persistence {
        db: [Circular],
        inMemoryOnly: false,
        filename: './xp.db',
        corruptAlertThreshold: 0.1,
        afterSerialization: [Function],
        beforeDeserialization: [Function] },
     executor: Executor { buffer: [], ready: true, queue: [Object] },
     indexes: { _id: [Index] },
     ttlIndexes: {} },
  query:
   { 'doc.userid': '312617227490951168',
     'doc.serverid': '539058992136323082' },
  execFn: [Function],
  _projection: {} }```
#

@heady zinc?

heady zinc
#

i meant the entire thing

#

if you log data there, does it show both

zinc pawn
#

oh 1 sec

#

no just this: [ { doc: { userid: '312617227490951168', serverid: '539058992136323082', xp: 181, level: 1 }, _id: '94jjqPipk5cv96jY' } ] 181 1 300

#

does that mean its a visual glitch?

heady zinc
#

idk, what matters is that it doesn't seem to actually duplicate

#

so your bot should run smoothly

zinc pawn
#

that's a relief then, thanks.

earnest phoenix
#

why wont this work

#

for multiple ids

#

<%if(user.id === config.owners_id.includes(user.id)) {%>

slender thistle
#

config.owners_id.includes(user.id) will return a boolean

#

Whereas user.id will not

earnest phoenix
#

so how could i resolve

slender thistle
#

Don't compare anything?

earnest phoenix
#

<%if(user.id === config.owners_id.includes(owners_.id)) {%>

#

so just

#

<%if(user.id === config.owners_id) {%>

slender thistle
#

Now you are comparing an integer to what I assume is an array

earnest phoenix
#

yeA>?

slender thistle
#

And that won't work

earnest phoenix
#

so

#

[0]

slender thistle
#

To be correct, it will be false. And no

#

You don't need to compare anything

#

You want to check if user.id is in config.owners_id array, right?

mossy vine
#

@slender thistle <% is ejs afaik

earnest phoenix
#

"owners_id": [
"friend id",
"my id"
]

slender thistle
#

Is ejs different from js? Thonkang

mossy vine
#

very

quartz kindle
#

ejs is just a weird php

mossy vine
#

^

slender thistle
#

Well, I doubt this case is affected by that

quartz kindle
#

but shivaco is right

earnest phoenix
#

hm

mossy vine
#

and yeah you just need if(config.owners_id.includes(user.id))

slender thistle
#

You don't need comparisons, my fam

#

yeet that spoonfeed

quartz kindle
#

@earnest phoenix config.owners_id.includes(user.id) this returns a boolean. a boolean means the value is either true or false. doing what you're doing is the same as doing if(user.id === true)

earnest phoenix
#

hm

#

swo how could i like return 2 ids?

quartz kindle
#

you dont, includes checks it for you

#

you dont need to compare anything

#

when you do config.owners_id.includes(user.id), the includes function does the compare internally

#

and returns true if one of the compares worked, or false if none of them worked

#

so you just need to feed it directly to the if

hybrid raptor
#

o

#

<%if(config.owners_id.includes(user.id)) {%> @earnest phoenix

#

try that

#

😉

earnest phoenix
#

ok

quartz kindle
#

he was supposed to figure it out lol, but yeah, thats all you had to do

earnest phoenix
#

@hybrid raptor ty

#

i added you to owner

hybrid raptor
#

?

earnest phoenix
#

for my website

hybrid raptor
#

.. k lol

rocky dagger
#

Why does this make a Syntaxerror? css let warns = JSON.parse(fs.readFileSync("./warnings.json", "utf8"));

earnest phoenix
#
let warns = JSON.parse(fs.readFileSync("./warnings.json"), ("utf8"));
#

maybe like that idk

amber fractal
#

I dont need to do that

#

It may be an error in the json

earnest phoenix
#

@rocky dagger

#
let warns = JSON.parse(fs.readFileSync("./warnings.json"), ("utf8"));
rocky dagger
#

the file is empty

quartz kindle
#

wut

#

why ("utf8") ?

inner jewel
#

the syntax error is in the json

#

not the js

quartz kindle
#

and its "utf-8" not utf8

amber fractal
#

It can be utf8

inner jewel
#

let warns = JSON.parse(fs.readFileSync("./warnings.json", "utf8")); is valid js

amber fractal
#

I use it as "utf8"

#

Both work

quartz kindle
#

alright

#

but in some places its not as forgiving xD

amber fractal
#

They use utf8 in the fs docs

rocky dagger
#

this is the json file: ```css

#

got it

amber fractal
#

It needs atleast a {} to be valid iirc

rocky dagger
#

yea I got that now

amber fractal
#

Working then?

rocky dagger
#

yes

#

lol

amber fractal
#

:+1:

dusky steeple
#

what is a good like phpmyadmin for linux desktop use?

restive bough
#

don't use json for writing

#

or as database

dusky steeple
#

I want something so I don't have to install phpmyadmin on my vps and use on my desktop to see and create databases.

night imp
#

There are many tools that you can download for that on PC and on mobile.

dusky steeple
#

im on linux

night imp
#

It is important to learn how to do it programmatically though

harsh nova
#

You can get a mongoDB database

#

They have a nifty tool called compass

night imp
#

https://goo.gl/M6bJty
software recommendation - MySQL GUI Tools - Ask Ubuntu

#

@harsh nova no need for them to change their entire db

harsh nova
#

They used json?

dusky steeple
#

no I am using mysql

#

no json stuff

harsh nova
#

Oh my bad

dusky steeple
#

😄

night imp
#

Check the link out I sent

harsh nova
#

I’m confused

dusky steeple
#

just looking for a good desktop gui

#

I am checking it out now ty

night imp
#

Np 😃

rocky dagger
#

why dosen't the bot remove the "muted" role after 10 seconds? can som1 help me?```css
if(warns[wUser.id].warns == 2){
let muterole = message.guild.roles.find(name, "muted");
if(!muterole) return message.reply("You should create a muted role. quick tip: do -tempmute @ranom guy 1s");

let mutetime = "10s";
await(wUser.addRole(muterole.id));
message.channel.send(`<@${wUser.id}> has been temporarily muted`);

setTimeout(function(){
  wUser.removeRole(muterole.id)
  message.reply(`<@${wUser.id}> has been unmuted.`)
}, ms(mutetime))

}```

dusky steeple
#

you have the mutetime set to 10s?

rocky dagger
#
let mutetime = "10s";```
dusky steeple
#

I don't know if I am right or not as I am new. But by the looks of it you have it set to unmute after 10s

quartz kindle
#

thats not how you use await

#

unless you have a function called await

#

but if you're trying to use async/await thats not how

#

async/await is await wUser.addRole(muterole.id);

rocky dagger
#

it adds the role but doesn't remove it

inner jewel
#

@quartz kindle await(promise()) is valid

quartz kindle
#

is it?

inner jewel
#

yes

#

it's the same as await promise()

quartz kindle
#

didnt know that lol

inner jewel
#

just like typeof

#

typeof x == typeof(x)

quartz kindle
#

typeof as well? also didnt know lmao

inner jewel
#

the () just resolve to the inner expression

#

typeof(x) is similar to console.log((x))

quartz kindle
#

are you gonna tell me let(x = 10) is also valid?

inner jewel
#

the additional () don't do anything

#

no

quartz kindle
#

lmao

inner jewel
#

you can wrap expressions in ()

#

not random stuff

#

typeof/await apply to the expression directly after them

quartz kindle
#

alright, thanks master

#

as for his problem, any ideas?

inner jewel
#

¯_(ツ)_/¯

#

needs more info

rocky dagger
earnest phoenix
#

Can anyone help with my glitch project @quartz kindle can you fix it again lmao

viral surge
#

Anyone know how to add a bot that you see on another server to your own server?

#

Which in my case

rocky dagger
#

@ tim is offline

dusky steeple
#

google the name of the bot

viral surge
#

No results

rocky dagger
#

write o.help

viral surge
#

o.help doesn't present link

dusky steeple
#

bot might be private then

viral surge
#

Its not private

rocky dagger
#

why dosen't the bot remove the "muted" role after 10 seconds? can som1 help me?```css
if(warns[wUser.id].warns == 2){
let muterole = message.guild.roles.find(name, "muted");
if(!muterole) return message.reply("You should create a muted role. quick tip: do -tempmute @ranom guy 1s");

let mutetime = "10s";
await(wUser.addRole(muterole.id));
message.channel.send(`<@${wUser.id}> has been temporarily muted`);

setTimeout(function(){
  wUser.removeRole(muterole.id)
  message.reply(`<@${wUser.id}> has been unmuted.`)
}, ms(mutetime))

}```

lusty dew
#

In a help embed, how could I make certain commands show to people who have certain permissions?
Like this:

#

@rocky dagger One I wouldn't put the mutetime in ""

earnest phoenix
#

Can anyone help with my glitch project

lusty dew
#

it looks at it as a string and not an int

earnest phoenix
#

So my bot you know the description can someone fix that as i broke mine?

#

it just don't show up

restive bough
#

oof

#

glitch

lusty dew
#

@earnest phoenix No one is going to do it for you but show code and we can try and help

earnest phoenix
#

I mean yes i dont want help i just need the code and need help with what i did wrong

#

lemme get a pic

lusty dew
#

I just said no one is going to do it for you

earnest phoenix
#

i said im gonna show code

lusty dew
#

Whatever

earnest phoenix
#

lmfao

#

@lusty dew ^

lusty dew
grim aspen
#

what program is that?

earnest phoenix
#

okay

lusty dew
#

Not gonna read through a screenshot

grim aspen
#

i mean the application not nodejs

lusty dew
#

That is glitch @grim aspen

earnest phoenix
grim aspen
#

oh

lusty dew
#

Mk what is the problem Arda?

grim aspen
#

they're having connection issues

earnest phoenix
#

I can't get it to say Watching for -help

#

then guilds ect

lusty dew
#

It says playing doesn't it

restive bough
#

oof you should really clean your code 😮

lusty dew
#

instead of Watching

#

Also the Presence if I remember correctly is like idle, dnd, online etc

#

You want setActivity

earnest phoenix
#

my brain hurts

#

um

#

so what do i add

restive bough
#

bruh

#

you can't add custom urls

lusty dew
#

You can, but not the way he is doing

restive bough
#

fr

#

is it possible?

lusty dew
#

Well

#

Not in that since

#

sense*

grim aspen
#

when you realize you deleted your bot

#

shit

restive bough
#

i've never seen an bot with an custom url

lusty dew
#

You'd want to put it in the message

#

I meant like

#

they would need to put it in their message

restive bough
#

?

#

yeah i get that 🙄

#

but i mean in the presence

lusty dew
#

Oh idk

restive bough
#

you can only put twitch urls

#

with type set to twitch

#

or something

rocky dagger
#

why dosen't the bot remove the "muted" role after 10 seconds? can som1 help me?```css
if(warns[wUser.id].warns == 2){
let muterole = message.guild.roles.find(name, "muted");
if(!muterole) return message.reply("You should create a muted role. quick tip: do -tempmute @ranom guy 1s");

let mutetime = "10s";
await(wUser.addRole(muterole.id));
message.channel.send(`<@${wUser.id}> has been temporarily muted`);

setTimeout(function(){
  wUser.removeRole(muterole.id)
  message.reply(`<@${wUser.id}> has been unmuted.`)
}, ms(mutetime))

}this doesn't even go offcss
message.channel.send(<@${wUser.id}> has been temporarily muted);```

lusty dew
#

Hmm didn't even know you could use setPresence for that

#

I forgot what setPresence did

restive bough
#

setpresence sets the presence

#

🤓

lusty dew
#

@rocky dagger I already told you it should be let mutetime = 10

keen drift
#

what is ms()

lusty dew
#

the bot will look at it as a string instead of an int

grim aspen
#

how do i run a code on glitch again?

restive bough
#

not

lusty dew
#

Lol

grim aspen
#

ah

lusty dew
#

Glitch abuses Discord API i think

keen drift
#

huh

lusty dew
#

That is what I was told

earnest phoenix
#

oh i forgot

restive bough
#

who tf uses an second to ms converter

lusty dew
#

since there is a cap of ho many times a bot can login

keen drift
#

Glitch doesn't abuse any API, it's just not designed for bot host

rocky dagger
#

@lusty dew I tryed that

keen drift
#

but it works

restive bough
#

for an timeout

#

😕

lusty dew
#

@keen drift Glitch auto saves everytime it atutosaves it logs into the bot and discord has a bot login cap of 1000 times or smth

#

autosaves*

keen drift
#

That's more of your personal problem rather's than glitch's

lusty dew
#

It happened to me lol

keen drift
#

Glitch even offers their own virtualized env

restive bough
#

10 seconds = 1E4

lusty dew
#

How is that a personal problem?

restive bough
#

just use that

lusty dew
#

Whateveer not gonna argue

restive bough
#

not ms("10s")

#

lmfao

keen drift
#

Editing bot in production sounds like a personal problem

lusty dew
#

Whatever Fishy

#

If you ain't gonna offer help then don't talk here

earnest phoenix
keen drift
#

I have offered help

#

Not sure what you are trying to bring up

#

There's plenty of throttling options for glitch

earnest phoenix
#

nah glitch is leaggly gae

rocky dagger
#

let mutetime = 10; doesn't work

#

it's the same

keen drift
#

Can you show an updated code

restive bough
#

use 1E4 as timeout

#

for 10 seconds

earnest phoenix
rocky dagger
#
if(warns[wUser.id].warns == 2){
    let muterole = message.guild.roles.find(`name`, "muted");
    if(!muterole) return message.reply("You should create a muted role. quick tip: do -tempmute @ranom guy 1s");

    let mutetime = 10;
    await wUser.addRole(muterole.id);
    message.channel.send(`<@${wUser.id}> has been temporarily muted`);

    setTimeout(function(){
      wUser.removeRole(muterole.id)
      message.reply(`<@${wUser.id}> has been unmuted.`)
    }, ms(mutetime))
  }```
lusty dew
#

Stop reposting

restive bough
lusty dew
#

@earnest phoenix

keen drift
#

@rocky dagger wtf is ms()

lusty dew
#

isn't ms an npm package

keen drift
#

can you show declaration

lusty dew
#

or am I wrong?

amber fractal
lusty dew
#

This boi

restive bough
#

@earnest phoenix bruh

amber fractal
#

Reposting isnt gonna get you help faster

keen drift
#

@inner jewel Hey, control tis repost

restive bough
earnest phoenix
#

Run

lusty dew
#

This guy is getting on my nerves

earnest phoenix
#

Runnnnnn

lusty dew
#

I'm not gonna help him forget it

restive bough
#

ikr

earnest phoenix
#

HELP ME THEN 😄

#

😄 👋

restive bough
#

stfu

earnest phoenix
#

Lmfao

lusty dew
#

I'd honestly stop resposting before yasmin comes

earnest phoenix
#

yeh i agree

lusty dew
#

Just advising you

earnest phoenix
#

@inner jewel

#

ill make it quicker

restive bough
#

🙄