#development

1 messages · Page 474 of 1

earnest phoenix
#

yes

quartz kindle
#

lmao

cobalt cape
#

Ok so Javascript people:

To make my bot say something when it joins a new server, would I do something like:

client.on('guildCreate', guild => {

Or would I do something different? I'm not really sure how to do this

steel drum
#

i mean

#

as long as thats the right action

#

which it should

#

i tihnk you're fine

#

thing is i think .defaultChannel is read-only

#

i also think its deprecated

#

dont hold me to that

#

so it might be funky

#

maybe just pming the owner some stuff

cobalt cape
#

I think it's systemChannel

steel drum
#

would be the safest option ?

#

oh really ?

#

let me try ito n my bot

#

brb

cobalt cape
#

I think so

#

idk

knotty steeple
#

defaultChannel is depreciated

#

there is no default channel

cobalt cape
#

I know that but whats the one that we should use

knotty steeple
#

loop through channels the bot can post to and get the first one

cobalt cape
#

Could work

#

I could also do what ben said

knotty steeple
#

it does

cobalt cape
#

and pm the owner

west raptor
#

That would be to much work especially if the bot gains servers fast

knotty steeple
#

what would be

cobalt cape
#

Sending pms to the owner

#

But that's the thing

#

I don't see my bot climbing that fast

west raptor
#

It will when it gets on a couple bot list

#

Well not

#

Like

cobalt cape
#

maybe

west raptor
#

10 servers a day but like 18 servers first day

sick cloud
#

if the owner has dms disabled

#

error

west raptor
#

Not 18

#

10

sick cloud
#

and people hate being dmd by bots

cobalt cape
#

True

west raptor
#

I would cycle through the channels and see which one the bot can send to first

cobalt cape
#

What's the command to do that

sick cloud
#

theres no command

#

you check permissions

cobalt cape
#

Oh

#

Right

west raptor
#

York made a tutorial on how to do it

earnest phoenix
#

or dont send a message on join

#

thats an option u know

#

like

#

they invited the bot

cobalt cape
#

I want the message thoygh

earnest phoenix
#

do u think they are gonan need a welcome message

cobalt cape
#

though

sick cloud
#

theres a good way

earnest phoenix
#

like "oh shit! that bot i invited 5 vseconds ago!"

#

almost forgot!

sick cloud
#

make the invite url redirect to a thank you website

#

my bot does that

#

kinda

cobalt cape
#

Oh cool

west raptor
#

Well it could be useful for setups that the not needs

#

Bot*

#

Autocorrect

#

Reee

sick cloud
#

also for dashboards

#

to redirect to server settings

steel drum
#

an organized command hierarchy

#

where commands are broken into sub categories

#

so that it would be easier to find commands

#

that are related

upper ember
#
var mail = require('mail').Mail({
  host: client.config.mailer.host,
  username: client.config.mailer.address,
  password: client.config.mailer.password,
});
mail.message({
  from: client.config.mailer.address,
  to: ['root@mrsheldon.me'],
  subject: 'Hello from Luki'
})
.body('Hellooooo Thereeeeeeeeeee')
.send(function(err) {
  if (err) throw err;
  console.log('Sent!');
});
(node:21828) [DEP0010] DeprecationWarning: crypto.createCredentials is deprecated. Use tls.createSecureContext instead.
(node:21828) [DEP0064] DeprecationWarning: tls.createSecurePair() is deprecated. Please use tls.TLSSocket instead.
#

oof

#

help please joi

sick cloud
#

the channel topic says bot development

#

not random module breaking help

knotty steeple
#

this is for any kind of development

sick cloud
knotty steeple
#

ask a mod

heady zinc
#

staph mini-modding tony

sick cloud
#

its in the channel topic

#

not mini modding

heady zinc
#

ur in the channel topic

sick cloud
#

nou

upper ember
#

@sick cloud this is for my bot smh

#

btw it works

#

¯_(ツ)_/¯

sick cloud
#

ok

wide ruin
#

const Discord = require("discord.js");
const client = new Discord.Client(); 
const config = require("./config.json");
const { RichEmbed } = require('discord.js')

module.exports.run = async (bot, message, args) => {
  let embed = new RichEmbed()
        .setTitle("Error")
        .setDescription("Could not find that user.")
        .setColor(0xff0000);
  
  if (args[0] == "help") {
    message.reply("Usage: $dm <user> <message>");
    return;
  }
  let dmMember = message.guild.members.get(message.mentions.users.first().id || args[0]);
  if (!dmMember) return message.channel.send(embed);
  else{
   const args = message.content.slice(config.prefix.length + 3).trim().split(/ +/g);
   const command = args.shift().toLowerCase();
   const mention = message.mentions.users.first();
   const mentionID = mention.id;
   client.fetchUser(mentionID) .then(user => user.send(args));
    
  }
}
module.exports.help = {
  name: "dm"
}
#

this has an error

#

the command is used like this:

#

$dm @wide ruin message

#

and yes, 3 bots dmd me

smoky spire
#

Perhaps knowing the error could help us help you

wide ruin
#

one second

#

`module.js:487

throw err;

^

Error: Cannot find module './config.json'

at Function.Module._resolveFilename (module.js:485:15)

at Function.Module._load (module.js:437:25)

at Module.require (module.js:513:17)

at require (internal/module.js:11:18)

at Object.<anonymous> (/app/commands/dm.js:4:16)

at Module._compile (module.js:569:30)

at Object.Module._extensions..js (module.js:580:10)

at Module.load (module.js:503:32)

at tryModuleLoad (module.js:466:12)

at Function.Module._load (module.js:458:3)`
#

it says error: Cant find module ./config.json

smoky spire
#

You don’t have a config.json in that path

wide ruin
#

but it is a file

#

does it need commands/ at the start?

#

thats the files folder

smoky spire
#

Show your bot folder

#

./ only refers to the current folder, I’m assuming your config.json is not in the commands folder

wide ruin
#

no

#

let me change that

#

no error

#

let me test it qiockly

#

quickly*

smoky spire
#

You’ll probably get an error in your main bot file

wide ruin
#

`(node:17388) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: Request to use token, but token was unavailable to the client.

(node:17388) [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.`

smoky spire
#

Told ya

wide ruin
#

so how can i fix it?

smoky spire
#

Move your config.json back to your root path and change the ./config.json to ../config.json afaik

wide ruin
#

?

#

there is a file called config.json and one called commands/config.json

smoky spire
#

gtg sorry

wide ruin
#

ok

karmic blaze
#

Do numbers come before or after in sorting? Like, would it go 8ball, a_command, b_command or a_command, b_command, 8ball, or such?

knotty steeple
#

numbers then letters

karmic blaze
#

Alright, thanks. 😄

#

Weird question here, if I type +user @username i get the data for that user, but if i use @Koshi user @username i can only get the data for my bot/Koshi, how do i stop it from doing this?

knotty steeple
#

its getting the first mention

#

if it uses the mention prefix make it get the second mention

wide ruin
#

how can i make a var work on each file?

#

so i set it in one file

#

and send it in another

#

(d.jd)

earnest phoenix
#

hey pineapplefan

wide ruin
#

hi

#

can you help?

earnest phoenix
#

also before you say anything else

wide ruin
#

yeah?

earnest phoenix
#

does you dm command show who sent it

#

because if it doesn't

karmic blaze
#

Thing is I don't know how to check if the mention prefix is being used @knotty steeple

wide ruin
#

i decided against making the command

earnest phoenix
#

oh ok

wide ruin
#

so can you help now?

#

@earnest phoenix

knotty steeple
#

@karmic blaze how do you check if someone uses a prefix

earnest phoenix
#

with what

knotty steeple
#

show ur code

wide ruin
#

what i said earlier

#

how can i make a var work on each file?
so i set it in one file
and send it in another
(d.jd)

karmic blaze
#

First lines of my message event:

const { prefixes } = require('../config');

module.exports = async (client, msg) => {
    const prefix = prefixes.find(pre => msg.content.startsWith(pre));
    
    if (!prefix || msg.author.bot || !msg.guild) return;

...
#

(prefixes is an array, prefixes: ['+', '@random depot '],)

earnest phoenix
#

you mean like

knotty steeple
#

so check if prefix is = '@random depot '

earnest phoenix
#

how to make bot make its own code? @wide ruin

wide ruin
#

no

karmic blaze
#

Alright, I'll try pass it through and check.

wide ruin
#

use the same var in a different file

knotty steeple
#

global variables iirc

earnest phoenix
#

ok

knotty steeple
#

use module.exports and pass them in a function

wide ruin
#

how do i make a global variable?

#

?

earnest phoenix
#

what he said

wide ruin
#

module.exports(var name)?

knotty steeple
#

no

wide ruin
#

how then

knotty steeple
#

look at the docs for modules

wide ruin
#

which section?

#

@knotty steeple

knotty steeple
#

idk look around

wide ruin
#

i cant see modules anywhere

#

module.exports.hmm = true;

#

the var is called hmm

#

is that right @knotty steeple?

knotty steeple
karmic blaze
#

Is it possible to get a users join position?

#

(1, 2, etc..)

west raptor
#

wdym?

slender thistle
#

Sort all guild members by join date in a list/array and then get the certain member's position

karmic blaze
#

That.. sounds hard, lol

ruby dust
#

p sure d.py has that implemented

slender thistle
#

Python has sorted() and <list>.sort()

ruby dust
#

no I mean I remember doing that with shiramine bot

slender thistle
#

¯_(ツ)_/¯

thorn vault
#

Looking for discord.js people for a big project 😃

#

and python too!

#

DM ME

knotty steeple
#

no details doesnt really help

ruby dust
#

he's basically "hiring" people, or looking for collaborators

knotty steeple
#

yes but what is this "big project" about

ruby dust
#

it's like you're interested

earnest phoenix
#

Im working with the spotify api.. I have the endpoint and have created the app but have no Idea how to get the token.. I only have the client secret and the client id

#

apperently theres this post request to get the token? I have no idea tbh

#

apperently you need to use an endpoint like this to get the token for the app? https://accounts.spotify.com/api/token

#

This is the endpoint Im trying to get btw https://api.spotify.com/v1/playlists/2yPnp0T86RmpNIQ07AkBQC

runic cloud
#

Is Possible create a Bot WebDashboard, if it possible contact me in DM

topaz fjord
#

ofc it's possible

runic cloud
#

You help me?

#

@topaz fjord

#

Is Possible create a Bot WebDashboard, if it possible contact me in DM

shell blade
#

Could someone help me make my bot play audio in a voice chat? I've tried using different methods from the Discord.js website and none of them have worked.

storm tulip
#

@shell blade you mean music?

shell blade
#

Just audio files.

#

For a soundboard.

#

I've tried using this, but it didn't work.

const broadcast = bot.createVoiceBroadcast();

message.member.voiceChannel.join()
.then(connection => {
  broadcast.playFile('https://cdn.glitch.com/864c9828-b89f-4db5-8f87-89af38495227%2Fnot_to_be_racist.mp3');
  const dispatcher = connection.playBroadcast(broadcast);
}).catch(console.error);
west raptor
#
[2018-08-31 16:01:26] TypeError: fn is not a function
[2018-08-31 16:01:26]     at Map.map (C:\Users\fazin\OneDrive\Documents\Coding\Bots\Discord\Daylight\node_modules\discord.js\src\util\Collection.js:263:47)
[2018-08-31 16:01:26]     at Map.store.(anonymous function) [as map] (C:\Users\fazin\OneDrive\Documents\Coding\Bots\Discord\Daylight\node_modules\discord.js\src\util\Util.js:454:23)
[2018-08-31 16:01:26]     at module.exports.run (C:\Users\fazin\OneDrive\Documents\Coding\Bots\Discord\Daylight\commands\Information\user.js:58:41)
[2018-08-31 16:01:26]     at module.exports.runCommand (C:\Users\fazin\OneDrive\Documents\Coding\Bots\Discord\Daylight\node_modules\klasa\src\monitors\commandHandler.js:91:106)
[2018-08-31 16:01:26]     at <anonymous>
[2018-08-31 16:01:26]     at process._tickCallback (internal/process/next_tick.js:188:7)```
#

thonk

topaz fjord
#

It's part of d.js

west raptor
#

How can i fix it?

#

here is the code

#
        let user;
        if (!getUser) {
          user = msg.author
        } else {
          user = getUser
        }
      
        let member = msg.guild.member(user);

        let status;

        if (user.presence.status == "dnd") {
            status = "Do Not Disturb"
        } else if (user.presence.status == "online") {
            status = "Online"
        } else if (user.presence.status == "idle") {
            status = "Idle"
        } else if (user.presence.status == "offline") {
            status = "Offline"
        } 

        msg.channel.send({embed: {
            title: `${user.tag} user info`,
            fields: [
                {
                    name: 'Username and Discrim',
                    value: user.tag,
                    inline: true,
                },
                {
                    name: 'Status',
                    value: status,
                    inline: true
                },
                {
                    name: 'Joined Discord',
                    value: moment.utc(user.createdAt).format("dddd, MMMM Do YYYY, HH:mm:ss"),
                    inline: true
                },
                {
                    name: 'Roles',
                    value: member.roles.map().join(' | ')
                }
            ]
        }});```
#

oh wait

knotty steeple
#

you cant leave it empty like that

west raptor
#

what

knotty steeple
#

member.roles.map().join(' | ')

west raptor
#

ye i noticed

#

for some reason i changed it before i came here, worked, and then reverted back

#

i may have it ctrl z

#

by accident

earnest phoenix
#

does anyone have any idea how can i add 20 seconds cool down before a user gets xp on each message?

#
    async def on_message(self, message):
        author = message.author
        await self._set_levels(author)
        await asyncio.sleep(20)
        try:
            self.data["user"][author.id]["total_xp"] += int(randint(10, 15))
            dataIO.save_json(self.file_path, self.data)
        except:
            pass```
#

this is my codes

slender thistle
#

Probably make a list and append user ID there and then check if the user ID is in there

knotty steeple
#

20 seconds cooldown

#

thats too much

quartz kindle
#

add a lastxp timestamp to his entry in the database

#

and on message check if difference between saved timestamp and current timestamp is bigger than 20 seconds, if it is, add xp and change the timestamp

earnest phoenix
#

understood (:

#

thanks tim!

earnest phoenix
quartz kindle
#

wtf

#

you cant just copy and paste all of that

earnest phoenix
#

(:

loud salmon
#

did you just copy +paste your site css

earnest phoenix
#

mhm

quartz kindle
#

css is not just css, css is always css+html. they work together

loud salmon
#

that wont work

earnest phoenix
#

oh

quartz kindle
#

so you have to code specific css for the html of the website

earnest phoenix
#

oh

#

ight

knotty steeple
loud salmon
#

sadcatte im not sure

proven surge
#

can someone tell me whats wrong with this code

#
async def state(ctx,state= ""):
    """Shows information about a state."""
    if state == "":
        await bot.say(":x: | Please Specify a state")
        
    if state == "California":
        color = ''.join([random.choice('0123456789ABCDEF') for x in range(6)])
        color = int(color, 16)
        embed.add_field(name= "Admission to Statehood", value = "September 9, 1850 (31st State)")
        embed.add_field(name= "Area", value = "163,707 sq.mi (423,999 sq.km.)")
        embed.add_field(name= "Capital City", value = "Sacramento")
        embed.add_field(name= "Nickname", value = "Golden State")
        embed.set_footer(text= "{} | Requested by: {}".format(OceanConfig.BOTNAME, ctx.message.author))
        await bot.say(embed = embed)```
#

it keeps giving me this error

#
Traceback (most recent call last):
  File "C:\Users\xmoreno\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 50, in wrapped
    ret = yield from coro(*args, **kwargs)
  File "C:\Users\xmoreno\Desktop\Ocean Main.py", line 47, in state
    embed.add_field(name= "Area", value = "163,707 sq.mi (423,999 sq.km.)")
NameError: name 'embed' is not defined

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\xmoreno\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\bot.py", line 846, in process_commands
    yield from command.invoke(ctx)
  File "C:\Users\xmoreno\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 374, in invoke
    yield from injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\xmoreno\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 54, in wrapped
    raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'embed' is not defined```
knotty steeple
#

you didnt define embed

proven surge
#

Thonk im a little new to this, what does that mean

knotty steeple
#

did you even learn anything about python

proven surge
#

yeah...

#

are you going to just criticize me

knotty steeple
#

no

#

the error says whats wrong

#

you didnt say what embed is in ur code

proven surge
#

name 'embed'; is not defined

earnest phoenix
#

Where would I get an emoji ID?

proven surge
knotty steeple
#

\:emoji:

ruby dust
#

it's always a good practice to learn about a programming language first before heading to make something as large as a discord bot

earnest phoenix
#

\✅

#

Hm?

ruby dust
#

that's a unicode, those don't have ids

proven surge
#

thats not an emoji lel

knotty steeple
#

it is?

quartz kindle
#

emoji IDs are only available in custom emojis

proven surge
#

/🤔

#

lel

earnest phoenix
#

@quartz kindle Still, where would I get it?

#

O.o

ruby dust
#

that number

earnest phoenix
#

How did you get that?

proven surge
#

magic

ruby dust
#

put \ in front

proven surge
#

/tickYes

earnest phoenix
#

Ah ok. Thanks.

inner jewel
#

\

#

not /

knotty steeple
#

i just said what you had to do lmao

proven surge
#

ahhhhh

quartz kindle
#

also, @proven surge i dont know python, but im pretty sure your problem is this ```js
color = int(color, 16) // program: ok so color means int(color,16)
embed.add_field(name= "bla", value = "bla") //program: ok so embed is... wait what is an embed? you didnt tell me what an embed is yet

proven surge
#

back slasj

earnest phoenix
#

@knotty steeple I know, I tried it with a normal emoji and thought it didnt work until they told me

#

lmao

ruby dust
#

@quartz kindle their problem is that they went adding fields before defining the embed, if it is even defined anywhere

quartz kindle
#

thats exactly what i said, in noob language

ruby dust
#

yes, I don't understand noob language

earnest phoenix
#

\✅

#

😄

#

That spike in Memory when accessing an API cant be good...

#

Should I increase RAM?

ruby dust
#

only 20MB RAM?

quartz kindle
#

its just 3mb

#

assuming the spike is from 16 to 19

ruby dust
#

oh

knotty steeple
#

looks like

ruby dust
#

I'm blind

earnest phoenix
#

True true

proven surge
#

lel

#

thanks @quartz kindle, i figured it out

#

you could have just said add embed=discord.Embed()

#

😛

quartz kindle
#

that was for you to find out ;)

proven surge
#

but thanks anyway lel

quartz kindle
#

so now you know what the error means if it happens again

west raptor
#

we dont want to spoon feed you

proven surge
#

yes

#

and, ok i get that

#

now i shall add all the rest of the states

west raptor
#

yes

stark frigate
#

How do I make the text not to go off the image, I am using Canvas.

quartz kindle
#

use measureText

#

with this you can measure the length of the text before drawing, and adjust it accordingly

stark frigate
#

that seems complicated

#

how do I adjust the text doe?

quartz kindle
#

unfortunately there isnt a simpler solution

#

you have to break down the text yourself

#

for example, use split(" ") to get an array of words, and add each word to the sentence until it reaches a cap, which you can define by character length, or by measuretext length

#

then you have to finish the line, and create a new line

#

here's an example

#

what he does in that example is exactly that, split sentence into words, create a new line, add one word at a time until it exceeds the limit, draw line, create new line with the exceeding word, continue

#

of course you have to move the Y coordinate to the next line as well

stark frigate
#

yeah, just trying and seeing how will it work

wide ruin
#

So I have a 8 ball command in d.js

#

You say $8ball <question>

#

I want a way to rig the answer

west raptor
#

no

#

well

#

yes

#

but thats not fun

wide ruin
#

Like $8ball <message> &&outcome=<outcome>

#

The code I need is to remove everything up to <outcome>

#

And save just <outcome> as a var

#

How is that done?

knotty steeple
#

use basic logic

#

check if message is something

#

if it is have your outcome

wide ruin
#

So I can do if(message.contains = "&&outcome=") {

#

@knotty steeple

knotty steeple
#

but uh something like that

wide ruin
#

How is it then

knotty steeple
#

contains isnt a thing

wide ruin
#

Is it contents?

west raptor
#

.includes()

wide ruin
#

Ah

west raptor
#

wait

#

message.content.includes()

wide ruin
#

if(message.content.includes("&& outcome=") {

#

Is that right?

west raptor
#

yes

#

i think

wide ruin
#

And can I just run an else after that?

#

Like normal

west raptor
#

uh ye, i think lol, i cant think rn

wide ruin
#

Thanks though

west raptor
#

np

wide ruin
#

It didnt work

#

if(message.content.includes("&& outcome=") { was what I used

#

@west raptor

west raptor
#

error?

wide ruin
#

Yeah

#

The last { had an error

#

Even with a }

#

A few lines below

west raptor
#

huh

wide ruin
#

So I did this:

#
if(message.content.includes("&& outcome=") {


}```
west raptor
#

i dont see the issue?

wide ruin
#

The { at the end of the first bit had the error

west raptor
#

can you give the full error?

wide ruin
#

Invalid syntax "{"

west raptor
#

huh

#

uh well

#

the if statment is fine

#

its probably other code affecting it

topaz fjord
#

can you code block it

wide ruin
#
let result = Math.floor((Math.random() * replies.length));
    let question = args.slice(0).join(" ");
    if(message.content.includes("&&outcome=") {
       
       
       }
       else{
    let ballembed = new Discord.RichEmbed()
    .setAuthor(message.author.tag)
    .setColor("#00ff00")
    .addField("Question", question)
    .addField("Answer", replies[result]);

    message.channel.send(ballembed);
}```
topaz fjord
#

wheres the ennding to thne else statement

wide ruin
#

Cut off

knotty steeple
#

tfw you all cant see he is missing a )

wide ruin
#

O

knotty steeple
#

and im suprised you didnt see that yourself

west raptor
#
if(message.content.includes("&&outcome=")) {
       
       
}```
topaz fjord
#

@knotty steeple sir im legally bling

west raptor
#

same

wide ruin
#

And now

#

I need to just get the text after "&&outcome="

#

How do I do that?

sullen path
#

get the index of "&&outcome=" and substring things

#

best guess

knotty steeple
#

or just slice it out

sullen path
#

or split the text at "&&outcome=" and get arr[1]

#

🤷

knotty steeple
#

yea how would you do that

sullen path
#

I'm not js dev I'm using pseudocode

wide ruin
#

Please can you translate it into code

knotty steeple
#

what

#

translate it into code meaning spoonfeed?

wide ruin
#

Well

#

I kinda k ow how to slice

#

Know*

knotty steeple
#

ok then do it

wide ruin
#

const args = message.content.slice(config.prefix.length).trim().split(/ +/g);

#

This slices all after the prefix

#

But can I replace config.prefix.length with "&&outcome="?

knotty steeple
#

well

#

you have to slice the prefix and that

wide ruin
#

So if the command is" $8ball <question> &&outcome=<outcome>"

#

Do I need to do both?

knotty steeple
#

wait

#

what the fuck is &&outcome=<outcome> supposed to do

wide ruin
#

Set the outcome of the 8ball

inner jewel
#

you could use Array.find

wide ruin
#

But custom things

inner jewel
#

args.find(x=>x.startsWith("&&outcome="))

wide ruin
#

How would that fit into the code?

knotty steeple
#

why do you have to set the outcome of 8ball Thonk

inner jewel
#

you want an argument that starts with &&outcome

#

that finds the argument

#

although separating question and outcome might get a bit hard

ruby talon
#

@queen sentinel, my discord bot (@ruby siren) got muted because it would respond to other bots.
This problem should be fixed.

queen sentinel
#

Done 👍

wide ruin
#

So @inner jewel

#

I used your method

#

But outcome is "&&outcome=no"

#

How do I fix that part?

#

This is the last bit

#

Please help

inner jewel
#

.substring

wide ruin
#

I haven't used that before

#

Ease explain

inner jewel
#

you should learn to read the docs

wide ruin
#

Please*

#

Ok

lusty dew
#

I need help with something.. I am trying to make it so you can do !verify male or !verify female and it creates a channel were only the person that used the command and the owner and staff of the server can see the channel. Also I want it to send a message to that channel along with giving them the role and deleting the channel if the Owner or staff approves this person. Another thing, if 60% members have the Male verified role, it won't let anyone use the !verify male part of the command and only let females verify

#

I have the create channel down

#

and the perms

#

I just need the 60% thing done

#

Along with the !verify female or !verify male

loud salmon
#

store the amount of males and females somewhere per server

lusty dew
#

It is a custom bot I should Have mentioned that

#

It is for one server

#

not multiple

loud salmon
#

oh ok

lusty dew
#

Yea

#

Sorry should have mentioned that

loud salmon
#

then just store the 2 numbers in the bot config / whatever way you think is best

lusty dew
#

So wait

#

The numbers?

loud salmon
#

every time someone verifies, check if there is more than 60% majority

lusty dew
#

I am not sure if I am understanding

#

You said two numbers

loud salmon
#

do you want the person to run the command more than once? or just one time and then lock the command from them

lusty dew
#

After they used it

#

they can't use it again

#

unless they leave and rejoin

loud salmon
#

oh ok

lusty dew
#

They are not allowed to verify more then once ;p

loud salmon
#

the first thing you should do is this: when a person does !verify male/female, add 1 to the amount of males/females in a config somewhere

lusty dew
#

Ah ok

#

So I can do like

#

Something like that?

loud salmon
#

OH FUCK DELETE THAT

lusty dew
#

Its fine lol

loud salmon
#

and reset your token ASAP

lusty dew
#

I know there is a token

loud salmon
#

wot

lusty dew
#

The bot is not even done yet

#

I will reset token later

#

xD

west raptor
#

reset it

#

now

loud salmon
#

you should probably do it now

west raptor
#

like right now

lusty dew
#

meh

west raptor
#

boi

loud salmon
#

uhhh alright

lusty dew
#

Its fine lmfao

loud salmon
#

¯_(ツ)_/¯

lusty dew
#

Idrc

#

I understand the dangers

#

I will reset it in a second

west raptor
#

ok so when someone api abuses and gets you api banned and possibly get you account banned dont come crying to us

#

oh

#

ok

#

good

lusty dew
#

Yea

#

lmfao

#

Anyway

#
{
  "token": "",
  "prefix": "!",
  "Male": {
    
  },
  "Female": {
    
  }
}
#

Here it is

#

without the token

#

Also

#

The bot app is not on myaccount

#

xD

#

It is on the person that wants the bot's account

#

Bot*

#

I told them to reset the token though

#

Anyway is that how you do it?

loud salmon
#

in the male / female area's store the user id

bright spear
loud salmon
#

and if the user leaves, then remove the id

lusty dew
#

Well fuck

loud salmon
#

yea

#

you should be more careful about that token

lusty dew
#

Yea I guess

#

I told my vlient to reset it

#

Client*

#

I hope I set up the Male and Female thing right in my config o.o

#

Well whoever made the bot leave the only guild it was in

#

That is cool

#

Glad they didn't uck the server up though

loud salmon
#

thats what happens when a token is leaked b1nzyhyperban

lusty dew
#
"Male": {
    
  },
  "Female": {
    
  }
}
#

Here is the part of the json

#

that has the male and female thing set up

#

So the ID's go into those brackets and hopefully get recorded in there

inner jewel
#

you'll want an array for that

lusty dew
#

Oh?

inner jewel
#

unless you need to map other data to the ids

lusty dew
#

Ah

inner jewel
#

if you want to just know what id is where

#

an array is better

lusty dew
#

Ok

#

Ok so I just replace the brackets with [] right?

inner jewel
#

yes

lusty dew
#

Ok

#

Thank you

#
const Discord = require("discord.js");

module.exports.run = async (bot, message, args) => {
guild.createChannel('new-general', 'text')
  .then(console.log)
  .catch(console.error);
}

module.exports.help = {
  name: "verify"
}
#

Also this is what I have for creating the channel

#

I am not sure if this is write or not

#

I made this example

#

before I got to far into it and it was wrong

vernal basin
#

so i have a random number generator that posts 3 embeds after the number is generated

#

all of them are literally identical besides the message

#

except

#

the 2nd of the 3 sometimes won't print out

#

so i have one Green, one Blue, one Red. The Green posts, then Blue, then Red. (Red sometimes lags a little but that's okay). Sometimes, it will just print Green - Red

#

ommitting the Blue

#

anyone know why?

west raptor
#

whats your code?

#

for

#

it

vernal basin
#

just a sec

#

message.channel.send({embed: {
            color: 3066993,
            description: "You rolled a **" + random + "**."}})```
#
if (random / number <= 0.2) {
            message.channel.send({embed: {
                color: 1752220,
                description: `Battle Damage: \n Critical Miss. Using a bow? Subtract 1 arrow from your inventory.`
            }});}
        else if (random / number <= 0.3) {
            message.channel.send({embed: {
                color: 1752220,
                description: `Battle Damage: \n Flimsy Hit. 50% of Base Damage.`
            }});}
        else if (random / number <= 0.6) {
            message.channel.send({embed: {
                color: 1752220,
                description: `Battle Damage: \n Weak Hit. 75% of Base Damage.`
            }});}
        else if (random / number <= 0.8) {
            message.channel.send({embed: {
                color: 1752220,
                description: `Battle Damage: \n Hit. 100% of Base Damage.`
            }});}
        else if (random / number <= 0.8) {
            message.channel.send({embed: {
                color: 1752220,
                description: `Battle Damage: \n Powerful Hit. 125% of Base Damage.`
            }});}
        else if (random / number <= 0.8) {
            message.channel.send({embed: {
                color: 1752220,
                description: `Battle Damage: \n Critical Hit. 150% of Base Damage.`
            }});}```
#

if (random / number <= 0.4) {
            message.channel.send({embed: {
                color: 15158332,
                description: `Enemy Damage: \n Miss.`
            }});}
        else if (random / number <= 0.6) {
            message.channel.send({embed: {
                color: 15158332,
                description: `Enemy Damage: \n Weak. Base Damage.`
            }});}
        else if (random / number <= 0.8) {
            message.channel.send({embed: {
                color: 15158332,
                description: `Enemy Damage: \n Hit. 300% of Base Damage.`
            }});}
        else if (random / number <= 1) {
            message.channel.send({embed: {
                color: 15158332,
                description: `Enemy Damage: \n Critical Hit. 500% of Base Damage.`
            }});}```
knotty steeple
#

could you instead use hastebin?

vernal basin
#

oh ok

lusty dew
#

Hi Samurai

#

:3

knotty steeple
#

hi

lusty dew
#

Hmm

#

I have a question Samurai

lusty dew
#
const Discord = require("discord.js");

module.exports.run = async (bot, message, args) => {
channel.delete()
  .then(console.log)
  .catch(console.error);
}

module.exports.help = {
name: "close"
}
#

Would that work as

#

deleting the channel

#

the command is used in?

knotty steeple
#

well

#

channel isnt defined

#

so what you think

lusty dew
#

So no

#

I forgot to define channel

#

~<

#

I also don't remember how to define channel for something like that

#

My friend told me but my memory is shit

knotty steeple
#

what channel are you deleting

lusty dew
#

I am deleting the channel the command is used in..

#

Also

#

I just done this

#

Someone helped me with part of it

#
const Discord = require("discord.js");

module.exports.run = async (bot, message, args) => {
if(your command arguments here){
<Message>.channel.delete()
  .then(console.log)
  .catch(console.error);
}
}

module.exports.help = {
name: "close"
}
#

That is why it says

#

your command arguments here

knotty steeple
#

are you using args

lusty dew
#

Not that I know of

#

it was a habbit

bright spear
#

if you can't understand that code and fix it, you should learn js and your lib before making a public bot

lusty dew
#

habit*

#

🤔

#

Okie

#

Dont be rude though

knotty steeple
#

<Message> would be your message object

lusty dew
#

Seeking help is one way of learning as you can learn from what the other person says

#

So sorry for learning in my own way :3

#

Ima take a break

vernal basin
earnest phoenix
karmic blaze
#

I'm trying to get the join position of a user.

quartz kindle
#

-1 means it was not found

#

also, instead of indexof(find), just use .findIndex()

#

@vernal basin blue doesnt print anything if the random number is above 0.8

#

you dont have anything for that

vernal basin
#

oh lol my bad

#

xd, thakns

quartz kindle
#

@earnest phoenix to POST something, means to send an HTTP request using the POST method

#

you can use libraries such as snekfetch, request, node-fetch, or use node's internal http functions

karmic blaze
#

Think you tagged the wrong person there @quartz kindle :3 but okay, uh, how would i use .findIndex()?

quartz kindle
#

oh oops

#

sorry, im blind lmao

earnest phoenix
#

I know

quartz kindle
earnest phoenix
#
const snekfetch = require('snekfetch')
const config = require('./config.json')

//Fetching the playlist from the spotify api

const credentials = {
  client: {
    id: config.client_id,
    secret: config.client_secret
  },
  auth: {
    tokenHost: 'https://accounts.spotify.com',
    tokenPath: '/api/token',
    authorizePath: '/authorize'
  }
};

snekfetch.post(credentials.auth.tokenHost)
``` currently trying it (this is unfinished code)
karmic blaze
#

@earnest phoenix How are you POSTing it?

#

Ohhh

#

You can use .set('Authorization', ' ... ')

earnest phoenix
#

yeah

#

thats why I said unfinished code

bright spear
#

thats not how you do it

heady zinc
#

i'd like to remind that snekfetch is deprecated and shouldn't be used lurk

bright spear
#

@heady zinc works fine

#

but u can use a fork like jaczfetch

heady zinc
#

i mean it works fine for now

karmic blaze
#

It works fine as .-.

quartz kindle
#

i use request instead

bright spear
#

@earnest phoenix you dont need any credentials object

topaz fjord
#

@heady zinc ur deprecated

earnest phoenix
#

why dont I?

topaz fjord
#

use node fetch

earnest phoenix
#

I need the bearer token

quartz kindle
#

according to the spotify api

#

it should be something like

#
headers: {
    'Authorization': 'Bearer ' + accessToken
},```
#

idk if im looking at the right place tho

earnest phoenix
#

you are

#

but I need to get the "accessToken" before I can use it

#

I only have the clientID and the clientSecret

uncut slate
#

you'll need to set up an oauth callback for that

#

afaik

#

your access token will be expiring hourly as well, you'll want to store a refresh token alongside it

quartz kindle
earnest phoenix
#

wdym

#

hm

#

so

#

const credentials = `${config.client_id}:${config.client_secret}`

snekfetch.post("https://accounts.spotify.com/api/token").set('Authorization', credentials).then(r => {```
#

and I'll need an redirect url

#

so I need to use express too I guess?

#

I really dont fucking know how to get this token ugh

quartz kindle
#

the problem is

#

You do Prompt your user to a webpage where they can choose to grant you access to their data.
You get An access token and a refresh token.

#

its oauth2

#

they need to click on your link

#

to give you the token

earnest phoenix
#

I dont want oauth2 smh I just want to get a playlist with my "app" on spotify

quartz kindle
#

then you're using the wrong authorization

earnest phoenix
#

okie

#
https://api.spotify.com/v1/playlists/2yPnp0T86RmpNIQ07AkBQC``` Im trying to get this
#

what token do I use

bright spear
quartz kindle
#

this is what you need

#

Client Credentials Flow
The Client Credentials flow is used in server-to-server authentication. Only endpoints that do not access user information can be accessed. The advantage here in comparison with requests to the Web API made without an access token, is that a higher rate limit is applied.

You do Login with your Client ID and Secret Key.
You get Access token.

earnest phoenix
#

;-; thats exactly what I was looking at too

#

before I looked at the bearer token and my brain went oh I must need this one

quartz kindle
#

if i understand correctly

#

POST must have {"grant_type":"client_credentials"}

#

and Header must have "Authorization" : "Basic <base64 encoded client_id:client_secret>"

earnest phoenix
#

oof thats const btw

#

credentials is going to be the base64 string

quartz kindle
#

something like that yes

#

.post(url).set(authorization).send(granty_type)

earnest phoenix
#

lemme check if it works

#

is there any lib that is in node that can convert base64

#

or in discord.js or something

gilded blaze
#

Don't need a lib. It's built into JS

earnest phoenix
#

since npm is down

#

oof it is?

quartz kindle
#

atob() and btoa() are base64 operations

gilded blaze
earnest phoenix
#

so I can do something like base64 = require('btoa') or is it just a built in function

#

fuck im a noob nvm

gilded blaze
#

Built in.

#

No require.

quartz kindle
#

its built in into js itself, not node

earnest phoenix
#
btoa is not defined```
#

:3

#

lemme require it and see if it works

gilded blaze
#

Show code

earnest phoenix
#
const credentials = btoa(`${config.client_id}:${config.client_secret}`)```
quartz kindle
heady zinc
#

that isn't nodejs

quartz kindle
#

no, but is js

#

did they remove it from node for some reason ?

heady zinc
#

it's like fetch

#

psure it's exclusive to browsers

earnest phoenix
#

my node is fucked? GWfroggyZoomeyes

#

oh

#
The 'btoa-atob' module does not export a programmatic interface, it only provides command line utilities.

If you need to convert to Base64 you could do so using Buffer:```
#

stack overflow saves the day

heady zinc
#

nodejs allows you to base64 encode stuff with Buffer.from('stuff').toString('base64')

earnest phoenix
#

oof wtf (node:8828) UnhandledPromiseRejectionWarning: Error: 415 Unsupported Media Type

#

media lol wut

quartz kindle
#

hmm

earnest phoenix
#

you think maybe its the quotes that I use?

#

these lil bastards? \`` `

#

oof lol

quartz kindle
#

what do you have now?

earnest phoenix
#

these `

quartz kindle
#

i mean, the whole code

earnest phoenix
#
const credentials = Buffer.from(`${config.client_id}:${config.client_secret}`).toString('base64') 
const host = "https://accounts.spotify.com/api/token"

snekfetch.post(host).set('Authorization', credentials).send({"grant_type":"client_credentials"}).then(r => {

console.log(r)

})```
quartz kindle
#

is the error coming from Buffer, or is it coming from snekfetch?

earnest phoenix
#

lemme sheck

#

check

gilded blaze
#
let test = "hello";
let other = " world";
Buffer.from(`${test}:${other}`).toString("base64")``` worked for me
quartz kindle
#

according to the spotify docs, the authorization header should be "Authorization" : "Basic <base64 encoded client_id:client_secret>"

earnest phoenix
#

oof its coming from snekfetch

quartz kindle
#

so in your case: "Basic "+credentials

earnest phoenix
#

still says it

#
const credentials = Buffer.from(`${config.client_id}:${config.client_secret}`).toString('base64') 
const host = "https://accounts.spotify.com/api/token"

snekfetch.post(host).set('Authorization', `basic ${credentials}`).send({"grant_type":"client_credentials"}).then(r => {

  console.log(r)

})
quartz kindle
#

maybe Basic with capital B?

earnest phoenix
#

nope :((

#

I guess snekfetch is shit? GWqlabsGarThink

#

tbh Im probably doing something wrong

#

lul

heady zinc
#

snekfetch may be deprecated, but it is still fully working lurk

quartz kindle
#

try adding

#

'Content-Type':'application/json'

#

to the header

earnest phoenix
#

ok

#

like this?

#
snekfetch.post(host).set('Authorization', `Basic ${credentials}`).send({"Content-Type":"application/json", "grant_type":"client_credentials"}).then(r => {```
quartz kindle
#

set('Authorization', Basic ${credentials}).set("Content-Type":"application/json").send()

earnest phoenix
#

I tried ://

#
snekfetch.post(host).set('Authorization', `Basic ${credentials}`).set("Content-Type":"application/json").send({"grant_type":"client_credentials"}).then(r => {
                                                                      ^^^^^^^^^^^^^^

SyntaxError: missing ) after argument list```
#

Its pointing at the "Content-Type"

#

oof should it be a comma

#

I changed it to a comma

#

and it worked but gave me an error again with the media type

quartz kindle
#

then try

#

'Content-Type':'application/x-www-form-urlencoded'

earnest phoenix
#

comma im guessing instead of :

#

it worked wow

#

I got a big buffer and a body cool

quartz kindle
#

halelujah?

#

lmao

earnest phoenix
#

thank you so much wow

quartz kindle
#

finally, now i can sleep

earnest phoenix
#

oof what time is it for you

quartz kindle
#

only 11pm, but im not a nightcore person

earnest phoenix
#

okie goodnight fam

west raptor
#

Is there a way to get connections on a user's profile? I'm guessing it's for user bots only, I also am to lazy to read the docs

oblique sequoia
#

it's for users only

#

that requires the profile endpoint which bots cant utilize

west raptor
#

Yea that's what I thought

#

Thanks for response though

earnest phoenix
#

Im using that as my args handler,

#

how can I actually get the thing?

idle mountain
#

I'm not really sure what /[ ]+/ means, but I'd guess that args would become an array, in which case you can use args[0] to get the first argument, args[1] to get the second, etc.

earnest phoenix
#

Ah, alright. Thanks.

#

It works.

idle mountain
#

also keep in mind that there's frequent OutOfRangeException errors with that, so before accessing args[1], make sure that args.length > 0 is true

#

or args.length > 2 is true before accessing args[3], for example, and etc.

earnest phoenix
#

Why does:

    var sender = message.author;
    message.channel.send("@everyone\n"+`**Important message from ${sender}:**`);
    message.channel.send(`${argsannounce}`);```
#

return

#

a , infront of it?

idle mountain
#

Is this JavaScript?

earnest phoenix
#

yes

idle mountain
#

It returns a , in front of the first message? before the @everyone?

earnest phoenix
#

ill show u

idle mountain
#

alrighty

earnest phoenix
idle mountain
#

try replacing your first line with var argsannounce = message.content.replace("!announce ", "");

#

um

#

the problem there is that if someone uses !announce without anything after it it might break but I'm not 100% sure how JavaScript handles it so idk

#

the problem there is that you're creating an array from the string !announce Announcement, splitting it by !announce, which creates two items in an array, which is a completely empty string and Announcement- you're asking it to post the full array, so it posts the first item, then Announcement, surrounded by commas to separate it, so it outputs , Announcement

earnest phoenix
#

It handles it fine, thanks for the help and explanation!

idle mountain
#

ah that formatting is all messed up

#

there I fixed it

#

np :P

earnest phoenix
#

ok

idle mountain
#

seems the regex string [^0-9a-zA-Z]+ works pretty well, just stole that from google topKEK

earnest phoenix
#

use \W

#

"A word character is a character from a-z, A-Z, 0-9, including the _ (underscore) character."

#

so let me break this down

#

if \W is a-z, A-Z and 0-9

#

then why the fuck are you keeping 0-9a-zA-Z in your regex

#

and why is \W out the front

#

pretty sure that works for what u wanted

bright spear
#

oof there did they go

earnest phoenix
#

Sorry if this is an easy answer. I'm stumped

How can I go about adding a role to active chatting users, and timeout like 10 minutes after if they stop being active?
like only give it to people who are constantly active for like 5 mins straight

#

if that makes sense

#

can somebody help

#

i am making a new bot

#

but this time in javascript

#

yep

#

can someone help

#

wdym by "help"

#

i dont get how i make a !help command

#

what

#

oof what lang did you make your bot in before?

#

Discord Bot Maker Program

#

oh

#

lmaooo

#

Do you know javascript?

#

a bit

#

Or python?

#

you need a command handler

#

Kush shh

#

😦

#

lul

#

I have a command, event, config and permission handler oof

#
if (message.author.bot) return;
let prefix = "!";
if (message.content.indexOf(prefix) !== 0) return;
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();

if (command === "help"){
...do something
}
#

and you can follow the if statement on the bottom for other commands

#

ill break it down

#

sec

#
if (message.author.bot) return;

This is just so the bot doesn't respond to itself

let prefix = "!";

Your prefix

if (message.content.indexOf(prefix) !== 0) return;

No prefix? Don't respond.

const args = message.content.slice(prefix.length).trim().split(/ +/g);

Splits the string up into arguments. So you can access it later by args[0,1,2,etc..]

const command = args.shift().toLowerCase();

Converts the command or args[0] to lower case

if (command === "help"){
...do something
}

Your if statement for commands.

#

there

#

enjoy

#

oof

#

amazing command handler 10/10

#

Yeah actually thats a good start

#

once you get more advanced you'll get into things like modular command handlers

#

yeh i only gave him that because he's practically new

#

its easier to have stuff in 1 document

#

than thrown all over the place

#

use an object with each command and check the key

#

no if statements and reloafable commands

#

does somebody have a !help embed command in js that i can customize

#

u can learn js. and make one urself

#

no blobspoonfeed

#

un bad in js

#

We won't spoon feed you. You need to learn

#

and im bad at some things

#

Check out embed documents

#

the solution is learn

#

Look up

"discord.js embed"

#

not ask for spoonfeed

#

Now. I have a question for you guys

#

ok

#

I wanna make a role where whenever the user is talking constantly for a certain amount of time (like 5 mins) they'll get a role.

It'll stay on them unless they stop talking. Which after 10 mins of not talking it'll be removed

#

Basically an activity role

#

Discord.js

#

i can make that with DISCORD BOT MAKER

#

that would be cool

#

lmfao

#

discord bot maker

#

I dont want discord bot maker lol

#

probably a bad idea since u will hit ratelimits for role, but you could store like the number of messages a person sends, then every 10 mins give people with a certain number of messages a role, and reset the coubt

#

Nah rate limits are fine

#

That'll only be a rate limit unless it's constantly changing

#

it would be 😂

#

is it a global bot?

#

No

#

oh then you should be fine

#

i have another bot thats on 24k servers

#

but im not going to add him to that

#

add that to him *

#

the bot token would be banned really quick

serene cobalt
#

@earnest phoenix you're bad at js lmao

earnest phoenix
#

not anymore

#

wanna join my test server

#

i made a bot in visual studio code

#

@serene cobalt

serene cobalt
#

oof

#

@earnest phoenix Stop advertising your discord

earnest phoenix
#

sorry

#

it is just a test server

#

with 3 bots

serene cobalt
#

still adverting a server

earnest phoenix
#

not

#

how do i let the bot send 2 lines in an embed]

#

if i use enter it will give an error

serene cobalt
#

\n

earnest phoenix
#

?

serene cobalt
#

What happened to you being good at js?

earnest phoenix
#

no

#

look

serene cobalt
#

\n is newline

earnest phoenix
#
{
          name: "Moderation",
          value: "``!kick`` - kicks an player from the server."
        }
      ],
      timestamp: new Date(),
      footer: {
        icon_url: client.user.avatarURL,
        text: "Absolutech"
      }
    }
#

ow thx

serene cobalt
#

pff

earnest phoenix
#

what

#
if xp < 100:
            level = 1
        elif xp < 250:
            level = 2
        elif xp < 475:
            level = 3```
am i doing this right ![thinkEyes](https://cdn.discordapp.com/emojis/406800811700781076.webp?size=128 "thinkEyes")
radiant night
#

No

earnest phoenix
#

rip

#

then how can i do it

steel drum
#

@earnest phoenix

#

imo you should

#

base how levels off

#

a exponential systems

#

so like for my bot

#

first 10 levels is the level * 100

#

thats how much exp you need to level up to the next level

#

then after level 10

#

you multiply the previous level's exp by 1.1

#

ill show the function

earnest phoenix
#

oh

#

so what is level defined as?

steel drum
#

what do you mean

earnest phoenix
#

first 10 levels is the level * 100

#

what is level?

steel drum
#

users start off as level 0

earnest phoenix
#

right

steel drum
#

so you need 100 xp to level up to level 1

#

then you need 200 to level up to level 2

#

etc

#

until level 10

earnest phoenix
#

right

steel drum
#

so at level ten

#

itll be however much exp you need for the previous level

#
  • 1.1
#

so at level nine you need 1000

#

so at level 10

#

itll be 1000 * 1.1

#

which is 1100

earnest phoenix
#

yep

steel drum
#

then at level 11, its 1100*1.1

#

which is w/e it is

earnest phoenix
#

right

#

its just the same

#

using more maths

steel drum
#

yea

earnest phoenix
#

but

steel drum
#

its a bad idea to hard-code stuff like exp

earnest phoenix
#

Your level is 7 with 1851 xp

#

elif xp < 2200: level = 7

steel drum
#

dont hard code exp dude

earnest phoenix
#

shouldn't the xp more then 2200 for level 7

#

why not

steel drum
#

thats just not good practice

earnest phoenix
#

mhm

#

but using that algo or formula

#

its just the same method 🤔

steel drum
#

the alg doesnt really matter that much as long as you scale how much exp users earn accordingly

earnest phoenix
#

yep

earnest phoenix
#

alright so I need to refresh a token for my application once every 10 days
i was considering a scheduledexecutor but im not sure if thats the best solution?
I wont get any sort of notification when it runs out or whatsoever by the server

#

technically i can change the 10 days to anything between 1ms and 10 days if that makes a difference

#

something java based if anything has any suggestions

neon swift
#

Keep track of when you last refreshed token and make sure token is valid each time you need to use it

earnest phoenix
#

problem is i dont need to use it i get notified with events for the duration i pass it on creation @neon swift

#

so theres no indicator for checking

neon swift
#

So you need to auth against their webhook instead of them authing against your server??

carmine veldt
#

Hey i need help setting up commands and things for a bot on a server im running

neon swift
#

wdym "setting up commands"??

#

Are you using a pre-made bot?

carmine veldt
#

no 😩

quartz kindle
#

do you want to create your own bot?

carmine veldt
#

ive got the bot made just need things for it to do and how to make it come online

quartz kindle
#

what do you mean with "got the bot made"?

#

you mean going to the discord dev website and creating a bot account?

#

or actually coding something?

carmine veldt
#

can you tell i'm new at this? haha

quartz kindle
#

yes

#

im gonna tell how you bots work

#

you create a bot account, which will give you an id to login with.
you create/code a program that will use the id to connect to discord.
your program receives messages from discord, does actions with it, and returns messages to discord

#

the bot will be online while this program is running in your computer

carmine veldt
#

right

quartz kindle
#

do you have experience with any programming language?

carmine veldt
#

😖 not really

quartz kindle
#

then your first step is to learn a programming language

carmine veldt
#

we just needed a bot and we didnt wanna use a premade one

quartz kindle
#

good languages for beginners are Python and Javascript

carmine veldt
#

ah ok

quartz kindle
#

study a language for a bit first, until you understand it more or less, then come back to attempt a bot

carmine veldt
#

ok

quartz kindle
#

otherwise you'll be running in circles having no idea what you're doing

carmine veldt
#

yeah than

#

thanks

quartz kindle
#

good luck!

west raptor
#

I started with little js experience

neon swift
#

Javascript is probably the best to learn for discord bot making. It has the most people willing to help you

west raptor
#

Py is also good

neon swift
#

Yeah, but it has like half the share of bots made

carmine veldt
#

yeah probs sound like a tool but is there money involved?

neon swift
#

There are free IDEs

west raptor
#

No, unless you you want a VPS

neon swift
#

Oh yeah, you need to host the bot so you would need to pay 4$ a month for a cloud server

west raptor
#

Or self host

neon swift
#

or host on your own PC if you have internet and stable electricity

carmine veldt
#

ah ok