#development

1 messages · Page 634 of 1

brave anvil
#

I’m cute

#

?

low wasp
#

yes

brave anvil
#

UwU

pallid zinc
#

Thanks

earnest phoenix
#

@pallid zinc setInterval

#
 message.channel.send("(~‾▿‾)~ ")
.then(msg => {
msg.edit("~(‾▿‾~) ")
}, 15000) // time in ms 15000 = 15s
}
#

Or this

pallid zinc
#

thanks it is done

peak quail
#

This "Code" creates/sets Override for all channels, right?

message.guild.channels.forEach(async (channel, id) => {
await channel.overwritePermissions(Muterole, {
SEND MESSAGES: false,
ADD_REACTIONS: false,
SEND TTS MESSAGES: false,
ATTACH_FILES: false,
SPEAK: false```
sinful lotus
#
try {
  yourCode();
} catch (error) {
  if (error) comeBackAndTellTheError();
  else TellWhatHappened();
}
peak quail
#

OwO

compact sparrow
#

quick question

#

how do i put in websites into the description of a bot

pale marsh
#

iframe

sinful lotus
#

html styling

compact sparrow
#

wassup saya, i mean

#

make it able to display an alternative website

pale marsh
#

Well if you already have one then iframe is the way to go GWcmeisterPeepoShrug

sinful lotus
#

yes just do probably what kef said

compact sparrow
#

does it include the css document

#

or is it just the html which gets transferred

pale marsh
#

I think that's only available to cert devs though? Not quite sure

sinful lotus
#

javascript is cert dev only

pale marsh
#

Html references the css files anyway

#

Ah so it's js

compact sparrow
#

iframe is a part of html5

#

it should work

pale marsh
#

Yeah iframe is a part of html since the beginning of time I think lol

compact sparrow
#

hm

pale marsh
#

What page are you trying to embed?

compact sparrow
#

a specific page i want to say, but i cant

pale marsh
#

DM it to me

compact sparrow
#

ahh, alright

#

wait 1 moment

pale marsh
#

Sure

compact sparrow
#

actually i found the solution just now

#

it's on cloudflare's side

#

they block Iframe requests

pale marsh
#

There you go

compact sparrow
#

you seen similiar issues?

pale marsh
#

No not really. Didn't even think about cloudflare blocking iframes before

compact sparrow
#

alright nvm its on discordbot's side

#

due to ssl key not being the same origin between the servers

#

basically

#

user -> discordbots -> cloudflare -> server

#

doesnt work

#

however user -> cloudflare -> server do work

pale marsh
#

That's odd

compact sparrow
#

indeed

#

i wonder would me stripping off my entire html/css (except for hyperlinks) work

#

or would it cause issues

#

i mean other way is to disable SAMEORIGIN parameter in my SSL

pale marsh
#

You can add the entire html/css to your description, but I'm pretty sure there's a way around it

#

What exactly does it show you when you add it? GWseremePeepoThink

compact sparrow
#

denied connection

pale marsh
compact sparrow
#

no its not an optional setting that u can change around

#

it's either on or off for all sites

pale marsh
#

Hmm

compact sparrow
#

here's the differences

#

and cause it cant verify the cert on the discordbots side (due to 2 request in one go)

#

and discordbots (client) is the one who gets access, but not the user

#

it doesn't work

pale marsh
compact sparrow
#

that's agony, my htaccess file, wherever i put it now again

cerulean haven
#

What is the code for guildBannerURL in stable?

#

I just know there's a bannerURL in master

pale marsh
#

What lib and lang?

cerulean haven
#

discord.js

#

should i use 11.5-dev

slim heart
#

It’s not supported in stable

cerulean haven
#

Oh

slim heart
#

Either go master or do fetches yourself to resolve banner URL’s

cerulean haven
#

I will use 11.5-dev

compact sparrow
#

@pale marsh it should work by default

#

my server doesnt use htaccess

#

its some outdated bs from apache2

#

i use nginx

pale marsh
#

I wouldn't really know tbh. Not an expert when it comes to this GWcmeisterPeepoShrug

compact sparrow
#

i see, well thanks anyways doe ^^

pale marsh
#

Anytime

earnest phoenix
#

rr!developermode

#

wont work

slender thistle
#

Wrong channel

modern sable
#

^

earnest phoenix
#

so which channel>?

west spoke
#

^

#

read rules kbai

modern sable
#

we aren't the support server for a specific bot

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

stone creek
#

.

slender thistle
untold matrix
#

Anyone have a clue on how to use axios?

#

Im unsure and Ive been trying to figure it out

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

west spoke
#

Boi calm down

untold matrix
#

Oh alright I was just asking

west spoke
#

I know it's a whitename but be nice qwq

slender thistle
#

^ Think

sage bobcat
#

One message removed from a suspended account.

pale glen
#

What do you need to do on axios?

untold matrix
#

I just wanna get the data on the JSON file for the bot to output it

warm marsh
#

Quick question, Does anyone know a useful database for storing a json array? I used mysql but for a music command and persistent queue it's not very good.

split hazel
#

Keyv is pretty simple, it's a nice wrapper for sqlite3

#

@keyv/sqlite

warm marsh
#

Aight

#

Keyv uses promises?

#

So .then or await?

amber fractal
#

.then and await both work with promises

warm marsh
#

Yeah I know. But they're required with Keyv?

amber fractal
#

if you dont await a promise or use .then the other code will just continue running which could cause errors

warm marsh
#

Fair.

#

Thanks.

brave ocean
#

Hey

#

How ı connected bot with js

pale glen
#

Why store a music queue on a database?

#

Isnt it better to keep it in memory

pale marsh
#

Depends on whether you want to have persistence of the queue or not after reboots/crashes/etc

pale glen
#

If thats your issue then keep it in memory and update the entire array after every new song/command

#

Just write over it

real helm
#
if(command === "roleinfo"){
    
    let inline = true

    let role = args.join(` `)
    if(!role) return message.reply("Specify a role!");
    let gRole = message.guild.roles.find(`name`, role);
    if(!gRole) return message.reply("Couldn't find that role.");

    const status = {
false: "No",
       true: "Yes"
      }

    let roleemebed = new Discord.RichEmbed()
.setColor("#00ff00")
    .addField("ID", gRole.id, inline )
    .addField("Name", gRole.name, inline)
  .addField("Mention", `\`<@${gRole.id}>\``, inline)
    .addField("Hex", gRole.hexColor, inline)
    .addField("Members", gRole.members.size, inline)
    .addField("Position", gRole.position, inline)
    .addField("Hoisted", status[gRole.hoist], inline)
  .addField("Mentionable", status[gRole.mentionable], inline)
   .addField("Managed", status[gRole.managed], inline)
    
  message.channel.send(roleemebed);

  }
#

why the bot don't detect me the role?

#

who helps?

warm marsh
#

em

#

let role = message.mentions.roles.first()

mossy vine
#

well first of all, .find takes a function

warm marsh
#

Because the way you do it is deprecated.

real helm
#

mmm

#

i go to test it

#

thamks. its working @warm marsh

warm marsh
#

no worries

earnest phoenix
#

How do create a webhook for a bot, to use, me and @bitter night are creating a moniter bot that will send status of the bot to a certain channel.

#

We've made a script m>ons that will make us say the status.

pale marsh
#

So you want to receive webhooks in your bot itself?

earnest phoenix
#

Yes.

#

I know how to create a webhook.

#

With postman.

pale marsh
#

What language is it written in?

earnest phoenix
#

We want the webhook to send the status to our api server.

#

discord.js

pale marsh
#

Create a simple http server in the same instance that's running the bot

earnest phoenix
#

Can I show you the server?

#

Ok.

pale marsh
#

Sure. Don't leak tokens or anything sensitive though

earnest phoenix
#

I won't

#

friend me

#

so i can dm you

#

or your dms are open

pale marsh
#

They are

#

I thought by server you meant server code, not a discord server lol

untold matrix
#

Ive got a question

#

I managed to get the data to log on console but how do I output the data in chat

solar lark
#

response is an object

#

so you need to specify your output

#

like response.data

untold matrix
#

Ahhh alright Ill try that thanks

west spoke
#

you could use a GET/POST statement if that's what you are doing

untold matrix
#

It logs it into the console but doesnt show up in the discord chat

idle basalt
#

probably because its too long

west spoke
#

Await?

#

Idk what lang you use so idk how it works

idle basalt
#

oh yea the bottom one wont send without await

west spoke
#

^

#

Or top I believe

idle basalt
#

top is fine

#

its in the callback

west spoke
#

Ah

#

Okaye

untold matrix
#

It is VERY long

idle basalt
#

well do you want to send that? seems unlikely

untold matrix
#

I just want it to output "data:"

idle basalt
#

its probably an object

idle basalt
#

you can navigate it like other objects

untold matrix
#

Id like it to output this, do you know how to output specifically this?

idle basalt
#

well it depends whats around it lol

pale glen
#

stick it under the console log?

untold matrix
#

stick it under?

pale glen
#

as in

west spoke
#

console.log(data)

pale glen
#

the line under console.log(response)

#

do

#

message.channel.send(JSON.stringify(response.data))

untold matrix
#

alright Ill try and figure it now out thanks!

#

It works!

unique nimbus
#

nice

untold matrix
#

Thanks a bunch as I've been racking my brains about this for about 30 minutes

pale glen
#

axios is asynchronous, the way you had it before there was no reference to response.data

#

it has to go inside of the .then clause

untold matrix
#

Ahhh

pale glen
#

it was probably crashing saying response wasnt defined

untold matrix
#

Yeah most likely

pale glen
#

well you tell me, ur the onethat ran it lol

untold matrix
#

Yup it works perfectly, its giving the string of data I was looking for

#

But what if I wanted to specifically get a string

#

{"level":24,"gender":"Male","player_id":2261231,"name":"Scottish","status":["Okay",""]}

#

Like if I wanted to get 24

pale glen
#

well thats good

#

do

let x = response.data.level
message.channel.send(x)
untold matrix
#

I did it and it works

#

I understand how the code works thanks for teaching me

#

Tutorials online are waaaay harder to understand

pale glen
#

not sure what tutorial you're looking at

idle basalt
#

now for a slight challenge, get "okay" from your response

untold matrix
#

Well mostly youtube ones

#

Alright Ill do it now

pale glen
#

hes tricking u

#

good luck

#

: )

idle basalt
#

good resource

pale glen
#

yeah use ^ if you wanna work with embeds

idle basalt
#

but they expect you know something about js already so maybe check out codecademy first

pale glen
#

or get data from discord

untold matrix
#

Works like a charm

idle basalt
#

🤔 with code or with an echo command

pale glen
#

what'd u do?

untold matrix
#

I changed level to status

idle basalt
#

should be .status[0] because its in an array

worthy pine
#

<@&265158261945270273> Can you help me with something with my bot? because it keeps saying invalid server format and i dont know what that means.

pale glen
#

ye should be [0]

warm marsh
#

@worthy pine Don't mention people.

#

Just wait.

worthy pine
#

<@&264889767072628742> Can you help me with something with my bot? because it keeps saying invalid server format and i dont know what that means.

slender thistle
#

Please

pale glen
#

lol

untold matrix
#

Yikers

modern sable
#

SERVERID, SERVERID, SERVERID

worthy pine
#

@modern sable Thanks For The Help!

tardy shoal
#

:v

idle basalt
#

oh boy

untold matrix
#

I got one last question, how do I make the bot output a string of data every 6 hours?

#

I heard its called a scheduler or something

high lava
#

Set an interval

mossy vine
#
function doThing() {
    //do some cool things
}

doThing()
setInterval(doThing, 6 * 60 * 60 * 1000)```
#

or alternatively, cron jobs

untold matrix
#

Alright thanks

untold matrix
#

I think Im doing something wrong here

#

SyntaxError: Lexical declaration cannot appear in a single-statement context
at Module._compile (internal/modules/cjs/loader.js:721:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

opaque eagle
#

declare args in a new linejs if (message.content.startsWith("!user")) { let args; }

#

enclosed in curly braces

untold matrix
#

Ah

opaque eagle
#

Although I wouldn't re-define args every single time

#

Just do it at the top and use it for every command.

untold matrix
#

Ill do that later thanks

#

I think i got it to work but the command isnt working

#
        let args; message.content.split(" ").slice(1);
    }
        axios.get("https://api.torn.com/user/" + (args[0]) + "?selections=basic&key=1vpH5bIwSDLfkwX7")
            .then(function (response) {
                console.log(response)
                let x = response.data.level
                message.channel.send(x)
            })
            .catch(function (error) {
                console.log(error)
            })

            .finally(function () {
            });```
opaque eagle
#

What's the error?

untold matrix
#

axios.get("https://api.torn.com/user/" + (args[0]) + "?selections=basic&key=1vpH5bIwSDLfkwX7")

opaque eagle
#

Hmm... you need to put it inside the if statement lol

untold matrix
#

This part I might be having issues

opaque eagle
#

Or else the GET request won't run when !user is triggered

untold matrix
#

Im trying to do this

#

!user 2261231 is run

#

Axios will go to this page and get the data

opaque eagle
#

Yes, put it inside the curly braces...

#
if (message.content.startsWith("!user")) {
   let args;
   axios.get(); // etc
}```
untold matrix
#

Alright it works but it spits out the same data over and over

#
        let args; message.content.split(" ").slice(1);
        axios.get("https://api.torn.com/user/" + (args) + "?selections=basic&key=1vpH5bIwSDLfkwX7")
            .then(function (response) {
                console.log(response)
                let x = response.data.level
                message.channel.send(x)
            })
            .catch(function (error) {
                console.log(error)
            })

            .finally(function () {
            });
    }```
opaque eagle
#

Why'd u change it from args[0] to args?

untold matrix
#

I must have removed it

opaque eagle
#

Put it back and try again.

untold matrix
#

With args it shows up data but the same one with args[0] it shows nothing

opaque eagle
#

Is there an error in the console?

#

Wait you copied let args word-for-word lmao

#

So get rid of the ; and replace it with a =

untold matrix
#

oh

pale glen
#

yeah..

untold matrix
#

Sorry for being a bother pretty new to discord bots and javascript

pale glen
#

if it was a big bother we wouldnt respond

#

dw

#

use setinterval for a schedule

#

and settimeout if you just want it to happen once

untold matrix
#

It works perfectly 😄

stark beacon
#

Kind of a loaded question here, so I have a leaderboard bot for PUBG which is going to be on a per-server basis. So as users invite the BOT, it will keep a leaderboard keyed in based on their server ID so they only get their own members data.

I have two main questions from this:

  1. What is the best way to share a BOT? Right now I gave away the custom discordapi link to a few people to test it out, but I am not sure if that is the best route or if there is a better way to share that?

  2. I ideally want to include 8 custom emojis for rank purposes. Obviously that is not ideal as it cannot be assumed the user will see nor import those 8 custom emojis. But if they do (which it works fine without), is there a guideline on the best way to express/share that they should grab those 8 images and turn them into emojis on their server?

Any other first time making a public BOT todos/NotTodos are welcome too so that it plays nicely with everything out there is welcome too!
Thanks! 😃

pale marsh
#
  1. go to our website https://discordbots.org and add your bot there to the list. When it's approved it will be publicly available for everyone to add
  2. bots have one of the nitro features, which is that they're able to use any custom emoji anywhere, provided it's in a server they're in
mossy vine
#

@stark beacon

  1. ideally you just give them the invite link to the bot, or make it redirect to the link from your domain such as mycoolbot.com/invite -> invite link
  2. bots can use emojis by doing <:emojiname:emojiid> for example :mmLol:
pale marsh
#

So as long as you have those 8 emotes in your support server, you can grab the emote's name and ID and add it in the format <:emote_name:ID>

stark beacon
#

So it sounds like I can use a custom emojis in other servers?! that is dope!

west spoke
#

You cant

pale marsh
#

Yup. Only bots and nitro can do this

west spoke
#

But your bot can

stark beacon
#

ahh my b, that is what I meant

pale marsh
#

If you wanna know the ID of an emote add \ before its name

west spoke
#

Or

pale marsh
#

Like \:bloblul: would print !bloblul

west spoke
#

![mmLol](https://cdn.discordapp.com/emojis/356831697385422848.webp?size=128 "mmLol")

#

Just use ``

pale marsh
#

Huh

#

:bloblul:

west spoke
#

Two

pale marsh
#

Nope doesn't work lol

west spoke
#

Two on each side

stark beacon
#

right, so I am trying to figure out that piece, what I currently do is use DiscordJS and

const emojiList = MESSAGE.guild.emojis.map(e => e.toString());
    _.each(emojiList, function(e) {
        if (e.includes(rank)) {
            emoji = e;
        }
    });
    return emoji;
```, 
then I just do a string find based on name (as I named them uniquely) what would I need to change?
west spoke
#

``:mmLol:``

pale marsh
#

Oh

mossy vine
#

i mean, you could just use message.guild.roles.find

stark beacon
#

so will the above work, or do I need to do something a bit different?

pale marsh
#

Well if you already know the emote name and id and you don't plan on changing them frequently you don't need the loop

#

Just store them somewhere

#

The easiest way to deal with that

stark beacon
#

Okay, so that emoji the <...> it returns works on a global level?

west spoke
#

Yea

pale marsh
#

As long as the bot shares a server with the emote, yes

west spoke
#

^

stark beacon
#

Hmm, I thought it wasn't working in a server until I added those emojis to it. I guess I could go test by removing those emojis from one and seeing what occurs

west spoke
#

I store my emotes in two testing servers of mine

pale marsh
#

You have to include the whole thing in that format

#

The name and the ID

west spoke
#

And one in the main server as a starboard thing

#

Yeah name and id

stark beacon
#

random Q while I test this. Will a PI hold old for quite a few servers? It is essentially doing MySQL calls based on user commands and a constant update process to the PUBG's API server for users updates that get pushed into the DB that the user's query. Never done much with BOTs or Pi's until a week ago haha

pale marsh
#

If you have a good enough internet I don't see why not, as long as you don't do a lot of calculations

stark beacon
#

okay coolio!

pale marsh
#

Unless it joins a really big server

#

Someone a couple of days ago complained that their cpu usage was at 100% almost constantly when the bot joined and got back to normal when it left, which lead to a huge delay for the bot to respond to commands

west spoke
#

I know what server that is

#

Botpocalypse

pale marsh
#

I was actually talking about here but nvm lmao

west spoke
#

Meh

#

I mean this server is less spammy

pale marsh
#

Yeah but imagine all those status updates

west spoke
#

That one only has bots and like a user

pale marsh
#

Presence updates*

west spoke
#

Yeah

pale marsh
#

So @stark beacon my advice is, for a new bot a pi is fine. If it's growing you might wanna consider having a vps

stark beacon
#

luckily for processing, I make users have to add users into the BOT's leaderboard. I just link their PUBG ID to their discord ID

#

then they do all stats stuff off their discord ID/mention

pale marsh
#

Alright sounds good then. Doesn't seem like a lot would be happening behind the scenes

untold matrix
#

For some reason discord is telling me it cant post an empty message

#
        let args = message.content.split(" ").slice(1);
        axios.get("https://api.torn.com/user/" + (args[0]) + "?selections=basic&key=1vpH5bIwSDLfkwX7")
            .then(function (response) {
                console.log(response)
                let q = response.data.name
                let w = response.data.gender
                let e = response.data.level
                let r = response.data.status

                let x = {
                    title: "Information: " + (q),
                    url: "https://www.torn.com/profiles.php?XID=" + (args[0]),
                    color: 1000,
                    description: (q) + " is a " + (w) + " and his level is " + (e) + " and he is currently " + (r) + ".",
                };

                message.channel.send(x)

            .catch(function (error) {
                console.log(error)
                 })

            .finally(function () {
                })
            })
    }
})```
smoky spire
#

You can't just send an object

pale glen
#

you cant post a message with an empty string

smoky spire
#

Also if that is supposed to be an embed object then you have to do send({embed: x})

pale glen
#

also thats an object you need to make it a string

untold matrix
#

Oh alright

#

Keenser's solution worked

#

Thanks to all of you for your help

stark beacon
#

Okay I am back, so yea, if I remove the custom icons from one server they do not show up in that server as of right now (even though it sounds like they should as the BOT share's a server that does have them), they currently print out as something like <elite:588031542660562984>

#

okay weird, there is a colon before elite but then it removes the numbers

#

<: elite : 588031542660562984> without spaces

#

So should this be working? or am I missing a step?

#

I added half the icons back and those half work, so I guess I am not sure what is off for the other custom icons to not be working? 🤔 Any ideas, @pale marsh?

west spoke
#

@stark beacon there is a colon around the elite like
:elite:

#

And the ID goes after that in the brackets

stark beacon
#

yup

#

that is what my log prints

#

and I am putting within text in an {embed}

#

but when I removed half the icons (from one of the servers), only the remaining half show up... so I am not sure what is going on..

#

so short-hand of the code looks like this

fields.push({
    'name': r.PUBGName,
    'value': getRankEmoji(r.PUBGSquadRankPointsTitle) + "...other stuff"
});

function getRankEmoji(rankstr) {
    const emojiList = MESSAGE.guild.emojis.map(e => e.toString());
    let emoji = "";
    rank = RANKS[rank].name.toLowerCase()
    _.each(emojiList, function(e) {
        if (e.includes(rank)) {
            emoji = e;
        }
    });
    //:elite: (for example)
    return emoji;
}

@west spoke

pale marsh
#

@stark beacon I'm confused. Wdym by when you remove half the emotes only half shows up?

#

Also editing messages to add a mention doesn't ping lol

stark beacon
#

oh really?? I never knew that haha my b

pale marsh
#

It's alright lol

stark beacon
#

I mean't I have two servers with the icons. On one I removed half the custom icons. The ones I removed no longer appear even though the other server has them

pale marsh
#

Because they're different id's even though they have the same name

#

That's why you need the emote name and the ID

#

Only keep the emotes on one server and remember that if you remove an emote and reupload it the ID changes

stark beacon
#

okay, so I just removed all emotes on one of the servers. I then had it print out all the emotes. so I can just key/value to what I need and it should work? like this?

const CUSTOM_ICONS = {
    "platinum": ":platinum:",
    "silver": ":silver:",
    "bronze": ":bronze:",
    "diamond": ":diamond:",
    "energydrink": ":energydrink:",
    "bandage": ":bandage:",
    "grenade": ":grenade:",
    "medic": ":medic:",
    "teamkiller": ":teamkiller:",
    "sharpshooter": ":sharpshooter:",
    "headshot": ":headshot:",
    "ironman": ":ironman:",
    "gold": ":gold:",
    "elite": ":elite:",
    "master": ":master:",
    "grandmaster": ":grandmaster:",
}
#

wow it cut out the numbers

split lantern
#

bc discord

pale marsh
stark beacon
#

i screenied already haha

pale marsh
#

Alright looks good then

stark beacon
#

so I can put those <...> inline of description, title, fields[], and it should work?

pale marsh
#

Yup. Give it a try

stark beacon
#

will do, brb

west spoke
#

@stark beacon it's because you removed them

stark beacon
#

ahh yay it worked!!

#

thank you everyone!

pale marsh
#

Anytime

west spoke
#

The intro docs just tell you what calls to use to get the api.

#

For example to get last message:

#

/api/channels/"id"["last-message"]

#

I would reccomend not using Google apps scripts tho. Use a free hoster first then move over to paid.

#

Since what it seems it doesnt support what you need.

#

Also most of what you asked could be found by going through google.

#

It's a example

#

One sec

#

This is a way to access the api directly to check if the channel is NSFW

#

The refrence documentation is mainly for making your own libary or making calls

hushed quarry
west spoke
#

^

hushed quarry
#

all the API calls are documented. you make these calls, build your objects, and then use them within your application

west spoke
#

^

hushed quarry
#

please, just read the docs

#

it's all there

west spoke
#

"Authorization":"token"

#

I believe

pale marsh
#

Not quite

west spoke
#

@upper tundra Google works miracles btw

hushed quarry
west spoke
#

Making that single api call I sent as a image took around a week to do

#

It's not that easy tbh

inner jewel
#

you just need to know how to make http requests

west spoke
#

^

#

But I didnt know how to do that

#

So I learned on my own since everyone hates me for using async

hushed quarry
#

reference= authentication and all other information you need to know for the api. then, you select an object you want on the side and look at the relevant api call which gives you what you want

west spoke
#

Ah

#

Didnt notice that before.

hushed quarry
#

not you, the other guy

west spoke
#

Yeah

#

But that would have made doing it easier

#

Now to make a lib in html

#

Kek

unique nimbus
#

make it in binary

west spoke
hushed quarry
warm marsh
#

Does anyone know if the discord.js@11.5-dev has an event to listen for forced disconnect?

hushed quarry
#

gl

west spoke
#

^

west spoke
#

why glitch... glitch sucks

loud salmon
#

dbl ask2ask @earnest phoenix

covert turtleBOT
#

Dont ask to ask
Just ask your question
it wastes time if you say "i need help" or "can someone help me?" instead of just saying what the problem is. Save your time and other people's time by just asking the question.

loud salmon
#

are you aiming to create a discord library?

west spoke
#

Apparently

loud salmon
#

I wish them the best of luck then!

#

ah I see

opaque eagle
#

@upper tundra Use Discord.js Web Builds

loud salmon
#

I have heard that the server is a tad unfriendly to newcomers

opaque eagle
#
loud salmon
#

but I don't have any direct experience

opaque eagle
#

I feel like the friendliness depends on the channel

loud salmon
#

lmao

untold matrix
#

Ive got a question

loud salmon
#

I've got an answer

opaque eagle
untold matrix
#

Thats great!

opaque eagle
#

The non-JavaScript ones tend to be friendlier

untold matrix
#

I'd like this command to run every 6 hours

#
    function Repeater() {
        setInterval(function () {
            axios.get("https://api.torn.com/faction/22295?selections=basic&key=1vpH5bIwSDLfkwX7")
                .then(function (response) {
                    console.log(response)
                    let y = response.data.respect

                    let x = {
                        title: "ID Current Respect",
                        url: "https://www.torn.com/factions.php?step=profile&ID=22295#/",
                        color: 50000,
                        description: "Infinite Dimension Current Respect: " + (y)

                    };

                    (message.channel.send({ embed: x }))

                        .catch(function (error) {
                            console.log(error)
                        })

                        .finally(function () {
                        });
                }
            }
        }, 3000);
    }
#

I think I am doing something wrong somewhere

opaque eagle
#

That runs every 3 seconds

untold matrix
#

Yeah I know that

#

But im unsure about the code

opaque eagle
#

It's becuz of the 3000 at the bottom

#

6 * 60 * 60 * 1000 is the number you're looking for, if u wanna run it for 6 hours

loud salmon
#

cyborg

#

he said he knows

opaque eagle
#

ok

loud salmon
#

pls

untold matrix
#

3000 is 3 seconds

stark beacon
#

I was going to ask as well, my bot only let's certain users admin it for their server. What is the best way to handle that for public use? Currently people with the role "leaderboard manager" can do the admin actions

untold matrix
#

But Im not sure about the code if it even is correct

loud salmon
#

you would have to tie that to a list of user ids @stark beacon

untold matrix
#

Im still trying to figure out whats wrong

loud salmon
#

and check if the command runner has their user id in the list

#

if they do, then run the command, if not, then either fail silently or tell them they dont have perms

#

your decision really

uneven rover
#

or you can make the bot check if the user has meet the required server perms

loud salmon
#

oh yea you could check if they are in that server, then check if they have that role, but it doesnt seem that efficient

stark beacon
#

Er I mean, how do I tell John Doe that he needs to add a role to let themself or others do admin commands

loud salmon
#

ohh

stark beacon
#

In my case it's adding and removing users to the bots leaderboard

loud salmon
#

check if they have the role on command run, if they do then do it, if not then say smth like "you need the role leaderboard manager to run this command!"

#

and maybe create it through the bot if it has perms

#

and notify that it has done so

stark beacon
#

Okay yea that is what I do, just wasn't sure if that was common to do

uneven rover
#

and the bot need to use .find('name', 'rolename') instead of .get('id')

stark beacon
#

Yup it does I believe

#

Just gotta update my queries to be by server and then I can go apply it here I think. 😬 😀

copper cradle
#

@uneven rover that is deprecated

#

instead of using .find('name', 'rolename') use a function

#

like this

uneven rover
#

i know, but you can use the older version if you need to use .find

copper cradle
#

.find(role => role.name === 'rolename')

#

Yeah

#

but in the future it will just kill the process

untold matrix
#

Some text in my discord should be repeatedly spitting out data every second but it is not working for me

    function Repeater() {
        setInterval(function () {
            axios.get("https://api.torn.com/faction/22295?selections=basic&key=1vpH5bIwSDLfkwX7")
                .then(function (response) {
                    console.log(response)
                    let y = response.data.respect

                    let x = {
                        title: "ID Current Respect",
                        url: "https://www.torn.com/factions.php?step=profile&ID=22295#/",
                        color: 50000,
                        description: "Infinite Dimension Current Respect: " + (y)

                    };

                    (message.channel.send({ embed: x }))

                        .catch(function (error) {
                            console.log(error)
                        })

                        .finally(function () {
                        });
                })
        }, 1000);
    }
});
#

Is there any issue?

copper cradle
#

is there any error?

untold matrix
#

Nope

#

I dont know why is it not repeatedly giving an output every 1 second

copper cradle
#

hmmm

stark beacon
#

Message have a value still?

untold matrix
#

It works when I do a command like !respect

#

But when I try to make it a set interval so it shows up every 1 second

stark beacon
#

Where do you pass the reference to what message is though into the interval?

#

Can you console log it

untold matrix
#

Alright

#

It console logs the response

#

response should be 802k

#

But it isnt working

stark beacon
#

I can look in a few, busy right now

copper cradle
#
function Repeater() {
 setInterval(function () {
 axios.get("https://api.torn.com/faction/22295?selections=basic&key=1vpH5bIwSDLfkwX7")
 .then(function (response) {
 console.log(response)
 let y = response.data.respect

 let x = {
 title: "ID Current Respect",
 url: "https://www.torn.com/factions.php?step=profile&ID=22295#/",
 color: 50000,
 description: "Infinite Dimension Current Respect: " + (y)

 }

 message.channel.send({ embed: x })

 .catch(function (error) {
 console.log(error)
 })

 .finally(function () {
 })
 })
 }, 1000)}
``` try with this
untold matrix
#

Unfortunately it doesnt work Snails

stark beacon
#

How is repeater called btw

untold matrix
#

Im trying to think about a solution for 2 hours already but I cant seem to think of whats wrong or is there any substitutes

stark beacon
#

When I'm back at my PC I can help, should be soonish.

untold matrix
#

Alright thanks

#

Ill try to figure it out again

#

I might find something

copper cradle
#

lol

untold matrix
#

Welp after an hour I still haven't figured it out lmao

#
setInterval(function () {
            axios.get("https://api.torn.com/faction/22295?selections=basic&key=1vpH5bIwSDLfkwX7")
                .then(function (response) {
                    console.log(response)
                    let y = response.data.respect

                    let x = {
                        title: "ID Current Respect",
                        url: "https://www.torn.com/factions.php?step=profile&ID=22295#/",
                        color: 50000,
                        description: "Infinite Dimension Current Respect: " + (y)

                    }

                    message.channel.send({ embed: x })

                        .catch(function (error) {
                            console.log(error)
                        })

                        .finally(function () {
                        })
                })
        }, 5000)

I tried this instead but unfortunately it still doesnt work

amber fractal
#

idk what that's for, all I see is a key to some api

#

which you should now regen

#

and you have an empty finally

#

which does nothing so there's really no reason it should be there

opaque eagle
#

That's so much easier with modern JS

amber fractal
#

Talking arrow functions

#

I mean it's the same, just more clean

#

or promises

untold matrix
#

All I just need is the line of code to run every 6 hours

#

Im testing it at 5 seconds

#
 axios.get("https://api.torn.com/faction/22295?selections=basic&key=1vpH5bIwSDLfkwX7")
                .then(function (response) {
                    console.log(response)
                    let y = response.data.respect

                    let x = {
                        title: "ID Current Respect",
                        url: "https://www.torn.com/factions.php?step=profile&ID=22295#/",
                        color: 50000,
                        description: "Infinite Dimension Current Respect: " + (y)

                    }

                    message.channel.send({ embed: x })

                        .catch(function (error) {
                            console.log(error)
                        })

                        .finally(function () {
                        })
#

This is the command I need to run every 5 seconds

amber fractal
#

but what's the error

untold matrix
#

There isnt

amber fractal
#

does it log anything

untold matrix
#

Thats why Im stuck on this for 4 hours

#

Nope

#

It should be

amber fractal
#

doesnt even log response

untold matrix
#

Yeah odd it doesnt

#

Probably there isnt a response thats why

#

I dont know how to setInterval running properly

#

I feel like its some very easy command but I cant figure it out

amber fractal
#

what setinterval?

#

setInterval(callBack, delayInMS)

untold matrix
#
            axios.get("https://api.torn.com/faction/22295?selections=basic&key=1vpH5bIwSDLfkwX7")
                .then(function (response) {
                    console.log(response)
                    let y = response.data.respect

                    let x = {
                        title: "ID Current Respect",
                        url: "https://www.torn.com/factions.php?step=profile&ID=22295#/",
                        color: 50000,
                        description: "Infinite Dimension Current Respect: " + (y)

                    }

                    message.channel.send({ embed: x })

                        .catch(function (error) {
                            console.log(error)
                        })

                        .finally(function () {
                        })
                })
        }, 5000) ```
amber fractal
#

yeah

untold matrix
#

Whats meant to happen is when I run node index.js in cmd it should run a few strings of code every 5 seconds

amber fractal
#

you do require axios right?

untold matrix
#

Yeah I do need Axios to run this command

amber fractal
#

in your .then

#

instead of logging response, log a string

#

just like "hi"

#

or something

untold matrix
#

Well I require it to log the response for the response.data.respect

#

I think its an issue with the setInterval

west spoke
#

Try logging something else to see if it works

#

I print to console when creating a new idea to see what works and what doesn't

stark beacon
#

so are the testing areas places to test bots at? Does your bot have to be already approved in this group/site or can it be any bot?

loud salmon
#

yea

#

uh

#

you need to get it approved first

stark beacon
#

ah okay, so you can get it approved and still be working on it?

#

or is that just for "new feature" stuff

#

Just not sure when I should do the approval process

#

I believe it is up and working correctly..

loud salmon
#

yea, bots dont have to be 100% production ready to be on our site

#

it just has to work

stark beacon
#

oh coolio

#

ima go do this then I think

#

So what if I have no public GitHub for it and no Website Url?

#

I also am not sure what I am supposed to in Servers this bot is in, the rest is filled out though

loud salmon
#

you dont need those

#

its optional

stark beacon
#

ahh yea, I Just saw that haha

#

coolio, added it. will probably need to add more detail description text haha

bitter linden
sinful lotus
#

did you make index.js?

#

did you code the bot?

#

do you have a server?

#

thats some questions you need to answer yourself

solid spear
#

Seems a lot of people use js for bots?

loud salmon
#

yep

sinful lotus
#

In my opinion, Javascript is easy to deploy thats why a lot of people use it

solid spear
#

Very true

#

I'm using JDA myself

#

I've never really liked web dev much so I never got into js

sinful lotus
#

I know Java as well, but I am using Javascript on my production bot

#

main reason was because js is not strict with types

solid spear
#

Yeah js is nice and loose! I always call it loosey goosey

#

Java is what my college focused on so I tend to it use it for almost everything... but I need to branch out

sinful lotus
#

you can try Node.js yourself and see how easy to deploy it on some scenarios

#

some packages can be problematic but other than that

#

its a breeze

untold matrix
#

I dont think my setInterval code is working

#
        message.send.channel("Hey")
    }, 5000)
#

Is there any issue with it

#

Cause Im trying to get setInterval to work specifically for this

#
        axios.get("https://api.torn.com/faction/22295?selections=basic&key=1vpH5bIwSDLfkwX7")
            .then(function (response) {
                console.log(response)
                let y = response.data.respect

                let x = {
                    title: "ID Current Respect",
                    url: "https://www.torn.com/factions.php?step=profile&ID=22295#/",
                    color: 50000,
                    description: "Infinite Dimension Current Respect: " + (y)

                    }

                    message.channel.send({ embed: x })

                 .catch(function (error) {
                            console.log(error)
                 })

                 .finally(function () {
                 })
            })
    }, 5000)```
sinful lotus
#

error?

untold matrix
#

No errors

sinful lotus
#

Ok first thing is first

#

does the code get executed?

untold matrix
#

Thats what Im thinking, most likely it hasnt cause it has it would log something

#

I got it to console.log(response)

sinful lotus
#

then ok if it doesnt execute. how do you do the whole code probably

#

probably input how you exactly do it from how it starts to end

untold matrix
#

Alright then

#

I dont know why setInterval has taken me hours to figure out

sinful lotus
#

Yes but I need to see how do you do the code itself

#

giving only the setInterval function wont give me ideas since you have no errors

#

so if it has no errors, do it even "arm" the setInterval?

untold matrix
#

I dont think it does

#

I know the code runs well but when I change if (message.content,startsWith("!command)) to setInterval(function ()) {` it stops working

#

Instead of it running with an input I want it to run every 6 hours by testing every 5 seconds

sinful lotus
#

you have a command on your statement

#

comma*

untold matrix
#

}, 10000)

#

you mean this?

late hill
#

You should really show the entire thing

#

Not clear what you're doing

untold matrix
#
setInterval(function () {
        axios.get("https://api.torn.com/faction/22295?selections=basic&key=1vpH5bIwSDLfkwX7")
            .then(function (response) {
                console.log(response)
                let y = response.data.respect

                let x = {
                    title: "ID Current Respect",
                    url: "https://www.torn.com/factions.php?step=profile&ID=22295#/",
                    color: 50000,
                    description: "Infinite Dimension Current Respect: " + (y)

                    }

                    message.channel.send({ embed: x })

                 .catch(function (error) {
                            console.log(error)
                 })

                 .finally(function () {
                 })
            })
    }, 10000)
#

The whole command

sinful lotus
#

thats not the whole thing

#

where do you even put that thing

#

thats what Im asking since earlier

#

I cant pinpoint your issue with little context right now

untold matrix
#

Right below client.on("message", async (message_ => {

#

But I have more stuff other than this

late hill
#

That's one problem

#

That'll create an interval for each message

sinful lotus
#

ok since

#

you are making an interval

#

why do you want it to become an interval?

#

so I can probably recommend something

untold matrix
#

So it can output data every 6 hours

#

Instead of me having to manually do !command

sinful lotus
#

10000 is not 6 hours

#

first of all

untold matrix
#

Its testing

sinful lotus
#

ok so I recommend not doing it like that

#

that will cause you a lot of issues

untold matrix
#

Alright

sinful lotus
#

so my suggestion in your design is

#

do an array or map

#

then set your guild id then channel id on that map

#

then make an interval outside any events that runs every 6 hours
use the ID you stored in the map to make it output the data. on the guild + channel you want.
then when you use !command, just do map.set(msg.guild.id, msg.channel.id)

untold matrix
#

I did one suggestion that I was told

#

Its working but there is an error

sinful lotus
#
const data = [];
setinterval(() => {
  for (const channelID of data)  client.channels.get(channelID).send();
}, 6 hours in ms)
client.on('message', (msg) => {
// If command is !command
  data.push(msg.channel.id)
})
untold matrix
#

(node:10956) UnhandledPromiseRejectionWarning: ReferenceError: message is not defined
at D:\Discord_Bots\Bot_1\Bot\index.js:126:13
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:10956) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

sinful lotus
#

I gave an example

#

base your command like that

untold matrix
#

Alright thanks

earnest phoenix
#

Not at all finished, just a prototype.

sinful lotus
#

export it in files instead of keeping it in one file

untold matrix
#

@sinful lotus Im sorry Im unsure on how to use your command

sinful lotus
#

what is your current code

untold matrix
#

I tried modifying my previous code

#

It spammed it so fast I got IP Blocked lmao

#
client.on("ready", async (message) => {
    setInterval(() => {
        axios.get("https://api.torn.com/faction/22295?selections=basic&key=1vpH5bIwSDLfkwX7")
            .then(function (response) {
                console.log(response)
                let y = response.data.respect
                let x = {
                    title: "ID Current Respect",
                    url: "https://www.torn.com/factions.php?step=profile&ID=22295#/",
                    color: 50000,
                    description: "Infinite Dimension Current Respect: " + (y)

                }

                message.channel.send({ embed: x })

                    .catch(function (error) {
                        console.log(error)
                    })

                    .finally(function () {
                    })
            })
    }); 100000;
});
sinful lotus
#

thats not what I said you to do

#
const data = [];
setinterval(() => {
  for (const channelID of data)  client.channels.get(channelID).send();
}, 6 hours in ms)
client.on('message', (msg) => {
// If command is !command
  data.push(msg.channel.id)
})

did I put the interval inside the message?

#

did I put the ms outside the setInterval second parameter?

#

please understand what I actually sent

#

you did not even change anything on your code

untold matrix
#

Alright sorry

sinful lotus
#

I cant spoon feed too much because that would hinder your learning

#

but I already gave you the idea on how to execute what you want to do

#

its up to you to digest it and apply it

earnest phoenix
#

Does anyone know how to have the bot automatically restart its VPS if the bot goes offline? I've heard it's possible but not sure how to do it.

The bot has been running perfectly fine on the VPS except for one issue where it occasionally switches the bot off even though the VPS is still running. When VPS is restarted, the bot works fine again.

sinful lotus
#

you can achieve that on pm2

earnest phoenix
#

We have that, but it didn't work.

sinful lotus
#

this is what I do on every server I have and it didnt failed me

earnest phoenix
#

Well we have the part which provides us with logs, I don't think we have the startup script though. Thank you.

real helm
#

Hello

#

Who have a bot with the command kill or suicide

#

I like to put anime images

sinful lotus
#

just do process.exit()

real helm
#

no, I have the command

sinful lotus
#

or if you meant by anime suiciding thats not allowed

real helm
#

aa oka

sinful lotus
#

we cant promote something like suiciding

real helm
#

I don't watch anime

#

Do you know some gore Animes? @sinful lotus

#

If you prefere send the names in Dm

sinful lotus
real helm
#

okay thanks ❤

sinful lotus
#

and I dont think we also promote gore here so keep that in mind thank you GWahreeVampyYay

real helm
#

okay, thnanks

#

I don't speak more XD

#

I don't like blood XD

earnest phoenix
#

    at item.request.gen.end (/rbd/pnpm-volume/2343a5d2-a3ec-43c3-aa15-d2ebbd304141/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15)

    at then (/rbd/pnpm-volume/2343a5d2-a3ec-43c3-aa15-d2ebbd304141/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:215:21)

    at <anonymous>

    at process._tickCallback (internal/process/next_tick.js:189:7)

  name: 'DiscordAPIError',

  message: 'Missing Permissions',

  path: '/api/v7/guilds/264445053596991498/invites',

  code: 50013,

  method: 'GET' }

Uncaught Promise Error:  { DiscordAPIError: Missing Permissions

    at item.request.gen.end (/rbd/pnpm-volume/2343a5d2-a3ec-43c3-aa15-d2ebbd304141/node_modules/.registry.npmjs.org/discord.js/11.5.1/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15)

    at then (/rbd/pnpm-volume/2343a5d2-a3ec-43c3-aa15-d2ebbd304141/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:215:21)

    at <anonymous>

    at process._tickCallback (internal/process/next_tick.js:189:7)

  name: 'DiscordAPIError',

  message: 'Missing Permissions',

  path: '/api/v7/guilds/264445053596991498/invites',

  code: 50013,

  method: 'GET' }```
#

What is this

plucky gale
#

@earnest phoenix the bot doesn't have permission to get invites to the server it's in

sinful lotus
#

You dont have permissions

earnest phoenix
#

On this server don't have permissions

plucky gale
#

Then you need to make sure that it gets permissions before trying to use invites

#

Otherwise you'll get this error

sinful lotus
#

Just do something like
if the bot has no perms to send message in this channel, return silently

earnest phoenix
#

what?

sinful lotus
#

do a check on start of your code

#

or command handler

#

to see if the bot can send messages

earnest phoenix
#

Commands do not work

sinful lotus
#

just do a check on top of your file like how you ignore bots

#

commands dont matter here

#

what matters is you stop your bot from doing anything if it has no permissions

#

= no more error

untold matrix
#

@sinful lotus Thanks for your help! I managed to used the knowledge you have given me and that allowed me to make the bot function as planned!

sinful lotus
#

no problems GWahreeVampyYay

lament meteor
#

Someone in #development made sense and made use of information Thonk

earnest phoenix
#

i messed up with modules system :D

#

Please keep the channel to the topic. #general would be more appropriate for these comments. @lament meteor @earnest phoenix

#

why

#

im about development

#

It has a line through it which clearly indicates that it is not a serious question or request for assistance regarding development.

ruby dust
#

You ok Trent?

#

I don't think it's needed to be so strict and formal like that

earnest phoenix
#

tryharding to get that mod role, its expected

#

I just asked to keep this channel on topic so don't send an off-topic message right after it, and everyone has their own way of moderating.

earnest phoenix
#

uwu

pallid zinc
#

Err on client.login(config.token)
Err unexpected token

opaque eagle
#

Are u sure that error is from that line?

pallid zinc
#

Yup

opaque eagle
#

token in a JS error rarely refers to your bot's token.

mossy vine
#

if you are getting unexpected token on your last line, there is another error in there

opaque eagle
#
  1. Use a linter.
  2. Check your syntax (grammar).
pallid zinc
#

Nope

opaque eagle
#

Well your error says otherwise.

pallid zinc
#

It say that only

#

I rewind my code

opaque eagle
#

rewind?

neat falcon
#

i'm guessing ctrl z

twilit rapids
#

@earnest phoenix what's the problem

earnest phoenix
#

i have 1 error at the end of my code

twilit rapids
#

What is it

earnest phoenix
#

@earnest phoenix send the error

#

EMERGENCY

opaque eagle
#

Lol

earnest phoenix
#

Sending

opaque eagle
#

ROFL

twilit rapids
#

Learn 2 code™

earnest phoenix
#

Stfu

opaque eagle
#

Learn JavaScript, get a linter.

earnest phoenix
#

@earnest phoenix really

#

And don’t be rude

opaque eagle
#

You seem to be trolling

earnest phoenix
#

just read @earnest phoenix

twilit rapids
#

It's not being rude, that's an error you can prevent when you know how to code.

opaque eagle
#

^

earnest phoenix
#

You are being rude

#

Idiot

#

@modern sable

opaque eagle
#

@modern sable

mossy vine
#

wrong marco

earnest phoenix
#

Let's refrain from disrespecting each other.

slender thistle
#

Will ya'll calm down

earnest phoenix
#

He has asked for help, so either help or don't reply.

#

he just need to read

#

i cant learn to someone how to read

mossy vine
#

there are helpful answers in that mess

slender thistle
#

Unexpected Token errors are a subset of SyntaxErrors and, thus, will only appear when attempting to execute code that has an extra (or missing) character in the syntax, different from what JavaScript expects.

earnest phoenix
#

You can simply point out what he should read instead of being rude about it. pepeCool

pallid zinc
#

You have extra one ) or one missing

opaque eagle
#

I think he forgot to install ESLint and get a proper code editor.

earnest phoenix
#

And if the error is on the end of the code its bc you miss a ) or a } somewhere

pallid zinc
#

Or give a clear ss

#

@earnest phoenix

earnest phoenix
#

Muted @pallid zinc

pallid zinc
#

??

slender thistle
#

That's js, not python

earnest phoenix
#

No

#

Yes*

pallid zinc
#

Why to mute me??

slender thistle
earnest phoenix
#

@limpid raptor

#

Do you code in js?

limpid raptor
#

yes

#

thanks to dm me xD

#

@earnest phoenix

earnest phoenix
#

@limpid raptor do you already have an embed?

#

For your command

limpid raptor
#

yes

earnest phoenix
#

A rich embed?

limpid raptor
#

do you want to see it ?

#

yes

earnest phoenix
#

yes

limpid raptor
#
if(message.content === prefix + "informations services") {
        if(message.guild.member(message.author).hasPermission("ADMINISTRATOR")) {
            let infosServEmbed = new Discord.RichEmbed()
                .setDescription("• Hey ! Dans ce salon proposez vos services ou dites nous ce dont vous avez besoin ! \n\n• Si vous cherchez des personnes qualifiées : <@&588055678522753054> !")
                .setColor("#249bff")
                .setThumbnail("a valid picture without importance")
                .addField("Partenaires", "**[Staff List](the link of the server)**!")
                .setImage("The link of the image")
                .setFooter("Time")
                .setTimestamp()
            infosServ.send(infosServEmbed)
        }
    }```
#

i want the link of the "setImage" in the addField("Partenaires")

earnest phoenix
#

What

limpid raptor
#

?

slender thistle
#

You can't put an image before fields

earnest phoenix
#

@limpid raptor .setAuthor(message.guild.name, image url)

#

I think is what do you want

#

Try

solid spear
#

What about Thumbnail

#

it's top right

#

and bigger

limpid raptor
#

okay 🤔

earnest phoenix
solid spear
#

Ok yeah that's author image

earnest phoenix
#

its the author function

#

Yup

limpid raptor
#

but just

#

can i put a link ?

earnest phoenix
#

Yes

solid spear
#

Yep to any image

limpid raptor
#

perfect

#

thanks !

earnest phoenix
#

The link need to be after the ,

limpid raptor
#

yes, i understand that

onyx summit
#

I have a two commands that will probably require massive storage.
Is it okay to force users to have voted in the last 24 Hours to use that commands?

earnest phoenix
#

@onyx summit force?

#

Like restrict a command?

#

You can

onyx summit
#

yeah

earnest phoenix
#

Maximum 2 commands

#

I think is that, not sure about that

solid spear
#

You could keep a hash map with users and a timestamp with a timer that removes them if it's been > 24

earnest phoenix
onyx summit
#

thanks

earnest phoenix
#

Np

solid spear
#

I never wanted to implement a feature like that but it seems like every bot does

onyx summit
#

and yeah, I already have a solution with ttl to limit api requests, but somehow I always get false, even tho I voted 5 mins ago

solid spear
#

I guess it's next to impossible to keep up with votes without it?

onyx summit
#

I rarely see a bot implement it

solid spear
#

Rewarding for voting?

onyx summit
#

unlocking commands for votes

solid spear
#

Ahh

onyx summit
#

Is there a delay with votes?
I just voted but every api request says no

earnest phoenix
#

It can take 1 minute

#

Or more

opaque eagle
#

Is a DM channel's ID the same as the user's id?

#

Like the user ur talking to

earnest phoenix
#

yes

opaque eagle
#

u sure?

earnest phoenix
#

yes

opaque eagle
#

ok

pale glen
#

My bot has issues where it takes a few minutes for some users to register as have voted

opaque eagle
#

Same, just wait a couple mins

pale glen
#

They will vote, do the command and it will be false for them

#

Then magically a few minutes after its true and the command works

opaque eagle
#

I've come to accept the delay

pale glen
#

Not really sure what causes that

opaque eagle
#

Maybe it's faster with webhooks

earnest phoenix
#

Api

pale glen
#

And the last 1000 votes doesnt work im pretty sure its discontinued

#

Gives random crap back

#

My bot doesnt have an external api so a webhook wouldnt work

#

External POST endpoint*

onyx summit
#

I just added this not If you already voted, but this doesn't work, wait up to 5 Minutes.

#

(the 5 minutes is the ttl for the entry that they didnt vote but psssht)

earnest phoenix
#

Hey, does discord offer their own database, or do you have to separately download one

slender thistle
#

Your own

loud salmon
#

make your own

waxen meteor
#

Is there a way to make a Python program restart itself in case of death of program

hushed quarry
#

use a process manager such as pm2 or docker

waxen meteor
#

Note this is on Windows for now, but I will be moving to Linux in the future

loud salmon
#

imagine using docker mmulu

waxen meteor
#

I don't have a working server rn, so I kinda have to run it off my desktop

mossy vine
#

pm2 can run on all operating systems with all programs

slender thistle
#

(Not sure why your py bot would crash unless your code is bad)

pale glen
#

Build something that never crashes 🤷‍♀️

#

Build something that never crashes

solid spear
#
    shitty_code()
except:
    restart()```
sinful lotus
#

just nullify all errors, problem fixed

waxen meteor
#

@slender thistle I have no clue either, unless my computer rebooted itself for updates or smthn

slender thistle
#

shrug

#

Your code, up to you to figure it out :p

earnest phoenix
#

Lol

solid spear
#

For unexpected reboots just have it launch on boot

earnest phoenix
#

What’s the recommended database for bots? I downloaded MySQL but it doesn’t open because it needs a password and I have no idea what it is

slender thistle
#

Depends on your needs

loud salmon
#

go to the mysql docs and find out what the default password is

earnest phoenix
#

K

loud salmon
#

you should have been able to set it up yourself during your install

solid spear
#

What are you coding in?

earnest phoenix
#

node.js

solid spear
#

How is SQLite on Node.js?

#

SQLite is usually good for small self hosted DB stuff

mossy vine
earnest phoenix
#

K

solid spear
#

Another thing can be using JSON

mossy vine
#

no

solid spear
#

lol

mossy vine
#

dont use json as a database

solid spear
#

If you don't need relational aggregations why not?

earnest phoenix
#

A good redneck data base is to just write a bunch of text files for everything 😆

solid spear
#

Depending how simple the needs are it could be easier if the person doesn't know SQL

slender thistle
#

JSON can be easily corrupted

mossy vine
#

its way too easy to fuck up

solid spear
#

Fair enough, it's true there's no real integrity checks

earnest phoenix
#

Now that I think of it, I could just use text files

mossy vine
#

of course, but just as easy to fuck up with fs as a json file

earnest phoenix
#

How so

solid spear
#

I use something consider blasphemy by many; serialization

waxen meteor
#

dude I use that too

earnest phoenix
#

?

waxen meteor
#

I would've used MySQL but my server died

earnest phoenix
#

Lol

slender thistle
#

@earnest phoenix improper management of data in json file can go to shit fairly quick

earnest phoenix
#

I run my bot on my laptop

solid spear
#

I use JSON as input data

waxen meteor
#

my JSON management is very shoddy, I think I'm doing it wrong

solid spear
#

Mostly because I can edit a spreadsheet and export to JSON and vice-versa for loading data

earnest phoenix
#

MySQL is better

solid spear
#

but saving and keeping object data is done via serialization

earnest phoenix
#

I’ll try to redownload it

waxen meteor
#

Each user has their own JSON file named after their ID, and it just pulls from the user's file when it's needed

earnest phoenix
#

I’m not an expert, but I’ll try my best

solid spear
#

That could scale poorly for your filesystem

#

At the very least I'd use a single file with a JSON Array of users

waxen meteor
#

I much prefer MySQL to JSON, but I never got the connector library working, and my server dying fucked everything over.

solid spear
#

but the positive side to your way is if one user is corrupt it doesn't crap the whole bed

earnest phoenix
#

Like I said, I’ll just try mySQL and I’ll work my way up from there. My bot is currently only on 3 servers

waxen meteor
#

Mine is on 5 👏👏

earnest phoenix
#

Nice

#

The sad thing is that no one uses the bot except me

waxen meteor
#

same

solid spear
#

My bot is in 2 servers being actively tested by ~7 people

#

4 of which are utterly hooked on the game which is a good sign

#

I'm curious to see how it scales

earnest phoenix
#

I want people to use my bot, but not to get famous. My laptop will commit suicide if it does

#

I’m middle school age...no money to buy legit servers

waxen meteor
#

I have a good rig, but if I have it running my bot and doing other stuff at the same time it slows down quite a bit

solid spear
#

fyi for in your near future:

#

$50 DigitalOcean credit can get you 10 months of a basic a VPS

waxen meteor
#

Other company who shall not be named?

#

cough cough Delimiter cough cough

earnest phoenix
#

I’ll just have it for my friends or so

loud salmon
#

vps stuff is still development

solid spear
#

??

#

Yeah what?

earnest phoenix
#

Ok, back to code, what the heck is a webhook

sinful lotus
#

webhook is basically a server that accepts post req

earnest phoenix
#

Topic says "bot development" which is usually coding, but okay.

sinful lotus
#

something like that

solid spear
#

I see, I guess we strayed a bit talking about the actual bots and goals. Apologies. It was in regards to scaling, which is development, but I see you point.

#

🙏

earnest phoenix
#

In what instances would you use a webhook

sinful lotus
#

something like if you handle large amount of data per sec

solid spear
#

webhooks wait for data

#

apis have to be called

waxen meteor
#

imitates other users with a webhook

sinful lotus
#

webhooks is basically a service that receives data from a webpage or something

#

it waits for post data

#

then process the post data

#

you can also make it handle get requests

#

and when you also make it handle /get thats basically where I think its called an api

earnest phoenix
#

I’m sorry, I’m so confused...how do you use one

sinful lotus
#

a sec

earnest phoenix
#

Ok

sinful lotus
#

I created that soley for my use but I decided to open source it anyways

#

that receives /POST and /GET requests, basically a middle man between my bot and dbl

earnest phoenix
#

Ahhhh.....I get it now, thanks

sinful lotus
#

here is a more indepth

#

stuff about api and webhook

earnest phoenix
#

Wow, that really cleared things up

#

Thanks

mint grove
#

hi there, is there any mod free to reinvite my bot to the server? id: 510980011008983060

earnest phoenix
hushed quarry
#

@modern sable ^

mint grove
#

oh my bad

modern sable
#

reinvited it

real helm
#

Hello

earnest phoenix
#

Hello

#

Do you need help? @real helm

real helm
#

Yes

#

If my bot is accept", is joined in this server?

mossy vine
#

ye

earnest phoenix
#

Yes

split hazel
#

How do i make pm2 startup start as the root user? Because pm2 doesnt wanna resurrect my processes on boot

mossy vine
#

you should be able to just run pm2 startup or something like that

split hazel
#

i have

#

the daemon doesnt start

#

and no processes get resurrected

mossy vine
#

with sudo?

split hazel
#

tried with sudo aswell

#

also tried sudo pm2 startup systemd

mossy vine
#

i get this output, maybe its suggesting a command like this for you as well?

split hazel
#

i'll try running the command again

#
Platform systemd
Template
[Unit]
Description=PM2 process manager
Documentation=https://pm2.keymetrics.io/
After=network.target

[Service]
Type=forking
User=root
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
Environment=PM2_HOME=/root/.pm2
PIDFile=/root/.pm2/pm2.pid
Restart=on-failure

ExecStart=/usr/local/pnpm-global/2/node_modules/.registry.npmjs.org/pm2/3.5.1/node_modules/pm2/bin/pm2 resurrect
ExecReload=/usr/local/pnpm-global/2/node_modules/.registry.npmjs.org/pm2/3.5.1/node_modules/pm2/bin/pm2 reload all
ExecStop=/usr/local/pnpm-global/2/node_modules/.registry.npmjs.org/pm2/3.5.1/node_modules/pm2/bin/pm2 kill

[Install]
WantedBy=multi-user.target

Target path
/etc/systemd/system/pm2-root.service
Command list
[ 'systemctl enable pm2-root' ]
[PM2] Writing init configuration in /etc/systemd/system/pm2-root.service
[PM2] Making script booting at startup...
[PM2] [-] Executing: systemctl enable pm2-root...
Synchronizing state of pm2-root.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable pm2-root
[PM2] [v] Command successfully executed.
+---------------------------------------+
[PM2] Freeze a process list on reboot via:
$ pm2 save

[PM2] Remove init script via:
$ pm2 unstartup systemd
root@raog:~#```
#

thats all i get

mossy vine
#

umm

#

that means it should be working thonkku

split hazel
#

ran a test script

[PM2] Spawning PM2 daemon with pm2_home=/root/.pm2
[PM2] PM2 Successfully daemonized
[PM2] Starting /root/pmtest.js in fork_mode (1 instance)
[PM2] Done.
┌────────┬────┬──────┬────────┬───┬─────┬──────────┐
│ Name   │ id │ mode │ status │ ↺ │ cpu │ memory   │
├────────┼────┼──────┼────────┼───┼─────┼──────────┤
│ pmtest │ 0  │ fork │ online │ 0 │ 0%  │ 8.3 MB   │
└────────┴────┴──────┴────────┴───┴─────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app
root@raog:~#```
#

and ran pm2 save