#development

1 messages ยท Page 432 of 1

fluid basin
#

then compare the next time they use it

#

ยฏ_(ใƒ„)_/ยฏ

knotty steeple
#

but how do i make it say You only have 3 more seconds until you can use this command zoomeyes

fluid basin
#

just subtract the time and format it to make it readable

knotty steeple
#

ok

quasi marsh
#

in d.py you just have a cooldown property

#

If you use the ext framework

knotty steeple
#

is there a way to find the owner of a bot in d.js?

earnest phoenix
#

Python btw

night imp
#

Make a random number generator for the amount of photos in the thing and then pick one based on the output

knotty steeple
#

ok i got a slots command, should i make it so that if you win you get the bet * 2 or something else?

#

thats what im going with rn

earnest phoenix
#

BufferedImage, is recomended for JDA?

native narwhal
#

Hue?

earnest phoenix
#

I want to create images to send with Jda.

#

BufferedImages?

spring ember
#

yes

#

it is recommended

native narwhal
#

I mean I don't think there is anything which is recommended but since BufferedImage and ImageIO are built in classes it is probably the way to go

earnest phoenix
#

But the background stay black.

spring ember
#

use Graphics

earnest phoenix
spring ember
#

umm set alpha composite to 0

#

oh wait

native narwhal
#

I am not sure if that is how you do it, try doing

graph.setColor(Color.CYAN);
graph.fillRect(0, 0, 600, 600);
inner jewel
#

INT_RGB means no alpha

spring ember
#

yeah I noticed

inner jewel
#

you probably want INT_ARGB

spring ember
#

or you can draw your image over an empty image full of Color.cyan

earnest phoenix
#

@native narwhal i'll try this

spring ember
#

what Joakim said will do if the background is not invisible and is just black

earnest phoenix
spring ember
#

elsewise try what I suggested

earnest phoenix
#

Okay

#

i'll try

native narwhal
#

What is the code after what you sent

earnest phoenix
native narwhal
#

Well the sending part and stuff

earnest phoenix
gilded blaze
#

That is unneeded

spring ember
#

wait wait

gilded blaze
#

Convert BufferedImage to bytes

#

Send that

spring ember
#

you have a new image

#

and you want to color it cyan?

#

like empty?

earnest phoenix
#

I'm searched how Buffered to file

#

is this that i find

gilded blaze
#

Use byteoutputarraystream

spring ember
#

can you send full code?

earnest phoenix
#

Is this the full code

inner jewel
#
public static byte[] toBytes(BufferedImage image) {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try {
        ImageIO.write(image, "png", baos);
    } catch(Exception impossible) {}
    return baos.toByteArray();
}```
gilded blaze
#

yes

inner jewel
#

then channel.sendFile(toBytes(image), "image.png").queue()

earnest phoenix
#

Okay!

#

i'll try

#

I delete the file?

#

and imageIO.write?

inner jewel
#

no need to write files at all

earnest phoenix
native narwhal
#

Remove the file

earnest phoenix
#

Okay

native narwhal
#

And also the setBackground was supposed to be setColor

earnest phoenix
#

I forgoted

#

Okay

native narwhal
earnest phoenix
#

i don't understand thisss

native narwhal
#

One second let me test, can you send the code you have

earnest phoenix
#
        BufferedImage image = new BufferedImage(600,600, BufferedImage.TYPE_INT_RGB);
        Graphics2D graph = image.createGraphics();
        graph.setColor(Color.CYAN);
        event.getMessage().getChannel().sendFile(toBytes(image), "imagem.png").queue();```
native narwhal
#

๐Ÿคฆ๐Ÿผ You removed the graph.fillRect

#

xD

earnest phoenix
#

ooh

#

haha

native narwhal
earnest phoenix
#

how

#

how

#

how

native narwhal
#
Graphics2D graph = image.createGraphics();
graph.setColor(Color.CYAN);
graph.fillRect(0, 0, 600, 600);

as I said from the beginning ๐Ÿ˜‚

earnest phoenix
#

not works for me

inner jewel
#

you might want to call graph.dispose() after you're done

native narwhal
#

๐Ÿค” I have never had to do that

inner jewel
#

it works without but you should call it

#

to release any resources which might have been allocated

native narwhal
#

Hmm

earnest phoenix
#

not works

#

.-.

#

omg

#

i don't undestand

#

i'll try in other project

#

i'll left now

#

later i'm back

#

bye thanks

native narwhal
#

Okay ๐Ÿ‘‹๐Ÿผ

earnest phoenix
#

is it possible to make a global stream? ๐Ÿ‘€

#

Like

#

a dispactcher but for every guild

inner jewel
#

so a single player sending to multiple guilds?

earnest phoenix
#

yeah

knotty steeple
#

pretty much a radio

earnest phoenix
#

Yeah pretty much

inner jewel
#

should be possible

#

not sure how hard it is

#

i know for jda/lavaplayer it'd be relatively easy

earnest phoenix
#

Im trying to figure it out with ytdl

#

and discord.js + ffmpeg

gilded blaze
#

YTDL is outdated

#

use discord.js/lavalink

#

and lavalink

inner jewel
#

lavalink doesn't allow this

earnest phoenix
#

I have but its server-based

gilded blaze
#

oh

earnest phoenix
#

Thats why I use quick.db

#

instead of mongo

#

wait nvm

#

hm

#

Here it is

limpid cosmos
#

I have a question how can I create a command where I can see all the servers where my bot is ?

knotty steeple
#

all the names?

topaz fjord
#

You can

limpid cosmos
#

how that's the problem

knotty steeple
#

you can map them

limpid cosmos
#

I'm starting with javascript x)

topaz fjord
#

You can map the .guilds property

spring ember
#

You can find all the servers by doing client.guilds

limpid cosmos
#

okay

spring ember
#

I recommend learning about map methods

limpid cosmos
#

for example message.send(client.guilds) ?

spring ember
#

No

#

You need to use methods to "stringify" the collection

quartz kindle
#

client.guilds.foreach, or something

#

to get their names

knotty steeple
#

nah

spring ember
#

Don't use foreach

knotty steeple
#

just use maps

limpid cosmos
#

how to use maps ? sorry for taking your time

spring ember
#

Look at the docs

knotty steeple
spring ember
knotty steeple
#

yes zoomeyes

quartz kindle
knotty steeple
#

shh dont spoonfeed

limpid cosmos
#

okay i'm going to look at the doc ๐Ÿ˜‰

earnest phoenix
#

sup

#

sup

limpid cosmos
#

i don't like to copy paste x)

earnest phoenix
#

sup

#

sup

#

sup

#

sup

#

sup

#

sup

spring ember
#

@quiet bobcat pls

#

@quartz kindle don't spoon-feed let him code by himself

limpid cosmos
#

yep but i'm not copy paste then it's okay

quartz kindle
#

its fine, its just a simple one-liner

quiet bobcat
#

@earnest phoenix don't spam

quartz kindle
#

and he still needs to resolve the returned array/map

spring ember
#

Sending code never helps because if he doesn't know by himself he will not understand the code either, you need to point to the right direction so he can learn

quartz kindle
#

depends on the person. i personally learn much faster from code examples

limpid cosmos
#

me too but it's okay no problem Tim and Donkku ๐Ÿ˜‰

earnest phoenix
#

Hello

#

oh nvm, i guess waiting four hours made it work just fine

#

strange

knotty steeple
#

keep on getting (node:8164) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): SqliteError: no such table: dailies

#

thing is i do have a table

earnest phoenix
#

is it opening the file

knotty steeple
#

wdym

earnest phoenix
#
sql.open("./fileWhereTablesAreLocated.sqlite");
#

^ @knotty steeple

knotty steeple
#

hmm

#

i didnt ill try that

#

@earnest phoenix what do you use

earnest phoenix
#

what do u mean, what do i use

knotty steeple
#

for sql stuff

earnest phoenix
#

sqlite

knotty steeple
#

oh

#

i use better-sqlite3

earnest phoenix
#

o

knotty steeple
#

i wonder if i even had to do that zoomeyes

earnest phoenix
#

u read the docs sir ยฏ_(ใƒ„)_/ยฏ

knotty steeple
#

i did

#

its just (node:8164) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): SqliteError: no such table: dailies GWqlabsThonkery

earnest phoenix
#

.

knotty steeple
#

can someone help me

uncut slate
#

create the table

knotty steeple
#

i did tho

real ginkgo
#

@neat falcon

#

Tell me.

neat falcon
#

what lib?

real ginkgo
#

lib?

neat falcon
#

yes

real ginkgo
#

what do you mean

gilded blaze
#

Get the channel using the client and send the message.

neat falcon
#

e.g discord.js

real ginkgo
#

js

#

discord js

#

Im using that

gilded blaze
#

<client>.channels.get().send()

#

i think

neat falcon
#

yes

knotty steeple
#

ye

#

thats it

real ginkgo
#

Is there a way so they put want they want to say which sends it into my bot's home server and then into a specific channel.

#

So they can put what they want for feedback

neat falcon
#

get the channel and send the args as a message

real ginkgo
#

Im not that good with coding..

neat falcon
#

args should be defined in your bot

#

e.g <client>.channels.get("channel-id").send(args)

#

i think

real ginkgo
#

what do I put for client?

knotty steeple
#

what you defined as Discord.Client()

real ginkgo
earnest phoenix
real ginkgo
#

I give up lol

knotty steeple
#

message.client Thonk

earnest phoenix
#

Yeah

#

Im using discord.js

#

:/

knotty steeple
#

i know

gilded blaze
#

You need to be able to access broadcast

neat falcon
#

message.client blobThonk

earnest phoenix
#

Like nobody notices message.client lol

#

its the client

#

:/

knotty steeple
neat falcon
#

shouldn't it be client.message eyeshake

earnest phoenix
#

lol

knotty steeple
#

message doesnt have a client property also zoomeyes

earnest phoenix
#

dis dude

#

it does

#

oml

knotty steeple
#

it does

earnest phoenix
#

do i need to go into the docs and slap it in ur face

knotty steeple
#

ok'

neat falcon
#

discord.js big meme

knotty steeple
#

very big meme

earnest phoenix
#

I know lol

knotty steeple
#

it just seems very weird

real ginkgo
#

<client>.channels.get("457646863856828426").send(args)

earnest phoenix
real ginkgo
#

Ive done that so far

earnest phoenix
#

it does

real ginkgo
#

What do I put for client?

earnest phoenix
#

ur client

knotty steeple
#

What you defined Discord.Client() as

#

smh

#

i already told you that

real ginkgo
#

K....

earnest phoenix
#

lmao

real ginkgo
#

a bunch of errors :/

knotty steeple
#

what did you put

real ginkgo
#

<457569212035235841>.channels.get("457646863856828426").send(args)

knotty steeple
#

oml

#

@real ginkgo const umm = new Discord.Client()

#

what do you have as umm

real ginkgo
#

Um..I dont know

knotty steeple
#

how do you not know

#

look for it

neat falcon
#

should be at the top of your main js file

earnest phoenix
#

hello..
are this code is not work anymore?

  var message = message
 message.member.setNickname('test');```
neat falcon
#

send error

earnest phoenix
#

no error

neat falcon
#

i can detect multiple problems with that code

knotty steeple
#

message isnt defined

neat falcon
#
  1. newUser should be member
  2. var message wtf
knotty steeple
#

you dont need a variable

#

message wont be defined because it is a different event

earnest phoenix
#

hey guys I gotta question.. I am trying to random a number but lock it after it is produced.. can anyone lead me to the docs or help me out for this specific subject?

#

hhm .. essentially, I want to use auto nickname when member join

#

when member join, nickname changed

knotty steeple
#

@earnest phoenix lock it?

#

wdym

earnest phoenix
#

before, it worked fine.

#

yes.. i am calculating IVs for stats which needs a random IV which is fine but I need that random IV to stay the same after it has been produced

knotty steeple
#

just randomize a number then store it

earnest phoenix
#

how would I store it?

knotty steeple
#

a db?

modern ember
#

if you want 1 fixed number, why are you randomizing?

earnest phoenix
#

because the IV has to be random to figure the stat

#

I got that part down no problem.. what is happening is the IV changes each time I do the info command

modern ember
#

yea, use a db to handle your no.(s)

earnest phoenix
#

ok thanks

modern ember
#

depending on how big your planning on using this, it could be json

#

however, if your project can be deemed as large, use something better such as sqlite, rethonk, etc

earnest phoenix
#

its huge.. Its over 800 pokemon and right now over 10k users

knotty steeple
#

woah

#

mysql

#

pls

earnest phoenix
#

Sorry for the text editor

#

i use atom but my computer kinda craps itself when i open it

sick cloud
#

How do you download videos with ytdl?

#

I tried the youtube-dl package, but all it does is errors on most with a Discord Api error saying the file is too big

uncut slate
#

well.. that's kinda self explanatory

#

do you mean how you download them to your filesystem?

sick cloud
#

@uncut slate I already can download them, but ytdl always errored, and I want to upload the file to discord once downloaded, then delete it off my syustem (since its a limited space vps)

uncut slate
#

well

#

you can't upload the file to discord if it's over discord's file size limit

sick cloud
#

Thats my issue, I understand that, but the lib im using (youbube-dl) auto downloads to mp4.. so, I kinda wanted to know how to do it with ytdl

#

I hit the file limit on most videos I try downloading ๐Ÿ˜‚

neon stone
#

hi

knotty steeple
#

ok

#

better-sqlite3 is being a shithead i need something better

#

keeps saying SqliteError: no such table: even though i created the table

earnest phoenix
#

just use sqlite

knotty steeple
#

how do you run stuff and get info

earnest phoenix
#

or just google it

#

https://anidiotsguide_old.gitbooks.io/discord-js-bot-guide/content/coding-guides/storing-data-in-an-sqlite-file.html
for a point system thing (will help a lot once u get the hang of it)

upper zodiac
#

@uncut slate Ayyyy ahahhaa my bot (spidey) prefix is -/ not ~/ that's why the command does'nt work! I wait so long for it then hmmmphh you declined it just like daaatt

sick cloud
#

How do you make your VPS IP + port work on a domain?
Like mydomain.com/profile/@user works like 00.00.0.00:3000/profile/@user

uncut slate
#

try in another channel @upper zodiac

upper zodiac
#

Wdym?

#

Now i need to re-queue my bot for the 2nd time hmph

inner jewel
#

@sick cloud you'd need a reverse proxy (such as nginx) for that

sick cloud
#

Well, my web server thing runs off Express

#

So the Express server looks on port 3000

#

oof though ._.

inner jewel
upper zodiac
#

@uncut slate wdym?

inner jewel
#
server {
    ...
    server_name mydomain.com

    location /profile {
        proxy_pass http://127.0.0.1:3000;
    }
}```
sick cloud
#

o.O

inner jewel
#

something like this for nginx

uncut slate
sick cloud
#

Can I like, remove the port? so its domain:/path

inner jewel
#

with a reverse proxy yes

#

if you don't specify a port, it will use 80 for http or 443 for https

sick cloud
#

oo ok so, do I keep my Express server running on 3000?

inner jewel
#

if you have a reverse proxy proxying from 80/443 to that, you can

sick cloud
#

I mean, I just want mydomain.com to work off my vps IP with the port 3000, but without a need for the :3000 port on the domain

#

so yeeee >~<

inner jewel
#

you access on the browser as grafana.atalanta.site

#

but grafana is running on port 56789

#

nginx proxies from 443 to that

sick cloud
#

ohk

gilded blaze
#

@inner jewel How did you manage to get grafana to work?

inner jewel
#

i just followed the install steps on the website

gilded blaze
#

Well I got it running

#

I just don't know how to post the stats to it

inner jewel
#

i use prometheus

earnest phoenix
#

i'm creating a bot in Intellij
i created a Gradle Java Project
How i run this?

gilded blaze
#

hmm

inner jewel
#

grafana pulls from prometheus

#

which pulls from my bot

#

you should see a play button like that

#

click it

earnest phoenix
#

Oh

gilded blaze
#

Ahh

earnest phoenix
#

i'm forgoted the static

gilded blaze
#

I will try it then

sterile goblet
#

does the discordjs 'messageReactionAdd' event allow adding of roles? this code returns TypeError: member.addRole is not a function every time its someone reacts to a message :v https://hastebin.com/amuxabudey.php

sick cloud
#

Member might not be a proper guildMember?

#

Let me check the docs, hold on ๐Ÿ‘€

inner jewel
#

btw you don't need the rmsg.channel === rmsg.guild.channels.find('name', 'rules') && part

#

just the id check is enough

sterile goblet
#

Oh yeah ik

#

I forgot to remove

#

:P

inner jewel
#

all discord ids are globally unique

sterile goblet
#

ye

sick cloud
#

Okay yeah, its a user zetari.

#

Not a guildMember

sterile goblet
#

Couldnt I grab the GuildMember from that?

sick cloud
#
user.guild.members.get(user.id)
sterile goblet
#

If i use const member = rmsg.guild.fetchMember(user)
it returns the guild member normally

inner jewel
#

users don't have guilds tho

sick cloud
#

๐Ÿ‘€

#

reaction.guild?

sterile goblet
#

o holdup

#

Now it's a cannot read property fetchMember of undefined

#

so reaction.guild may not be the best idea

sick cloud
#

ยฏ_(ใƒ„)_/ยฏ

#

Wait, reaction.emoji.guild would work I think

sterile goblet
#

uhh lemme try that

#

it's still cannot read property fetchMember of undefined, so im going to assume it somewhat works with rmsg.guild

west raptor
#

d.js commando command handler setup? i just started using commando

tulip coral
#

I spent hours trying to figure out what was wrong with my code, I was kinda sleepy too

#

then I looked at my command name and I wanted to cry, I tried so hard to figure out what was wrong and there was no RunMode = RunMode.Async

#

So much time wasted for so little :')

stray wasp
#

๐Ÿ˜ฆ

sick cloud
#

Does anyone know a free file host for .mp4 files with an API? I only discovered file.io, but the 100 files per day limit is too small for my needs ;-;

stray wasp
quartz kindle
#

why not google cloud?

#

pretty cheap as well

stray wasp
#

haven't looked into that. @quartz kindle but if you want to shead more light on it

earnest phoenix
#

Uhh my music function is doing this for no reason.. any idea why the end event is being triggered so much? http://prntscr.com/jvtaar

#

owait

#

lemme see if i got it working :333

quasi hearth
#

It seems like there is an end event for each song in the Playing list?

earnest phoenix
#

Yeah its super weird

stray wasp
#

LoseJoe whos example are you using?

earnest phoenix
#

Im not using an example

stray wasp
#

ok nvm then

quasi hearth
#

what is the "end" event? When the song ends or the playlist ends?

earnest phoenix
quasi hearth
#

yeah, then it makes sense why there are a bunch of end events

earnest phoenix
#

thats what im asking ยฏ_(ใƒ„)_/ยฏ

#

Ima see if i have it working

quasi hearth
#

There are that many end events because there were that many songs in the list

earnest phoenix
#

weird

quasi hearth
#

how so?

earnest phoenix
#

Because its suppost to loop through each one

#

seperately

quasi hearth
#

yeah

earnest phoenix
#

and it works fine

#

until 2 songs pass

#

then it just spams so much

quasi hearth
#

hmm

#

could be invalid songs?

earnest phoenix
#
Playing:
mSLuJYtl89Y.mp3
Ready on Icy Discord#7658 with 3 servers
Loaded a guild database - The Bot Farms
Loaded a guild database - Testing Server
Loaded a guild database - Icy Discord
End event executed
Playing:
mSLuJYtl89Y.mp3
End event executed
End event executed
Playing:
Playing:
r7Ve8ExE8YY.mp3
IIrCDAV3EgI.mp3
End event executed
End event executed
End event executed
End event executed
End event executed
End event executed
End event executed
Playing:
Playing:
Playing:
IIrCDAV3EgI.mp3
MM0lWsvieaE.mp3
End event executed
End event executed
End event executed
End event executed
End event executed
Playing:
IhchfhxvPKI.mp3
End event executed
End event executed
End event executed
End event executed
End event executed
End event executed
End event executed
End event executed
End event executed
End event executed
End event executed
End event executed
End event executed
EP625xQIGzs.mp3
End event executed
End event executed
End event executed```
#

It just spams

stray wasp
#

I'm wondering why are you downloading songs locally?

earnest phoenix
#

Better quality

stray wasp
#

oh ok

quasi hearth
#
Playing:
Playing:
IIrCDAV3EgI.mp3
MM0lWsvieaE.mp3```

Could be related to this?
or is this just from multiple servers using the tool?
earnest phoenix
#

nope

west raptor
earnest phoenix
#

just one server

#

well its global radio so

#

end bracket bro

west raptor
#

works fine on my main bot

earnest phoenix
#

:333

#

the top line

#

the bracket isnt closed

sick cloud
#

^

#

:3

quasi hearth
#

lol

stray wasp
#

happens to the best of us

west raptor
inner jewel
earnest phoenix
#

ye

inner jewel
#

they show the proper time for everyone regardless of timezone

earnest phoenix
#

.setTimestamp(message.timestamp)

#

thats what I use

#

Idk if its correct lol

west raptor
#

i just want to know why it is linted ;_;

quasi hearth
#

what program are you using?

west raptor
#

vsc

#
[ts] Unexpected token. A constructor, method, accessor, or property was expected.
quasi hearth
#

hmm

west raptor
#

never got that on my main bot

quasi hearth
#

just ignore it?

#

it probably doesn't understand js let?

west raptor
#

it should?

quasi hearth
#

actually, nvm. yeah it should. Can you provide the code before the let statement?

west raptor
#

oops

#
const { oneLine } = require('common-tags');
const Command = require('../base');

module.exports = class PingCommand extends Command {
    constructor(client) {
        super(client, {
            name: 'ban',
            group: 'moderation',
            memberName: 'ping',
            description: 'Bans a user.',
            
        });
    }
#

uhh

#

no sec

#

i am

#

not used to commando

#

so

#

it is probably wrong

knotty steeple
#

great ping command

stray wasp
#

@west raptor

west raptor
#

thats why i said one sec

stray wasp
#
west raptor
#

i just realizd that

stray wasp
#

I found docs!

topaz fjord
#

commando isn't really that up to date iirc

west raptor
#

so

#

i shouldnt use it?

stray wasp
#

you could make your open

#

if you like

topaz fjord
#

many people dont

west raptor
#

a friend recommended it to me

stray wasp
#

Duck does for his

fluid basin
#

o.O commando

west raptor
#

thats why i am doing it

knotty steeple
#

uh (node:15200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 10): SqliteError: database is locked

topaz fjord
#

i use my own command framework

knotty steeple
#

how to open database

topaz fjord
#

may be borrowed from york

quasi hearth
#

what database?

earnest phoenix
#

password

topaz fjord
#

@knotty steeple google :^)

knotty steeple
#

google didnt help

gilded blaze
knotty steeple
#

ok

fluid basin
#

Most likely another process is accessing it and the file is locked to other processes

gilded blaze
#

^

#

Might have two bot instances open

west raptor
#

i much angry i spent 2 hours setting up commando and it is useless yelAngry

stray wasp
#

@west raptor it's not, just gotta learn it

fluid basin
#

Don't use commando lol

gilded blaze
#

In JS making a command framework isn't hard

knotty steeple
#

i do have 2 bot instances but only 1 uses the db

fluid basin
#

There are much better d.js bot frameworks out there, so why use commando bloblul

topaz fjord
#

klasa

fluid basin
#

Well again personal preference

topaz fjord
#

is a good framework

gilded blaze
#

Check which process is using the db file.

west raptor
#

@fluid basin a friend recommend so i tried it out

#

recommended*

fluid basin
#

Hmm well popular frameworks I see is either klasa or no framework

#

And commando sometimes

stray wasp
#

@west raptor if you want to make your own command handler https://anidiotsguide_old.gitbooks.io/discord-js-bot-guide/content/coding-guides/a-basic-command-handler.html
to get the basics of one.

west raptor
#

i have one on my main bot

#

its not hard

earnest phoenix
#

Command handlers are so much easier to handle e.e

stray wasp
#

๐Ÿคฆ

fluid basin
#

Don't forget event handlers

earnest phoenix
#

true

west raptor
#

well i gtg

#

see yall

earnest phoenix
#

Bye ๐Ÿ‘‹

west raptor
#

bye

knotty steeple
#

just use no framework

#

and a command handler

#

easy mmLol

neon stone
#

when does my xbox bot gets approved? does it take up to an hour or more?

inner jewel
#

if(args[0] === "ping") {

}

fluid basin
#

It can take up to a week @neon stone

gilded thunder
#

How can I write values to a JSON file in d.py async?

neon stone
#

@fluid basin ok

stray wasp
#

@neon stone 2 months

neon stone
#

@stray wasp hell no

inner jewel
stray wasp
#

no really

fluid basin
#

if(args[0] === "ping") {
console.log('REEEEEEEEEEEEEEEEEE')
}

gilded thunder
#

Ty

neon stone
#

nuuu

#

@stray wasp

stray wasp
#

english plssss.

neon stone
#

...

#

french pls

stray wasp
#

a du twa

neon stone
#

?

fluid basin
inner jewel
#

if(msg.content.startsWith("!ping") || msg.content.startsWith(bot.user.mention + "ping")) {

}

#

what about this one

fluid basin
#

Add a space for the mention

#

Lul

earnest phoenix
fluid basin
#

if(msg.content.startsWith("!ping") || msg.content.startsWith(bot.user.mention + " ping")) {
await message.reply('smh')
process.exit(0)
}

inner jewel
#

why not add the mention with space as a third option

neon stone
#

@fluid basin my bot is on my server so how do i put it online?

fluid basin
#

Hmm

earnest phoenix
#

lol

#

tcd?

inner jewel
#

you need to write code for your bot

#

and run that code

fluid basin
#

You run the bot and keep it running

neon stone
#

whats the code

inner jewel
#

you need to write it

earnest phoenix
#

what do you want to use?

neon stone
#

dm me it

inner jewel
#

do you know any programming languages?

earnest phoenix
#

:33333333333333333333333

neon stone
#

@earnest phoenix discord.js visual studio code

earnest phoenix
#

im talking about the lib

fluid basin
#

lul

earnest phoenix
#

I use atom, discord.js

#

:3

quasi hearth
#

what programming language is "visual studio code"?

neon stone
#

@earnest phoenix note.js

#

i use that

earnest phoenix
#

uhh

fluid basin
#

๐Ÿ‘€

earnest phoenix
#

idk what that is so

neon stone
#

node.js

earnest phoenix
#

I think he means node.js

quasi hearth
#

Do you know how to program in javascript though?

neon stone
#

no

earnest phoenix
#

what lib in node.js?

quasi hearth
#

rip

earnest phoenix
#

eris? discord.js?

quasi hearth
#

hes using discord.js

neon stone
#

i said it

fluid basin
#

He just mentioned d.js

neon stone
#

omg

#

yeah......

earnest phoenix
#

oh

#

im so dumb

neon stone
#

lolol

inner jewel
#

do you know any programming languages?

neon stone
#

maybe

quasi hearth
#

to use d.js and node.js, you will need to learn javascript.

fluid basin
#

yes learn js

earnest phoenix
#

uhh

neon stone
#

@inner jewel i use english but i need the code to run my bot but i already have the token so i just need the code

fluid basin
#

@earnest phoenix well something is undefined there...

inner jewel
#

english is not a programming language

quasi hearth
#

xD

earnest phoenix
#

english best programming lang

neon stone
#

eslint

shy verge
#

English programming langauge?
did you mean VB???!!?!??

neon stone
#

no

earnest phoenix
#

vbs

quasi hearth
earnest phoenix
#

lol

#

help me learn .bat for discordbot

prime cliff
neon stone
prime cliff
#

Username leak oof

earnest phoenix
#

oh so downloaded bot

quasi hearth
neon stone
#

@earnest phoenix not downloaded

#

i made it

earnest phoenix
#

mhm

#

If you don't know how to code js then how?? GWfroggyMonkaThink

neon stone
#

i know how wtf

#

who said idk how

earnest phoenix
#

you did GWfroggyZoomeyes

neon stone
#

its just the code to run it that idk

earnest phoenix
#

use Client.login()

neon stone
#

then what do i type after that

#

you kow what

#

go in my dms

earnest phoenix
#

no thanks

neon stone
#

.

#

why

earnest phoenix
#

client.login is the method you use to login

#

you said you know js, so

#

<Client>.login(token)

neon stone
#

i said its only the code to run my bot that idk

#

you dont understand

#

daammm

earnest phoenix
#

ohh

neon stone
#

thx for the code

earnest phoenix
#

your token?

neon stone
#

ik my token

earnest phoenix
#

wait so you know javascript, you just don't understand node?

#

im probs being really stupid rn

#

;-;

neon stone
#

my bot isnt online do i have to run a command?

#

i whrote the code i copy and pasted it

torpid vale
#

your file tree looks impossible for a bot

quasi hearth
#

well, if your bot is offline, then you need to login with (bot client).login(token) Also, you need to run node bot.js in a terminal?

torpid vale
#

it has no index, just command files

sick cloud
#

Its cutting off the first argument..

inner jewel
#

code?

quasi hearth
#

^

sick cloud
#

This part?

client.on('message', async (msg) => {
    if (!msg.content.startsWith(prefix) || msg.author.bot) return;

    const args = msg.content.slice(prefix.length).split(/ +/);
    const command = args.shift().toLowerCase();
#

prefix is defined as 'urban '

torpid vale
#

just split ' '

#

right?

inner jewel
#

try logging args

sick cloud
#

Uhh, I did / +/ so it cuts off unnecessary spaces. And okie, hold on.

fluid basin
#

@sick cloud no not that, shift() is whats cutting it off

torpid vale
#

Wait...

fluid basin
#

Just comment the const command part

torpid vale
#

you are using something in the case as the command

sick cloud
#

What? That'll break all my commands though?!?

neon stone
#

@quasi hearth i did run node bot.js it didnt work

torpid vale
#

@neon stone you don't have the file...

sick cloud
#
client.on('message', async (msg) => {
    if (!msg.content.startsWith(prefix) || msg.author.bot) return;

    const args = msg.content.slice(prefix.length).split(/ +/);
    const command = args.shift().toLowerCase();

    console.log(args)

    
    if (commands.some(cmd => !msg.content.includes(prefix + cmd))) {
        return msg.channel.send('You are trying to get the def. for `'+args.join(' ')+'`.');
    } else {

    // commands
    if (command === '-h' || command === '-help') {
        const embed = new Discord.RichEmbed()
        .setColor('#000000')
        .setAuthor(`How to use Urbanify:`, client.user.displayAvatarURL)
        .setDescription(`Prefixing any message with \`urban \` will make the bot respond with the most popular matching definition. To use a specific command, put a command flag after the prefix. An example for the search flag would be \`urban -s <query>\`. A list of valid flags can be found below.`)
        .addField('Flags', `[-h](https://google.com) will show you this help guide. [-s](https://google.com) will allow you to search for a more specific definition off the Urban Dictionary; accepts a "query" argument.`)
        .addField('Invite me', `Click [here](<redacted>) to add me to your server.`, true)
        return msg.channel.send({ embed: embed });
    }

    }
});
inner jewel
#

urban something
command will be something, args will be []

urban something something
command will be something, args will be ["something"]

neon stone
#

@torpid vale where do i get it?

quasi hearth
#

you need to run node <file>

sick cloud
#

ugh

neon stone
#

ok

#

dosent work

sick cloud
#

I don't get why this isn't working then, its making no sense to me ;-;

neon stone
quasi hearth
#

maybe when you do " foo".split(/ +/) it returns: ["","foo"]. nvm..

fluid basin
#

Yeah like what do you want the command to be?

#

Like make it search or something

#

urban search ...

sick cloud
#

I want it like this:

if the bot can't match the args as a command like -h or -s, it'll see it as a urban <query> and run separate code
earnest phoenix
#

do node .

neon stone
#

k

sick cloud
#

so urban bob would run this code, urban -h would show the help menu

quasi hearth
#

use a bunch of if statements?

sick cloud
#

messy, but i guess i can

inner jewel
#
if(!handleCommand(message, command, args)) {
    handleQuery(message, [command, ...args].join(" "))
}```
#
function handleCommand(message, command, args) {
    if(commands[command]) {
        commands[command](message, args);
        return true;
    }
    return false;
}```
quasi hearth
#

or js args.join(" ").search(/(-h)/img) != -1 || args.join(" ").search(/(-s)/img) != -1 ? args.join(" ").search(/(-h)/img) != -1 ? /*help*/ : /*-s command*/ : //search UD?

inner jewel
#

why go the unreadable way

uncut slate
#

also something something regex is expensive

inner jewel
#

just keep a map of command name -> command

sick cloud
#

Wait, fixed it myself owo

inner jewel
#

also something something joining arrays to strings creates garbage objects and a local variable would help

sick cloud
quasi hearth
#

how did you fix it?

sick cloud
#

I just replaced command with const command = msg.content.split(' ').slice(1)[0]

quasi hearth
#

oh lol

inner jewel
#

you don't need the slice(1) part

#

afaik

fluid basin
#

Just do a command handler

inner jewel
#

okay nvm

fluid basin
#

If command not found do query

inner jewel
#

i misread it

neon stone
#

and what file do i need to put my boot online?

sick cloud
#

replace that with your bots actual client name

neon stone
#

ok

stray wasp
#

bot.login

neon stone
stray wasp
#

OMG

#

pls

neon stone
#

take what i whrote and edit it

stray wasp
#

read how he logged in his bot.

#

at the end of the file. No i'm not spoon-feeding you.

neon stone
#

ok

earnest phoenix
#

but not created the folder src/main/java

inner jewel
#

you can create it manually

earnest phoenix
#

I tryied

#

but don't have the option class

#

in java

inner jewel
#

can you send a screenshot?

earnest phoenix
#

wait plz

#

if i'll have the same problem i said

neon stone
inner jewel
#

bot.login

neon stone
#

bot.login xbox then the token?

inner jewel
#

where are you taking xbox from

stray wasp
#

bot.login("token");

neon stone
#

@inner jewel xbox is the name of my bot

sick cloud
#

what did you define client as

#

const <what did you put here> = new Discord.Client()

neon stone
#

@stray wasp i saved it now what

#

i also puted my token

stray wasp
#

Xbox look at a few videos

neon stone
#

your making my job harder

#

i guess its always like that for bot dev

quartz kindle
#

Lol

inner jewel
#

first thing you should learn js

quartz kindle
#

you're making your own job harder by refusing to learn

neon stone
#

no

#

i dont refue

#

i take all suggestion

stray wasp
#

@neon stone This discord channels name isn't called spoon-feed central. Go look at a few youtube video and docs and you'll learn.

quartz kindle
#

everything you need to know is written in many guides everywhere on the internet

#

its not difficult to check a guide and see how its done

inner jewel
#

in general videos are a bad way of learning libraries/languages

#

they get outdated easily and are almost always low quality spoonfeed

#

the docs are the best option always

neon stone
#

@stray wasp see? dont tell me to go on yt

#

ill check the docs

#

and shes right

stray wasp
#

haha ok have fun.

neon stone
#

......

quartz kindle
#

everything you need is right there

neon stone
#

k

quartz kindle
#

in the big "example" box

inner jewel
#

she
PepeHands

neon stone
#

i just need my bot to be online

stray wasp
#

xD

neon stone
#

it hasnt been aprooved yet to

quartz kindle
#

the "example" box says how to get it online

neon stone
#

k

#

this was right in my face the whole time

#

xddd

stray wasp
#

yep.

neon stone
#

it was in the exemple box not on

#

youtube...

quartz kindle
#

i didnt say to go to youtube

#

i say to check guides

#

like

#

text guides

#

in github for example

#

and docs

stray wasp
#

it's on Youtube Xbox, it's really up to you how you want to learn.

neon stone
#

@quartz kindle i didnt say you said to go on yt

#

i was talking about mudda

quartz kindle
#

ah alright

neon stone
#

I think its not working because my bot wasn't approved yet.

quartz kindle
#

it has nothing to do with approval, test it in your own server

neon stone
#

i say ping with the prefix then

quartz kindle
#

besides, if the bot doesnt do anything yet, its not gonna be approved

neon stone
#

the prefix is !

keen anvil
#

Have you tried using a JSON file for config?

quartz kindle
#

create a server, add your bot there, code it and test it there. when its actually working and has working commands, then you can add it here to have it approved

neon stone
#

@quartz kindle my bot is in my server already

quartz kindle
#

alright

neon stone
#

@keen anvil it is a json fille that you are seeing there

keen anvil
#

no, that's a js file according to you

#

it would need to be botconfig.json

#

not botconfig.js

neon stone
#

k

#

and of curs my bot just got declined....

keen anvil
#

Did you read the reason why

neon stone
#

yes

#

it has to be online and work

quartz kindle
#

a good place to get help is your framework's official server, in your case probably discord.js server

neon stone
#

now i wanna put all my coding filles in my bot right?

#

ill check discord.js

keen anvil
#

are you under 13 years old?

#

if you don't mind me asking

neon stone
#

no

#

xd

#

im 17

#

its fine lots of people have been asking what my age was

#

so i dont mind

fluid basin
#

Commands in testing channels pl0x

tulip coral
#

trying to figure out why Smite API only gives me access to one player's stats during a game ๐Ÿ‘€

#

var matches = await client.GetMatchDetailsAsync(Endpoint.SmitePC, id);

#

and it only allows me to do PlayerStats

#

๐Ÿค”

#

There's nothing else player(s) related which is so strange.

neon stone
quiet bobcat
#

You can't use ; in JSON

neon stone
#

in what do i have to use it?

quiet bobcat
#

wdym?

neon stone
#

do i have to do it in a other coding app like python?

quiet bobcat
#

What?

#

Remove the semicolon in the JSON file

#

named botconfig.json

solid cliff
#

You have a ; in your json file

neon stone
#

oh

#

what do i use instead of ;?

#

{
"prefix"; "!"
}

quiet bobcat
#

:

neon stone
#

ok

#

i need a tokeen json file now

#

xd

quiet bobcat
#

Read the error messages

#

module = file

#

it can't find the file token.json

neon stone
#

ik thats why i need it

#

no?

quiet bobcat
#

what?

neon stone
#

i need to add the token file

#

right?

quiet bobcat
#

or you could just do it in botconfig.json

neon stone
#

where?

#

{
"prefix": "!"
}

quiet bobcat
#

under prefix

neon stone
#

i whrite (token id);

#

with the letters and numbers

quiet bobcat
#

What

neon stone
#

what do i whrite

#

for the token

quiet bobcat
#

I really suggest you learning javascript or JSON before trying to make a bot

#

or just watching a tutorial

sick cloud
#

@neon stone we won't spoonfeed you every single piece of code, go learn for yourself maybe.

limpid cosmos
#

thanks ๐Ÿ˜‰

sick cloud
fluid basin
#

weird

#

did you setup everything correctly

quiet bobcat
#

it might be because of your redirect uri

sick cloud
#

Redirect url or whatever is setup right, and I think so

#

in the dev page its http://localhost:3000/api/callback, in the auth thing code its http://localhost:3000/api/callback

low rivet
#

whats ur config?

sick cloud
#

config file or how i'm using auth?

low rivet
#

like the one on ddevs page

sick cloud
#

(i'm using passport-discord fyi)

#

oh

low rivet
#

and your full oauth2 url?

sick cloud
#

full oauth2 url that the thing gives me is this

https://discordapp.com/oauth2/authorize?response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fapi%2Fcallback&scope=identify%20guilds&client_id=<redacted>
low rivet
#

config?

sick cloud
low rivet
#

hmm

#

wait

sick cloud
#

oh?

low rivet
#

try adding a state GWcfcThonk

#

it says its optional on the docs but encouraged

#

(just a random str)

sick cloud
#

state?

#

what do i add and where? ๐Ÿ‘€

low rivet
#

wait what..

sick cloud
#

.-.

#

i can even send my code if wanted

low rivet
#

i created a simple app like that

sick cloud
#

okay?

sick cloud
#

well my oauth2 url is being generated by passport-discord

low rivet
#

try using the discord generator

sick cloud
#
Router.get('/api/login',
        passport.authenticate('discord', { scope: config.server.scopes }), function(req, res) {});
#

i dunno how though since thats what its doing ^^ but maybe i can try manual

#

hold on

#

that failed too

#

unknown_error

#

but that doesn't work either

low rivet
#

theres something with your url

sick cloud
#

oh?

low rivet
#

oh nevermind

sick cloud
#

yes >.>

sick cloud
#

Yes -.- and weird

sick cloud
#

wait tf now its working

#

.>

#

oof

low rivet
#

wait what the link you sent earlier worked GWcfcThonk

sick cloud
#

idk turns out i didn't save it

pale marsh
#

I was eagerly reading the whole convo and trying to figure out what went wrong and help, only to find you saying this at the end ๐Ÿ˜‚

sick cloud
#

lol

gilded thunder
#

How can I have a bot send a message to the channel it was triggered in if the commander has DMs disabled? Discord.py async

solid cliff
#

if cant send message to the user's dms, send it to the channel like you normally would ยฏ_(ใƒ„)_/ยฏ

low rivet
#

using exception handling

frail kestrel
#

sweats

mental willow
#

@gilded thunder what are you trying to do.

#

It made no sense

gilded thunder
#

If the person who runs help has DMs on that server disabled, how can I have the bot send the help output to the channel?

frail kestrel
#

try/except?

mental willow
#

Why wouldn't you have the bot ping the member that triggered the command in the channel that it was triggered.

frail kestrel
#

oh wait

#

does d.py have a built in think like user.dms_open

mental willow
#

I personally don't know

frail kestrel
#

because, ie, you could do if not user.dms_open: # do stuff

mental willow
#

It may have its own way of doing it

fair canyon
#

who know how to run a bot in minecraft server?

frail kestrel
#

elaborate?

mental willow
#

@gilded thunder have you got the DM component set up

#

I agree elaborate

frail kestrel
#

if you're trying to get a discord bot to "login" to minecraft, i'm afraid that's impossible

#

wait does minecraft have an api thinkingLol

#

prob

gilded thunder
#

DM component?

mental willow
#

Please note "Discord" in "Minecraft server" do they match up

#

Can the bot send DMs

#

To someone

#

@gilded thunder

frail kestrel
#

Josh wants the bot to be able to send the help command in the channel the command was executed in if the author's DMs are off for that specific server

gilded thunder
#

Yes.

mental willow
#

Yeah I know that but has he codes the part that sends the DM

frail kestrel
#

prob lol

mental willow
#

Have you thought about skipping lines of code if something does not meet "parameters" as such

gilded thunder
#

It sends DMs

frail kestrel
#

what

#

skipping lines of code

gilded thunder
#

hm

frail kestrel
#

lmfao

mental willow
#

Ok so I know js has this

frail kestrel
#

hes using py tho

#

stated it before ok

#

rekt!!

#

brb gotta do something irl sec

solid cliff
#
try:
    await self.bot.send_message(userToSendTo, content)
except:
    await self.bot.say(content)```
frail kestrel
#

oh shit

#

you can do that

#

except: # do nothing with the error

#

ok good job void

solid cliff
#

yes

mental willow
#

So you skip over lines of code if something is not met (I would assume that this is the if function). If it is not met it will continue a different set of code that does and entirely different thing.

frail kestrel
#

if function

#

facewall

#

that is called a condition

mental willow
#

close enough but you get my point

frail kestrel
#

yes

#

if(this) { do this } else { do this }

mental willow
#

Yes that

#

I am not a python enthusist. I do not know everything about python

#

Ok now that that is resolved

@fair canyon what it this Minecraft bot thing you are on about

gilded thunder
#

@solid cliff thank

#

except it's rewrite

#

but I know how to convert

mental willow
#

???

fair canyon
#

@mental willow i mean start up a discord bot in minecraft server

mental willow
#

1for what perpose and 2 please explain a tad bit more what you want to do

#

@frail kestrel halp please

solid cliff
#

@gilded thunder you said its async think

gilded thunder
#

it's ok

#

i just remove self

fair canyon
#

I wanted to make my bot to start up along with my minecraft server so it will be online when my minecraft server is online

mental willow
#

What is the uptime

fair canyon
#

@mental willow 24/7

quartz kindle
#

there is a discord api as a minecraft mod

#

that can relay messages

mental willow
#

Yeah I got nothing

quartz kindle
#

DiscordChat, Discord2MC, Minecord, DiscordIntegration

fair canyon
#

I want to make my own for some reason

teal sigil
#

ืขื›ืฉื™ื• ืงื“ื™ืžื”

mental willow
#

I have an issue

#

How do I stap a py bot from responding to other bots

quartz kindle
#

not sure about py, but the message object has an author.bot property

mental willow
#

See my issue is is that my js part is not responding to bots but my py component responds to bots

quartz kindle
#

thats strange, is your py component fired from the js?

mental willow
#

No

#

Independent