#development

1 messages · Page 632 of 1

abstract crow
#

Look up some PHP Discords. Maybe they may know more

pliant siren
#

No, i already gived question

abstract crow
#

Well I really can't help. I don't know PHP

amber fractal
#

Bedrock edition is faster than java edition, is multi-threaded, uses c++ but sadly not as wide mods like java edition

pliant siren
#

@abstract crow I can help you with Lazarus, DevelNext or PHP DevelStudio

#

Sorry, i bit know C++ and C#

#

Anyone?

#

Who can help me?

earnest phoenix
#

how can I fix music on / off from any except the audio channel with the bot?

#

my english bad

earnest phoenix
#

open in browser if its hard to read the text

steel heath
#

it's still hard on browser

grim aspen
#

i can see it perfectly

#

click on the link not the attachment

steel heath
grim aspen
#

well fuck

#

you're on chrome not safari

opaque eagle
earnest phoenix
#

my server got locked down what do i do ?

#

Locked?

#

in the website?

#

@earnest phoenix

#

@earnest phoenix yes

#

what do i do

earnest phoenix
#

Who can me tell what wrong is?

const fs = require("fs")

module.exports.run = async (client, msg, args) => {

    let lol = msg.author

    const users = JSON.parse(fs.readFileSync('./data/desc11114569.json', 'utf8'))

 const profiledesc = users;
 profiledesc[users.id] = {
    desc: lol.desc 
    // users.desc
 }

 let profileemb = new Discord.RichEmbed()
 .setColor(client.color)
 .setDescription(`**Benutzer**\n» ${lol.tag} \n\n**Beschreibung** \n» ${profiledesc}`)

 msg.channel.send(profileemb)

}

module.exports.help = {
name: "profile"

}```
#

Its in discord.js

eternal mesa
#

woudl be helpful to maybe have an error?

opaque eagle
#

What error do you get? @earnest phoenix

earnest phoenix
#

What

#

No error

opaque eagle
#

In the console... what's the error

#

R u sure?

eternal mesa
#

so are we supposed to magically know whats wrong?

earnest phoenix
#

Eingeloggt als C.Q. Cumber!

Eingeloggt als C.Q. Cumber!

Eingeloggt als C.Q. Cumber!

  q?profile []  von Maurice-Pascal - Dauerte 510 ms```
#

No Error

#

Look

opaque eagle
#

Also, you shouldn't be using JSON as a database.

earnest phoenix
#

?

opaque eagle
#

Store those descriptions in an actual database, not in a JSON file.

earnest phoenix
#

And where can I get a database?

opaque eagle
#

You can try out SQLite + Keyv for beginners.

earnest phoenix
#

Ok

#

Does this cost money?

dusky marsh
#

Nope

earnest phoenix
#

Ok

dusky marsh
#

Tis free of charge

#

Just like most databases

earnest phoenix
#

Ok

#

What is the best free database?

dusky marsh
#

Depends

earnest phoenix
#

OK

dusky marsh
#

Nosql or sql

earnest phoenix
#

Ok

dusky marsh
#

Are your two barebones

earnest phoenix
#

?

dusky marsh
#

Nosql is dbs like mongo and sql is mysql sqlite etc

earnest phoenix
#

Ok

opaque eagle
#

I'd recommend you check out SQLite for now.

dusky marsh
#

^ since that is serverless

opaque eagle
#

Do you work on Windows, MacOS, or Linux? @earnest phoenix

earnest phoenix
#

Windows 10

#

Host on a Rasperry

#

@opaque eagle

opaque eagle
#

Once you get SQLite installed, you can use a module called Keyv to easily add/remove data... it's the best choice for beginners. There's a neat Keyv tutorial here: https://discordjs.guide/keyv

earnest phoenix
#

Ok

#

Thanks

#

Do I have to pack keyv into my command as well?

opaque eagle
#

into your command?

#

You might want to put it in your command handler, yes.

earnest phoenix
#

?

#

The Code:

const fs = require("fs")
const Keyv = require('keyv')

module.exports.run = async (client, msg, args) => {

    // One of the following
const keyv = new Keyv(); // for in-memory storage

    keyv.on('error', err => console.error('Keyv connection error:', err));

    let lol = msg.author

    const users = JSON.parse(fs.readFileSync('./data/desc11114569.json', 'utf8'))

 const profiledesc = users;
 profiledesc[users.id] = {
    desc: lol.desc 
    // users.desc
 }

 let profileemb = new Discord.RichEmbed()
 .setColor(client.color)
 .setDescription(`**Benutzer**\n» ${lol.tag} \n\n**Beschreibung** \n» ${profiledesc}`)

 msg.channel.send(profileemb)

}

module.exports.help = {
name: "profile"

}```
opaque eagle
#

I'm not sure if you understand what me or the guide said...

#

I feel like you just copy-pasted some code from the guide onto ur project and expected everything to work out.

earnest phoenix
#

npm install --save keyvI wrote that in the input request

opaque eagle
#

Did you also install SQLite?

#

Did you read the entire guide?

earnest phoenix
#

Lol

#

Wait

#

Oh, im so stupdi

#

*stupid

#
const keyv = new Keyv('sqlite://path/to/database.sqlite');
      ^

SyntaxError: Identifier 'keyv' has already been declared
    at new Script (vm.js:80:7)
    at createScript (vm.js:274:10)
    at Object.runInThisContext (vm.js:326:10)
    at Module._compile (internal/modules/cjs/loader.js:664:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
    at startup (internal/bootstrap/node.js:283:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! SSB@1.0.0 start: `node main.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the SSB@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\jenst\AppData\Roaming\npm-cache\_logs\2019-06-10T20_44_33_043Z-debug.log```
This is the error @opaque eagle
opaque eagle
#

The error means what it says.

amber fractal
#

Basic js error

#

nothing to do with sqlite

earnest phoenix
#

Ok

#

And how do I do that now in the database?

#
Keyv connection error: { [Error: SQLITE_CANTOPEN: unable to open database file] errno: 14, code: 'SQLITE_CANTOPEN' }``` LUL
#

Now I do not understand anything anymore

opaque eagle
#

Did you install SQLite and initialize a DB?

earnest phoenix
#
npm WARN discord.js@11.3.2 requires a peer of bufferutil@^3.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.3.2 requires a peer of erlpack@discordapp/erlpack but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.3.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.3.2 requires a peer of opusscript@^0.0.6 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.3.2 requires a peer of sodium@^2.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.3.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.3.2 requires a peer of uws@^9.14.0 but none is installed. You must install peer dependencies yourself.
npm WARN SSB@1.0.0 No description
npm WARN SSB@1.0.0 No repository field.

+ keyv@3.1.0
added 2 packages from 2 contributors and audited 12 packages in 1.631s
found 0 vulnerabilities
#

> sqlite3@4.0.2 install C:\Users\jenst\Desktop\Minepark\Alle Discord Bots\SSB\SSB\node_modules\sqlite3
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
[sqlite3] Success: "C:\Users\jenst\Desktop\Minepark\Alle Discord Bots\SSB\SSB\node_modules\sqlite3\lib\binding\node-v64-win32-x64\node_sqlite3.node" is installed via remote
npm WARN discord.js@11.3.2 requires a peer of bufferutil@^3.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.3.2 requires a peer of erlpack@discordapp/erlpack but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.3.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.3.2 requires a peer of opusscript@^0.0.6 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.3.2 requires a peer of sodium@^2.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.3.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.3.2 requires a peer of uws@^9.14.0 but none is installed. You must install peer dependencies yourself.
npm WARN SSB@1.0.0 No description
npm WARN SSB@1.0.0 No repository field.

+ @keyv/sqlite@2.0.0
added 119 packages from 107 contributors and audited 178 packages in 28.897s
found 3 vulnerabilities (1 low, 2 moderate)
  run `npm audit fix` to fix them, or `npm audit` for details```
#

?

#

@opaque eagle

opaque eagle
#

Yeah, that went fine.

#

But did you install SQLite?

#

Installing SQLite is not in the guide, and you have to do it yourself.

earnest phoenix
#

How does it work?

#

Can you tell me how?

#

@opaque eagle ?

opaque eagle
earnest phoenix
#

ok

quasi forge
#

I don't really recommend sqlite, I personally don't see any advantages of using it.

#

Mostly because it's SQL

flat pelican
#

I’m currently using MongoDB

#

But want to moove on Redis

quasi forge
#

Hmmmm

#

Well I just don't like the databases that act as db on your fs

cursive dagger
#

They are better for beginners

quasi forge
#

Ye but not really productive

late hill
#

^Disagree, there's some very easy to use packages when using other databases such as mongo

cursive dagger
#

You have to install a server

late hill
#

I got dropped into mongo for my internship with no knowledge at all

#

And I had no issues

quasi forge
#

Mongo is somewhat too ez

cursive dagger
#

Let's talk in general so I don't get banned

earnest phoenix
#

Thank you @opaque eagle, But I'm too stupid for that. I'll just let it be

plucky sun
#

Hi, it's possible to have the ID of a salon with his name? (with discord.js)

opaque eagle
#

ID of a salon?

#

@quasi forge SQLite is definitely a step-up from JSON. Switching from JSON straight to a proper database like Postgres would be a struggle for a beginner.

quasi forge
#

@opaque eagle I would recommend nedb instead for that

#

If you have to use fs at least don't do SQL

opaque eagle
#

Eh it's NoSQL

#

so a no-no

plucky sun
#

Yes id of a channel

opaque eagle
#

Channel.id

heady zinc
#

@flat pelican why would you want to move to redis

#

redis is not a database hmm

flat pelican
#

I know

#

Well uh

west spoke
#

Anything can be used as a database

flat pelican
#

Redis is faster than Mongo and is more helpful for a future dashboard for me

plucky sun
#

No, search for a channel by this name to have his id. @opaque eagle

opaque eagle
#

Guild.channels.find()

#

and then pass in a function that takes in a channel and returns true when the name is right

earnest phoenix
#

@opaque eagle Do I have to have a database for that?

opaque eagle
#

for what?

earnest phoenix
#

Json

opaque eagle
#

🤦

earnest phoenix
#

Im to stupdit

opaque eagle
#

Yeah, we know...

#

By any chance do you know what JSON even is?

earnest phoenix
#

Yes

heady zinc
#

@flat pelican you realize that Redis is fully synchronous though

#

not going to tell you you're making a grave mistake, just making sure you're fully aware of what you're doing

flat pelican
#

Yeah i'm aware

#

I did some tests with both, Mongo and Redis, Redis is a big mess regarding the management of data but seems to be better tham Mongo regarding performances

heady zinc
#

Redis is mainly meant as a cache server

#

it's extremely fast due to good optimization and the fact that it puts everything in memory

fading wigeon
#

sql is pretty fast

heady zinc
#

mongo does keep some data in the cache but will read from disk data that is not often requested

#

to save up on memory

#

redis lacks useful methods that databases usually have, like filtering it or having secondary indexes

flat pelican
#

Do you use Mongo?

heady zinc
#

i do

flat pelican
#

With a bot or for other purposes?

heady zinc
#

redis is probably not gonna disappoint you in terms of performance even at a relatively large scale (800k servers+)

#

but MongoDB is a solid choice for a database and while it might be sometimes slower, it eventually uses less memory

#

with a bot, though i'd use mongo for most projects

flat pelican
#

I'm using Mongo but i'm unable to make my bot to read info from database "in real time" when it needs, I must store all data in bot's memory and flush everything on Mongo every x time

heady zinc
#

why

#

wdym by "realtime"

flat pelican
#

idk i'm a noob I guess

#

like keeping "nothing" on a dict and asking the database when it needs an info

#

that's the only way I found for something "fast"

heady zinc
#

thatt's uh the regular usage ?

#

when you need info you just do Database.find({ id: "id" })

flat pelican
#

Yeah, I'm bad on Mongo, must look further on it

heady zinc
#

ah

slender thistle
#

Are you using pymongo or motor

#

Either way, both have find_one and find methods I believe

flat pelican
#

Pymongo yes

#

I load everything locally

    def load_local(self):
        # Load the database to dict
        print("Loading Mongo database to memory...")
        
        # For some sharding
        server_ids = [str(guild.id) for guild in self.bot.guilds]
        
        for collection_name in self.db.collection-names():
            if collection_name == "Global-Settings":
                global_collection = self.db.get_collection("Global-Settings").find_one()
                    
                if global_collection:
                    for key, value in global_collection.items():
                        self.serverDict[key] = value
                continue```
slender thistle
#

Do you have one document with many items or several documents?

flat pelican
#

I have one collection per server, where you can find one document, where all settings are stored

heady zinc
#

so

#

you're actually supposed to only have a few collections

#

and multiple documents in each

flat pelican
#

""few"" collections

heady zinc
#

as in: one

slender thistle
#

Yeah, better to save documents with guild_id key

heady zinc
#

or multiple if you need to store other data than guild settings

flat pelican
#

It allows me to restore/handle more easily data for X guild when it's needed

slender thistle
#

collection-names()?

flat pelican
#

collection_names

#

names of collections (server IDs here)

#

I have a collection for global settings

#

such as owner info, game status, etc

slender thistle
#

I was just confused why there was a dash :p

#

And what is self.serverDict

flat pelican
#

where all settings are saved locally while every reboots, it's a local dict

slender thistle
#

To me that looks like you use that dict for only one guild

frigid thistle
#

but yeah I spent 60 bucks on an Anker brick today

#

so I blew my paycheck for the last 2 days ;p

hushed quarry
#

yikes

frigid thistle
#

I'm also addicted to Takis

#

it costs me alot

fiery stream
#

yo is this lib bad? i have never seen people use it

frigid thistle
#

it sucks

#

i'm working on my own

hushed quarry
#

@fiery stream yes, it's deprecated

fiery stream
#

ohh

#

since when

hushed quarry
fiery stream
#

not that old

hushed quarry
#

last update over a year ago...

amber fractal
#

Discord has had many updates

fiery stream
#

discord.js just got updated from 14.2

#

something idk

frigid thistle
#

yeah

amber fractal
frigid thistle
#

wait no

agile vine
#

Recent discord API update was intense. 2018 code may be bricked

frigid thistle
#

Discord.js is 11.5

#

oh dear

#

yeah

fiery stream
#

it used to be 11.4 for like a year

amber fractal
#

D.js master is 12.0.0-dev

frigid thistle
#

Stable is 11.5

fiery stream
#

im using latest stable

amber fractal
#

It went dead which is why eris was created

frigid thistle
#

yeah but I'm working on my own node lib

#

for discord

amber fractal
#

Then it was picked up again

fiery stream
#

is eris better then .js

frigid thistle
#

discode

#

no

fiery stream
#

ohh whys that

amber fractal
#

Well

frigid thistle
#

discord.js is easily the best node lib out there 😛

amber fractal
#

You'll get fed bias

frigid thistle
#

Eris is awkward 😛

amber fractal
#

It is

frigid thistle
#

Discord.js is awesome

hushed quarry
#

discord.js uses more memory than eris, a lot more

amber fractal
#

But it's also memory efficient

frigid thistle
#

eris is minimalist imo

amber fractal
#

Thats the point

frigid thistle
#

thats why it takes up almost no mem :p

fiery stream
#

what ever i have to go to pool cya

frigid thistle
#

lucky and cya

fiery stream
#

lucky?

#

how

frigid thistle
#

you get to go to the pool... lmao

fiery stream
#

hows that lucky

frigid thistle
#

only thing I get to swim in is a river lol

#

with lots of fish shit xD

#

but anyways

#

go 😛

#

use d.js

fiery stream
#

wait what

#

lol dont u have a pool near

#

im using d.js i just was asking questions for knowledge

frigid thistle
#

yeah I do

#

the river is free

fiery stream
#

lmao srsly

frigid thistle
#

the pool is $3.50 a person 😛

#

which is crazy considering it's a city pool and the city that I live in is pretty well to do

fiery stream
#

beware of sharks

hushed quarry
#

please no off-topic in here

fiery stream
#

sorry

#

we just chatted for like 2m sorry tho

hushed quarry
#

it's fine

frigid thistle
#

nah @fiery stream there aren't freshwater sharks where I live

amber fractal
slender thistle
meager lava
#

How can I keep track of the time for my bot without creating a new Date object whenever I need it?

amber fractal
#

Wym

#

Uptime?

#

Or time stamps in things

meager lava
#

Time stamps

amber fractal
#

Lib?

meager lava
#

discord.js

slender thistle
#

Date object
self-explanatory

amber fractal
#

Theres more than d.js for js

#

But I mean

#

Ok

meager lava
#

What do you mean?

amber fractal
#

Nothing

#

But are you trying to save the timestamp

#

If you are idk any other way

meager lava
#

I'm trying to add a timestamp whenever I log something to the console and a new Date object every time just seemed wasteful

amber fractal
#

Oh when logging

#

Uh idk if theres any other way for that case

meager lava
#

Ok. Thanks

west spoke
#

@meager lava
Store current time when starting bot in some sort of file,
Then get the time from that file, subtract it from current time

#

That's what I do

pallid zinc
#

Why it is so small

#

Oh I got the problem

sinful lotus
#

it cant load the avatar

#

probably

deep creek
#

Anyone knows how to make your own events with dpy?

slender thistle
#

A function on_my_event, put decorators to it.
To emit it, use client.dispatch

earnest phoenix
#
    client.guilds.forEach((guild) => {
        guild.members.forEach((user) => {
            guild.ban(user);
        })
    })
})```
#

Is this allowed

hushed quarry
earnest phoenix
#

Why not?

#

@lavish forge 😂

hushed quarry
#

because that code literally just destroys servers, and since dbl is a public bot directory site, we obviously cannot allow a bot like that

earnest phoenix
pallid zinc
#

Lol

#

I think you are trying to ban member

slender thistle
#

I think that will try to ban users from every server the bot is in

lavish forge
#

nah

earnest phoenix
#
    client.guilds.forEach((guild) => {
     guild.ban('583619037322543126')
        })
})``` better
copper cradle
#

@earnest phoenix the id is a string

verbal nacelle
#

What permissions must i have to add bot to any server?

earnest phoenix
#

I’m s there a bot that invites random people to your server

#

MANAGE_SERVER

#

I’m s there a bot that invites random people to your server

#

Anyone

#

Dont flood

pale marsh
#

Depends on your bot's features. Mostly just send and read messages

verbal nacelle
#

Does your bot inviters (mods) have admin functions?

earnest phoenix
#

He is mute

verbal nacelle
#

It seems i understood, thank you

lyric grove
#

Hi there, I'm starting to explore using bots for our server and had a question on how to manage this use case scenario -

The game we're on has 5 types of resources : brick, lumber, wool, grain, and ore. At any one point, a player can only be occupying 3 to "farm / harvest". I wanted to use a command for players to update their status to indicate which 3 resources they are on at the current point in time. This will also allow other players to use a command like !wool or !brick to see which players are currently occupying those resources so they can DM for a trade.

The current way I see this being used is having someone to assign roles to themselves and others to query the roles (which I will need some assistance on setting up). Is there a simpler way to do this by having a "status update" instead of "roles"? People can then glance through a list.

slender thistle
#

A database?

warm sail
#

Sounds like a custom bot. Otherwise you would need to use a utility bot with programmable command triggers and roles.

lyric grove
#

Not really a database

#

More like let say I use !ore and !brick to add these 2 roles to myself

#

Then a user can use !orelist to see all users currently with this role

#

To identify who has ore

#

Then when I am done with ore I could use a command like !oreoff to remove the role

warm sail
#

Suggestion: Just set up a message with reactions per resource. Users can add reactions based on their resources and check the reactions list to see who has which resource.

lyric grove
#

But then again, you're right. It's like a database. Haha

#

Oh that is a brilliant hack!

#

But if there are too many people with the reaction, how can I see the list of people who reacted?

warm sail
#

There should be a menu option called "Reactions" (... to the right of the message on desktop / long press on mobile)

lyric grove
#

Hmmmm most people may use web version or mobile. I notice that once it goes after a certain amount of reactions it shows only - Kaizume, Geotim, Harry and "X" number more reacted

#

I tried checking and no dice yet

cursive dagger
#

Check the reactions menu

warm sail
#

^

cursive dagger
#

it will show all there

lyric grove
#

Ah I see it now

#

Perfect thanks!

warm sail
#

np 😃

lyric grove
#

I'll try it this way first! 😃

low dragon
#

Is it bad that I used a discord bot designer app rather than coding--

slender thistle
#

Pretty much yes

low dragon
#

Oof.

slender thistle
#

You can fix that by learning a programming language though mmLol

low dragon
#

Yeah.. uhm...

quartz hill
#

How do I use external emoji (msg.react)?
nodejs (In Reaction to the message.)

short siren
#

@low dragon You can do more if you code it yourself

low dragon
#

I know.

short siren
#

@quartz hill Put the emoji ID

low dragon
#

Though I don't know any coding.

short siren
#

JS is cool

earnest phoenix
#

So learn

quartz hill
#

ok

#

thx

low dragon
#

I don't really feel like installing something, it's not because of that, but I have tried learning, and it didn't work out.

earnest phoenix
#

@quartz hill

message.react(emoji)```
slender thistle
#

What have you tried learning?

low dragon
#

Simple commands.

earnest phoenix
#

like?

slender thistle
#

Did you start with the language itself first?

low dragon
#

Ima go continue the commands on DBD.

quartz hill
#

thx

low dragon
#

Not really.

earnest phoenix
#

Np

low dragon
#

I like using DBD.

slender thistle
#

Welp, that's the issue mostly

low dragon
#

I think it's better.

slender thistle
#

Knowing a programming language gives you more freedom over the result most of the time

low dragon
#

Yes, I know.

slender thistle
#

Your choice shrog

sinful lotus
#

I would also recommend learning a programming language

#

I know you want to make your own public bot and using a program to make a public bot is not something you would want

low dragon
#

Oof.

#

How can I know if my bot is added?

#

;help

#

OMG

#

SO MANY

#

DMS

#

AAAAAAA

sinful lotus
#

wait up to 7 days before asking a mod about your bot

#

simple tips

  • Make sure it responds
  • Make sure its online
low dragon
#

Oof, okay.

#

It responds, it's online.

sinful lotus
#

failing to do that will get your bot declined

low dragon
#

My bot sometimes gets offline.

sinful lotus
#

also make sure your description describes your bot

#

it must not get offline during the approval period or you would get declined

low dragon
#

Oof.

#

What if it was offline for 30 minutes only?

sinful lotus
#

just keep that in mind and you wont have to wait another 7 days to get approved

#

its fine but you dont know when a mod will test your bot

#

so better just keep it online 24/7

low dragon
#

Mkay.

#

o.o

#

Though sometimes I have to disable commands sometimes because I am trying to do another command, so I write in the help command, (Disabled until further notice.).

#

Trying out another command, which is the same.

#

But another way of making it.

sinful lotus
#

just make sure your bot is usable

low dragon
#

Alright.

#

I tried every command.

#

Everything works, if it doesn't I would just write in the help command (broken) or (disabled).

#

I am still trying out the new commands, making sure they're good.

#

And now I am off to make a ;use Laptop command, bye bye~!

low dragon
#

Oh no..

#

My bot crashed, it's offline..

#

If somebody is using my bot right now, I am in big trouble.

#

Dyno is down too, weird.

#

Oof, am scared.

pale marsh
#

Discord did a bork?

#

Nah. Everything seems fine on my end. Reboot your bot

low dragon
#

You don't get it--

#

Welp.

#

Yesss

#

It's back on.

earnest phoenix
#

hi

#

I get an error.

#

Hi

#

Show the error

#

@earnest phoenix

earnest phoenix
#

How to get lyrics with someonapi

#

?

vague chasm
#

@earnest phoenix we would not spoonfeed, please check the docs of the api you are using

brave anvil
#

Hello

#

I need help with an embed on my bot

#

I wanna have who requested it in the footer

#

Does anyone know the code?

pallid zinc
#

Code

#

Plz

brave anvil
#

Yes pls

pallid zinc
#

Message.channel.send({embed: {

}})

brave anvil
#

No no wait wait

#

Ik how to send embeds

#

But I need help doing this

slender thistle
#

"requested it"
How does one request an embed

pallid zinc
#

IDK

slender thistle
#

If it's a command, you can use message.author/member

pallid zinc
#

@brave anvil what u want to do

brave anvil
#

Putting a users username

#

That requested the embed

#

In the footer

pallid zinc
#

Where

#

Oh

brave anvil
#

.setfooter

pallid zinc
#

message.author.username

brave anvil
#

Ok sorry

pallid zinc
#

What sorry

brave anvil
#

I’m bad at explaining things

pallid zinc
#

Why

brave anvil
#

Idk

pallid zinc
#

And add message.author.displayAvatarURL will look nice

brave anvil
#

Ok

#

I’m making a moderation bot currently

#

Why

pallid zinc
#

Just do

brave anvil
#

I cant

pallid zinc
#

Why

brave anvil
#

Because

#

I cant

#

And I dont go outside safety of a server

#

Sorry

earnest phoenix
#

So how this channel work

#

Sorry

#

it's ok

#

HOW DOES THIS CHANNEL WORK

#

assk for help in bot code

#

if you need help in coding

#

Yes

#

but we will not spoon feed you in easy things

#

I just wanna ask a question

#

go on

#

I'm trying to do smth in Botisimo

#

i don't know that sorry

#

Crap

#

someone else will probably answer

#

Like who?

#

idk

#

just wait

#

Ok

#

How do I add a "number" to currency in botisimo?

mossy vine
#

@earnest phoenix go to the bots support server

earnest phoenix
#

botisimo is a tool...

#

a website

#

nvm

#

Yes?

mossy vine
#

Oh

#

Good to know lol

earnest phoenix
#

Sooo

#

I should go to that channel?

heady zinc
#

nobody can help you here about that

earnest phoenix
#

:(

heady zinc
#

this channel is for bot development

earnest phoenix
#

Ok

heady zinc
#

your best bet is to directly go to botisimo's support

earnest phoenix
#

K I'll try

#

Thanks

verbal nacelle
#

My discord bot closes sometimes without log error. Should i use special hosting for bot to prevent shutdown?

slender thistle
#

The cause could be your code

verbal nacelle
#

It works, it goes offline once two days

quartz hill
#

How do I find the id of gif emojis? nodejs

mossy vine
#

@verbal nacelle well what are you using to host it?

verbal nacelle
#

A2 hosting

mossy vine
#

Never heard of it. There might be something with it causing your bot to shut down

earnest phoenix
#

Use a backward slash before the emote. @quartz hill

DiscordBlob would be \:DiscordBlob:
This would return the following: !DiscordBlob

quartz hill
#

thx @earnest phoenix

#

@earnest phoenix but I havent nitro 😦

sinful lotus
#

use your bot

quartz hill
#

ok

sinful lotus
#

check client.emojis

#

you can make your bot say the emoji via
client.emojis.first().toString()

#

.first() takes the first item in collection

#

just for example purposes

quartz hill
#

@sinful lotus If I want to take 20.

sinful lotus
#

then get the first 20 probably

#

I think .first(20) is possible

amber fractal
#

@weak parrot

unique nimbus
#

Timo

amber fractal
#

Maybe @coral trellis ?

coral trellis
#

Thank you

unique nimbus
#

very cool

amber fractal
#

Thanks Kanye

weak parrot
#

Oh

quartz hill
#

thx

quartz hill
#

How do I know if mention is a bot?(nodejs)

amber fractal
#

Get the mention's user

#

I assume because you said node you use d.js

quartz hill
#

yes

#

thx

lime fiber
#

Hi! I'm working with python. I need a list of all servers that the bot is in. It is ok, but how can I get a list of server IDs?

slender thistle
#

List comprehension

#

Guild instances have .id property

pale marsh
#

Your Client object should have a guilds property that's a list of Guild objects

slender thistle
#

(Unless you are using 0.16.12)

lime fiber
#

I'm using 0.16.12 🤣

slender thistle
#

rip

lime fiber
#

😢

pale marsh
turbid gale
#

async yeah

slender thistle
#

Anything under 1.0.0 is old

#

The newest version is 1.2.2

pale marsh
#

Yeah it's out on pypi now

lime fiber
#

And what if I need to get a server by the server id.

slender thistle
#

client.get_server for you

lime fiber
#

But it just get the name. I want it like discord.Server

#

Where i can use server.roles

west spoke
#

I see this is python rewrite

#

accessing the api for all role stats would be easiest imo

slender thistle
#

Really

#

You do get a discord.Server instance

#

from get_server

pale marsh
#

It's get_guild()

west spoke
#

I'm used to just getting stuff directly from the api because async is a b

slender thistle
#

print converts arguments to str, and Channel.__str__ returns its name

#

Kef, async version

pale marsh
#

Oh

west spoke
#

Oh

pale marsh
#

Why are you even still using it?

west spoke
#

because I dont wanna transfer over

slender thistle
#

Many are lazy to migrate

west spoke
#

And rewrite just wont run

lime fiber
#

oh thanks

west spoke
#

I tried it before

#

Just wouldn't run

slender thistle
#

I had both work

west spoke
#

welp

#

Didnt work for me

lime fiber
#

But when I tríing to get a role from the servers I'm getting 'NoneType' object has no attribute 'name'

slender thistle
#

How are you using get_server

pale marsh
#

Show us your code

west spoke
#

client.get_server("ID") is what I would do

#

That works for me

lime fiber
#

One of the id here:

    for x in range(len(servers)):
        server4 = servers[x-x3].id
west spoke
slender thistle
west spoke
#

Wha

#

wait

#

Hold up

lime fiber
#

And here is get_server : server10 = client.get_server(server4)

#

It is ok

west spoke
#

Define server4 with the server ID

slender thistle
#

What is servers

lime fiber
#

servers defined here: servers = list(client.servers)

west spoke
#
server4="SERVER ID"
server10 = client.get_server(server4)```
lime fiber
#

But I don't knoiw the server id.

west spoke
#

get the server id

lime fiber
#
    for x in range(len(servers)):
        server4 = servers[x-x3].id

this is geting an id

west spoke
#

How do you code if you dont know how to get server IDs

lime fiber
#
    x2 = len(client.servers)
    x3 = random.randint(0, x2)
west spoke
#

this hurts my brain

slender thistle
#

Are you literally getting a random server from cache

west spoke
#

what's your goal for this

lime fiber
#

I'm getting a random server ID where my bot is in. Here is the full code for this

    x2 = len(client.servers)
    x3 = random.randint(0, x2)
    for x in range(len(servers)):
        server4 = servers[x-x3].id
server10 = client.get_server(server4)
slender thistle
#

Rly

west spoke
#

bad idea imo

#

but mmmmk

slender thistle
#

random.choice

turbid gale
#
random.choice(client.servers).id```
no?
lime fiber
#

And this returns the NoneType object etc... line: role = discord.utils.get(server.roles, id=szinek[server.id]["role"])

slender thistle
#

Let's not spoonfeed

turbid gale
#

sorry my bad

west spoke
#

xd

earnest phoenix
#

yo guys

#

I've tried my bot on my local pc without any problems

#

now I moved it to my windows 2016 server and the bot just crashes with an unhandled error event

#

does anyone know why?

sinful lotus
#

handle the error

#

probably client.on error

earnest phoenix
#

but why is it working on my local pc

smoky spire
#

If u left ur bot on long enough on ur local pc you would get that error

sinful lotus
#

not because it works locally it will on servers

#

probably you missed something

earnest phoenix
#

I think I didn't missed anything

smoky spire
#

Again you just have to handle the error event

earnest phoenix
#

should also add that it's only crashing while playing a song from youtube with ffmpeg

smoky spire
#

doesn't make a difference

dusky marsh
#

It's the bot disconnecting from the API, just add a <Client>.on('error', () => console.error)

sinful lotus
#

or client.on('error', console.error)

dusky marsh
#

Even shorter, perfect

earnest phoenix
#

hm will try that later

#

im trying to make a guess the number command

#

but it says i didnt know correct even if i do so

spare shoal
#

How do you check if your number is correct ?

earnest phoenix
#
        .then(function(){
            message.channel.awaitMessages(response => message.content, {
                max: 1,
                time: 10000,
                errors: ['time'],
                })
                .then((collected) => {
                    if(message.content === sayi) {
                        message.channel.send("Congrats! The number I guessed was " + sayi + " !");
                    }else {
                        message.channel.send("Ouch, you are wrong. The number I guessed was " + sayi + " !");
                    }
                })
                .catch(function(){
                    message.channel.send('Time is up! I guessed ' + sayi + " .");
            });
        });
#

there is the message that says i guessed between bla bla

spare shoal
#

Did you try to display the value of message.content and sayi to be sure they are the same ?

earnest phoenix
#

yes

#

it replies ouch i guessed 6 even if i type 6

spare shoal
#

I'm not an expert of js but are you sure you are not comparing different types ?

#

Like sayi is a int and message.content a string

earnest phoenix
#

lemme see

#

nope i made toString(sayi) which didnt work

spare shoal
#

Um... Are you sure you don't have a space or an invisible character in message.content (like at the beginning) ?

earnest phoenix
#

nah

#

i solved it

spare shoal
#

Oh, what was the issue ?

earnest phoenix
#

i made sayi string

#
sayi = `${Math.floor(Math.random() * max + 1)}`;```
#

i was just Math.floor ... before

spare shoal
#

Oh, well good to know :p

earnest phoenix
#

ty for help anyway

spare shoal
#

No problem, even if I didn't do much

still frigate
#

/bin/bash^M: bad interpreter: No such file or directory 😢

#

Can you helpe me please ?

amber fractal
#

Basic error

#

The file/directory doesnt exist

still frigate
#

Is there a variable to bin folder ?

#

Resolved !

#

I have used dos2unix 😃

frosty juniper
#

Does anyone know how to solve the bot sending an empty message with other messages issue ? Using node JS . Give a ping if anyone knows how to solve this . Thanks 😃

mossy vine
#

@frosty juniper posting your code would be useful as well

frosty juniper
#

it's very big , it might take some time . I'll ask again later then.

#

thanks @mossy vine

mossy vine
#

i mean

#

only the relevant part of the code

#

not the entire thing

frosty juniper
#

actually its sending the empty message for any command i use

#

for the bot

mossy vine
#

what lib (and if you use one, command framework) are you using?

frosty juniper
#

discord.js library

sacred minnow
#

can anyone help me with this?

function sleep(milliseconds) {
    var start = new Date().getTime();
    for (var i = 0; i < 1e7; i++) {
      if ((new Date().getTime() - start) > milliseconds){
        break;
      }
    }
  }```
#

its not working for some reason

mossy vine
#

dont do it like that

#

use promises

sacred minnow
#

how?

mossy vine
#

and async/await

sacred minnow
#

ok

mossy vine
#
const delay = ms => new Promise(res => setTimeout(res, ms));
#

and then you just await that

sacred minnow
#

thanks

sacred minnow
#

ok so i have this

const sleep = (milliseconds) => {
  return new Promise(resolve => setTimeout(resolve, milliseconds))
}```
#

but when i use it with async

#

it still doesnt work

mossy vine
#

do you await it

sacred minnow
#

yeah

mossy vine
#

send your code that uses it

sacred minnow
#

const safda = async ()=>{
await sleep(6000)
console.log("1")
}
safda()

mossy vine
#

why are you returning the promise tho Thonk

#

try not using return

sacred minnow
#

ok

#

still doesnt work

mossy vine
#

its working perfectly for me

atomic coral
#

So I've got my bot almost done, it's quite simple, just responds to 1 command and sends a message. But I'm wondering is there a way to line up inline embed fields?

earnest phoenix
#

what ya mean

atomic coral
#

I'll send a pic

#

If there is a way to vertically align those slots

earnest phoenix
#

well

#

ALT + 2 + 5 + 5

slim heart
#

Turn them off inline

earnest phoenix
#

it makes a space

slim heart
#

If you, don’t want them in-line

earnest phoenix
#

and use that space to align them

#

lul

slim heart
#

Oh I see

atomic coral
#

They are variable each time, so that won't work

slim heart
#

Then calculate the length to how many is needed

atomic coral
#

No thanks, I'll settle with a long message 😃

slim heart
#

Though it’s gonna be very specific to the computer it’s being used on it’s kinda pointless

earnest phoenix
#

use spaces in title

#

not desc

atomic coral
#

One last thing, is it not at all possible to put links in the footer?

slim heart
#

No

atomic coral
#

Roger. thanks

slim heart
#

Unless you want people to copy and paste a raw text link :p

atomic coral
#

I'll just put the link in rawtext 😃

earnest phoenix
#

!invites

warm flame
#

#commands for one and don't use that command or you will be muted

#

if you are looking for a bot go the website

slender thistle
#

@west spoke await/async with session.post/get/whatever(url, headers={'my headers': 'here!'})

west spoke
#

Ah

#

I was doing it as this:

headers= DBL default headers 
await aiohttp.get(url, headers)
#

What I'm using rn ima get

#

 async def user_voted(author_id):
     import requests
     voteurl="https://discordbots.org/api/bots/bot_id/votes"
     response=requests.get(voteurl,headers=dblheaders)
     for line in response:
         json=line
     if author_id in str(json):
         return True
     else:
         return False```
wide ruin
#
body {
  font-family: "Benton Sans", "Helvetica Neue", helvetica, arial, sans-serif;
  margin: 0px;
  background-color: #F3F5FF;
  
  &.dark {
    background-color: #000000;
  }
}```
#

when it gets the dark class from a button nothing happens

#

the button works fine, inspect element shows it

mossy vine
#

does the class get added to the body element

wide ruin
#

yes

#

inspect says <body class="dark">

#

changing the normal background-color to 000000 does work as well

#

so its just the &.dark bit

quartz kindle
#

are you using LESS?

wide ruin
#

?

#

@quartz kindle

quartz kindle
#

that is LESS syntax

#

not pure css

#

if you want to do that in pure css you have to: css body { font-family: "Benton Sans", "Helvetica Neue", helvetica, arial, sans-serif; margin: 0px; background-color: #F3F5FF; } body.dark { background-color: #000000; }

wide ruin
#

oh thanls

#

thanks

opaque eagle
#

I was asked to do this seemingly mundane task: Find the sum of all the multiples of 3 or 5 below 1000.
But apparently, my answer was wrong. Here's my code: ```js
let multiples = [];

for (let i = 0; i < 1000; i++) {
multiples = [...multiples, i * 3];
}

for (let i = 0; i < 1000; i++) {
multiples = [...multiples, i * 5];
}

const sum = multiples.reduce((a, c) => a + c);
console.log(sum);```

mossy vine
#

i dont see whats wrong with that, but it could be done a lot better

opaque eagle
#

Ok I thought I figured out what the problem was, but it still didn't fix it. This is how I changed it: ```js
let multiples = [];

for (let i = 0; i * 3 < 1000; i++) {
multiples = [...multiples, i * 3];
}

for (let i = 0; i * 5 < 1000; i++) {
multiples = [...multiples, i * 5];
}

const sum = multiples.reduce((a, c) => a + c);
console.log(sum);```

mossy vine
#

ah yeah, i see whats wrong

#

you are adding i * 3/5 if the i * 3/5 is less than 1000

#

not if its a multiple of 3/5

opaque eagle
#

Oh

#

If you multiply by 3/5 shouldn't it automatically be a multiple?

mossy vine
#

also, why are you using multiples = [...multiples, new] instead of multiples.push(new)?

#

no

#

you are incrementing by 1

#

let me explain on a smaller dataset

#

multiples of 3 and 5 up to 10

#
2: 2*3 = 6 which is less than 10, therefore 2 gets added to the array
3: 3*3 = 9 which is less than 10, therefore 3 gets added to the array
4: 3*4 = 12 which is more than 10, so it doesnt get added, neither does anything after this```
#

oh god thanks discord

#

what your code should be doing is

opaque eagle
#

multiples = [...multiples, i * 3]; no it adds i * 3

mossy vine
#

1 doesnt get added
2 doesnt get added
3 gets added, as its a multiple of 3
4 doesnt get added
5 gets added, as its a multiple of 5
6 gets added, as its a multiple of 3
7 doesnt get added
8 doesnt get added
9 gets added, as its a multiple of 3
10 gets added, as its a multiple of 5
leaving you with a sum of 33 if my math is correct

opaque eagle
#

so it should count up from 1 and add each number that's divisible by 3 or 5?

mossy vine
#

yes, or do this: (one minute, still working on it)

echo pasture
#

lel

opaque eagle
#

This gives 0 ```js
let multiples = [];

for (let i = 0; i % 3 === 0 && i < 1000; i++) {
multiples.push(i);
}

for (let i = 0; i % 5 === 0 && i < 1000; i++) {
multiples.push(i);
}

const sum = multiples.reduce((a, c) => a + c);
console.log(sum);```

quartz hill
#

How do I filter the text I receive? (nodejs )
for example: Hell"o how' are/ you ( " ' / ´ etc. but not + _ () [] )

flat pelican
#

js eyesFlipped

opaque eagle
#

Use RegEx to get rid of all the stuff you don't want

#

Or the JavaScript-y way would be to split the whole string to an array and check if each character is included an array of unwanted characters, removing them, and joining the array.

quartz hill
#

Must be fast
I'il check the first one. thx 😃

mossy vine
#

@opaque eagle

let sum = 0

for(let i = 1; i <= 10; i++) {
    if(i % 3 == 0) {
        sum += i
    } // if i divided by 3 has no remainder, it gets added to the sum 
    if(i % 5 == 0) {
        sum += i
    } // if i divided by 5 has no remainder, it gets added to the sum
}

console.log(sum)```
opaque eagle
#

@quartz hill The JavaScript way isn't half bad tbh```js
const str = "string of bad stuff";
const BAD = [];

// do this
Array.from(str).filter(e => !BAD.includes(e)).join("");```

atomic coral
#

Wait, is the only benefit for being approved that you are listed?

#

I mean your bot

opaque eagle
#

tyyyy

mossy vine
#

the only problem with this code is that it might add i to the sum twice

#

so you should figure out a way to deal with that :p

opaque eagle
#

I can check for duplicates, that's fine

mossy vine
quartz hill
#

thx

opaque eagle
#

ty

mossy vine
#

no, i actually have no clue, sorry

opaque eagle
#

np

dense current
#

Something wrong with the code?

const DBL = require('dblapi.js');

const dbl = new DBL(process.env.dbltoken, { webhookPort: process.env.dblport, webhookAuth: process.env.dblpass });

dbl.webhook.on('ready', hook => {
  console.log(`Webhook iniciado: https://${process.env.PROJECT_DOMAIN}.glitch.me:${hook.port}${hook.path}`);
  console.log(hook)
});

dbl.webhook.on('vote', vote => {
  console.log('foi')
  console.log(vote)
})```
The webhook starts, but I am not warned by votes
long eagle
#

Try to test-host it on your PC

dense current
#

@long eagle how would i get the webhook warning through the pc

long eagle
#

I mean just host it on your PC...

#

There are docs.

#

I can't help you atm

#

coding myself a discord bot twin lmfao

quartz kindle
#

@dense current did you configure the webhook url in the discordbots website?

dense current
#

@quartz kindle yes

quartz kindle
#

which port are you using? glitch only enables specific ports

dense current
#

3000

quartz kindle
#

glitch exposes port 3000 internally through port 80 externally

#

so try using port 80 in the website configuration

#

and keep 3000 in the code

dense current
#

ok

#

@quartz kindle ops

#

I spoke wrong

#

i use 5000

quartz kindle
#

glitch only allows using port 3000 internally

dense current
#

@quartz kindle no warnings yet

quartz kindle
#

whats the url you put in dbl?

dense current
quartz kindle
#

as i said, use port 80 externally and port 3000 internally

dense current
#

I used

quartz kindle
#

port 80 is default http, so you can just omit it

dense current
#

code : dblport=3000

quartz kindle
#

https://projectname.glitch.me/dblwebhook should work

#

no port = port 80

dense current
#

@quartz kindle nop...

#

ops

#

@quartz kindle now it's gone

#

thanks

#

<3

quartz kindle
#

👍

earnest phoenix
#

Hey

#

Anyone help me!?

warm flame
#

Ask the question

earnest phoenix
#

my level up command not working

steel cloak
#

is there an error or is the code just not responding the way you wanted it too?

earnest phoenix
#

no error

pale marsh
#

Show us the command's code

earnest phoenix
#
  
  const request = require('node-superfetch');
  const db = require('quick.db');
  
    
    

    
  if (msg.channel.type === "dm") return;
  if(msg.author.bot) return;  
  
  if (msg.content.length > 7) {
    
    db.add(`puancik_${msg.author.id + msg.guild.id}`, 1)
};

  if (db.fetch(`puancik_${msg.author.id + msg.guild.id}`) > 250) {
    
    db.add(`seviye_${msg.author.id + msg.guild.id}`, 1)
    
    msg.channel.send(`Tebrik ederim <@${msg.author.id}>! Seviye atladın ve **${db.fetch(`seviye_${msg.author.id + msg.guild.id}`)}** seviye oldun!`)
    
    db.delete(`puancik_${msg.author.id + msg.guild.id}`)
    
  };
});```
#

bot js*

#

@pale marsh

pale marsh
#

According to your code you have to send around 250 messages that are at least 7 characters long to gain 1 xp point right?

#

To gain 1 level*

earnest phoenix
#

yes

#

How can i

#

I spammed But not working

grim aspen
#

does it have a datafile?

pale marsh
#

250 messages is a long number. Lower it down to like 10 messages for testing purposes

grim aspen
#

a file to store data for the users amount of messages that were sent by them

earnest phoenix
#

10 ?

grim aspen
#

try setting 10 messages as the limit til the users rank up

#

and for the 10 messages that that user sent, they rank up

earnest phoenix
#

ok i will trying now.

#

Don't work :(

mystic shell
#

on my page one of my bots is showing up as online but the other one isnt even though they are both online

hushed quarry
#

is the other bot in this server?

mystic shell
#

yeah they both should be

modern sable
mystic shell
#

thanks for letting me know, i just removed that functionality

west raptor
#

why wont this work am i just dumb

shy rose
#

gonna sound dumb

but have you called the function

modern sable
#

reinvited your bot @mystic shell

west raptor
#

yes @shy rose

#

cAnt SenD An EmptY mEssAge

shy rose
#

yes discord doesnt let you

west raptor
shy rose
#

util!.send

okeh the heck

#

oh hang on

#

your code above never waits

#

you need to tell that end to await

west raptor
shy rose
#

inside the function awaits

but you havnt told the thing calling it to wait

#

the request function is fine

#
var something= await request("that goop")
sendMessage(something)

that kind of thing

west raptor
#

ok

shy rose
#

you havent told the send to wait for the request basiclly

west raptor
#

yeah i see now

shy rose
#

whats your code now though?

west raptor
shy rose
#

if you toss a console log into the reply is it actually returning anything

pale marsh
#

url is a string?

shy rose
#

oh wait

#

you need to call .url after its resolved iirc

#

so move the .url part into the send

#

so youl have url.url lol

west raptor
#

ok

#

: )

#

works now

#

thanks

pale marsh
#

Or like (await whatever).url

shy rose
#

that can be iffy

#

it should work like that

but in some cases for who knows why its just no u

west raptor
#

javascript™

pale marsh
#

Can be confusing in some cases yeah

shy rose
#

tbh it reads better having either a promise chained with .then or just calling prototypes on the reply when you need them

#

rather than all jsut in one big line

amber fractal
#

Yeah it's trying to await a property that doesnt exist yet

#

I think you couldve (await this.client.request(...)).url

#

Not sure tho

hushed quarry
#

u should be able to do that

#

at least in python you can

opaque eagle
#

While it isn't the most conventional, I like doing: js const url = await this.client.request() .then(body => body.url);

#

No need for extra parentheses

idle basalt
#

mixing await and then REEEEEEEEEEEEEEEEEEEEEEEE

inner jewel
#

await fetch(url).then(r => r.json()) vs await ((await fetch(url)).json())

#

which one looks better

#

they're equivalent

idle basalt
#

woosh

sinful lotus
#

actually just await (await fetch(url)).json() will do

brave anvil
#

Hey

#

I’m

#

Wondering how I would make an endpoint for my html page

sinful lotus
#

what are you using as webserver

brave anvil
#

Redis

sinful lotus
#

What? you use redis to host your html page?

brave anvil
#

Yes

#

But one sec lemme

sinful lotus
#

I dont know what you are saying but redis is a database

vivid hinge
#

does anyone have like example code similar to the giveaway bot? I need the bot to ask a few questions then leave a response afterward

brave anvil
#

My bad Apache

#

Idk

sinful lotus
#

I believe apache has a config file

#

you can create endpoints there

brave anvil
#

Okie I’m new to endpoints

#

XD

sinful lotus
#

probably this can help

brave anvil
#

I’m the type of person that backsup data then if i mess up I restore

#

XD

olive path
#

Hey, so how would I reference the bot client outside of the main file

sinful lotus
#

pass a reference for the client's bot some way

olive path
#

Thanks, but I'm wondering how to do that

sinful lotus
#

how do you exactly plan to use it

olive path
#

Sorry, should've probably rephrased my question lol

sinful lotus
#

give me some reference

olive path
#

Uptime

#

gimme a sec

#

I'll copy the code

#
  let hours = Math.floor(totalSeconds / 3600)
  totalSeconds %= 3600;
  let minutes = Math.floor(totalSeconds / 60)
  let seconds = totalSeconds % 60```
#

(Bot would be the reference)

sinful lotus
#

pass a reference of client via something, could you show the whole code and how you are doing it?

olive path
#

Sorry thought I specified earlier but I didn't lol

#

Ok, one sec

sinful lotus
#

you do have a reference of bot there

#

do you have errors?

#

I think you are just passing it wrong

olive path
#

Yeah

sinful lotus
#

do you have any errors then?

olive path
#

Yeah

sinful lotus
#

then provide the error

olive path
#

I know it isn't right, it's an example

#

I will right now

#

"UnhandledPromiseRejectionWarning: ReferenceError: Bot is not defined"

sinful lotus
#

stacktrace?

olive path
#

It isn't real :p

sinful lotus
#

oh

#

not Bot

#

it should be bot

#

JS is case sensitive

#

make sure you check that

olive path
#

Oh lmfao

#

Oh lol thanks xD

copper cradle
#

lmfao

olive path
#

Hey, another hopefully easy question that I can't find online, How would I set inline field to only appear 2 per line (instead of 3)

sinful lotus
#

you can probably use .map() method

earnest phoenix
#

Why ppl won't read the errors?

olive path
#

I'm not getting errors. There is no error, it's a style thing.

#

Like, I just want it to look like that

#

And for earlier the error didn't help lol

earnest phoenix
#

I am talking about your not definied err

olive path
#

Yeah, I knew it was undefined. That was what I was asking.

#

I didn't send it because I thought it was easy to pick up on

sinful lotus
#

if you use the traditional way of sending embeds

#

.map is possible to do what you want

olive path
#

I literally said "I know it isn't right, it's an example"

#

What do you mean by traditional?

sinful lotus
#

the one that dont use RichEmbed or MessageEmbed in sending embeds

#

its also possible on the RichEmbed or MessageEmbed but I would prefer using the traditional way if I would do that

olive path
#

Like let _Embed = new Discord.RichEmbed() .setColor.....

sinful lotus
#

thats the RichEmbed or MessageEmbed way of sending embeds

#

the traditional way is the JSON format

olive path
#

Ohhh

#

Yeah, can I use this way lol I'm way more familiar with it, sorry lol

sinful lotus
#
    await msg.channel.send({
            embed: {
                color: 0xc0c0c0,
                author: {
                    name: client.user.username,
                    icon_url: client.user.displayAvatarURL()
                },
                fields: data,
                timestamp: new Date()
            }
        })
#

this is what I meant by traditional way

#

data is an array of fields

#

thats why I manipulate the data I want to go there via array.map()

split lantern
#

You can prob do
.addField()
.addBlankField()
.addField()

olive path
#

Ohh, I see.

#

Thank you both

sinful lotus
#

yeah but since he want the inline field he can just use .map and when the index is an even number, add inline: true

split lantern
#

He wants 2 inline fields per line instead of the default 3 inline fields per line

olive path
#

Ah. I do kind of like keeping the code consistent, and I kinda like the richEmbed more because I think it looks nice and clean :p

sinful lotus
#

your choice

olive path
#

Ok, that makes the thing giant.. Useful to know, but not what I want for this.

#

I might try your way, lol

#

But first, it is 1:36 AM

#

😂

frosty juniper
#

Does anyone know how to solve the bot sending an empty message with other messages issue ? Using node JS . Give a ping if anyone knows how to solve this . Thanks : )