#development

1 messages · Page 424 of 1

zenith sequoia
#

Dude

#

@knotty steeple node .

knotty steeple
#

🤦 no

zenith sequoia
#

;)

knotty steeple
#

do you have like a variable set as token to login with

zenith sequoia
#

NO MY LORD

knotty steeple
#

yes im done

#

DO YOU JUST <Client>.login("token") WITH YOUR TOKEN?

zenith sequoia
#

listen agin I get an error http://prntscr.com/johavd and then i make a new bot and put the exact same code in and it works, why doesnt my old bots tokens ever work?
i use bot.log("token")

Lightshot

Captured with Lightshot

knotty steeple
#

so you just copied your code

zenith sequoia
#

🤦

#

its in 400+ servers

knotty steeple
#

ok bye

zenith sequoia
#

...

knotty steeple
#

the only way you get that error is because you have an invalid token or something like that

frail kestrel
#

regen ur token and use the new token

#
const { Client } = require('discord.js');
const client = new Client();

client.login('BOT_TOKEN');
upper ember
#
l.eval const superagent = require('superagent')

superagent.get('https://discordbots.org/api/bots/365958655926992896/check')
  .set('Authorization', 'BOT_TOKEN_WAS HERE')
  .query({ userId: '231733082804322304' })
  .end((err, response) => {
    console.log(response.body);
});

anyone know how to store the number from response.body https://mrsheldon.me/images/523590.png ?

#

I want to do msg.channel.send(variable);

#

and get 1 or 0

gusty topaz
#

its not supposed to be a bot token but your API token

#

DBL API token

upper ember
#

ik

#

does it even matter? the thing is works

#

I get { voted : 1 } in the console

#

I want to send this "1" in the chat

gusty topaz
#

can you do console.log(typeof response.body) ?

upper ember
#

yes

earnest phoenix
#

JSON.parse(response.body).voted

gusty topaz
#

no

#

it may be parsed already

upper ember
#

it says object

gusty topaz
#

okay

earnest phoenix
#

o

gusty topaz
#

its parsed already

earnest phoenix
#

its parsed already

#

XD

upper ember
#

ok

#

so what now...?

gusty topaz
#

so just do msg.channel.send(response.body.voted)

upper ember
#

oh

#

great

#

it works

strong linden
#

i need help me this please?

#

guys?

#

I'm heroku here

#

help meee

#

!!!!

midnight topaz
#

create a package.json file

#

¯_(ツ)_/¯

#

type npm init in your project folder

strong linden
#

how?

midnight topaz
#

and answer the questions

fluid basin
#

learn js

earnest phoenix
#

oof

strong linden
#

and?

midnight topaz
#

make sure the needed dependencies are in this file and you can push

strong linden
#

wat the hell with that?

midnight topaz
#

don't remember where but you need to specify that the app is a node.js one

strong linden
#

i have nodejs here... So?

midnight topaz
#

in heroku website

#

but dunno where exactly

strong linden
#

i see

#

It's said build failed

midnight topaz
#

lemme see

#

in the settings tab

#

you have a thing called buildpacks

#

I think you can add node.js

strong linden
#

hey look this buildpack

#

i can remove it?

midnight topaz
#

you should keep it I think

#

heroku/nodejs

strong linden
#

ok

#

i added

midnight topaz
#

try to deploy again

strong linden
midnight topaz
#

package.json missing

#

maybe you forgot to push it

strong linden
#

i pushed it

midnight topaz
#

not package-lock.json but the valid one

strong linden
#

package-lock.json?

#

Can remove "package-lock.json"?

midnight topaz
#

this won't change anything

#

you just need the package.json

strong linden
#

I have package.json too

#

But... Why?

midnight topaz
#

because heroku needs it so it can know what dependencies your bot needs

upper ember
#
 const discord = require('luki.js')
 const superagent = require('superagent')

superagent.get('https://discordbots.org/api/bots/365958655926992896/check')
  .set('Authorization', 'MY-DBL-TOKEN-WAS-HERE') 
  .query({ userId: msg.author.id })
  .end((err, response) => {
    console.log(response.body.voted);
    var check = response.body.voted;
    if (check == 1) {
      msg.channel.send("You already upvoted today")
    } else {
      msg.channel.send("GO UPVOTE!!!")
    }
});

@gusty topaz thanks for the help

strong linden
#

Damn my laptop can't connect to my WiFi

fluid basin
earnest phoenix
#

Better use === for comparisons in JavaScript @upper ember

#

Unless you specifically don't want it

strong linden
#

i deleted

ruby dust
#

does your bot have a data storing of some sort? a json or db?

strong linden
#

Its a Json file

#

Idfk

ruby dust
#

is it for credentials or legit storing data from discord?

strong linden
#

Yes

slender thistle
#

Which one are you replying with "Yes" to?

ruby dust
#

nice, you can forget about it then if you will be using heroku

strong linden
#

I never use heroku anymore

ruby dust
#

choose a priority: either you want to host on heroku or have your bot to store data you wanted

#

oh?

slender thistle
#

What.

ruby dust
#

then what is that above in screenshots? 🤔

slender thistle
#

Horuke.

earnest phoenix
#

heroku doesn’t support persistent database btw

ruby dust
#

or more specifically, heroku has github-like data or something

strong linden
#

i watched tutorials video so much

earnest phoenix
ruby dust
#

no

#

just no

earnest phoenix
#

it’s shit but better than heroku

strong linden
ruby dust
#

moving from shit, and recommending shit

earnest phoenix
#

still better than shitty heroku and so what it’s a okay for a simple bot

ruby dust
#

do people not hear about skysilk? they are in open beta which gives you 100% discount, plus they will have a free plan after closing beta soon

fluid basin
#

¯_(ツ)_/¯

#

glitch is ok for starting bots

#

but when your bot grows it won't be that good of a choice

#

And it'll be time to move to a proper VPS

gilded thunder
#

Keeps saying the ping is 0ms, just wanna check that this is working right. Discord.py async

# ping command
@bot.command(pass_context=True)
async def ping(ctx):
    """Ping the bot."""
    before = time.monotonic()
    ping = (time.monotonic() - before) * 10
    embed = discord.Embed(title=f"Pong!  `{int(ping)}ms`", color=0x176cd5)
    embed.set_author(name=ctx.message.author, icon_url=ctx.message.author.avatar_url)
    await bot.say(embed=embed)```
slender thistle
#

Probablt because you are basically doing before - before in ping var?

halcyon abyss
#

bc you should calculate the ping value after awaiting

low rivet
#

you should do datetime.datetime.now() - ctx.message.created_at

halcyon abyss
#

This has the flaw that discord time and bot time need to be synchronized

sullen nymph
#

Does anyone know how to use Node.js to download an image from a URL?

halcyon abyss
#

I would use classic http request module

fluid basin
#

snekfetch or superagent

halcyon torrent
#

request (npm install request) does the job too ^^

abstract crystal
#

@gilded thunder you could try setting a time (before) then execute typing then set the after time and do a time delta

#
t1 = time.perf_counter()
await ctx.channel.trigger_typing()
t2 = time.perf_counter()

don't forget to import time

earnest phoenix
#

Hi

#

I'm trying to have the bot status have the server count plus another message

#

I set a variable to get the number of guilds

#

And I added the command to set the status and game

#
    console.log('I am not dead.....yet');
    client.user.setStatus('online', numguilds + " servers | ;help");
});```
#

It is not working, no errors in console

#

help

#

please

slow elk
#

@earnest phoenix I think setStatus was deleted. Try setPresence instead

earnest phoenix
#

ok

#

still nothing @slow elk ;-;

slow elk
#

Hmm

earnest phoenix
#

My other friend told me to do setStatus

#

I tried both

#

Neither worked GWcmeisterPeepoShrug

slow elk
#

How did you do the setPresence?

earnest phoenix
#

I just replaced setStatus with set Presence

halcyon abyss
#
earnest phoenix
#

ok

slow elk
#

Or that

slate basin
#

i have tried to get rid of it.. but it doesn't work

rancid relic
#

which website?

slate basin
#

mine

earnest phoenix
#

@slate basin source

slate basin
#

ty

rancid relic
#

@earnest phoenix yep

earnest phoenix
#

Did you try the margins?

#

Like margin: 0px;

#

On the body

#

Or html

#

on of them

#

Post code to hastebin though

rancid relic
#

no one likes margin anyway...

earnest phoenix
#

yea

#

plus this is bot development

slate basin
#

it's annoying af

#

fixed it

#

xD

earnest phoenix
#

ok gj

#

btw

slate basin
#

is my website

earnest phoenix
#

#webdev is there

slate basin
#

ahhh

earnest phoenix
#

get SSL

crude tapir
#

weew

slate basin
#

thanks man

earnest phoenix
#

For free

#

With cloudflare

#

Mine ^^ 😄

fluid basin
#

lol

slate basin
#

that interactive background

#

is so common nowadays

earnest phoenix
#

not rlly

#

Looks cool though

slate basin
#

i have seen it on three*

earnest phoenix
#

I've never seen it

#

Only on mine

slate basin
#

that's just a different version of it

earnest phoenix
#

yea

#

Still looks cool

slate basin
#

it does

earnest phoenix
#

In my opinion

slate basin
#

not gonna lie

#

i like my simplistic style tho xD

crude tapir
#

idk why im rewriting pibot

earnest phoenix
#

lol

#

I like the navbar btw

#

The effect is 👌

slate basin
#

on my web?

earnest phoenix
#

ye

slate basin
#

ahhh, thanks

#

my favourite

#

bit of my website

#

is my docs

earnest phoenix
#

ye gud

slate basin
#

thank you 😄

earnest phoenix
#

gj

slate basin
#

i try.

#

my gf made the logo

earnest phoenix
#

nice

#

Is the bot gud

slate basin
#

quite

earnest phoenix
#

imma invite it 😄

slate basin
#

still trying to find ways to advertise it

earnest phoenix
#

Seems cool

slate basin
#

47 guilds ;-;

earnest phoenix
#

I have a dev group that can help if you like

#

they have like 1k

#

users for their bots

slate basin
#

any help will be fantastic ❤

upper ember
#

if (msg.channe.nsfw == true) {

#

you probably got the idea

#

how do I do it?

rain orbit
#

channel*

upper ember
#

yea

#

ok

#

you still got the idea

#
if (msg.channel.nsfw === true) {
  msg.channel.send("true");
} else {
  msg.channel.send("false");
}
#

it doesn't work

spring ember
#

do == if this doesn't work

earnest phoenix
#

That statement should work

#

I've done smth similar and it worked for me

#

The random.cat api hates me

9|FauxBot  |     at _response.transport.request.then (/home/reconal/FauxBot/node_modules/snekfetch/src/index.js:182:21)
9|FauxBot  |     at <anonymous>
9|FauxBot  |     at process._tickDomainCallback (internal/process/next_tick.js:228:7)
9|FauxBot  |   request: undefined,
9|FauxBot  |   body: <Buffer 3c 21 44 4f 43 54 59 50 45 20 48 54 4d 4c 20 50 55 42 4c 49 43 20 22 2d 2f 2f 49 45 54 46 2f 2f 44 54 44 20 48 54 4d 4c 20 32 2e 30 2f 2f 45 4e 22 3e ... >,
9|FauxBot  |   raw: <Buffer 3c 21 44 4f 43 54 59 50 45 20 48 54 4d 4c 20 50 55 42 4c 49 43 20 22 2d 2f 2f 49 45 54 46 2f 2f 44 54 44 20 48 54 4d 4c 20 32 2e 30 2f 2f 45 4e 22 3e ... >,
9|FauxBot  |   ok: false,
9|FauxBot  |   headers:
9|FauxBot  |    { 'content-type': 'text/html; charset=iso-8859-1',
9|FauxBot  |      date: 'Wed, 30 May 2018 15:56:59 GMT',
9|FauxBot  |      server: 'Apache',
9|FauxBot  |      'content-length': '213',
9|FauxBot  |      connection: 'Close' },
9|FauxBot  |   statusCode: 403,
9|FauxBot  |   statusText: 'Forbidden' }
``` x.x
#

I swear lol

#

That's the same thing

#

Lol

rain orbit
#

ik

earnest phoenix
#

It will only trigger true if the channel is marked as nsfw

olive drum
earnest phoenix
#

I've used it before and it was working

olive drum
#

Temporary Downtime

#

xD

earnest phoenix
#

xD

#

That's probably why

rain orbit
#

ye

earnest phoenix
#

Even though, when I start the dev version of my bot up, it posts images fine, while the live version errors out

#

Should i use comic sans as my vscode font Thonk

rain orbit
#

i just use the normal font

earnest phoenix
#

Have you tried comic sans

rain orbit
#

nope

earnest phoenix
#

It's basically the most hated font of all time

rain orbit
#

lol

earnest phoenix
#

I use Roboto Mono for vscode

#

With a material theme

#

Looks really nice

rain orbit
earnest phoenix
#

?

hazy marten
#

guys

#

newbie question here

#

you know when you say

#

await bot.say("")

#

you can use that for urls too

#

but it also posts the url

#

ya how do we get the image without like printing the url as a message

spring ember
#

Embed

floral stone
#

^

#

You could save it as well

hazy marten
#

ik you can save it, but if you save it you have to upload it

#

making it

#

slower

#

correct me if im mistaken

spring ember
#

Use an embed

hazy marten
#

yea will do

#

thank you

#

😃

spring ember
#

Np

quasi hearth
#

anybody use node-canvas?

spark spire
#

could I post a question that is semi related to discord bots? (its about downloading an image from discord that I will use later in a bot)

stuck coyote
#

How can I make an instant volume on java Player?

inner jewel
#

wdym?

native narwhal
#

^

stuck coyote
#

That the volume is taken over immediately after change

quasi hearth
#

how do I add custom fonts to node-canvas?

olive drum
quasi hearth
#

i did that already. You don't have to google it for me. nothings been working for me so far.

spring ember
loud bear
#
    raise NotImplementedError
NotImplementedError``` how to fix?
trim plinth
#

show code

loud bear
#

When my laptop reconnects to the WiFi XD

#
async def run_cmd(cmd: str) -> str:
    """Runs a subprocess and returns the output."""
    process = await asyncio.create_subprocess_shell(
        cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
    results = await process.communicate()
    return "".join(x.decode("utf-8") for x in results)
    @commands.command(aliases=["shell"])
    @commands.check(checks.is_owner)
    async def debug(self, ctx, *, command: str):
        oof = await run_cmd(f'{command}')
        await ctx.send(f'{oof}')

    @commands.command(hidden=True, aliases=["pull"])
    @commands.check(checks.is_owner)
    async def update(self, ctx):
        """gets latest commits and applies them from git"""
        await ctx.trigger_typing()
        await run_cmd('git init')
        await run_cmd('git remote add cookie https://github.com/Skullbite/CookieBot')
        pull = await run_cmd('git pull cookie master --no-commit --no-edit --ff-only')
        await run_cmd('git fetch --all')
        ack = await run_cmd('git reset --hard cookie/master')
        pull = pull.replace('https://github.com/Skullbite/Cookiebot', '🍪')
        info = discord.Embed(description=f":cookie::fast_forward: `py\n{pull}`", color=0xa40bdb)
        msg = await ctx.send(embed=info)
#

trying to make a pull command

#

asyncio and subprocess are imported

floral stone
#

your error doesn't specify the line of error

loud bear
#
Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\site-packages\discord\ext\commands\core.py", line 62, in wrapped
    ret = yield from coro(*args, **kwargs)
  File "C:\Users\drago\Documents\GitHub\CookieBot(test2)\owner.py", line 100, in update
    await run_cmd('git init')
  File "C:\Users\drago\Documents\GitHub\CookieBot(test2)\owner.py", line 19, in run_cmd
    cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
  File "C:\Program Files\Python36\lib\asyncio\subprocess.py", line 210, in create_subprocess_shell
    stderr=stderr, **kwds)
  File "C:\Program Files\Python36\lib\asyncio\base_events.py", line 1162, in subprocess_shell
    protocol, cmd, True, stdin, stdout, stderr, bufsize, **kwargs)
  File "C:\Program Files\Python36\lib\asyncio\coroutines.py", line 212, in coro
    res = func(*args, **kw)
  File "C:\Program Files\Python36\lib\asyncio\base_events.py", line 341, in _make_subprocess_transport
    raise NotImplementedError
NotImplementedError

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

Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\site-packages\discord\ext\commands\bot.py", line 886, in invoke
    yield from ctx.command.invoke(ctx)
  File "C:\Program Files\Python36\lib\site-packages\discord\ext\commands\core.py", line 514, in invoke
    yield from injected(*ctx.args, **ctx.kwargs)
  File "C:\Program Files\Python36\lib\site-packages\discord\ext\commands\core.py", line 71, in wrapped
    raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NotImplementedError:```
#

thats the traceback i get

#

any ideas?

floral stone
#

tried googling error

loud bear
#

did this is what the python site said
This exception is derived from RuntimeError. In user defined base classes, abstract methods should raise this exception when they require derived classes to override the method, or while the class is being developed to indicate that the real implementation still needs to be added.

    Raised when an error is detected that doesn’t fall in any of the other categories. The associated value is a string indicating what precisely went wrong.```
earnest phoenix
#

What's it trying to do on line 886 of bot.py

loud bear
#

idk that file is provided by discord.py i dont look at the source files

earnest phoenix
#

Oh right. I figured that was your main bot but didn't look at the file path.

#

Don't know much about python, my bad

loud bear
#

its fine lol this error just been bothering me for weeks

earnest phoenix
#

You know anything about discord.js?

loud bear
#

no

earnest phoenix
#

Damn ok lol

#

Is there a way to ask questions in the awaitMessages function and get multiple responses?

So lets say

The bot says: "Hey! Can you provide me with your name."
user inputs name

Bot: "What about your age"
user inputs age

Bot: "What about your country"
user inputs country

Bot sends the data to me in dms
https://paste.ofcode.org/44LvNPayzUE6e3P43Fc5NT
Obviously this isn't the right way to do it because it doesn't work

earnest phoenix
#

Whats it missing access too?

#

the channel?

#

must be permissions

#

not a bot error

earnest phoenix
#

It's a permissions issue.

coral dock
#

Hi, short Question, I have an Embed which can Users React to, I would like the User Id's of all Users that reacted, how could I do that correctly?

earnest phoenix
#

Add to an array

#

for each collected emoji reaction

coral dock
#

reactions.get('🎊').users

#

I get Collections for every User

#

But tbh I don't know how to go on, I'm pretty new to Javascript

earnest phoenix
#

Okay so. It should work the same as an array unless I am being dumb af.

reactions.get('EMOJI').users[0]

#

possibly

coral dock
#

I try that, one moment

earnest phoenix
#

There's also collection maps but idk how those work.

coral dock
#

Could I send you the Collection via DM? I don't want to spam this Channel with it

#

Because I get an "undefined"

earnest phoenix
#

Sure

night imp
#

map it as an array

earnest phoenix
#

Why is the bot replying to commands in DMs?

#

because you're not checking channel type

quasi hearth
#

whats the best way to render custom fonts

earnest phoenix
#

is it if (message.channel.typedm.message.author.sendMessage('Commands can not be used in Dms')) ?

#

message.channel.type !== "dm"

#

you are using d.js no?

#

discord.js yes

#

message.channel.type !== "dm" message.author.sendMessage('Commands can not be used in DMs') ? @earnest phoenix

#

if statement

#

hi

#

I was just about to put my bot back on the list

#

if an if statement

#

also

#

sendMessage is deprecated don't use it

#

use .send instead

#

I use sendMessages...

#

for every commands etc

#

if (message.channel.type !== "dm" (message.author.send('Commands can not be used in DMs')))?

#

also, I use DBM for my bot, just because i can

shy verge
#

prepare for !say abuse

earnest phoenix
#

?

#

you should really read up some basic js mc

shy verge
#

the code DBM generates doesn't filter bot messages

earnest phoenix
#

if statements are really fundamental

shy verge
#

so bots can trigger your commands

#

which is

#

bad

earnest phoenix
#

My bot actually has no prefix

shy verge
#

LGWactionFakkedCorgi

earnest phoenix
#

well goddamn if people say "commands" in one sentence it's gonna REALLY spam

shy verge
#

what

earnest phoenix
#

also, what library does DBM bots go through?

shy verge
#

do !=

#

@earnest phoenix d.js

earnest phoenix
#

ok

shy verge
#

iirc

earnest phoenix
#

!= 'dm'?

shy verge
#

yes

earnest phoenix
#

use the identity operator instead (!==)

#

What do you guys look for in an IDE?

#
  • intellisense?
  • design/looks?
  • customizability?
knotty steeple
#

looks

#

and customizability

earnest phoenix
#

personally my #1 is intellisense (auto complete/suggestion)

shy verge
#

idc about looks as long as it has a dark theme and a not stupid syntax scheme

knotty steeple
#

same

shy verge
#

I care most about code completion mostly

earnest phoenix
#

ye

shy verge
#

The JetBrains editor is easily the best in that category

earnest phoenix
#

yep

shy verge
#

And the VS syntax scheme is cool too

#

so I use Rider

#

cause I get both

earnest phoenix
#

you code in c#?

shy verge
#

yes

earnest phoenix
#

C# is my main language but I've been putting it aside lately

#

it's just depressing that it isn't natively cross-platform

#

in my opinion C# is better X2 compared to java

#

but the flaw of cross platform 😭

shy verge
#

c# is java++

earnest phoenix
#

but then the mono project limits cutting edge stuff and alot of stuff

#

ikr

#

c# has everything that java has and much more

shy verge
#

no but the funny thing is that C# is designed to be a clone of Java, but still can get things right like async/await

earnest phoenix
#

async/await, structs

shy verge
#

Java doesn't have real async lul

earnest phoenix
#

yea

#

does java have umm

#

anony methods

knotty steeple
#

what about javascript lmao

earnest phoenix
#

typed languages are always better in large professional projects

shy verge
#

all dynamically typed languages are innately prone to fuckups

#

fact

earnest phoenix
#

yea

#

if just microsoft woulda made c# cross-platform from the first place

#

😭

shy verge
#

tfw mono

#

mono is big gae

earnest phoenix
#

ye 😭

knotty steeple
#

is slots with no profit/actual gambling bad?

earnest phoenix
#

nope

#

while real money isn't involved

#

I'm pretty sure it isnt

knotty steeple
#

well

#

with like

shy verge
#

oh and also if you wanna make rythm 2.0 use kotlin

#

better than java in every way

#

objectively

knotty steeple
#

bot economy

#

is it bad

shy verge
#

no arguments

earnest phoenix
#

no

shy verge
#

hands down

#

period

earnest phoenix
#

kotlin's syntax is weird

#

that's why I haven't approached it

knotty steeple
#

show me an example

earnest phoenix
#

same with python

#

it's frustrating without brackets

knotty steeple
#

i dont know what kotlin looks like

shy verge
#
fun main(args: ArrayOf<String>): Unit {}

the unit bit is optional but I used it to make a point

earnest phoenix
#

btw can you just do mono myapp.exe to run apps in linux?

knotty steeple
#

im gonna suck at kotlin if i tried to make a bot with it

#

tbh

#

just trying to get ping with jda is complicated a bit zoomeyes

shy verge
#

what part?

knotty steeple
#

getting the actual ping

#

response time

shy verge
#

oh that's another thing I fucking hate with Java

#

why are properties methods

earnest phoenix
#

it feels good tho

#

idk why

#

maybe its because its more consistent

knotty steeple
#

what are properties methods

earnest phoenix
#

so like everything is methods

shy verge
#

getContextRaw() < content

earnest phoenix
#

it kinda feels good

knotty steeple
#

oh no

earnest phoenix
#

in my opinion

knotty steeple
#

why properties methods

earnest phoenix
#

java doesn't have properties like that

shy verge
#

no it does

earnest phoenix
#

"like that"

shy verge
#

but in pure OO all properties of a class are private, and you have dedicated methods to get/set them

earnest phoenix
#

true

shy verge
#

hence, "getters and setters"

earnest phoenix
#

but shortcuts boost productivity alot

#

so java should have that by now

#

:/

verbal night
#

i mean, you can abuse static

earnest phoenix
#

that's bad practice

verbal night
#

^

earnest phoenix
#

btw

#

I didnt know u just needed to use mono <app>.exe to run c# apps in linux

#

lol

shy verge
#

idk maybe java was designed with the intent of being the shining beacon of pure OO

#

and everyone said "ok cool" and went off and did their own thing

earnest phoenix
#

the real reason that java is so popular is because

#

of it's compatibility

#

its because of coffee machines

#

with alot of stuff

worn sparrow
#

my bot's already slowing down h o w

shy verge
#

ew an m-sku

#

cause ur thermal throttling

#

or windows is doing some priority fuckery with it

earnest phoenix
#

tbh I was disapointed with rider

#

😦

#

it feels idk

#

it feels not-jetbrainish

worn sparrow
#

i dont think i am

earnest phoenix
#

its like an outlier

#

of jetbrain

#

for some reason

knotty steeple
#

241 processes tf

earnest phoenix
#

its kinda different you know what I mean

shy verge
#

@worn sparrow increase the priority of your bot's runtime

worn sparrow
#

How so

#

my bot is online whenever im logged in it's automatic

earnest phoenix
#

self-hosted?

shy verge
#

right click process, there should be a "priority" drop-down in the rightclick menu

worn sparrow
#

i dont have a credit card so i can use my AWS stuff

earnest phoenix
#

can or cant

shy verge
#

lemme just plug my sketchy hosting

worn sparrow
#

cant*

earnest phoenix
#

ah

#

so it is self-hosted

worn sparrow
#

i have like a year free bc github edu

#

ye

shy verge
trim plinth
#

owo what is this

earnest phoenix
#

eks dee

worn sparrow
shy verge
#

@trim plinth neofetch

trim plinth
#

ok

earnest phoenix
#

did you know that you're paying more for a gaming laptop compared to an actual desktop with the same capabilities

topaz fjord
worn sparrow
#

that OpenVZ plan looks nice 🤔 @shy verge

knotty steeple
#

i have no neofetch Thonk

shy verge
#

openVZ bad

worn sparrow
#

its cheap boyo

shy verge
#

KVM good

earnest phoenix
#

cheap?

#

alienwares aren't cheap lol

worn sparrow
#

i mean OpenVZ is cheap

earnest phoenix
#

oh

shy verge
#

there's a promo code that gets you 20% off for life

#

lemme find it

knotty steeple
#

how to neofetch

worn sparrow
#

how to make bot?

shy verge
#

KVM20OFF

#

it's that

#

@knotty steeple what's ur distro

knotty steeple
#

wot

trim plinth
#

linux os

#

shy verge
#

what linux distro are you running

knotty steeple
#

Ubuntu

earnest phoenix
#

I run winbuntu

#

( ͡° ͜ʖ ͡°)

knotty steeple
#

lol

shy verge
#

16.04?

knotty steeple
#

.4

#

yes

shy verge
#

ok

earnest phoenix
#

upgrade to 18

knotty steeple
#

no

worn sparrow
#

time to beg the parents

earnest phoenix
#

lol

knotty steeple
worn sparrow
#

hey mom its 20% off, I know how you loooove discounts,

knotty steeple
#

cuz this isnt really bot development chat

earnest phoenix
#

o yea that's a good hook

#

they love discounts

shy verge
#

@knotty steeple

$ sudo add-apt-repository ppa:dawidd0811/neofetch
$ sudo apt update
$ sudo apt install neofetch
knotty steeple
earnest phoenix
sour wraith
#

so for some reason this server and this server only my bot can't grab the owner throwing an error

#

and no idea as to why

#

anyone else have the same issue

fluid basin
#

Yes it happens

sour wraith
#

rip

fluid basin
#

Cant find owner zoomeyes

sour wraith
#

where does one use bot cmds in this server

fluid basin
sour wraith
#

oh

earnest phoenix
sour wraith
#

it'd help if I unstacked them lol

#

well rip

#

bot is muted for some reason

#

¯_(ツ)_/¯

verbal night
fluid basin
sour wraith
#

already looked

#

nothing

earnest phoenix
#

whats your bot?

knotty steeple
#

@manic zealot

verbal night
#

Mute | Case #5972
Bot
Finbot#2066 (@Finbot)
Moderator
EGGSY#3388
Reason
Responds to other bots.
05/15/2018
sour wraith
#

oh

fluid basin
#

¯_(ツ)_/¯

sour wraith
#

well thats not my fault

verbal night
#

Kinda is

fluid basin
#

fix it then

verbal night
#

You didn't add the check

sour wraith
#

oh

fluid basin
#

then ping the mod to tell them its fixed

sour wraith
#

I thought it meant like

fluid basin
#

it shouldn't respond to other bots

sour wraith
#

the other bot with the f! prefix

#

nvm

fluid basin
#

like other bots shouldn't be able to trigger your commands

#

basically

sour wraith
#

I left it open intentionally but I mean.. I guess I can make a hardcode for this server

#

eh idk if I care enough tbh

#

this server will just be broke for my bot

#

¯_(ツ)_/¯

verbal night
#

._.

sour wraith
#

what

fluid basin
#

well its up to you

sour wraith
#

ye idrc tbh. I might make a config cmd once I set up a database that someone could make one of the options no reply to bots

#

but like eh

#

just tryna see why I can't get server owner

fluid basin
#

well why would you want it to respond to other bots in the first place

#

basically you can't in this server

sour wraith
#

because its funny to use my f!fight command and make a bot fight someone else using a say command

#

plus other reasons

#

I don't really see much reason to why not to allow my bot to reply to another bot

#

but I guess thats just me

verbal night
#

endless loops?

fluid basin
#

causes spam and loops are hell

verbal night
#

^

sour wraith
#

well duh, but like anyone can make a selfbot and do the same thing if they wanna

fluid basin
#

?

sour wraith
#

I still gotta make a rate limiting thing rather than just api-end

verbal night
#

However self-bots aren't allowed so we could report those people to discord

fluid basin
#

selfbots are against ToS

sour wraith
#

yea

#

but someone can still do it if they want

fluid basin
#

...

sour wraith
#

like, saying BD is against ToS doesn't mean nobody uses it

#

just being realistic

fluid basin
#

Users use bots and not the other way round

#

nor bots use bots

#

doesn't make sense

sour wraith
#

I mean, sometimes it does

verbal night
#

Quite honestly, i know i'll never use a bot that responds to other bots >.>
although i make my own bots so i know i'll probably never actually use another bot 🤷

sour wraith
#

same tbh

#

plus, most people don't use bots to make a bot reply, and most, if not all my commands are basically spam-proof through a loop

#

I dont know of any that will loop

fluid basin
#

orheally

sour wraith
#

I mean

verbal night
#

It probably wouldn't be hard for me to make a bot that causes an endless loop

fluid basin
#

yus

sour wraith
#

if it loops for a user, then it'd loop for a bot

#

so

fluid basin
#

no it doesn't

#

you don't understand

sour wraith
#

besides bot spamming

#

ya I do

fluid basin
#

bots that overlap each other will cause an infinite loop

verbal night
#

humans can just not use that command anymore

fluid basin
#

Like you do !say !say !say !say !say !say !say !say !say !help

#

if bots respond to each other they will start spamming help messages

#

and it makes other things complicated

#

especially in servers where there are many bots

#

Like if your bot has logs or stuff they log other bots deleting their own messages as well

#

Well idk

#

One thing for sure is that you don't want it to respond to a random bot

sour wraith
#

hence why I made my say command owner only :D

#

I was very aware on recursive loops with other bots hence why I implemented things the way they are

#

anyways

earnest phoenix
#

you should use embeds

#

that may help you avoid the loop

sour wraith
#

I do for a lot of my commands

#

I don't have any

earnest phoenix
#

for the say command

sour wraith
#

I have mine locked to owner only

#

since I don't plan on getting my bot deleted and all lol

earnest phoenix
#

deleted for what?

sour wraith
#

prob api abuse

earnest phoenix
#

it'll probably just get muted

sour wraith
#

I meant via discord, not a server

earnest phoenix
#

discord api is rate limited

#

and will return a 429 response

sour wraith
#

I know, but excessive sets off red flags, resulting in deleted bots

#

they understand a few hiccups, so I'm not worried

#

the only way my bot would get hard limited is via logging deleted messages in one server, but even then its fairly normal for a 110k server

#

tldr; yes I know what I'm doing with my bot

violet wyvern
sour wraith
#

I think one of your properties is null

#

not a js dev so idk

violet wyvern
#

ok

strong linden
#

My phone use Termux running my bot here

#

but why is heroku doesnt work?

tepid laurel
#

I dont think many people would even suggest to use heroku

#

@violet wyvern your params need a edit

#

exports.run(client, clientUser, message, args, guild)

#

Like what

#

And for your error

#

Your message param did not contain a proper message cause it does not have the channel on it

#

Hence the error what it pretty much exactly says

dapper moon
#

how do you do a top 10 leaderboard that works? i have this one:

#
    if (command === 'leaderboard'||command === 'lb'||command === 'top') {
        const data = await r.table('players').run();
        let pos = '', dat = '', coi = '', lim = 0;
        data.forEach(player => {
            if (lim !== 10) {
                pos += `${data.indexOf(player) === 0 ? ':first_place:' : '🔸'} #${data.indexOf(player) + 1}\n`
                dat += `**${client.users.get(player.id).username}**#${client.users.get(player.id).discriminator}\n\n`
                coi += `${player.coins.toString()} coins\n\n`
                lim++
            }
        })
        const embed = new Discord.RichEmbed()
        .setColor('#FAA61B')
        .setAuthor(`Global Coins Leaderboard`, client.user.displayAvatarURL)
        .addField(`Position`, pos, true)
        .addField(`User`, dat, true)
        .addField(`Coins`, coi, true)
        msg.channel.send({ embed: embed });
    }
#

but it doesn't order ;-; just displays the top 10

spring ember
#

You made a limit

dapper moon
#

yeah..?

halcyon torrent
#

you have to run through the whole array once, to sort it, then you can get only the 10 first users

spring ember
#

You ask for top 10 leaderboard and you complain that it just displays the top 10

native narwhal
#

xD

earnest phoenix
#

how long until the bots get verified usually?

ruby dust
#

1 hour - 1 week

keen cradle
earnest phoenix
#

s

violet wyvern
#

Hmm

#

I still need help

spring ember
#

?

violet wyvern
#

The bot says undefined

#

At clientUser

#

But it's the bot, not the error

spring ember
#

do it in the onready event

#

it seems the bot hasn't loaded yet

#

wait there is not such thing as bot

#

in the code

#

oh

#

is like clientUser undefined?

#

weird if it's a command

zenith sequoia
#

Help

#

my profile dont show on heroku

#

This is mine one :l

tiny turtle
floral stone
#

python?

tiny turtle
#

javascript

fluid basin
#

lmao

tiny turtle
#

seriously having a huge brain fart

fluid basin
#

tbh you could just html parse it

tiny turtle
#

thats what that ishttp://prntscr.com/jp2y2m

Lightshot

Captured with Lightshot

#

but that is appearing in my bot

#

i did something with .replace but i cant remember for the life of me

halcyon torrent
#

if you're talking about the &amp; it's a & encoded for URL

uncut slate
#

not really

#

&amp; is & encoded for HTML

#

%26 would be & encoded "for URL"

halcyon torrent
#

true

earnest phoenix
#

my bot is only showing that 8k people are using it when its in server over 20k

quiet bobcat
#

have you tried rebooting your bot?

earnest phoenix
#

yep

quiet bobcat
#

I don't know then

earnest phoenix
#

${bot.guilds.array().length}

#

wrong one

#

${bot.users.array().length}

#

should be right?

quiet bobcat
#

you could remove array and length and then just do size

earnest phoenix
#

hmm

#

i could

#

but that wouldnt change the issue

quiet bobcat
#

true

young cradle
#

<Client>.users return all the cached users. If you want to see the most accurate as possible (It is never going to be 100% accurate if your bot is in any large server [> 200]), you can fetch all the members guild by guild and then check the users property of the Client again.

knotty steeple
#

what would be a good license for a open source discord bot?

shy verge
#

MIT?

#

or GPL3

earnest phoenix
#

@earnest phoenix

dapper moon
#

@spring ember no i was saying it wasn't sorting them

#

@halcyon torrent how do i do that?

earnest phoenix
#

do what?

dapper moon
#

its from an earlier conversation

#

look up

earnest phoenix
#

ik

dapper moon
#

about leaderboards

#

ok

#

so.. i got a way to sort my leaderboard but it puts the ones with the lowest (1, 2, 17..) at the top. could i just reverse the array?

dapper moon
#

how do i make it sort big numbers? -.-

#

its only sorting based on the first numbers

#

5,4,2

verbal night
#

google?

dapper moon
#

didn't help

verbal night
#

ah

topaz fjord
#

If the numbers are an array you can try array.sort()

dapper moon
#

... thats what i'm already using xD

#

but its sorting based on the first number only

#
data.forEach(player => { arr.push({ id: player.id, coins: player.coins }) }); 
let sortedArr = arr.sort((a, b) => a - b);
sortedArr.forEach(o => msg.channel.send(`${sortedArr.indexOf(o) + 1} ${o.id}, ${o.coins}`, { code: 'js' }))
#

thats the code i'm using

earnest phoenix
#

there is array.reverse()

dapper moon
#

do i use it as well?

earnest phoenix
#

also that's not what sort should return

#

arr.sort((a, b) => a > b ? 1 : (a < b ? -1 : 0))

dapper moon
#

woah thats weird looking, but it'll sort all the coins right?

earnest phoenix
#

try it

dapper moon
#

okay

earnest phoenix
#

I mean a - b could work but I prefer the -1/0/1 version

#

clearer flexibility

dapper moon
#

i'll try it in a sec but quick question, when i type node advbot.js it starts 2 versions of my bot

#

so the commands run twice etc

earnest phoenix
#

it shouldn't

#

are you logging in twice maybe?

dapper moon
#

wait fixed that, it was nodemon still running xD

#

it sorts on the first coin number i think

#

or maybe its sorting on the user id

#

my goal is to have users with the most coins (in that case 402) as #1 etc

#

leaderboard

earnest phoenix
#

wait

#

you are pushing obj to arr

#

lmao

#

just noticed

dapper moon
#

oh

earnest phoenix
#

this is kinda basic js

#

are you new?

dapper moon
#

yeah

earnest phoenix
#

so what happens is that you push {id, coins} object to the array

#

when the sort fn is called

#

a and b are comparing elements

#

and they're whatever is stored in the array

#

in that case is the obj you pushed

#

so you can't just compare a > b because a and b are actually the {id, coins} objects pushed earlier

#

got it?

dapper moon
#

oh yeah i think i do

earnest phoenix
#

so instead you want to compare the coins

#

a.coins > b.coins etc. complete the sort fn I sent you like that

dapper moon
#

ohk i'll try it

earnest phoenix
#

(a, b) is correct because those will be the parameters passed in the fn

#

(parameter) => fn code

#

those are called arrow functions

#

its the same as writing function(a, b) {
return a.coins > b.coins ... rest of the code etc.
}

dapper moon
#

oh

earnest phoenix
#

so those should be (a, b) in fact it could be called anything as its just the parameters sorted will pass to the fn

dapper moon
#

oh that worked 😄 then i call reverse on it?

earnest phoenix
#

you could call reverse on it, or you could just revert the sorter result

#

if you swapped the 1 with the -1, the order would swap too

#

test it out and think about it

dapper moon
#

okay

#

but i'll play around with it

#

thanks lots ❤

earnest phoenix
#

xD alright

#

yw

buoyant estuary
#

How to show the person's name this way? (JavaScript)
Username#0000

trim plinth
#

what lib

topaz fjord
#

.tag on the user

trim plinth
#

in discord.js it's user.tag

#

in eris you would have to do ```js
${user.username}#${user.discriminator}

buoyant estuary
#

thx

buoyant estuary
#

@trim plinth ?

trim plinth
#

?

buoyant estuary
#

I use

`${message.author.username}#${message.author.discriminator}`

For get the Username#0000, more i need the username + discriminator of user mentioned, how i make this?

dapper moon
#

its right in front of you tho

trim plinth
#
`${message.mentions.users.first().username}#${message.mentions.users.first().discriminator}`
``` or ```js
message.mentions.users.first().tag
inner jewel
#

`${message.mentions.users.first().username}#${message.mentions.users.first().discriminator}`

#

local vars pls

dapper moon
#

also guys, how do i add 🥈 and 🥉 place here? my code is kinda weird when adding 🥇 so idk how to set it up ;-;

#
pos += `${sortedArr.indexOf(o) === 0 ? ':first_place:' : '🔸'} #${sortedArr.indexOf(o) + 1}\n`
#

thats how i do it rn ^ and it works but it only does 🥇 or 🔸

inner jewel
#

const emojis = ["first", "second", "third"]

pos += emojis[index of o]

dapper moon
#

ohhh ok, and then do || diamond thing if it doesn't match?

vestal cradle
#

guys can i ask how you get default channel of a server ?

#

i kinda forgot xD

trim plinth
#

default channels aren't a thing anymore I think

vestal cradle
#

ugh

dapper moon
#

there is a way

#

are you on discord.js by any chance

vestal cradle
#

No

#

js

dapper moon
#

what library?

vestal cradle
#

discord.js?.... if thats what you asking xD

dapper moon
#

yes -.-

#

its a messy but working way to get a default channel

vestal cradle
#

no joke it's messy af

dapper moon
#

yep

#

barely makes sense to me lol

#

but it works

vestal cradle
#

oh great the only stupid error that i hate

#

invalid or unexpcted token

ivory sorrel
#

hei

earnest phoenix
#

@gilded plank botinfo @ornate zealot

gilded plankBOT
#
Bot info
ID

410253782828449802

Username

JADE AI

Discriminator

3796

Short Description

The first of its kind on discord, a chatbot based on Deep learning to accompany you through your discord days!

Library
Prefix

JH

Upvotes

3

Server Count

No server count

Owner(s)

@cold harness

earnest phoenix
#

lolrip

fluid basin
halcyon torrent
#

he is

earnest phoenix
#

@249024790030057472

#

dmit

halcyon torrent
#

<@!ID> ^

earnest phoenix
#

@cold harness

#

o

halcyon torrent
#

you didnt need to ping tbh

prime cliff
#

Discord is bad with mentions

earnest phoenix
#

can somebody show me how to require a questions.json file (but also catch the error message)

dapper moon
#
const questions = require('./questions.js');

that'll require it

#

wdym catch the error message though?

earnest phoenix
#

because it doesn't collect the questions.json file, the output comes up as "undefined" (if I do a ${questions[i]}

dapper moon
#

whats in questions.json?

earnest phoenix
#

example:

"B1q1":"A simple quiz question"
}```
rich kiln
#

That's an obj, not an array.

earnest phoenix
#

I have the array later on in my code

dapper moon
#

just do ${questions.B1q1}

earnest phoenix
#

B1questions = ["questions.B1q1, questions.B1q2, questions.B1q3]

#

that's my array

#

and then I select a random one using an index

#

but it comes up as "undefined"

dapper moon
#

i think i see

#

don't add questions. to the things in the array

#

just set them as B1q1 etc

earnest phoenix
#

ok, but they need to be variables with questions inside them

dapper moon
#

hm

rich kiln
#

array of object also works

dapper moon
#
{
    "question thing": {
        "question": "banana",
        "answer": "also banana"
    }
}
#

something like that maybe

#

in questions.json

earnest phoenix
#

so that would make an array?

dapper moon
#

whatt?

earnest phoenix
#

so I wouldn't need to do the whole:

B1questions = ["questions.B1q1, questions.B1q2, questions.B1q3]?

dapper moon
#

-.-

#

yes you need to

rich kiln
#

Could you paster your code on hastebin, please?

dapper moon
#

but make it into this

B1questions = ["B1q1", "B1q2", ...]
#

then do ${questions[i]} or whatever

#

guessing that i is one of the things out of the array

earnest phoenix
#
    "B1questions": {
        "B1q1": "banana",
        "B1q2": "also banana"
    }
}``` this would make the B1questions array or what
dapper moon
#

@earnest phoenix stop commenting if your not helping thx

#

@earnest phoenix no don't do it now i see what you mean

earnest phoenix
#

I agree

#

kewl

#

oh ok

dapper moon
#

do the array thing at the top and just do them separately in the json

earnest phoenix
#

^?

#

wdym @dapper moon

dapper moon
#

how do you get the random number?

#

the i thing

earnest phoenix
#

random math stuff

dapper moon
#

i'll put together an example fou you

#

code?

earnest phoenix
#

I've tried using just 1 and it still didn't work

#

that's not the problem

#

it still says "undefined"

dapper moon
#

hold up then

#

ugh

earnest phoenix
#

so I think the problem is the collecting of the questions.json

#

rip

dapper moon
#

questions.json

{
    "B1q1": "thing1",
    "B1q2": "thing2"
}

your main file/code:

const questions = require('./questions.json');
const array = ["B1q1", "B1q2"];

const i = array[Math.floor(Math.random() * Math.floor(2))];
const questionChosen = questions[i];

console.log(questionChosen);
// => will return 'thing1' or 'thing2'
#

idk if that'll work fully since its off my head and i haven't done much like this in a while but try it

earnest phoenix
#

don't I need to do a
const array = [questions.B1q1, questions.B1q1]

dapper moon
#

i'll try it in my bot if you want

#

no

earnest phoenix
#

to get them from the questions.json file

dapper moon
#

-.-

#

thats why you have a separate file

#

so you don't need that

#

i gave you the code you need anyways so just try it

earnest phoenix
#

wait so why isn't it collecting it from the questions.json file because it's a separate file

#

just curious tho xd

dapper moon
#

ugh it is >.>

#

your not using them right in your original code tho

earnest phoenix
#

ok

dapper moon
#
// get the questions from questions.json:
const questions = require('./questions.json');

// question names, set in questions.json
const array = ["B1q1", "B1q2"]; 

// randomly get a name of a question from the array above
// set 2 higher or lower based on how many questions are in the questions.json file
const i = array[Math.floor(Math.random() * Math.floor(2))];

// gets the second string/question content from a question in questions.json
const questionChosen = questions[i];

// console logs the chosen question
console.log(questionChosen); 
// => will return 'thing1' or 'thing2'

thats an explanation if it helps

earnest phoenix
#

oh so if we require the questions.json then it already knows about the variables?

dapper moon
#

yes

#

and you just need to randomly choose a question name from the file

earnest phoenix
#

ok

dapper moon
#

then get the content and (say as above) console log it

earnest phoenix
#

Guys in MAX function in SQL, How to get more results than one?
For example this one will only get one result:

SELECT MAX(column_name) FROM table_name WHERE condition; ```
How to get more?
fluid basin
#

wdym

earnest phoenix
#

Like I want leaderboard

#

Top 10

#

Wait

#

Maybe SELECT DISTINCT will work

fluid basin
#

Just select then order

#

¯_(ツ)_/¯

earnest phoenix
#

@fluid basin Order?

#

How?

#

I think it won't work, I want more than one result

fluid basin
#

Mysql?

earnest phoenix
#
SELECT MAX(column_name) FROM table_name WHERE condition; ```
#

Ye

fluid basin
earnest phoenix
#

The code I've sent will only return one value

fluid basin
#

Just add ORDER BY DESC at the back

#
SELECT column_name FROM table_name WHERE condition ORDER BY DESC```
earnest phoenix
#

Yes

#

And limit

#

by 10

#

Thanks

fluid basin
#

yeah

#

oh wait

earnest phoenix
#
SELECT MAX(column_name) FROM table_name WHERE condition ORDER BY DESC LIMIT 10;```
fluid basin
#
SELECT column_name FROM table_name WHERE condition ORDER BY column_name DESC
LIMIT 10```
earnest phoenix
#

Hm?

#

ORDER BY column???

fluid basin
#

yeah

earnest phoenix
#

What does it do?