#development

1 messages · Page 512 of 1

keen drift
amber stone
#

my commands things at the top is just a command handler

keen drift
#

so what message is it saying 30 times

amber stone
#

my event listeners are at the bottom

keen drift
amber stone
#

when a user joins

#

or leaves

#

or channel created or deleted

#

basically just the event listeners

keen drift
#

are those event listeners within on message

amber stone
#

when a user joins the message it sends

keen drift
#

i can't tell with the indents

#

Yeah, those are within on message

#

Which in theory, it will register the listener every message it receives

#

Creating duplicate listeners

amber stone
#

idk how I can fix that

keen drift
#

don't register events within another event

sick cloud
#

lol

#

api noobs

keen drift
sick cloud
#

i just made my bots page very red

#

like

#

v e r y red

keen drift
#

i recommend cleaning up that code, and use 4 space indent

earnest phoenix
#

omfg

#

@amber stone you are registering a new event for guilkd member add, remove and channel create/delete every message blobsweat

#

never do that pls

#

u should have got a warning that you have too many event listeners... jesus christ

topaz fjord
#

events in events

#

what the fuck

jagged plume
#

on message
register more events

#

ok logical

lament meteor
#

i remember someone who made a client in their command when using a cmd handler

heady anvil
#

every message you send register a new webhook, send the message through that, then delete the webhook

hushed berry
#

Why delete it though

heady anvil
#

so you can make more webhooks

#

alternatively you can make a github repo, make a webhook for that repo on discord, push a commit with the message being what you want to send, then delete the repo and the webhook

short siren
#

Anyone know how to use glitch?

zenith moss
#

Ehh somewhat

short siren
#
$ node index.js
events.js:183
      throw er; // Unhandled 'error' event
      ^
Error: listen EADDRINUSE :::3000
    at Server.setupListenHandle [as _listen2] (net.js:1360:14)
    at listenInCluster (net.js:1401:12)
    at Server.listen (net.js:1485:7)
    at Function.listen (/rbd/pnpm-volume/c127384d-4c47-4f9b-b102-97459c96273a/node_modules/.registry.npmjs.org/express/4.16.3/node_modules/express/lib/application.
js:618:24)
    at Object.<anonymous> (/app/index.js:12:5)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (modul``` This is the error
zenith moss
#

Lib?

short siren
#

discord.js

sick cloud
#

change your port your using

short siren
#

wha port?

sick cloud
#

the port 3000 is in use

#

server.js

short siren
#
const http = require('http');
const express = require('express');
const Discord = require('discord.js'); //Discord Package
const bot = new Discord.Client(); // The Client
const PREFIX = "-";

const app = express();
app.get("/", (request, response) => {
  console.log(Date.now() + " Ping Received");
  response.sendStatus(200);
});
app.listen(process.env.PORT);
setInterval(() => {
  http.get(`http://${process.env.PROJECT_DOMAIN}.glitch.me/`);
}, 280000);

bot.on("message", function(message) {
  if(message.author.bot) return;
  if(message.channel.type == 'dm') {
  return message.channel.send(":smirk: | **You cannot do commands in PM's!**")
  }
    if(!message.content.startsWith(PREFIX)) return;
  var args = message.content.substring(PREFIX.length).split(" ");
    switch (args[0].toLowerCase()) {
    case "test":
     message.channel.send("hello")
     break;
  }
});

bot.login(process.env.TOKEN);``` This is my index.js
#
const express = require('express');
const app = express();

// we've started you off with Express, 
// but feel free to use whatever libs or frameworks you'd like through `package.json`.

// http://expressjs.com/en/starter/static-files.html
app.use(express.static('public'));

// http://expressjs.com/en/starter/basic-routing.html
app.get('/', function(request, response) {
  response.sendFile(__dirname + '/views/index.html');
});

// listen for requests :)
const listener = app.listen(process.env.PORT, function() {
  console.log('Your app is listening on port ' + listener.address().port);
});
``` server.js
sick cloud
#

what's process.env.port

short siren
#

Not sure lol, I''m following the anidiots guide but it dosnt say what to fill it in as

sick cloud
#

change it to 301 then

#

or a random port

zenith moss
#

Oh I used his guide to help me setup

sick cloud
#

lol

short siren
#
const listener = app.listen(301, function() {
  console.log('Your app is listening on port ' + listener.address().port);
});
``` like that
#

# store your secrets and config variables in here
# only invited collaborators will be able to see your .env values

# reference these in your code with process.env.SECRET

SECRET=
MADE_WITH=
TOKEN=JzUzOHTxODYwOTA9OTY2NDY0.BI3K3w.NN1Gvsl7CSh2IYIEUJDJAFejH4w

# note: .env is a shell file so there can't be spaces around =
#

My current env above

lament meteor
#

zoomeyes a token

short siren
#

zoomeyes a fake one

zenith moss
#

I was bout to say, never seen a token look like that

short siren
#

Yeah xd

#

I got mie and changed it

hushed berry
#

its honestly so cool that I can ask a question about groovy lang and have one of the lead maintainers answer it 😍

west raptor
#

Glitch should start the process automatically

#

You shouldn't have to run node index

short siren
#

What should i have run

quartz kindle
#

do you need an express server? are you running a web dashboard or a website?

#

if not, just remove it

carmine echo
#

I have a really weird issue. I completely remade my bot, @icy lichen. It works perfectly well with the dev bot's token, but it breaks if I use the actual bot's token. It can read messages, but it can't see commands. How is that even possible?

#

It's here btw.

sick cloud
#

that code hurts my eyes, but check permissions

#

make sure nothing else changes, it's exactly set up the same

carmine echo
#

I found the issue. And it happened because of my stupidity.

#

The way I trimmed off the prefix was message.content.slice(1)

#

so it didn't work with a 1+ char prefix

#

so uhh fixed it lol

#

Also I'll try to clean up the code.

sick cloud
#

gg

#

also just rewrite again lol

carmine echo
#

Probably only the join/leave messages and make the bot.on("message" thing look not horrible

#

You haven't seen the old bot.

#

Everything about this repository is wrong.

sick cloud
#

does it have semicolons

carmine echo
#

the old one - yes. And even in places where you don't need them. And the new one has 0 unless I accidentally put 1 or 2 somewhere.

#

The old bot was my first ever js (or even programming) project.

sick cloud
#

then put them in the new one pls

carmine echo
#

no

#

why would anyone need semicolons

sick cloud
#

they're useful

carmine echo
#

if you're writing code in 1 line.

earnest phoenix
#

no semicolons...?

#

what is this, npm?

#

use semicolons pls

carmine echo
#

no

earnest phoenix
#

bad practice peepoAnger

carmine echo
#

Why use semicolons when they do absolutely nothing?

#

Semicolons GWeeeSataniaDisgust

#

I know there are cases when you'd need a semicolon, but there are no such cases in my bot.

#

Not even 1.

quartz kindle
#

i always use {} even in one-line ifs

#

and always use semicolon after )

earnest phoenix
#

consistent code style always

#

some people be like "well its just one line after my if, why add {}

#

but when you start mixing style ur code just turn into a clusterfuck

#

and js is already bad enough

quartz kindle
#

the only style mixing i do is that i keep short ifs in one line, and long ifs in multiple lines xD

sick cloud
#

being consistent is key to good code

quartz kindle
#
if(short) { dosomething(); return; }
if(long) {
    dosomething();
    dosomethingmore();
    return;
}```
sick cloud
#

i follow a modified xo code linter

carmine echo
#

My code is consistent. It has exactly 0 semicolons in it.

#
if (short) {
    return dosomething()
}
if (long) {
    dosomething()
    dosomethingmore()
    return
}

@quartz kindle

quartz kindle
#

i dont want to return dosomething(), i want to dosomething() then return nothing

#

but yeah, i prefer using semicolons

carmine echo
quartz kindle
#

im sorry but i really dislike the second option

#

¯_(ツ)_/¯

carmine echo
#

it has a semicolon GWeeeSataniaDisgust

quartz kindle
#

in that case, you need one regardless

#

else is the same as foo()[1,2,3]

carmine echo
#
foo()
const arr = [1, 2, 3]
arr.forEach(bar)

That's what I'd do.

heady zinc
#

the second option is absolutely disgusting hello yes

quartz kindle
#

well, yeah, but why allocate a new variable if you dont need to?

carmine echo
#

To not use semicolons

heady zinc
#

they are

#

because they're hot

#

end of the discussion

quartz kindle
#
“I put semicolons in my JavaScript because without semicolons, it’s not valid C/C++/Java/Whatever.” If you have to write a bunch of Java or C code in a project, and want your JavaScript to not look too different, then that is a valid concern. (Cassis takes this approach to its absurd end.)```
carmine echo
#

I used to think this way too @heady zinc . I've changed.

quartz kindle
#

using them helps you keep up with other languages, so

#

¯_(ツ)_/¯

carmine echo
#

Semicolons are disgusting to me now.

heady zinc
#

im having a hard time seeing how you could not like them, they explicitely determine the end of a statement too, it's extremely useful

quartz kindle
#

i write js and php, and in php if you forget a single semicolon it will throw a fatal exception lmao

carmine echo
#

php GWeeeSataniaDisgust

quartz kindle
#

so im not gonna go around writing in different styles for different languages xd

heady zinc
#

why not, consistency is overrated anyway

earnest phoenix
#

how do I make my bot dm everyone?

carmine echo
#

I won't even bother with y'all. Semicolons are disgusting. eod.

heady zinc
#

you don't.

quartz kindle
#

you dont,

earnest phoenix
#

in python

carmine echo
#

You don't.

quartz kindle
#

thats api abuse and will get you banned

earnest phoenix
#

oh ok

#

thanks

heady zinc
carmine echo
#

I bet they'll go look for ways to do it anyway

quartz kindle
#

well, its not hard anyways

carmine echo
#

memberarr.foreach(send)

#

wait it's python. Anyway, same thing.

#

ok

quartz kindle
#

pie

carmine echo
#

Python doesn't have forEach() GWchadThinkeyes

#
for n in arr
doSomethingWithN()
quartz kindle
#

python doesnt have semicolons

#

go learn python

earnest phoenix
#

I dm everyone all the time bloblul

#

my bot still stands

heady zinc
#

reported

carmine echo
#

This might actually be grounds for account termination. Not like I'm dedicated enough to report someone

earnest phoenix
#

Thonk seriously?

carmine echo
#

Yes. Very seriously.

#

Sending unsolicited DMs is API abuse.

earnest phoenix
#

You don't have any proof, now do you

#

I could be kidding for all you know

carmine echo
#

Possibly. As I said, I am not dedicated enough to report someone lol

#

if you're dming everyone announcements and such, why not do it in a channel? Bot updates? Also do it in a channel.

earnest phoenix
#

it was a joke, i don't actually dm everyone..

carmine echo
#

I knew that, just making sure.

#

I don't believe there are people retarded enough to do that.

#

But I do sometimes see people on r/discordapp asking others how to do it. So uhh, there are people like that.

quartz kindle
#

lmao at the end of that semicolon video

#

if you dont write semicolons, try spending one month writing them
if you do write semicolons, try spending one month writing TWO of them

carmine echo
#

I won't survive a month

heady zinc
#

why two of them

carmine echo
#
const foo = 'bar';;
quartz kindle
#

so you know how it feels when you tell people they should be writing them

#

or something

#

lmfao

heady zinc
#

what.

quartz kindle
#

he claims its less confusing to teach people who are new to programming

#

and as an example he asks you to try writing your code with an extra semicolon, so you know how students new to the language feel about it

carmine echo
#
const foo = 'bar';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
quartz kindle
#
for(;;) { alert(1); }```
carmine echo
#

no

quartz kindle
#

yes

carmine echo
#
const foo = "bar"
foo = "not bar"

GWchiakiSataniaLaugh

sick cloud
#
const n = 'n';
const u = 'u';
const t = 't';

const nut = `${n}${u}${t}`;

console.log(nut);
// => 'nut'

semicolons useful

carmine echo
#

the whole thing would work without them

quartz kindle
#

jesus christ

carmine echo
#
const n = 'n'
const u = 'u'
const t = 't'

const nut = n + u + t

console.log(nut)
// => 'nut'
sick cloud
#

bad

carmine echo
#

no u

heady zinc
#

that's so gross

sick cloud
#

whats gross

carmine echo
#

yes the semicolons are gross

sick cloud
#

the no semicolons or

heady zinc
#

no u

carmine echo
#

ok

quartz kindle
#
const a = ["n","u","t"];
let i = 0;
for(;;){
    i < a.length ? console.log(a[i]) : exit;
}```
#

lmao

carmine echo
#

no

sick cloud
#

lets see how complicated we can make this script

carmine echo
#

well that's easy. Make it download the characters from the internet

quartz kindle
#

just replace characters with ascii codes or hex or something

#

or just use jsfuck

carmine echo
slender thistle
#

@carmine echo Python:

for some_shit in SOME_shit:
    do_some_shit()
carmine echo
#

exactly what i said

#

apart the : thingie

quartz kindle
#
var result = "";
var i = 0;
for(;;) {
    Number(i % 255).toString(36) === "n" && result.length === 0 ? result += Number(i % 255).toString(36) : null;
    Number(i % 255).toString(36) === "u" && result.length === 1 ? result += Number(i % 255).toString(36) : null;
    Number(i % 255).toString(36) === "t" && result.length === 2 ? result += Number(i % 255).toString(36) : null;
    if(++i && result.length === 3) { console.log(result); break }
}
#

lmfao

carmine echo
#

delet this

quartz kindle
#
(function(){
    var a = [0,0,0];
    for(;;) {
        if(a[0]++ > 36) { a[0] = 0; continue; }
        for(;;) {
            if(a[1]++ > 36) { a[1] = 0; break; }
            for(;;) {
                if(a[2]++ > 36) { a[2] = 0; break; }
                let string = Number(a[0]).toString(36) + Number(a[1]).toString(36) + Number(a[2]).toString(36);
                if(string === "nut") { console.log("nut"); return "lol"; }
            }
        }
    }
}())```
#

another one

hushed berry
#

@quartz kindle i switch pretty often between a lang that requires semicolons and a lang that doesn't. It messes me up everytime

earnest phoenix
#

I NEED A WEB DEV

#

please

pale marsh
#

Just ask ahead

earnest phoenix
#

how

hollow fulcrum
earnest phoenix
#

@hollow fulcrum bro

#

?

#

where do i sumbit

hollow fulcrum
#

fetch as google is your best bet

earnest phoenix
#

so

#

I'm using the bot called react-role

#

i mean reaction role

#

and idk if it has the ability to replace a role when you react to an emote

#

i know that it can give you a role,

#

but idk about replacing

#

if anybody knows how to do that please show me

sick cloud
#

@keen drift ^^

earnest phoenix
#

yeah I was watching his tutorials on yt

#

but he didnt have a video of what i was looking for

#

idek if what i want is possible GWcorbinMonkaGIGA

sick cloud
#

i don't think it can but wait for fishy

earnest phoenix
#

can i get help?

#

i pressed fetch and render

#

and i got this

#

??

#

ok thank you!

#

do they make a different?

#

becauase google was only able to fetch and render one of them which had the www because my server forces https

#

should i remove the other one?

quartz kindle
#

you should learn SEO and use canonical tags

#

plus all other meta tags

earnest phoenix
#

yeah i got those but not cononical tags

#

because i never knew they existed

quartz kindle
#

they tell google which one is the "real" address, and all others are just copies

#

google canonical tags

earnest phoenix
#

o

quartz kindle
#

another option is to use htaccess rewrites

#

if you use a webserver like apache/nguinx

earnest phoenix
#

so this is it?

quartz kindle
#

yeah

earnest phoenix
#

ok

#

i put that in the header right?

quartz kindle
#

yup

earnest phoenix
#

for this

#

should i delete one of them or should i leave both of them

#

because one of them is getting indexed and the other isnt

quartz kindle
#

its better to keep https://hqmusic.ga

#

with https and without www

#

if your server supports SSL its better to keep https always on

earnest phoenix
#

my server will only allow the user to connect if https

#

is used if not the website wouldnt load

quartz kindle
#

good

#

that means it has HSTS enabled

earnest phoenix
#

yea

#

also TLS1.2 and above

#

supported

#

so they can only connect with tls1.2 and 1.3

#

1.1 or 1.0 will give them an error

quartz kindle
#

the only possible problem with HSTS is that if for some reason your server's ssl fails, your server will be inaccessible

#

but that should never happen

earnest phoenix
#

ah

quartz kindle
#

i use hsts on my website too

#

and im making an https-only api

earnest phoenix
#

o

#

nice

#

is this an issue? google failed to load one image

#

how do you make a role assigned to newcomers automatically?

#

.aar using the nadeko bot right?

#

but what about changing it?

#

i accidentally assigned the wrong role

#

and 2 of them at that GWfroggyFacepalm

sick cloud
#

that's a bad idea, but ask the bots support server

earnest phoenix
#

plez halp

#

oof ok

sturdy verge
#

the requirements from node or npm?

boreal acorn
#

Npm

sturdy verge
#

@boreal acorn i have discord.io, winston, and auth.json

#

./auth.json

boreal acorn
#

Can you not tag me plz

sturdy verge
#

sorry

boreal acorn
#

And why use io discord.js is better and what's the error

sturdy verge
#

ill paste what command prompt is saying when i use the line: "node bot.js"

boreal acorn
#

I need the error

#

That tells me nothing

sturdy verge
#

C:\Users\Ashton\Documents\Bot>node bot.js
internal/modules/cjs/loader.js:710
throw err;
^

SyntaxError: C:\Users\Ashton\Documents\Bot\auth.json: Unexpected token “ in JSON at position 3
at JSON.parse (<anonymous>)
at Object.Module._extensions..json (internal/modules/cjs/loader.js:707:27)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (C:\Users\Ashton\Documents\Bot\bot.js:3:12)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)

C:\Users\Ashton\Documents\Bot>

boreal acorn
#

Show me the auth file

#

And that error says there's an error on position 3

inner jewel
#

wrong quote char

boreal acorn
#

^

sturdy verge
#

all it has is:
{
“token”: "BOT-TOKEN"
}

inner jewel
#

yes

#

that's the wrong quote character

#

" this is the right one

boreal acorn
#

Ye

#

To slow to type on phone

sturdy verge
#

but that is what it has is double quotes

boreal acorn
#

Do not double quote it or change the double quate or something

topaz fjord
#

It's old and abandoned

boreal acorn
#

Yah

#

Discord.js is a lot better

inner jewel
#

vs
"

#

one is tilted

#

the correct one isn't

boreal acorn
#

Why do people mistake quotes facepalm

topaz fjord
#

I wonder how lavalink works 👀

boreal acorn
#

Some of my dev friends used it they said its bad

sturdy verge
#

so lets do this first. get me started with d.js

boreal acorn
#

Google search discord.js how to

#

And on the docs there is an example

topaz fjord
#

Lavalink isn't bad

#

lavalink good

boreal acorn
#

Only repeating what I been told

sturdy verge
#

npm install discord.js

#

that okay?

#

I feel like I'm going to have to scrap everything I have. is this true?

earnest phoenix
#

@keen drift please ping me when you answer ok? thanks!

topaz fjord
#

@sturdy verge some stuff might be the same some stuff wont

#

it's still better than using a library that doesn't get updated

sturdy verge
#

yeah I see, it looks so easer and more comfortable

earnest phoenix
#

And it uses a ton more memory too

#

Yay

sturdy verge
#

so I took the example code from the website and I fixed it to my liking. i put in my bot token as well as changing the tag

#

to actually turn my bot on how do i need to run that in cmd?

restive silo
#

it doesn't use much memory if you actuall disable useless events like Typing_starts

topaz fjord
#

@restive silo what if I disable you

#

no

restive silo
#

wtf was that

sturdy verge
#

advert

modern sable
#

@coarse shuttle

#

white name

#

where's my hammer

sturdy verge
#

do i need to node my bot.js file again?

keen drift
#

@earnest phoenix yes it can give and remove role

#

View the pinned in my support channel

#

It's quite hacky as of v1

#

I aim to improve that for v2

sturdy verge
#

i got this as an error when i " node bot.js " my bot file with all my code

#

C:\Users\Ashton\Documents\Bot>node bot.js
(node:5200) UnhandledPromiseRejectionWarning: Error: Incorrect login details were provided.
at WebSocketConnection.client.ws.connection.once.event (C:\Users\Ashton\Documents\Bot\node_modules\discord.js\src\client\ClientManager.js:48:41)
at Object.onceWrapper (events.js:273:13)
at WebSocketConnection.emit (events.js:182:13)
at WebSocketConnection.onClose (C:\Users\Ashton\Documents\Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:390:10)
at WebSocket.onClose (C:\Users\Ashton\Documents\Bot\node_modules\discord.js\node_modules\ws\lib\event-target.js:124:16)
at WebSocket.emit (events.js:182:13)
at _receiver.cleanup (C:\Users\Ashton\Documents\Bot\node_modules\discord.js\node_modules\ws\lib\websocket.js:220:12)
at Receiver.cleanup (C:\Users\Ashton\Documents\Bot\node_modules\discord.js\node_modules\ws\lib\receiver.js:535:15)
at WebSocket.finalize (C:\Users\Ashton\Documents\Bot\node_modules\discord.js\node_modules\ws\lib\websocket.js:206:20)
at TLSSocket.emit (events.js:187:15)
(node:5200) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:5200) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
C:\Users\Ashton\Documents\Bot>

restive silo
#

wrong token

sturdy verge
#

i got it from dicord/developers

smoky spire
#

you got it wrong

sturdy verge
#

i regenerated my token and same error

keen drift
#

May we see some login code redacted

sturdy verge
#

would probably help if I was acually getting the Token

keen drift
#

What were you getting before

sturdy verge
#

client secret

smoky spire
sturdy verge
#

if i change my bot.js file do i need to re node it?

keen drift
#

Yes

sturdy verge
#

oaky

#

well i got it on

#

he powered off

#

do i need to keep the cmd open after i node? im confused after this point

smoky spire
#

You can either keep cmd open or you can get a host

sturdy verge
#

okay how do i get a host?

#

ill search that

earnest phoenix
#

@keen drift can you show me your support channel please? I can't seem to find it

keen drift
#

It's on the doc

#

Support server is mentioned several times in it

sturdy verge
#

doc doesn't seem to work.

#

nvm i'm dumb

unkempt notch
#

Anyone know how to make a welcome and leave command for MULTIPLE servers?

earnest phoenix
#

I need help.

#

I cant seem to get CatBot to work

unkempt notch
#

CatBot?

earnest phoenix
#

My bot

unkempt notch
#

oh

earnest phoenix
#

It says Invalid Server Format

unkempt notch
#

never had that error before so cant help im afraid

earnest phoenix
#

oof

#

I need some help

#

anywayssss from another person

#

It now says Unable to fetch application. Make sure you've provided the correct Client ID and that the application has a bot account.

quartz kindle
#

we cant help you unless you post your code

unkempt notch
#

Tim

quartz kindle
#

?

ruby dust
#

has anyone ever had an opportunity to play around with enum flags?

sick cloud
#

i like the custom ones over default, but i wanna make it blurple to fit with my theme

earnest phoenix
#

You can use CSS

sick cloud
#

what css though

#

i know i got to use it lol, that really isn't a help

earnest phoenix
#

The CSS of the check box element 🙈

#

im trying to add divs to a div thru js and am confuse

#

someone halp

#

are you using jquery?

#

no

#

then you can use .innerHTML or .appendChild iirc

#

lmfao .appendChild moves it onto my navbar

#

ok

frigid thistle
#

Why does the api keep on rejecting my POST request to the stats endpoint? My token is correct, and my bot's ID is correct.
It will not work!
If I try https://discordbots.org/api/bots/stats it gives a 400. If I try https://discordbots.org/api/bots/mybotid/stats it gives me a 403.
and yes I replaced mybotid with my bot's id.
I also made sure to include headers!
("Authorization","mytoken")
and yes, I read the docs.

earnest phoenix
#

show your code

#

Isn't 400 bad request?

frigid thistle
#

Yes

sick cloud
#

yea

frigid thistle
#
fetch.post(`https://discordbots.org/api/bots/stats`)
    .set("Authorization", options.token)
    .send({count: options.servercount})
    .then(r => {
      callback("Successfully posted your count to DBL.")
    })
    .catch(err => {
      callback(console.log(err)) 
})```
earnest phoenix
#

I know 403 is forbidden

frigid thistle
#

snekfetch

sick cloud
#

so it means incorrect data was sent

frigid thistle
#

D'oh!

#

I think I know what is wrong

earnest phoenix
#

why are you using snekfetch

frigid thistle
#

ez

earnest phoenix
#

node-fetch is gud

frigid thistle
#

eh

earnest phoenix
#

*/ping

bright spear
#

No it's not

earnest phoenix
#

wait

bright spear
#

If it's anything like window.fetch it sucks

earnest phoenix
#

snekfetch is depreciated

frigid thistle
#

yeah I figured it out

earnest phoenix
#

Node fetch is basically the window.fetch API, @bright spear

#

Hence the name.

frigid thistle
#

I was sending the JSON as json { count: servercount }

#

instead of ```json
{
server_count: servercount
}

#

It just worked.

sick cloud
#

lol

earnest phoenix
#

lmao

sick cloud
#

well, gg

#

my server count is broken since tonkku blocked posting from botblock

bright spear
#

Oof

earnest phoenix
#

how to use .insertBefore

bright spear
#

I thought botblock used a proxy

sick cloud
#

well it works on all lists apart from here now advaith

#

i need to make my own botblock lol

earnest phoenix
#
            cmdsDiv.parentNode.insertBefore(div, cmdsDiv)
zealous veldt
#

whytho

earnest phoenix
#

@earnest phoenix Google it

#

i did

zealous veldt
#

just do it with a few requests

earnest phoenix
#

wait thats wrong

sick cloud
#

@zealous veldt posting to like 14 lists every 15 minutes is a pain in the ass

zealous veldt
#

creating your own botblock is going to make more work for you

bright spear
#

Lol

sick cloud
#

so

bright spear
#

Just ask the admins to unblock botblock

sick cloud
#

then i can make it support my own stuff

#

also nah

#

tonkku wont

#

ipv4 is banned

zealous veldt
#

yeah

frigid thistle
#

y is ipv4 banned?

sick cloud
#

¯_(ツ)_/¯

bright spear
#

But idk why the proxy isn't working

earnest phoenix
#

@bright spear yes i know thanks

frank dust
#

Ok, so I need help
I just installed pycharm because I wanna start coding in python using discord.py but when I try to run the code inside pycharm, it says ModuleNotFoundError: No module named 'discord' but when doing it in cmd with py bot.py, it works like a charm. Any reason why it doesn't work in pycharm?

modest schooner
#

test

#

jsut making sure i know how to make my texxt like that lol

#

Ignoring exception in on_message Traceback (most recent call last): File "C:\Users\soyou\AppData\Local\Programs\Python\python\lib\site-packages\discord.py-0.16.12-py3.6.egg\discord\client.py", line 307, in _run_event yield from getattr(self, event)(*args, **kwargs) File "C:\Users\soyou\Desktop\komaeda\bot.py", line 48, in on_message await client.send_message(message.channel, msg) File "C:\Users\soyou\AppData\Local\Programs\Python\python\lib\site-packages\discord.py-0.16.12-py3.6.egg\discord\client.py", line 1152, in send_message data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts, embed=embed) File "C:\Users\soyou\AppData\Local\Programs\Python\python\lib\site-packages\discord.py-0.16.12-py3.6.egg\discord\http.py", line 196, in request raise Forbidden(r, data) discord.errors.Forbidden: FORBIDDEN (status code: 403): Missing Permissions

#

anyone know what the fuck this means? it didnt affect my bot's productivity at all, im just confused

knotty steeple
#

doesnt have permission to do whatever

frank dust
#

nvm, turns out pycharm was using a difference python.exe

knotty steeple
#

also use codeblocks

#

```language
code
```

earnest phoenix
#

I cant figure this out bot.registry.registerGroup('commands', 'Commands'); and the error says Cannot read property 'registerGroup' of undefined please help (.js)

#

?

quartz kindle
#

cannot read X of undefined means whatever comes before X is either wrong, empty or doesnt exist

#

@earnest phoenix

#

in your case its registry

earnest phoenix
#

ok

frigid thistle
#

Why does https://discordbots.org/api/users/id not work?

#

I replaced id with my id

#

and it keeps giving me Not Found

frail terrace
hushed berry
#

it works

#

youre doing it wrong

frigid thistle
#

Code: js getUser(id, callback) { require('snekfetch').get(`https://discordbots.org/api/users/${id}`) .then(r => { const json = JSON.stringify(r.body) const body = JSON.parse(json) const data = { username: `${body.username}#${body.discriminator}` } callback(data.username) }) }

hushed berry
#

you sure the ID is right?

frigid thistle
#

Yes

#

I call the function with the id 242734840829575169

#

So it should work, because I can open the same link in my browser, and it works fine.

hushed berry
#

kinda unrelated

frigid thistle
earnest phoenix
#

why are you stringifying json just so you can parse it again?

hushed berry
#

but why do you put username into an obj but then take it right back out ThonkingButCool

frigid thistle
#

Cuz directly parsing the body returns an error.

#

If I stringify it, then parse the stringified json, it works

#

I'm kinda a noob to node

hushed berry
#

i believe the body maybe already be parsed json

frigid thistle
#

Hmm

#

So what would be a fix for my problem?

#

It works when I replace the id placeholder with my id

quartz kindle
#

instead of js const json = JSON.stringify(r.body) const body = JSON.parse(json) const data = { username: `${body.username}#${body.discriminator}` } callback(data.username)

you could just do js callback(`${r.body.username}#${r.body.discriminator}`); lmao

frigid thistle
#

I plan to add more to the data table tho

#

:p

quartz kindle
#

but anyway, if it works with a fixed id, but not with ${id}

#

then you're not passing in the id to the function correctly

frigid thistle
#

I am.

#

I made the function

#

I'm making a library

#

for dbl

quartz kindle
#

can you console.log(id) right before the snekfetch line?

frigid thistle
#

mhm.

#

lets see.

#

Yea it's returning my id.

earnest phoenix
#

maybe use node-fetch

frigid thistle
#

Hrm...

#

Node-fetch is new, and buggy

#

it hates me

earnest phoenix
#

i mean

quartz kindle
#

what if you do ""+id instead of ${id}

frigid thistle
#

I did

#

I just tried that

quartz kindle
#

could be a problem with snekfetch, since its deprecated and all

frigid thistle
#

It didn't work

quartz kindle
#

try with node's own http

#

also removes the need for dependencies if you're building a lib

topaz fjord
#

using snekfetch

#

I suggest axios

frigid thistle
#

hrm

quartz kindle
#

i suggest node's http/https :3

earnest phoenix
#

axios gay tbh

frigid thistle
#

snekfetch works for everything else I use.

#

but okay

topaz fjord
#

but it still isn't recommend

#

since it's not being updated anymore

quartz kindle
#

funny enough

#

it works in runkit

#

@frigid thistle

frigid thistle
#

weird

#

THAT'S what I missed.

#

I didn't think to put "s around the ID

#

ty for ur help.

quartz kindle
#

you were passing it as an int?

frigid thistle
#

yea

quartz kindle
#

oh

frigid thistle
#

Like I said, I'm a noob sometimes.

#

Lmao

quartz kindle
#

it happens

#

xD

frigid thistle
#

xD

quartz kindle
#

if i pass it as an int in runkit it gives me unhandled rejection lul

frigid thistle
#

How would I change int to string so it would work as both int and string?

#

like .toString() or something?

topaz fjord
#

why are you stringify then parse

#

you can literally get the request and return the request body

quartz kindle
#

js usually differentiates between them automatically, but if you need to explicitly convert them, then use toString yeah

#

or you can use tricks like 8798+""

topaz fjord
#

afaik snek parses it for u

#

most http modules do

earnest phoenix
#

yeah node-fetch has res.json()

#

Is there any good way to run a certain line of code whenever Bitcoin is sent to a certain address?

#

NodeJS

sick cloud
#

if they have an api maybe

#

google it

dire fossil
#

!free

earnest phoenix
#

!wrong channel

bright spear
#

please stop sending random stuff in development and api channels @dire fossil

#

or i will get a mod here

#

no

dire fossil
#

@bright spear oh no not a mod

queen sentinel
#

oh yes, a mod

bright spear
coral trellis
#

Thanks

earnest phoenix
#

So I am trying to get a users ID after running for r in cm.reactions: ru = await r.users().flatten()

I tried appending each user to my JSON by doingj["message"][mid]["users"].append(ru.id)but I am getting that the Member object does not have the id attribute

slender thistle
#

Now wait a minute

#

.flatten() returns a damn list

#

which is under your var ru

#

now let's see what you are doing right there

#

j["message"][mid]["users"].append(ru.id)

earnest phoenix
#

i am trying to get a list IDs

#

so the people that react i get their id

slender thistle
#

You are using .id on a damn list

earnest phoenix
#

o

slender thistle
#

Just iterate through r.users() and append every time the looping stuff begins bongocatto

earnest phoenix
sick cloud
#

is there a reason why client.users would be undefined on discord.js?

late hill
#

If the login failed?

sick cloud
#

it didnt

#

but its showing undefined

#

i know the login works

#

since it logs on ready

#

@late hill so no, the login isnt the issue

fossil oxide
#

I'm losing my mind

#

is anyone able to look at something json related with me?

late hill
#

🤔

sick cloud
#

sure

fossil oxide
#

is this not valid json?

#

I'm so confused and tired

#

I feel like I'm missing something obvious

sick cloud
#

json has to start with a {}

#

afaik

fossil oxide
#

omh

#

omg

late hill
#

lol

fossil oxide
#

is it a fucking array

#

kill me

coral trellis
late hill
#

oof

#

I thought

#

U had to put quotes

#

Around key names

fossil oxide
#

oh right, so basically

#

I am drunk

late hill
#

😂

fossil oxide
#

I was receiving an object thinking it was json

#

then trying to parse it

#

then was like wtf why no work

late hill
#

xddd

hollow fulcrum
#

PRENEW = PRENEWdict[str(message.guild.id)] returns 'str' object does not support item assignment

#

idk what im doing wrong

coral trellis
#

Anyone know which module I would need to get this function? .generateTimeString()

earnest phoenix
#

@coral trellis lol, how is anyone supposed to know this.

midnight widget
#

Because they are smarter

coral trellis
#

Shut

earnest phoenix
#

You may want to start off by explaining a bit more

marble elm
#

and also the shapes at the bottom?

knotty steeple
#

what white line

marble elm
#

one at the top

knotty steeple
#
#bot-details-page .shapes-1 {
    display: none;
}
``` shapes
marble elm
#

ok thanks

knotty steeple
#

pretty sure you cant remove that line

marble elm
#

Groovy doesnt have it

#

also how can i remove the long description box ?

quartz kindle
#

you can do anything with css

#

even make the entire page empty lul

#

if you're talking about this line

#

its a border-top css on .container

gloomy fog
#

line not removed with this

#bot-details-page .shapes-1 {
    display: none;
}```
quartz kindle
#

thats not for the line

gloomy fog
#

hmm

#

what for line 🤷

quartz kindle
#

as i said, the line is a border-top propriety in the .container element

#

use the element inspector / dev tools

gloomy fog
#

ok \👍

marble elm
#
#border-top .container {
    display: none;
}``` this?
#

its still appearing

#

How can I add text to my upvote button like 31 Upvotes instead of just 31

gloomy fog
#
#bot-details-page 
#details .container {
    border-top: none;
}

This Works mental.

marble elm
#

ok thanks

quartz kindle
#

you can add text using :after pseudoelements

marble elm
knotty steeple
#

box-shadow

#

i think

#

idk

#

for the pfp

marble elm
#

ok

#

nah that didnt work

knotty steeple
#

what did you do

marble elm
#
.bot-img img {
box-shadow: none;
}```
knotty steeple
#

thats not the pfp

marble elm
#

what is the pfp ?

knotty steeple
slender thistle
#
  #bot-details-page .bot-img {
    box-shadow: none;
  }
marble elm
#

ok thanks

#

what is the element for the prefix line?

knotty steeple
#

the whole line

#

or

marble elm
#

so i can change the colour of the text

topaz fjord
#

Inspect element, find the class name or identifier, edit it with css

earnest phoenix
#

whats an css

topaz fjord
#

come sail Sally

earnest phoenix
topaz fjord
#

wur

#

wut

#

do you know css?

marble elm
#

not really

keen drift
knotty steeple
#

well learn

keen drift
#

Lmgtfy

topaz fjord
#

Brush up on css before you try to edit it

knotty steeple
topaz fjord
#

rather not learn css

keen drift
topaz fjord
#

we're not going to tell you how to edit it all

earnest phoenix
#

should have a role that bans from development

#

if people say that

topaz fjord
#

yes

earnest phoenix
#

seen multiple people say shit like that lmao

marble elm
#

I just want an element 🤔

topaz fjord
#

@ Tonkku c'mere

earnest phoenix
#

i dont wanna learn

#

i wannt a spoonfeed

marble elm
#

i can do the rest

earnest phoenix
#

im lazy

knotty steeple
#

yes

earnest phoenix
#

im dumb

marble elm
#

ik

earnest phoenix
#

this isnt anidiots.guide server

#

go there for support that caters to literally anyone

#

LMAO

topaz fjord
#

inb4 help vampire

earnest phoenix
#

im deead

#

oooof

topaz fjord
#

inb4 that isn't the real reason

earnest phoenix
#

shes not the nicest person

#

but they help anyone

#

ifu got banned

#

u must be like

#

on another level

topaz fjord
#

The only thing I learned from there is async/await

earnest phoenix
#

mental the hero we need

topaz fjord
#

And then I left the server

knotty steeple
#

the only thing i learned from there is how toxic most of them are mmLol

earnest phoenix
#

i got muted for reacting with OMEGALUL to a sad announcement

#

so i left

#

lmao

#

the only thing i learned from their support server was that i am super dumb and that my enmap system has crashed irreparably

topaz fjord
#

I believe it

earnest phoenix
#

which part of that...

topaz fjord
#

All of it

knotty steeple
earnest phoenix
#

using enmap > v2 peepoKek

#

nice meme

#

ah, thanks for the self-confidence boost

topaz fjord
#

I don't know what you expected me to say

#

np

earnest phoenix
#

xd

earnest phoenix
west raptor
#

because when you make the winner field the value is 'winner'

#

always

#

because it's assigned before wrps is changed

earnest phoenix
#

Ok I’ll tinker with it when I get back

earnest phoenix
#

How can I trim the starting "0" off in NodeJS?

#

0100

#

is that in a string

#

Its in a variable.

#

you can just backspace

#

also that isn't what i asked

#

but thanks

#

Uh huh.

west raptor
#

@earnest phoenix what is the type?

earnest phoenix
#

Type?

west raptor
#

like

#

int

#

string

#

float

#

boolean

earnest phoenix
#

string

west raptor
#

ok

earnest phoenix
#

thats what i asked

#

Alright, so how do I do it?

mossy vine
#

@earnest phoenix variablename.slice(1)

earnest phoenix
#

^

#

Thanks.

prisma sedge
#

how can i change upvote button text?

frigid thistle
#

I made a DBL Api wrapper

heady anvil
frigid thistle
#

Ik

#

For testing.

#

I can't publish it to npm yet; the node.js installer is broken.

#

So I use heroku to test it

west raptor
#

what version are you trying to download?

#

@frigid thistle

frigid thistle
#

Latest

west raptor
#

Try installing v10

hushed berry
#

@earnest phoenix don't ask moderators to review your bots

bright spear
#

dont mention mods or anyone for no reason

marble elm
#

but there was a reason weSmart

hollow fulcrum
#

@earnest phoenix Want a bot verification? Type dbl!verify (bot id in a mention) in #commands!

earnest phoenix
#

ads

bright spear
hollow fulcrum
#

ok

gloomy fog
sonic glade
#

code ?

gloomy fog
#

in css edit

topaz fjord
#

box shadow none

sonic glade
#

box-shadow: none;

gloomy fog
#

Thanks

marble elm
#
#bot-details-page .bot-img {
  box-shadow: none !important;
}```
topaz fjord
#

nice spoonfeed

marble elm
#

np

topaz fjord
#

not a compliment

marble elm
#

❤ ill take it as one

gloomy fog
#

cert only for certified users?

marble elm
#

obviously

#

why would a normal user have it?

gloomy fog
#

oh ok \👍

marble elm
#

👍

summer escarp
#

hey can someone write me a command script

#

trying to learn how to code a bot

sonic glade
summer escarp
#

Discord.js

#

@sonic glade

sonic glade
#

?

summer escarp
#

Im using discord.js

sonic glade
#

ok?

#

so , you need an tutorial or a Command Handler?

gloomy fog
#
#bot-details-page  
  .page {
background: #011E30;
}

how to change background

#

this not works

sonic glade
#

background-color:rgb(64, 64, 64);

gloomy fog
#

Thank you

sonic glade
#

no problem

gloomy fog
#
#bot-details-page  
  .page {
background-color:rgb(64, 64, 64);
}```
sonic glade
#

..

gloomy fog
#

nothing happen

sonic glade
#

DMed the message

gusty rune
#

just a quick question can we vote via command?

earnest phoenix
#

no

gusty rune
#

tru

#

kk

#

thx

sonic glade
#

it´s posibble

gusty rune
#

k thx you for the confusing answer

quartz kindle
#

btw you dont need to use !important in your css

#

google css specificity

wheat marten
#

So I made a file called config.json

west raptor
#

Yea?

wheat marten
#

How do I make it have my token (I forgot JSON)

west raptor
#
{"Name": "value"}```
wheat marten
#

oh

#

I forgot

sonic glade
#

.json file {
"token": "insert-bot-token-here",
}

#

const config = require("./config.json"); - client.login(config.token);

west raptor
quartz kindle
wheat marten
#

I didn't need to know that

earnest phoenix
#

what do you use as text editor?

#

Visual Studio code

wheat marten
#

yes

west raptor
#

I personally use vscode

wheat marten
#

It's really nice looking

quartz kindle
#

sublimetext

#

sometimes notepad++

west raptor
#

Notepad++

#

Gross

quartz kindle
#

i like it :3

wheat marten
#

I hate the UI of it

quartz kindle
#

how big is the entire vscode installation?

wheat marten
#

D A R K M O D E I S F O R P R O S

quartz kindle
#

notepadd++ is 11mb total

#

and it has portable versions

#

plus very good plugin system

west raptor
#

Uh lemme see

quartz kindle
#

sublimetext3 is 32mb

#

its a bit more of a pain in the ass to install and set up, but it has god-send plugins for automation

last jacinth
#

Can someone help me

#

I'm trying to make my bot respond to being pinged but

#
client.on('message', msg => {
        if (msg.content === '@<409069320480620554>') {
            msg.reply("Hm?");
        }
    });
wheat marten
#

would this work for my token

last jacinth
#

Is not working

quartz kindle
#

your mention is wrong

west raptor
#

<@id>

quartz kindle
#

its <@id> not @<id>

earnest phoenix
#

node js it's not my sorry domain

last jacinth
#

🤦

#

Thankjs

wheat marten
#
{"token": "not telling yall"}
west raptor
#

Yes

wheat marten
#

good

#

JSON is one of my worst enemies

quartz kindle
#

i like json

wheat marten
#

I've done it a lot on roblox and I still can't remember the format lol

quartz kindle
#

it makes it so easy to pass data around

last jacinth
#

Well in my hosting service I have it set to put it in when booting so I don't have a token laying around inside my github repo

west raptor
last jacinth
#

For people to use their own code in my bot

west raptor
#

its basically there

#

For insiders it might be different

quartz kindle
#

disk footprint of ~200mb

#

20x bigger than notepad++

west raptor
#

yes

earnest phoenix
#

there is more option

quartz kindle
#

im a fan of lean mean minimalistic software

#

:3

wheat marten
#

wait aren't you able to put a name in front of the json code like ```json

alert
{
{"name": "text"}
}

last jacinth
#

Now anyone know how to fix the annoying EventEmitter memory leak?

quartz kindle
#

thats wrong on so many levels

earnest phoenix
#

What do you advice me ?
python or nodejs?
(python I know)

wheat marten
#

nodejs

quartz kindle
#

DU you cant put an object inside an object like that

#

and your alert is also wrong

wheat marten
#

true

quartz kindle
#

@last jacinth do you have multiple <bot>.on("message")?

last jacinth
#

Yes

quartz kindle
#

thats why

#

remove them

last jacinth
#

Well client

#

Not bot

quartz kindle
#

yeah, but on("message")

#

meaning for each message that you receive, your bot will get two copies

#

because its listening for messages twice

#

or more times, idk how many times you have it

last jacinth
#

Will it still run the cmd without

#

client.on('message', msg => {

#

Just

#

SOmething like

quartz kindle
#

you have to put all your commands inside one on("message") event

last jacinth
#
if (msg.content === '!test') {
        msg.channel.send('Oh Ok');
    }
});
quartz kindle
#

yes

last jacinth
#

Ok one second

wheat marten
#

Does JSON have variables?

quartz kindle
#

JSON no, js object yes

earnest phoenix
#

you advise me to do otherwise?

@client.event
async def on_command_error(error,ctx):
    if isinstance(error, discord.ext.commands.CommandNotFound):
        logs("[ ERROR ] : \"{}\" performed an unknown command".format(ctx.message.author))
    if not isinstance(error, discord.ext.commands.CommandNotFound):
        await client.send_message(ctx.message.channel, "oops an error has occurred")
quartz kindle
#

object = running in a program
json = outside of a program, like a text file

#

and idk, i dont know python

earnest phoenix
#

idk ?

quartz kindle
#

idk = i dont know

earnest phoenix
#

okay

wheat marten
#

I have been learning Java recently

last jacinth
#

Java is not too tough

quartz kindle
#

learn jabba

wheat marten
#

lol

quartz kindle
#

jabba the hutt

wheat marten
#

LOL

#

why putting another JSON object in a JSON file creates an error?

quartz kindle
#

because you did it wrong

#

json always needs a key and a value

#

keys cannot be objects

#

only values can

#

this is valid {"key":{}} this is not {{"key":"value"}}

wheat marten
#

for me my code is

#
{"token": "not showing"}
quartz kindle
#

that is correct

#

what code is creating the error?

wheat marten
#
{"token": "not showing"}
{"test": "test"}
#

when I add another one it creates the error

quartz kindle
#

that is incorrect

zenith moss
#

Yup

quartz kindle
#

all contents of a json file must be inside a single {}

#

you cant do {}{}

#

but you can do mulitple keys and values

#

no need for multiple objects

#

{key1:value1,key2:value2}

#

etc

wheat marten
#

Oh

#

I was looking at w3schools' tutorial on json

#

now I understand

quartz kindle
#

a json file is basically a list of keys and values

zenith moss
#

{
“Token”: “blah blah”,
“Other”: “blah blah”
}

wheat marten
#

Now I think I fully understand JSON

#

wait why do I get an error when I run node .

#

?

earnest phoenix
#

No idea

zenith moss
#

What’s your main file??

wheat marten
#

index.js

zenith moss
#

Just do nose index.js

#

Node*

west raptor
#

node . is index point

#

it should work

zenith moss
#

I seen it doesn’t work for a lot of people

wheat marten
#

I get a bunch of errors

zenith moss
#

Errors

west raptor
#

probably no package.json

zenith moss
#

And they are?

wheat marten
#

there's package.json

quartz kindle
#

invalid token lol

zenith moss
#

Your login

west raptor
#

read the error