#development

1 messages · Page 764 of 1

modest maple
#

It sums up 80% of this discord @earnest phoenix

unique nimbus
sudden geyser
#

@earnest phoenix it wasn't supposed to 100%. Your token should be private always

odd dune
#

Anyone help me please

earnest phoenix
#

help with what

west spoke
#

@odd dune what do you need help with

odd dune
#

No no, now all its ok, but thank you :)

#

Sorry for my bad english

sage bobcat
#

One message removed from a suspended account.

grizzled raven
#

@earnest phoenix when you reset your token, it changes

#

so you need to update it in the code

west raptor
#

^ note: it only changes when you explicitly tell it to or you login 1000 times in a 24h period, those are the only times it resets as far as I know

modest maple
#

and github

#

if you commit a file with youre token in it gets reset

west raptor
#

Eh? Since when

modest maple
#

since a while

#

found out the hard way a couple times as i accidently commit it and the bot instant gets kicked off

west raptor
#

I don't remember anything like that being put in place but okay

I'll try in a bit on a bit i don't care about

grizzled raven
#

yeah i also found that the hard way

modest maple
#

good safety feature tho

grizzled raven
#

i changed a bot's token and committed to a repo multiple times

#

i thought the way i would fix it was by resetting the token, committing and logging in really really fast lol

#

worked some times

earnest phoenix
#
      const top = client.shard.fetchClientValues("guilds.size").sort((a,b)=>a.memberCount-b.memberCount).array().reverse()

#

TypeError: client.shard.fetchClientValues(...).sort is not a function

#

not working

surreal sage
#

...

quartz kindle
#

@earnest phoenix fetchClientValues is a Promise. do you know what a Promise is?

surreal sage
#

nvm :)

earnest phoenix
#

@quartz kindle yes

#

but it doesn't work

grizzled raven
#

you need to await the promise first

#

or do .then()

uneven wyvern
#

what's a promise?

#

sorry for asking tho

mossy vine
uneven wyvern
#

How to add roles to a User in d.js v12-dev?

#

I tried member.roles.add() but it gives me an Error

white anvil
#

read the docs and find out

unkempt ivy
#

rtfm

uneven wyvern
#

whoops the snowflake needs to be in a array

#

but how to add them by their name?

summer torrent
#

@uneven wyvern show your code and error

uneven wyvern
#

@summer torrent

summer torrent
#

remove [ ]

white anvil
#

.add does not take a function as a parameter

summer torrent
#
message.member.roles.add(message.guild.roles.find(r=>r.name === "Community").id)``` try this
uneven wyvern
#

ty

vital lark
#

or you can just do Member#addRole sipp

sudden geyser
#

that's only on stable ChiakiHmm

white anvil
#

well define webhookclient then

small prairie
#

How Can I get id's Of Each Reaction? on a specific message

#

d.js

modest maple
#

well logically you cant really

#

cuz if its a default emoji it will be unicode not an ID

small prairie
#

No No

#

I mean the d's of users

#

Who reactied

#

reacted*

modest maple
#

ohhhhhhh

#

okay that makes more sense now xD

small prairie
#

sorry for less info /:

mossy vine
small prairie
#

uh yeah i did

#

didnt quite get it

modest maple
#

well you could just have a on_reaction_add event

small prairie
#

.reactions right?

#

No

#

I want to get of already

modest maple
#

that would work aswell i think

small prairie
#

reacted too

summer torrent
#

what is ur lib

modest maple
#

d.js @summer torrent

quartz kindle
summer torrent
quartz kindle
small prairie
#

ANyways thanks

#

Got it

modest maple
#

if you get a list of reactions just iterate through them

modest maple
#
LastSentMessage = await Data.channel.send(embed=EmbedList[0])```
#

I am

#

Really quite stumped

#

Info:

EmbedList has Min two Embed Objects in it, ive checked and logged it, each time two elements

#

the Data object is similar to the Message object just with client in it for ease of use

#

I get

#

No Error

#

yet it isnt sending the message

grizzled raven
#

python?

topaz fjord
#

that ain't d.js so yes

modest maple
#

xD yus

#

wanna know the most annoying part

#

ocassionally

#

it works

#

but most of the time it doesnt

uneven wyvern
#

@vital lark im on Master =}

vital lark
#

oh

#

they removed addRole?

grizzled raven
earnest phoenix
#

got some code for a profile command to use canvas to display info

#

i need help getting info from a table from MySQL so i can use it in canvas

#

use a text sharing service like hastebin to share code

#

removed the password since its a password xD

#

i originally was close when i had let level = await conection.query(`SELECT level FROM info WHERE ID = '${msg.author.id}'`) but it would display on the canvas [object, object] or something like that

#

help?

#

ive been at this for hours xD

quartz kindle
#

are you sure your mysql library supports async tho?

#

last time when i checked, it didnt seem like it did

#

you cannot use await connection.query() if query() is not a promise

#

if you want to use async/await, you need to promisify it yourself

#

like this js let level = await new Promise((resolve,reject) => { connection.query(... , rows => { resolve(rows[0].level) }) })

#

or just stick to callbacks like you were doing before: ```js
connection.query(... , rows => {
// do all your code here
let canvas = new Canvas(...)
.addText(rows[0].level)
...
msg.channel.send(...)
})

unkempt ivy
#

imagine using a lib that wasnt based on promises

modest maple
#

I mean SQL does have a async version

#

For Py atleast

#

Alchemy also is async I do believe

quartz kindle
#

most databases have at least 5 or 6 different libraries and drivers for them lol

#

last publish 9 months ago

modest maple
#

Yh

#

Python has a asyncsqlite version

#

Idk if theirs a js version that isn't alchemy

knotty steeple
#

™️

modest maple
#

God that TM is so hard to read

#

XD

quartz kindle
#

but like, database tech is pretty solid and slow moving, you dont really need "the latest modern actively updated library", you can stick with the old and proven drivers

#

most newer ones are built on top of the old ones any way

modest maple
#

Yh

#

And unless it's a massive and I mean massive db

#

The effect of the blocking code is pretty much unnoticeable

quartz kindle
#

db's are non-blocking by design, unless explicitly marked as sync

#

they use node's i/o callbacks

modest maple
#

Yh

fast dune
#

hey guys, is it possible to get the game that a user is currently playing through an API?

honest karma
#

yes

fast dune
#

how? i couldn't find the relevant docs

honest karma
#

what api are you using

fast dune
#

hmm not sure if i understand. my question was whether such an API exists

honest karma
#

I mean...?

grizzled raven
#

js or py

modest maple
#

If you mean what game they're playing as shown in discord, discord API does that

fast dune
#

does it? i can't find it from the official docs

#

i'm not seeing any API that tells me what game they are playing

modest maple
#

What programming language r u using

#

Because it's defo available for the d.py and d.js libs

#

I don't think it's a listed thing on discord's docs

fast dune
#

oh i see

#

i'm using JS

ivory sapphire
#

It's listed under activity in the d.py docs

honest karma
#

ah.

ivory sapphire
#

Idk about JS

honest karma
#

hold on lemme get it

ivory sapphire
#

Probably the same though, maybe

quartz kindle
#

should be in presences

honest karma
fast dune
#

thanks guys

quartz kindle
fast dune
#

thanks 😄

minor kelp
#

how to fix this:

There was an error processing your song.
[ffmpeg was not found.]

FFmpeg IS installed, but im still getting this

earnest phoenix
#

ffmpeg is not an installable program

#

it is a CLI

#

portable

#

it needs to be in the directory you are searching it in

minor kelp
#

so

#

i put the ffmpeg folder in the cogs folder @earnest phoenix

unique nimbus
#

No

#

@minor kelp

#

Or whatever you run for the bot to start

minor kelp
#

ok

unique nimbus
#

Yes

minor kelp
#

also

#

im using other music bots rn

#

and im not getting any sound

wise arrow
minor kelp
#

Their site is a little broken rn

#

@unique nimbus Its in the main bot folder, but didnt work

frosty gate
#

ah ok thats what im seeing too

earnest phoenix
#

Is website crashed?

pearl canopy
#

Is there any body that can program or help me program my discord bot?

#

I tried all day

jolly ridge
#

I can help. I don't spoon feed though.

#

@pearl canopy If only it's in Javascript.

minor kelp
#

@pearl canopy If its Python, i can help

pearl canopy
#

I don't know what it is

minor kelp
#

That helps.

#

not.

pearl canopy
#

Lol

minor kelp
#

What programming language will you use?

pearl canopy
#

I don't know all I know is I been trying to follow. Some type of manual

minor kelp
#

Link it.

minor kelp
#

thats Javascript

#

@jolly ridge you can help him

pearl canopy
#

I have created most of the files but i dont think im using the correct app

minor kelp
#

What app.

pearl canopy
#

Node.js consol note pad ++

minor kelp
#

ok wow um

#

Use VSCode

#

Visual Studio Code

pearl canopy
#

send link ps

minor kelp
#

Im busy

pearl canopy
#

ok

#

I think i have the right one, it should be downloading, btw i am using windows 10

minor kelp
#

same

pearl canopy
#

@earnest phoenix is helping me right now

floral bloom
#

If I wanted to use JSON for a "database" is there a chance of loosing "data" if the bot is in multiple thousand servers?

Ping with response, please.

blissful scaffold
#

it depends,
if every server has it's own file then it should be fine
if everything is in one file but there is only 1 write or read action at a time then it should be fine
the main problem is that JSON isn't made to be used as a database and it might be slow when it gets bigger

west spoke
#

I use a json based database on get requests and post requests only, and all that

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

floral bloom
#

Ah, okay. Thanks. 😄

sage bobcat
#

One message removed from a suspended account.

slender thistle
#

If you manage to not do many I/O operations all at once, JSON isn't that bad but it's still recommended to use an actual database for bigger bots

earnest phoenix
#

why are self-bots forbidden ?

#

@(not)everyone

opal halo
#

@everyone

earnest phoenix
#

it doesn't work ;)

#

@opal halo

opal halo
#

I know that

stable horizon
#

@earnest phoenix

desert forge
#

Is it a problem for reviewing, if I Have a code that the bot reacts to messages saying hi and hello?

zealous veldt
#

Yes

marble juniper
#

it should only react to commands

#

or well if the bot prompts the user for input

stable horizon
#

plus the obvious like logging etc

pliant needle
#
(node:1661) UnhandledPromiseRejectionWarning: Error: A token must be provided.
    at Promise (/home/pi/avibot/node_modules/discord.js/src/util/Util.js:57:25)
    at new Promise (<anonymous>)
    at Function.fetchRecommendedShards (/home/pi/avibot/node_modules/discord.js/src/util/Util.js:56:12)
    at ShardingManager.spawn (/home/pi/avibot/node_modules/discord.js/src/sharding/ShardingManager.js:113:19)
    at Object.<anonymous> (/home/pi/avibot/index.js:5:9)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    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)
(node:1661) UnhandledPromiseRejectionWarning: Unhandled promise rejection. Thiserror originated either by throwing inside of an async function without a catchblock, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:1661) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
#

How tf does changing my API key do THIS

#

@earnest phoenix any ideas?

#

Like it thinks the token isn't provided

#

But it is

#

It's right fucking there

earnest phoenix
#

Unable to think clearly rn

pliant needle
#

Unless

#

....nvm

#

I know why

#

fukken....

earnest phoenix
#

@stable horizon that isn't why?

earnest phoenix
#

Can we pass data from .ejs to js ?

#

Just a string

west raptor
#

If you just want to get the JavaScript contents you would have to parse and remove everything else

earnest phoenix
#

@west raptor actually im trying to save my toggle button checked data on db.
Im stuck from 4 days

west raptor
#

Oh I see

#

Why can't you do that in the .ejs

earnest phoenix
#

All times its undefined db

quartz kindle
#

you can pass data into an ejs file

#

render(ejsfile,data)

#

the other way around is more complicated because ejs is supposed to be like html, to render and send

#

but you need to explain better what you're trying to do

#

because ejs is rendered server side

#

so you mean save something to a database during rendering while still on server side?

#

or do the database thing on the client side after the user receives it and uses it?

earnest phoenix
#

Im trying to save a toggle switch button data on firebase

quartz kindle
#

when a user clicks on it?

earnest phoenix
#

Yes

quartz kindle
#

thats client side code

#

has nothing to do with ejs

#

you probably want to use ajax for that

earnest phoenix
#

But that button inside .ejs

quartz kindle
#

it doesnt matter

#

ejs is a rendering file

#

the file will get converted into html/js/css

#

and sent to the user

#

the user doesnt receive ejs, he receives html/css/js

earnest phoenix
#

And how lt possible with ajax

quartz kindle
#

when a user clicks the button, the button executes js code and sends data to the server

#

this is browser javascript, not server javascript

#

like a .js file that you put in your <script> tags

#

so you need to do something like <button onclick="js function">, or have a <script>document.querySelection("button").addEventListener("click", function())</script>

earnest phoenix
#

Wait ill show you my code

quartz kindle
#

and then the function must be in ajax (asynchronous javascript execution) if you dont want the page to reload

#

and ajax has a million of security vulerabilities by the way so its not easy to protect

#

also make sure you dont send any authentication or api key to the client

earnest phoenix
#

manage.ejs

<script>
          var input = document.getElementById('toggleswitch');
          var outputtext = document.getElementById('status');
          var db = <%db%>

            input.addEventListener('change',async function(db, guild, guildID) {
            if(this.checked) {
              outputtext.innerHTML = true;
              db.ref(`servers/<%=guildID%>`).update({
                  autojoin: true
                }).catch(function(err) {
                  console.log(err + "\n\n\n");
                });
            } else {
              outputtext.innerHTML = false;
              db.ref(`servers/<%=guildID%>`).update({
                  autojoin: false
                }).catch(function(err) {
                  console.log(err + "\n\n\n");
                });
            }
               
          });

          </script>

deshboard.js

app.get("/manage/:guildID", checkAuth, async (req, res) => {
    const guild = bot.guilds.get(req.params.guildID);
    if (!guild) return res.status(404);
    const isManaged = guild && !!guild.member(req.user.id) ? guild.member(req.user.id).permissions.has("MANAGE_GUILD") : false;
    if (!isManaged && !req.session.isAdmin) res.redirect("/");
    const autojoin = (await db.ref(`servers/${guild.id}`).child('autojoin').once('value')).val();
    renderTemplate(res, req, "manage.ejs", {
        guild: guild,
        guildID: guild.id,
        db: db,
        autojoin: autojoin
      
    });
  });
#

error is db.ref is not a function

quartz kindle
#

that will never work

earnest phoenix
#

then ?

quartz kindle
#

look

#

imagine a discord bot

#

what you are doing is like doing message.send(db)

#

on discord

#

you're trying to send the database connection to the client

earnest phoenix
#

Ah

quartz kindle
#

because ejs is like message.send()

earnest phoenix
#

How should i do this

quartz kindle
#

as i told you, you need to write client side code

nimble steppe
#

help me

#

please

#

invites manager

earnest phoenix
#

@nimble steppe wait plz

nimble steppe
#

ok

quartz kindle
#

what you are writing inside the <script> tags will be sent to the user and executed on the users computer

#

the user's computer is not your server, it has no variables no databases, nothing

nimble steppe
#

@earnest phoenix ?

earnest phoenix
#

Ah right

summer torrent
#

@nimble steppe what is your problem

nimble steppe
#

Invites maganer

#

is my server offline

#

!invites

#

no

#

?invites

#

no

#

$invites

#

no

earnest phoenix
#

So i need to pass that data to my server right ?

quartz kindle
#

????

solemn viper
#

i invited the bot to my server

summer torrent
#

go to support server of inv manager

solemn viper
#

and it s offline

#

invite?

earnest phoenix
#

@quartz kindle

summer torrent
solemn viper
#

i can t join

quartz kindle
#

@earnest phoenix you need to code a script to be executed on the user side that does everything: listen to the button click, create an http request back to your server, send data to your server

#

and then in your server you need to have an endpoint to accept it

nimble steppe
#

@summer torrent i'm banned on this server

solemn viper
#

me too

#

wtf

summer torrent
#

¯_(ツ)_/¯

#

DBL isn't a support server for bots

solemn viper
#

it s from discord a friend invited me on a server and i had the same problem

earnest phoenix
#

Im confused i really dont know how to send data from client side to my server side

nimble steppe
#

bro

#

help

quartz kindle
#

@solemn viper you created a bot and invited it to your server? thats all you did?

summer torrent
#

do you understand?

earnest phoenix
#

@nimble steppe plz wait some sec.

nimble steppe
#

om

#

ok

quartz kindle
#

@nimble steppe help with what? we are not "invitemanager" this server is not the invitemanager server

summer torrent
#

He says invitemanager is offline

earnest phoenix
#

@quartz kindle bro is this right way?

<form action="/" method="POST">
  <input type="hidden" name="autojoinbtn" id="toggleswitch" value="">
</form>
quartz kindle
#

that is one way to do it

#

a <form> tag will automatically send the the contents to the url in the action when the submit button is clicked

#

but that is not ajax, that will reload the page

#

like clicking a link

earnest phoenix
#

Oh

quartz kindle
#

there are a million different ways to do it

#

you can use a <form> and overwrite the action with preventDefault()

#

or you dont need a form at all, you can add a click listener on any kind of tag

#

or any other kind of listener

#

basically what you want is:```js
<someElement>.addEventListener("click/change/whatever", function() {
create a new http request here
you can use the Fetch API or use XMLHTTPRequest
})

earnest phoenix
#

Ok and where i listen that request ?

quartz kindle
#

and in your server code you add .post("/ajax/autojoin", (res,req) => {})

earnest phoenix
#

Ok i understand but i will be new page

quartz kindle
#

yes, its a new page, but you dont need to send anything

#

the ajax will connect to it without reloading the page

#

and your new page will receive, do something, and optionally respond

#

and the ajax will do something with response or not

#

all in the background of the page

earnest phoenix
#

Is ajax easy for bigginer

quartz kindle
#

no

#

but its not super hard

earnest phoenix
#

Ah

#

Ok ill read docs now

#

And heartly thanks tim brother

quartz kindle
#

👍 good luck

modest maple
#

Ajax is good but can be a pain for some other systems

earnest phoenix
#

Is the site fixed

#

Can someone pls tell at which position my bot is in the waiting list for checking for the add bot

sinful lotus
earnest phoenix
#

So there is a chance that my bot never gets reviewed?

#

.

quartz kindle
#

i dont think that will happen, applications are probably time-stamped and they will see if there is an application that's been waiting for a long time

modest maple
#

And they're mostly done in order of being added

earnest phoenix
#

Ok

#

Thats a gud thing

stable horizon
#

@earnest phoenix it's against tos. That's why we don't do it. There's no philosophy or other shit. It's simply because it's against tos.

earnest phoenix
#

...

stable horizon
#

Mate I don't know what other shit you want

earnest phoenix
#

Hey @quartz kindle i got the time now to try the code you sent but i get this error

wet scroll
#

Anyone got any advice on fixing the following error

#

Error: socket hang up
at connResetException (internal/errors.js:570:14)
at TLSSocket.socketOnEnd (_http_client.js:440:23)
at TLSSocket.emit (events.js:215:7)
at endReadableNT (_stream_readable.js:1184:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)

unique nimbus
#

That is most likely Discord being a dick

#

It is trying to connect to something but timed out

quartz kindle
#

@earnest phoenix whats User-profile.js line 43? if its rows[0] that means an entry was not found in the database, unless you did something wrong

earnest phoenix
#

i managed to fix it now 😁 thanks for all your help Tim

floral bloom
#

JavaScript
How do I delete a whole JSON file? I know how to create a new JSON file with code, but I don't know how to delete one with code. I've Googled and found nothing helpful.

Please ping with response since I have this server muted.

modest maple
#

just like you would delete any normal file tbh

#

i imagine

floral bloom
#

I'm using this to create a file. I can't do it manually. It needs to be automated.

fs.writeFile(`guilds/${guild.id}/settings.json`, defaultSettings);

I just need to know how to delete the file.

modest maple
#

im guessing maybe that link might help

mossy vine
#

that isnt node

floral bloom
#

^

mossy vine
#

i literally sent a link

#

to the docs

#

where it describes the function

#

and even gives an example

floral bloom
#

Ah, thanks. I didn't see that.

earnest phoenix
#

@modern sable ads

restive furnace
#

no?

#

they're refering to helping pages

#

they're not ads...

earnest phoenix
#

there was ads

#

but a mod deleted the ad

restive furnace
#

kk

green kestrel
#

Ok so im just looking to vent for a few mins. Please check out my scything sarcasm below.

I present to you... the generic bot list (not top.gg).
It's written in node.js and is a fork of someone else's bot list. It runs on glitch, but eventually I'll get a $3 VPS and run it there as root.

For a database I'll use a JSON database.

I'll make sure to cover it in ads.

My server will be full of drama where I bicker alongside other list devs.

At the bottom of all sites will be a protected by DMCA notice even though I'm not even American.

/S. 👍 😁 comments welcome.

#

And yeah I'm not picking on anyone in Particular, just making fun of the culture that seems to spring up around discord bot lists in general.

floral bloom
#

Am I creating a .json file correctly? Because it doesn't seem to be working.

fs.writeFile(`guilds/${guild.id}/settings.json`, defaultSettings);
modest maple
#

doesnt json have its own system rather than writing to it like a txt file

wooden lance
#

wait a minute is that json being used as a database??

floral bloom
#

I don't know, I'm using Glitch. Every time my bot joins a server, I want to create a new file. And when it leaves/is removed a server, I want it to delete that file. I haven't used json this way before, so I'm confused.

#

Directed to @modest maple

modest maple
#

oh god

floral bloom
#

@wooden lance Well, yes.

modest maple
#

right

#

im stopping u there

wooden lance
#

Why don't you just use a database?

modest maple
#

dont use json

green kestrel
#

Lol, glitch makes good devs do bad things

wooden lance
#

Yes dont

modest maple
#

user a DB

wooden lance
#

it bad

#

yes use db

modest maple
#

dont even bother starting with a json it will kill you in the future

wooden lance
#

you are taking the words right out of my mouth

#

yes

#

dont

floral bloom
#

Well...

#

A friend and I are programming the bot on Glitch and then exporting the code to GitHub.

#

But json should be able to work.

wooden lance
#

But still, dont use a db

#

it gets easily corrupted

earnest phoenix
#

use a db don't use json

green kestrel
#

Wait wut someone's using glitch for its intended purpose of collaborative prototyping?!?!

floral bloom
#

We may need to transfer to a better database in the future...

green kestrel
#

What the hell the world's gone all right

wooden lance
#

If you don't understand or dont want to learn how to interact with a db just use something like enmap

earnest phoenix
#

json file collation is not a database and can't be compared to one because it's simply too poor in performance

wooden lance
#

and breaks when ever you write to it

floral bloom
#

I've tried so many databases, and even tried enmap, in the past, but it has always failed me. JSON is the only thing that has worked.

earnest phoenix
#

enmap is glorified Map

#

it's trash

#

enhanced map xd

wooden lance
#

works for me

green kestrel
#

I have two file types in my bot that are JSON: it's config file, and help files. The help files are just raw embeds

earnest phoenix
#

buy a server and host a database server on there, that way both you and your friend can use it at the same time while having synced results

green kestrel
#

JSON is fine until you want multi user access, or indexing, or Fk relationship, or atomic access....

uneven wyvern
#

I can't upload Pictures lmao

green kestrel
#

Or replication, or security, or redundancy, or...

floral bloom
#

Oh gosh.

uneven wyvern
#

Index.js

 //requirements
 const fetch = require("node-fetch")
 
 //actual code
 if(options.name === name) {
   var url = `https://www.instagram.com/${name}/?__a=1`
   var res = await fetch(url).then(url => url.json())
   
   let user = res.graphql.user
   console.log(user.username + " found")
 }
}

module.exports = search```

server.js

const {search} = require("./index.js")
search({"name": "thegstwins"})


Err
earnest phoenix
#

search isnt a function

#

but uhm

quartz kindle
#

@uneven wyvern you dont need {search}

floral bloom
#

We don't have a server to host it on at the moment. We may have one, but if not, my friend will keep it online via his computer.

quartz kindle
#

just do search

floral bloom
#

He will back up the JSON files with his drive also.

uneven wyvern
#

@quartz kindle ok wait

#

nothin

quartz kindle
#

btw Ace, no database has "failed" you, rather you probably failed to use them properly :P

floral bloom
#

I always get a bunch of errors no matter what tutorial I follow.

quartz kindle
#

@uneven wyvern what did you change? did you save?

uneven wyvern
#

yes

quartz kindle
#

because tutorials are trash

uneven wyvern
#

even twice

quartz kindle
#

to properly use a database you need to learn how to read documentations

#

and follow that instead

uneven wyvern
#

is it because I have === name?

floral bloom
#

I've tried, but...

uneven wyvern
#

ok solved. But now I get undefined found

quartz kindle
#

@uneven wyvern there are many things wrong with your code, but is its still saying search not found?

#

ok

#

now you need to fix the parameters

uneven wyvern
#

what parameters?

quartz kindle
#

because function({some:thing}) is the same as function(something) its still only one parameter

#

if you want to use two parameters, then properly use two

#

search(name,something)

uneven wyvern
#

so I can basically delete the parameter name?

quartz kindle
#

basically dont make it an object

#

if you use {something:something2} thats not two paramenters, thats one object with a key and a value

uneven wyvern
#

oh fuck now I get invaild-json

quartz kindle
#

what do you have now?

#

show current code

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

quartz kindle
#

roll a random number

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

if smaller than (or bigger than) whatever number is 5% of the max/min number

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

uneven wyvern
#
  //requirements
  const fetch = require("node-fetch")
  
  //actual code
  if(options.name) {
    var url = `https://www.instagram.com/${name}/?__a=1`
    var res = await fetch(url).then(url => url.json())
    
    let user = res.graphql.user
    console.log(user.username + " found")
  }
}

module.exports = search```

Now it says `cannot read property name of undefiend`
quartz kindle
#

in js it would be 0.05

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

quartz kindle
#

@uneven wyvern because you are not passing any options

earnest phoenix
quartz kindle
#

why are you using both name and options.name?

sage bobcat
#

One message removed from a suspended account.

quartz kindle
#

should be the same

sage bobcat
#

One message removed from a suspended account.

uneven wyvern
#

for .../${name}/?__a=1

quartz kindle
#

but why do you need two names? are they two different names?

uneven wyvern
#

.name is actually the username

quartz kindle
#

but you dont need it, do you?

#

you only need one name

#

the name you are searching for

#

so just change your function to async function search(name) {

#

and change your if to if(name) {

#

then call the function like result = await search("username")

uneven wyvern
#

now I got it ty

floral bloom
#

I know people don't recommend it, but how do I create a file? I'm trying:

bot.fs.writeFile(`guilds/${guild.id}/settings.json`, defaultSettings);

But it doesn't work. I've Googled and can't find anything.

mossy vine
#

use a relative path and make sure the directories exist

floral bloom
#

...huh? Sorry, I'm confused.

mossy vine
#

./guilds

#

and make sure the guild id is a folder that exists

quartz kindle
#

what do you mean "doesnt work"? any error? does the file not get created?

#

also, writeFile needs a callback

floral bloom
#

@quartz kindle The file isn't created AFAIK.
Error when trying to access the file:

Cannot find module './guilds/664176673997979649/settings.json'
#

*that's the server ID

quartz kindle
#

have you actually went into the folder and checked?

#

dont rely on your code for that

floral bloom
quartz kindle
#

so the file was created but under a different id?

#

or is that a different file?

floral bloom
#

That's a different file.

#

I don't think the file was ever created.

#
bot.on("guildCreate", guild => {
  let checkSettings = require(`./guilds/${guild.id}/settings.json`);
  if (!checkSettings || !checkApps) {
    let defaultSettings = {
      "prefixes": ["/"],
      "inServer": true
    };
    bot.fs.writeFile(`guilds/${guild.id}/settings.json`, defaultSettings);
  } else {
    checkSettings.inServer = true;
  }
});
```This is the whole code.
quartz kindle
#

again, writeFile needs a callback

#

its an async function

#

unless you use writeFileSync

#
fs.writeFile('message.txt', data, (err) => {
  if (err) throw err;
  console.log('The file has been saved!');
});```
#

also, as far as i know, trying to require a non-existent file will throw an error

#

so doing if(!requiredfile) wont really work

#

you need to try/catch it

#
let file;
try {
  file = require(..)
} catch(e) {
  file = {
    // default settings
  }
}```
floral bloom
#

🤷‍♂️ Still nothing.

quartz kindle
#

then you're still doing something wrong

floral bloom
#
bot.on("guildCreate", async guild => {
  
  let checkSettings, defaultSettings;
  try {
    checkSettings = require(`./guilds/${guild.id}/settings.json`);
  } catch(e) {
    defaultSettings = {
      "prefixes": ["/"],
      "configAt": "channel",
      "inServer": true
    };
    
    fs.writeFile(`guilds/${guild.id}/settings.json`, defaultSettings, (err) => {
      if (err) throw err;
      console.log('The file has been saved!');
    });
  }
  
  checkSettings.inServer = true;
  
});
vital lark
#

is there any error thrown

#

does it print file has been saved?

floral bloom
#
bot.on("guildCreate", async guild => {
  
  let checkSettings,checkApps, defaultSettings;
  try {
    checkSettings = require(`./guilds/${guild.id}/settings.json`);
    checkApps = require(`./guilds/${guild.id}/applications.json`);
  } catch(err) {
    defaultSettings = {
      "prefixes": ["/"],
      "configAt": "channel",
      "inServer": true
    };
    
    fs.writeFile(`guilds/${guild.id}/settings.json`, JSON.stringify(defaultSettings), err => {
      if (err) console.log(err);
      console.log("File saved.")
    });
    fs.writeFile(`guilds/${guild.id}/applications.json`, JSON.stringify({}), err => {
      if (err) console.log(err);
      console.log("File saved.")
    });
  }
  
  checkSettings.inServer = true;
  
});
#

😩

#

I don't know why it won't work.

#

Gosh.

sudden geyser
#

is that the full stacktrace trace in red? You don't return if there was an error in the callback, so it'll log "File Saved." regardless. Are you possibly requiring ./guilds/.../settings.json somewhere else in your code

floral bloom
#

@sudden geyser I didn't have return but yes, I require it in the message event lower down.

#

🤷‍♂️

sage bobcat
#

One message removed from a suspended account.

floral bloom
#

@sage bobcat Yes.

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

marble juniper
#

so

sudden geyser
#

wdym (dvsaezi)?

marble juniper
#

no text file databases

#

on glitch

#

well I have an api and such

#

wich makes an image each time you submit an url to a certain path

sudden geyser
#

@sage bobcat I'm pretty sure glitch does.

#

I think you're talking about it not appearing on the sidebar but it's still there

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

sudden geyser
#

You need to check if it's 5 or lower as 0.05 will never be true

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

sudden geyser
#

you're checking if it's exactly 5. That's not a 5% chance; that's a 1% chance

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

topaz fjord
#

very good js

earnest phoenix
small prairie
#

if I Insert a client.on message event in and client.on channel create how can i exit it from both the events?
d.js

lament meteor
#

there is a removeListener function iirc

earnest phoenix
#

What does this mean?

FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal.
sudden geyser
faint grove
#

how do i send a embed with a image?

quartz kindle
#

Its a v8 error, are you coding a native C addon? If not, inform the developer of the library youre using

#

@faint grove use an attachment

faint grove
#

hoe lol

#

how*

quartz kindle
#

What library?

faint grove
#

idk

quartz kindle
#

What language?

faint grove
#

js

quartz kindle
#

discord.js or eris?

faint grove
#

discord.js

quartz kindle
#

Thats the library

faint grove
#

oh

#

so like an addon?

earnest phoenix
#

Use it’s richembed builder

quartz kindle
#

Yes, now look at discord.js's documentation

faint grove
#

i try .setImage(message.author.avatarURL) but that doesnt work

#

i have 5 errors in doing so

quartz kindle
#

As i said, check the documentation

faint grove
#

thats what the docs said to do :/

quartz kindle
#

It explains how to use setAttachment

copper cradle
#

@faint grove send the error

grizzled raven
#

isnt it displayAvatarURL?

heavy grotto
#

Can anyone here help me think about the design for linking discord accounts to usernames on a website?

minor kelp
#

Trying to make a token command that sends a token to the mentioned user via Direct Message, But i keep getting TypeError: 'Member' is not iterable
Code:

    @commands.command(name='vtk')
    async def vtk(self, ctx, *, member: commands.Greedy[discord.Member]):
        vtkn = await client.bot_token()
        for m in member:
            await m.send(f"Hey! Your token is here, {vtkn} \nPlease DM SBot V3 and tell him your token, then he will whitelist you.")
slender thistle
#

Uhh

#

You can't iterate over Member

minor kelp
#

Then what do i do?

slender thistle
#

You have member variable that is an instance of Member

minor kelp
#

Yes.

slender thistle
#

So use member.send

minor kelp
#

so

#

i dont need

#

for m in member:

slender thistle
#

Correct

minor kelp
#

Well then

#

Thx

heavy grotto
#

Can anyone here help me develop a discord bot? Would be a paid project

minor kelp
#

What language

#

Gotta specify that.

earnest phoenix
#

English

minor kelp
heavy grotto
#

@minor kelp The website is coded in PHP, but I can forward it to any language that you use. Preferably Python but I can work with NodeJS I believe

minor kelp
#

I mainly use Python.

heavy grotto
#

Nice, I will DM you the details and if you are interested we can proceed. If not, no worries.

minor kelp
#

Alright, DM me, i'll have a good read

restive furnace
#

i mainly use .net/c#

floral bloom
#

Is there anyway that I can add mySQL on an Acer Chromebook?

#

Ping with response, please.

minor kelp
#

@floral bloom Chromebook uses ChromeOS

floral bloom
#

Hm, okay.

#

Thanks.

#

That's what I thought...

grizzled raven
#

shouldve picked source code then they wouldve just given you what you needed to do

heavy grotto
#

Is it possible to change this "BOT" text?

minor kelp
#

No.

heavy grotto
#

Thank you

earnest phoenix
#

what uh

#

event is on bot join

#

with guild info

mossy vine
#

guild_create?

heavy grotto
#

Anyone have any rules designed neatly? Looking for neat/stylish designs to text posts

pulsar lava
#

Yes

earnest phoenix
#
require('axios').get('https://api.ksoft.si/images/rand-reddit/panda' , {headers: {'Authorization': 'Bearer '+ksoftToken}}).then(res => {
      const e = new Discord.MessageEmbed()
      .setColor('RANDOM')
     .setDescription(Image not showing? Click [here](`${res.data.image_url}`) !)
      .setImage(res.data.image_url)
      .setTimestamp()
        .setFooter("Command Ran By: " + message.author.username, message.author.avatarURL());
message.channel.send(e)
});
#

Where is the error

#

ERROR :
SyntaxError: missing ) after argument list

late hill
#

the description

uneven wyvern
#

.setDescription @earnest phoenix

earnest phoenix
#

The `` are missing coz I copy paste the code

uneven wyvern
#

You need to add a ) at setDescription

late hill
#

oh

#

Are you sure the error is being thrown by that piece of code

uneven wyvern
#

Error: (node:2585) UnhandledPromiseRejectionWarning: FetchError: invalid json response body at https://www.instagram.com/accounts/login/ reason: Unexpected token < in JSON at position 0

Index.js ```async function search(name) {
//requirements
const fetch = require("node-fetch")

//actual code
if(name) {
var url = https://www.instagram.com/${name}/?__a=1
var res = await fetch(url).then(url => url.json())

let user = res.graphql.user
console.log(`Found ${user.full_name} with ${user.edge_followed_by.count.toLocaleString()} Followers`)

}
}

module.exports = search```

modest maple
#

Invalid JSON

grizzled raven
#

@earnest phoenix message.author.avatarURL);

earnest phoenix
#

how do people keep making up their own properties on (invalid) objects lmao

#

this just keeps on amusing me more and more

slender thistle
#

They return undefined, meaning they aren't erroring out -> it's fine

earnest phoenix
#

who?

slender thistle
#

Nonexistent properties

earnest phoenix
#

ah yeah

#

but still

#

it's funny how just because js is not oop and doesn't error out, people think that their own made up props will be filled

slender thistle
#

Don't try to understand that logic or you'll get used to it :^)

uneven wyvern
#

@modest maple it worked yesterday

earnest phoenix
#

the response is in html

#

not json

#

and if you had the effort to actually look at the error, you would have realized you got redirected to the login page

#

@grizzled raven v12 is different

grizzled raven
#

oh wait

#

my bad

#

didnt see it was a part of the footer

#

well then read the error

earnest phoenix
#

What ) is missing

#

I tried adding one like in every line / everywhere it gives me unexcepted token

grizzled raven
#

show the whole file

#

actually nvm

earnest phoenix
#

Hello is there any workaround for YouTube Bots? My YT won't play some songs anymore due to youtube changes

modest maple
#

wdym

#

you cant play the automatic user playlist song link

earnest phoenix
#

wym with this

#

bot just joins the channel and then quits instantly without any error on some videos

modest maple
#

you using LL?

earnest phoenix
#

LL?

#

xD

#

bit brain afk

modest maple
#

lavalink

slender thistle
#

LavaLink

valid frigate
#

doesnt lavalink have issues now because of api changes

earnest phoenix
#

no I don't use it

valid frigate
#

quit as in leave the voice channel?

twilit rapids
#

The force disconnecting a bot while connected is not handled yet with the changes, only creates and error and handles the rest fine

earnest phoenix
#

so is there any way now for me?

#

xd

twilit rapids
#

Lavalink is still fine

#

I think you're talking about being banned by YouTube because you're sending to many requests

earnest phoenix
#

I don't think that I'm banned

#

because some videos still works

#

but videos for example from VEVO won't work xd

twilit rapids
#

They might be blocked in your country

earnest phoenix
#

nope they aren't

twilit rapids
#

What are you using to search and stream the songs

#

And of course, what language and library are you using

blissful scaffold
#

do you use a library to play youtube songs, or did you write it yourself?

valid frigate
#

i dont think he wrote an entire wrapper

#

and id assume javascript

blissful scaffold
#

he said he isnt using LL

twilit rapids
#

Still many others that can stream

earnest phoenix
#

yeah javascript

valid frigate
#

i guess

#

ytdl-core

earnest phoenix
#

and ytsearcher for search

#

yes ytdl

valid frigate
#

youtube is funny like that

quartz kindle
#

video might be blocked in your vps's country

earnest phoenix
#

nope it isn't

valid frigate
#

wouldnt ytdl give an error message

twilit rapids
#

Yes it would

earnest phoenix
#

tested my bot in finnland and in germany

valid frigate
#

yeah so is there any error in your console when trying to play music

blissful scaffold
#

Maybe check if there is an uncaught error that makes your bot disconnect from the voice channel

earnest phoenix
#

nope there isn't any error

valid frigate
#

???

blissful scaffold
#

maybe you catch an error and dont log it?

earnest phoenix
#

I used another bot from github just to test if it works

valid frigate
#

in these cases there would usually be an error message

#

bruh

earnest phoenix
#

and it doesn't work either

valid frigate
#

might be a problem with your firewall?

#

if all bots dont work

earnest phoenix
#

nah

#

firewall disabled on win server

valid frigate
#

my guess is it can't download the track for whatever reason

#

but dont quote me on that

blissful scaffold
#

try from the same PC if the URL that doesn't work with your bot works with your browser

earnest phoenix
#

did it already

#

it is for example this video: https://www.youtube.com/watch?v=UZwi9SHgzGY

twilit rapids
#

Let me try to play it

earnest phoenix
#

bot joins -> disconnects

twilit rapids
#

Hm works, and you're sure that other tracks do work?

earnest phoenix
#

yep

blissful scaffold
#

and that song never works, or does it sometimes work?

earnest phoenix
#

this song/meme works for example: https://www.youtube.com/watch?v=6Dh-RL__uN4

#

the 1st song will never work

quartz kindle
#

add breakpoints, check all steps of the code, try to find where exactly the failure is

earnest phoenix
#

uff :(

#

just for example I tried this src: https://github.com/the-jame/shaqbot

west spoke
#

just do <url>

#

good lord

earnest phoenix
#

;)

#

tested it with discord.js-musicbot-addon and ytdl-core

#

thank you for your help I fixed the problem

split hazel
#

Is there any nice way to convert sqlite3 dump into mysql-compatible queries?

modest maple
#

im pretty sure SQLlite db's and mysql db's are cross compatible

split hazel
#

trust me i tried

#

they have multiple differences

modest maple
#

there SQL queries are both identical tho

split hazel
#

for example mysql uses single quote for string while sqlite3 can use doube

#

they cant be indentical, they have to be exact

#

mysql wont accept "identical"

earnest phoenix
#

I got this message (node:30697) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added. Use emitter.setMaxListeners() to increase limit and im confused on how I fix it

#

Could I get some help? please

sudden geyser
#

by not using as many message listeners? how are you adding them?

earnest phoenix
#

stop creating a new handler for each command

#

ok

#

handle your commands in one listener only

#

ill try that

earnest phoenix
#

how can I get youtube channel name from a video?

#

is there any npm package?

summer torrent
#

youtube-search

earnest phoenix
#

are u sure lmfao?

unique nimbus
#

I mean youtube-dl can also

#

Most likely

earnest phoenix
#

hmm then I am maybe too retarded rn

outer niche
#

How can I change this to make it to where my bot is streaming not do not disturb

await bot.change_presence(status=discord.Status.dnd, activity=discord.Game('hello all'))

modest maple
#

the same way you do dnd

#

just

#

as streaming

outer niche
#

Yes but when I put it in I streaming It does not work

modest maple
#

its discord.Streaming

#

altho it might still need .status.streaming for you and you just havent given it a url

outer niche
#
Traceback (most recent call last):
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.7/site-packages/discord/client.py", line 270, in _run_event
    await coro(*args, **kwargs)
  File "<string>", line 10, in on_ready
AttributeError: type object 'Status' has no attribute 'streaming'```
modest maple
#

well then .Streaming it is

outer niche
#
Traceback (most recent call last):
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.7/site-packages/discord/client.py", line 270, in _run_event
    await coro(*args, **kwargs)
  File "<string>", line 10, in on_ready
AttributeError: type object 'Status' has no attribute 'Streaming'```
#

Sam exact error

modest maple
#

its discord.Streaming
altho it might still need .status.streaming for you and you just havent given it a url

Read this again

#

we have established that status.streaming is no

outer niche
#

So that

modest maple
#

well yes but actually no

#

Capital letters

#

Streaming requires a url

#

this is all listed on the docs

earnest phoenix
#

@unique nimbus can u maybe help meh?

unique nimbus
#

what

#

oh

#

I am not a js dev

#

look at docs

#

trial and error

modest maple
#

we are le python devs

earnest phoenix
#

LeAvE mE AlOnE

#

xD

amber fractal
#

This isnt bot development obviously mmLol

lilac wharf
#

So why ask it then...?

vital lark
#

you can ask about anything here iirc

amber fractal
#

you can afaik

#

people get redirected here for any development

lilac wharf
#

Okay this might seem like a stupid question but I just can't figure this one out:

I'm currently working on a system to do with levels and I'm trying to implement when they hit every 10 minutes they will increase a level but I just can't figure out how to do it without listing all levels (trying to do it to not hit a max level),
All that's coming to my head is something like this [which I know is a stupid method]

let level1 = 600;
if (_user[variable].time == level1) _user[variable].level = 1;

which is what I'm trying to avoid due to how irritating it will be with having to add each and every level...

Something which checks for each minute for example:

if _user[variable].time = 1200 that will then automatically change the level to 2
if _user[variable].time = 12000 that will then automatically change the level to 20
(Hopefully that should explain and help to get the gist of it)

If anyone has any ideas that'll be gratefully appreciated,
Thanks.

late hill
#

Just divide by 600?

lilac wharf
#

crap I'm an idiot...

late hill
lilac wharf
#

Thanks for that, I'm just going to go on the walk of shame now...

real cedar
lilac wharf
real cedar
#

rip 1 hour of work

#

what do I need to improve on it

lilac wharf
#

For me personally it's

The lack of support for PC-built browsers (screenshot will be provided below)

The layout of the site
What I mean by this is that it's all compiled into one page instead of separating it out like into
Different pages for example: Home (index.html) - Staff (Staff.html) - About (About.html) - Support (Support.index)

The Color Scheme
Gradient light and dark blue just doesn't go well with a discord grey color in my opinion, Try actually sticking to Discord's color scheme is my suggestion (can be found here: https://discordapp.com/branding)

real cedar
#

OK

#

Ill fix the color

#

And Ill do that layout

lilac wharf
real cedar
#

Im getting hosting and a domain

#

this was just while Im getting it ready

stable osprey
#

I already have freehosting.

lilac wharf
#

When I say don't use glitch.me I mean don't use them at all.

stable osprey
#

Lmao.

real cedar
#

from where?

stable osprey
#

A new upcoming web hosting service. It's decent.

#

But it get's the job done.

real cedar
#

wahts the hosting link

#

and where did u get your domain'

stable osprey
#

From the hosting service.

#

it provides free sub-domains.

real cedar
#

sick

#

when will it be released

lilac wharf
#

Except it doesn't offer HTTPS yet does it Aniwuey?

stable osprey
#

What?

#

No it does not.

real cedar
#

whats the link to the site

stable osprey
#

Possibly.

#

Am i allowed to post it here?

#

I don't know.

real cedar
#

Dm me it

lilac wharf
#

I don't believe it breaks a rule...

blissful scaffold
#

I think you are allowed to post a link when someone asks for it, but if you are afraid it isn't allowed then you can DM the person

stable osprey
#

Oh. Yas

#

@real cedar Your going to have to accept my friend request. Due to me settings

#

I'll try to fix them one second

#

I posted it in your DM's

outer niche
#

How would I go about making a prefix for @bot and not !

stable horizon
#

Lang?

#

Lib?

outer niche
#

Python

stable horizon
#

I'll assume dpy then, use commands.when_mentioned

outer niche
#

Ok

modest maple
#

Read the docs if you want it for cogs and if you don't wanna use cogs for it then learn the basics of python

vague chasm
green kestrel
#

hmmm

#

can someone please offer me a bit of feedback on how i can improve this? https://github.com/braindigitalis/botnix-discord-cpp/wiki/Advanced-Chat-Commands#Embeds

I chose json because it easiest represents the embed format, but isnt that user friendly for non-programmers. however, any other format i pick is also not too friendly once i go into the realms of inline fields etc, and arrays of objects inside objects.

Thoughts?

I'm also considering adding a generator to my dashboard for them.

bitter sundial
#

but isnt that user friendly for non-programmers

how so? I've seen non-programmers being able to follow json easily without any explanation

fresh mural
#

The only issue I've had with that sort of thing is embedding the bot prefix in the embeds, but that's just running it through a very simple template engine

green kestrel
#

so youre saying im not giving people enough credit if i asssume they'll all go "meh too hard"

#

😛

#

@fresh mural how do you mean embedding the bot prefix?

fresh mural
#

Some of my global embeds include examples of commands to be ran and the bot prefix is configurable

modest maple
#

Just have the prefix as a var and format the strings

fresh mural
#

That's exactly what I did :P

#

Just made it slightly more complex than it should have been

modest maple
#

I mean it is only string formatting

#

Like it's one thing

fresh mural
#

If I were to do something more complex, Jinja2 might have been a decent idea

restive furnace
#

Whats the point of doing it complex way, even tho there is simplier way, and doing so, it may lead eventually into problems

modest maple
#

There's a saying

#

"Keep it stupid simple"

plucky briar
#

is it possible that once the bot has been added it gets redirected to a url?

modest maple
#

wdym

#

oh you mean like a redirect url after the oauth

plucky briar
#

ye

#

here they do write You'll also notice the absence of response_type and redirect_uri. Bot authorization does not require these parameters because there is no need to retrieve the user's access token. but it doesn't require but can it be used?

modest maple
#

i believe so

#

oauth2 does allow for a redirect url

plucky briar
#

then what did i do wrong?

modest maple
#

i cant remember the extension on the url you do for the redirect

slender thistle
#

redirect_uri is life

plucky briar
#

well that's the issue i added the redirect_uri but it ain't working

slender thistle
#

How did you add it

wheat jolt
#

@plucky briar where did you add

#

Redirect_uri

#

In the url?

plucky briar
#

yes

#

&redirect_uri=http%3A%2F%2Flyfe.tk%2Fhome.php

wheat jolt
#

You also have to add it on the app

#

On the oauth section

plucky briar
#

i've

wheat jolt
#

And what error

#

Do you get

plucky briar
#

once i've added the bot?

#

none

#

just Authorized with a green tickYes

wheat jolt
#

Give me the url

plucky briar
golden condor
#

I am tryna setup a gitbooks site, does anyone know what URLs on pages look like

modest maple
#

well all you get is a subdomain

#

you cant exactly choose exactly how you want it

golden condor
#

Yeah but would a page be whatever the title is

#

Like example.gitbooks.io/page

modest maple
#

yh

restive furnace
#

except main page

#

it would be just the url or home idk

plucky briar
#

@wheat jolt did you figure it out yet?

wheat jolt
#

Nop

#

Sorry

plucky briar
#

ain't no thing

#

i'll ask discord

lusty quest
#

is there an way to have an Or in js without that only use one of the options? like having 2 member ids and if one of them is valid that use this one and not just outputs invalid.

mossy vine
#

so you want to check if a user id is one of two ids or not?

lusty quest
#

currently when i try to use || in an if statement only one of them is used but the output is still invalid bcs the other id is invalid

quartz kindle
#

|| checks if the value is "truthy"

#

an id is a string, and a string is a truthy value

#

as opposite to a "falsey" value, such as "" 0 null undefined

#

etc

lusty quest
#

hmm. What i wanted to do is a small override for certain commands that should be either aviable for the Guild owner or the Botowner (set an id for this in my configs)

#

|| always gives me invalid

quartz kindle
#

so in fact you want if (id === guildowner || id === botowner)

lusty quest
#

yes

quartz kindle
#

then || should work

#

how did you do it?

lusty quest
#

it doesnt

#

one moment

mossy vine
#

[guildowner, botowner].includes(id) maybe?

lusty quest
#

is the current way i try it

quartz kindle
#

in this case, you need to use &&

#

because its like this

lusty quest
#

interestening. i looked up the docs for Or and i got || as answer

quartz kindle
#

IF author id is NOT EQUAL to owner id AND author id is NOT EQUAL to bot owner -> return

#

you want the error to happen if NOT AND NOT

lusty quest
#

thanks.

quartz kindle
#

you would use || if you would use ===

#

but you're using !==

#

so the logic changes

lusty quest
#

makes sense

#

i was still thinking on my Days in Lua where or was doing what i wanted to do here

blissful scaffold
#

I don't know any language where the logic is like you described, since it wouldnt be logical

lusty quest
#

maybe i just need sleep

#

idk

blissful scaffold
#

could be I also start to make a ton of mistakes when im tired

warm marsh
#

Does anyone know how to use .htaccess?

amber fractal
#

stackoverflow answers do

warm marsh
#

Thanks

slender chasm
#

Hey! I've never really been able to figure out because i just use try {}catch(err){}, but how do you catch a missing permissions error?

twilit rapids
#

Instead of catching it, you could check if your bot has the required permissions to do X action before you try to do it

slender chasm
#

true.

#

Hey how would I handle the members, when dealing with messages I just use messages.forEach()

#

but it says that isn't a function for members.

radiant basin
#

For some things you can't check if your bot has permissions to do X and you're forced to catch the error (e.g. when trying to send a direct message to a user and the user has DMs disabled or blocked the bot). Libraries typically throw an exception (or reject the promise in JS) when an API error occurred, so you will either want to append .catch(callback) to the promise or make the scope asynchronous, as try/catch blocks don't catch promise rejections unless the inner scope is async

slender chasm
#
message.guild.fetchMembers().then(members => {
  members.forEach(...);
});```
#

that wouldn't work.

#

How would I do this

#

even moreso how do i tell if that person owns the guild o.o

#

i don't normally work with fetch stuff.

radiant basin
#

if you've got the user ID, you can compare it to guild.ownerID (or whatever library you're using)

slender chasm
#

the guild owner isn't cached and causes a crash.

radiant basin
#

are you using discord.js

quartz kindle
#

what are you trying to do exactly? sending a message to all members is a no no no

summer torrent
#

@slender chasm client.fetchUser(message.guild.ownerID)

outer niche
#

How can I make a prefix so this way I can @ my bot instead of using !

lilac wharf
#

what language?

earnest phoenix
#

check for <@id> and <@!id> too

#

alongside your generic prefix

twin pendant
#

Some update changed the mentions so it's the <@!id> one

earnest phoenix
#

some platforms still use both

summer torrent
#

use isMentioned (if djs)

earnest phoenix
#

eg androids

lilac wharf
#

Both still work my dude.