#development

1 messages · Page 389 of 1

nimble merlin
#

lemme check the TOS

abstract crystal
#

yea do that, but you probably can use them

earnest phoenix
#

how do i get the bot developer role?

nimble merlin
#

K, 😃

abstract crystal
#

@earnest phoenix by getting you bot approved

prime cliff
#

Theose emotes are not copyrighted i think its just the ones with faces

earnest phoenix
#

@earnest phoenix adding your bot and its bein approved

prime cliff
earnest phoenix
#

kkkk

#

anyone know how I can make command cooldown in discord.js?

#

or anti-spam idk

abstract crystal
#

cache + rate limiting check

inner jewel
#

using a rate limiter

abstract crystal
#

^

nimble merlin
#

@prime cliff thanks for the info 😃

#

Hey @inner jewel am I breaking DBL TOS by using dblSupporter dblCertifiedDev dblMod dblAdmin dblCertified in my server and bot???

inner jewel
#

¯_(ツ)_/¯

nimble merlin
#

lol

#

ok

earnest phoenix
#

¯_(ツ)_/¯

nimble merlin
#

i'll check the TOS

#

I assume not, since they are not iconic emoji's

#

By that I mean, they are not emoji's that represent DBL (like hrt or dblWink)

abstract crystal
#

most likely yes

nimble merlin
#

I can't see any form of Term that states that I may not use the DBL Emoticons: dblSupporter dblAdmin dblCertifiedDev dblMod and dblCertified

#

But I will check with Oliy just to be sure

abstract crystal
#

use them

nimble merlin
#

ok.. 😃

earnest phoenix
#

hi in discord.js, does anyone know how to make a status command. so it changes the status of the bot/

#

Read the docs

#

it's very easy

#

ye

#

but

#

im a nub

#

lol

#

<botdingus>.user.setGame

idle mountain
#

That's why the docs are there.

earnest phoenix
#

Then learn how to code in javascript

quiet bobcat
#

read the docs to learn it then

idle mountain
#

To help newbies.

#

and well anyone

earnest phoenix
#

No, but I want a command like ';status', to change the status of the bot.

#

; - ;

#

Yes

#

then learn js

#

would it ble like

#

oh

#

Ik how you can do that

#

oo

#

dm me

#

😉

#

Please don't encourage spoonfeeding

#

is this an official discord server

#

like discord feedback, etc

idle mountain
#

nope

earnest phoenix
#

k

earnest phoenix
#

hi

#
      if (msg === prefix + "SETGAME") {
        const sayMessage = args.join(" ");

        bot.user.setGame(sayMessage);
        console.log(sayMessage + ` (Requested by ${message.author})`);
      }
#

isn't working

#

language: discord.js

#

no errors, or anything. ;-;

#

theres a lot wrong with that

#

k

#

can yo tell me what's wrong? c:

#

It's not executing the code inside that block, and there's no check to ensure that the message author is you

#

oof

#

wait

#

one sec.

#
let BotCreator = "382915575971577858";
if(!BotCreator) return;
const sayMessage = args.join(" ");

bot.user.setGame(sayMessage);
console.log(sayMessage + ` (Requested by ${message.author})`);
}
#

that, solace?

#

no...

#

what then

#

lol

#

I know it.

#

no u dont

#

I don't know, what's wrong with it

#

Well @earnest phoenix helped me with it

#

;-;

#

Please, can ya just help me? c:

#

I did

#

I said it's not executing the code in that block

#

Like help me edit the code.. 😛

#

and it's not checking to see if the message author is you

#

and no

#

Im not coding it for you

#

that's spoonfeeding

#

and we dont encourage that here

#

well

#

he sent wrong one lol

#

im stuck af

#

dont spoonfeed @earnest phoenix

#

he isnt

#

lol

#

uf

#

You're stuck because you do not know js

#

and if you get a solution to this

#

i read the

#

fucking

#

forums

#

lol

#

you're only going to learn nothing and keep coming back expecting to have code given to you

#

so would ```if (msg === prefix + "setgame") {
const sayMessage = args.join(" ");

    bot.user.setGame(sayMessage);
    console.log(sayMessage + ` (Requested by ${message.author})`);
}```
#

work?

#

No

#

-_-

#

Same issue as before

#

oof.

#

depending what ya gonna do

#

No, that just wont work at all

#

well kewl

#

hence the no errors being thrown

elder rapids
#

Are you actually making an open setgame comamnd

earnest phoenix
#
    if(command === "setgame") {
        const sayMessage = args.join(" ");

        client.user.setGame(sayMessage);
        console.log(sayMessage + ` (Requested by ${message.author})`);
    }
``` would this work then, what ya say?
#

taht's why I said to make a check @elder rapids

#

and actually make the code execute properly

#

That would work depending on how you define command but

#

there is still no check

#

open status messages are bad and should not exist

#

so everyone can use it ik

#

Dont do that

#

lol

#

the command i want to do is:

just do a written status, in the code

so like ';status', and in the code; it knows to set it to a selected one.

#

;p

#

well

#

We know what you want

#

but we cannot just code it for you

#

We can help you by pointing out errors

#

; - ;

#

so you can fix them

#

ivee

#

tried.

#

I gave you the two errors that you need to fix

#

just one little bit

#

pls.

#

All that you need now is an understanding of javascript and d.js

#

Which you can gain by learning js and reading d.js docs

#

I KNOW FUCKING JAVA SCRIPT, SO JUST 🖕

#

;_;

#

You do not

idle mountain
#

he's just trying to help mate

earnest phoenix
#

Otherwise you'd know the issue

#

because I've told you the issue several times

#

The reason why im like this

#

ik the issue

#

is because if I just code it for you

#

you'll keep coming back to be spoonfed code

#

and you will keep expecting to be spoonfed

#

when that is not allowed in this channel

#

So if you want to fix this issue, take the issues I pointed out, and fix them. They're both extremely simple issues to solve

#

it's not checking if the author is me; it's not executing the code in that block.

#

Yes

#

eheh

#

Two easy fixes

#
let author = "382915575971577858";
if(!author) return;
const sayMessage = args.join(" ");

bot.user.setGame(sayMessage);
console.log(sayMessage + ` (Requested by ${message.author})`);
}```
#

?

#

no

#

Both issues still exist there

#

oof.

#

i changed it to author

#

Yes

#

and thats my user id

#

That doesnt change anything

#

in let <dingus> you can have anything it doesn't effect how it works -_-

#

oh ok

#

so you need to change other stuff

#

do u know?

#

lol

#

wai

#

wait

#
client.on("ready", () => {
    client.user.setGame("with my code");
});
client.on("ready", () => {
    client.user.setActivity({game: {name: "with my code", type: 0}});
});```
#

lol

#

why..

#
    bot.user.setActivity({game: {name: "with my code", type: 0}});
});```
#

?

#

the bot.user.setGame is faster...

abstract crystal
earnest phoenix
#

That will work but it would not be a command

#

Just put that in your ready event

#

K

#

Ooo.

#

K.

#

hehe

#

lol i cant be arsed with a command

#

wait.

#
bot.users.get("382915575971577858");
const sayMessage = args.join(" ");

bot.user.setGame(sayMessage);
console.log(sayMessage + ` (Requested by ${message.author})`);
}```
#

no

#

aw

#

Where did u get that code from lol

#

did i fix one of the errors?

#

no

#

ugh.

quiet bobcat
#

Learn await and async before using them

quiet bobcat
#

great explanation owo

abstract crystal
#

I at least know how to use google

quiet bobcat
earnest phoenix
#

Guys how do u tag someone with a bot, i tried:

#

'message.channel.send('@215780447370608640 your a noob, hahahaha.')

idle mountain
#

<@ID>

earnest phoenix
#

OH

idle mountain
#

@idle mountain

quiet bobcat
#

@earnest phoenix is actually @earnest phoenix

#

sorry for peng btw

earnest phoenix
#

ik

quiet bobcat
#

👌

wispy axle
#

wait do u know what peng means lol

quiet bobcat
#

"A very positive word used casualy to show how attracted etc you are to "

wispy axle
#

k

quiet bobcat
#

I just meant pong but changed a letter

#

so eh

earnest phoenix
#

oof

elder rapids
#

You really think an urban dictionary command is a good idea? No offense but the content on that site is 👀

#

You'd be forced to put the urban command under NSFW

#

If there was any chance something can slip up

#

But anyways there should be an API somewhere for it

earnest phoenix
#

im pretty sure they have an API @nimble merlin if not officially, then at least unofficially. google a bit.

fleet socket
#

Anyone mind checking out my python code to make sure the mods wont have a problem with it? It isn't long

west current
#

This is discord.js.

    let guildHighestRole = message.guild.roles.highestRole;
#

Returns with undefined

old glade
#

Heyo,
How do I make my bot auto send an embed message on server join
I'm using discord.py

topaz fjord
#

@west current wut versions

old glade
#

@nimble merlin Isn't it supposed to be on_server_join() ?

topaz fjord
#

Version*

old glade
#

😃

#

it's ok man

#

so you have any idea ?

#

okay

west current
#

@topaz fjord 11.3.2

#

Stable

old glade
topaz fjord
#

@west current there is no highestRole from the roles

#

You'll have to check the positions and find the highest

old glade
#

@nimble merlin What do I do with the server kwarg ?

#

I did

#

This is what I have now (just calling an embed with the class/function stuff

#

server alone is working

#

why ? It's working perfectly on my other functions

#

I think I'm just missing the way to give the channel destination to post the message

#

Yeah

#

I know

#

Yeah I'll try that

#

no

#

But I found the error

#

The errors comes when a default channel is not defined

#

I'll try to find a way to work around this

#

good night friend

#

rest well 😃

frail harness
#

@old glade mate just loop through the channels and look for one that your bot can speak in

#

and then send the welcome message there

bleak sapphire
#

anyone knows how to do a welcome message where in the user gets to choose what channel the welcome message is going to be sent

ruby dust
#

my best bet is to get the current channel's id

bleak sapphire
#

well i want other users to be able to do it in different servers

#

like the welcomer bot

ruby dust
#

hmm

frail harness
#

make the user mention the channel

#

get the channel's id

ruby dust
#

store the channel's id in the respective server's id column?

frail harness
#

store it in a sqlite database

#

along with the server id

#

and put the welcome message in the same row

bleak sapphire
#

hm

#

will try

earnest phoenix
#

Could someone please help me make a discord bot i've never made one before and i need help to make one. Thank you

prime cliff
#

Use google

small solar
#

how do you make your bot leave all guilds its in apart from one (i have its id)? using discord.js stable

prime cliff
#

Just go through all the guilds and leave if the ID does not match the id you want to not leave

small solar
#

thats what i'm asking tho, how? i'm not that good with javascript really

brisk notch
#

how do you fix php(7.2) 502 errors nginx

tepid laurel
#

@small solar use a forEach() loop or for loop

floral stone
#

I can't get the json from the api

#

You got an error from server pokeweeb (427229734947127306) in channel general (427229734947127308) caused by TEDD_Tranzit#6243 (314558939696201728)

  File "/usr/local/lib/python3.5/dist-packages/discord/ext/commands/core.py", line 62, in wrapped
    ret = yield from coro(*args, **kwargs)
  File "/root/modules/profile.py", line 458, in upvote
    k = await resp.json()
  File "/usr/local/lib/python3.5/dist-packages/aiohttp/client_reqrep.py", line 730, in json
    headers=self.headers)
ClientResponseError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8'
#

@uncut slate

uncut slate
#

?

floral stone
#

The app is returning html instead of json

uncut slate
#

Please don't ping random people for help, anyone who knows will answer

floral stone
#

it's 2 am

#

I'm sorry

earnest phoenix
#

oof

floral stone
#

b'<!DOCTYPE html>\n<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->\n<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en-US"> <![endif]-->\n<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en-US"> <![endif]-->\n<!--[if gt IE 8]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->\n<head>\n<title>Access denied | discordbots.org used Cloudflare to restrict access</title>\n<meta charset="UTF-8" />\n<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\n<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />\n<meta name="robots" content="noindex, nofollow" />\n<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1" />\n<link rel="stylesheet" id="cf_styles-css" href="/cdn-cgi/styles/cf.errors.css" type="text/css" media="screen,projection" />\n<!--[if lt IE 9]><link rel="stylesheet" id=\'cf_styles-ie-css\' href="/cdn-cgi/styles/cf.errors.ie.css" type="text/css" media="screen,projection" /><![endif]-->\n<style type="text/css">body{margin:0;padding:0}</style>\n<!--[if lte IE 9]><script type="text/javascript" src="/cdn-cgi/scripts/jquery.min.js"></script><![endif]-->\n<!--[if gte IE 10]><!--><script type="text/javascript" src="/cdn-cgi/scripts/zepto.min.js"></script><!--<![endif]-->\n<script type="text/javascript" src="/cdn-cgi/scripts/cf.common.js"></script>\n\n</head>\n<body>\n <div id="cf-wrapper">\n <div class="cf-alert cf-alert-error cf-cookie-error" id="cookie-alert" data-translate="enable_cookies">Please enable cookies.</div>\n <div id="cf-error-details" class="cf-error-details-wrapper">\n <div class="cf-wrapper cf-header cf-error-overview">\n <h1>\n <span class="cf-error-type" data-translate="error">Error</span>\n <span class="cf-error-code">1015</span>\n <small class="heading-ray-id">Ray ID: 401fdc01e9a791a0 &bull; 2018-03-27 06:39:21 UTC</small>\n </h1>\n <h2 class="cf-subheadline" data-translate="er'

#

It's a cloudflare error

earnest phoenix
#

is that html? oof

floral stone
#

That's what the api results is returning

#

when trying to get the upvote

solemn obsidian
#

How often do u retrieve votes

floral stone
#

when ever someone runs the command

#

it's not a rate limit though

solemn obsidian
#

why not?

#

What prevents someone to run the command 60 times

#

1015 = ratelimit

floral stone
#

it's not that many times

#

Either way, it's poor handling of errors

solemn obsidian
#

Is it a public bot?

#

How is it poor handling of errors, you dont validate if json is valid

#

The whole point of ratelimiting is that they dont reply from their server back

floral stone
#

It should return a better response like "ratelimit" instead of this long as html code.

solemn obsidian
#

Thats cloudflare replying

#

Not their webserver

floral stone
#

True but this should be in some sort of documentation

solemn obsidian
#

ur spamming the api

floral stone
#

no one is spamming it

solemn obsidian
#

do u have logs of how many commands/per hour are ran

#

or is the bot public

floral stone
#

I have txt logs of commands with timestamp, happened 11 times in the last hour.

solemn obsidian
#

the error?

#

or commands were ran

#

its realistic that someone runs 60 commands in an hour

#

->>>>> ratelimit

floral stone
#

I'm going to add a cool down but there should be some sort of documentation of responses from the site. I usually have json checks as well, just ran the code without it to see what the problem is.

solemn obsidian
#

why not just cache the response

#

and just preload all on bot bootup

floral stone
#

Preload the json response?

#

I need to call it upon command.

primal adder
#

i can't seem to figure it out

earnest phoenix
#

Depends on how you set it up my fair lad

solemn obsidian
#

why would u need it to be called upon command

#

fetch all voters + have webhook

#

-> up to date list of voters

primal adder
#

I'm using it with python

#

and the docs for python are really limited

earnest phoenix
#

i love python it kills you inside

primal adder
#

loll

#

how do i do ittt

earnest phoenix
#

:/

#

what causes the error with 'pipe' when trying to upload random image? (discord.js)

#

like; is it image error or something else

#

by chance could you post said error

#

well not atm maybe later

#

Found this from what I sent sometime to someone (node:14688) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'pipe' of undefined (node:14688) [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.

And
(node:14688) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: Cannot read property 'pipe' of undefined

floral stone
#

@solemn obsidian I think it's something with the site though

#

sorry for the ping

solemn obsidian
#

elaborate

#

ur blacklisted because api spam

gilded thunder
#

I now I'm missing the owner only bit, but why doesn't this work?

# eval command
@bot.command(pass_context=True, hidden=True)
async def eval(command):
    """Evaluate a command."""
    eval({command})
    bot.say("{command})
#

The error I get is ```
File "bot.py", line 215
bot.say("{command})
^
SyntaxError: EOL while scanning string literal

#

Wait...

#

I see my mistake.

#

xd

#

Works now.

earnest phoenix
#

heh

gilded thunder
#

Getting errors reeeee

earnest phoenix
#

heheh

gilded thunder
#

Why doesn't it work then?

#

10/10 code for eval too.

low rivet
#

thats a horrible eval command

gilded thunder
#

Doesn't even work.

#

Because I don't do eval.

earnest phoenix
#

How do yall do the image manipulation

low owl
#

Libraries

olive crown
#

can someone tell me how to host a bot on shards?

#

because i dont know.

low rivet
#

is ur bot over 2k servers?

olive crown
#

no.

low rivet
#

is it a music bot?

olive crown
#

moderation

low rivet
#

then u no need to shard

olive crown
#

then how do i host my bot without being online

trim plinth
#

VPS

low owl
#

That has little to do with sharding

floral stone
#

right?

torpid frost
#

a mean way is heroku 😅

trim plinth
#

heroku is no

earnest phoenix
#

you can host it with node

#

aka vps should work

floral stone
#

vps cost money and money cost money so

low owl
#

I think you already got the idea what you could change about your first page. In short again what's important: First impression, Short and insightful description, space to breath, layout on different devices. Basically try to sell yourself. I'd suggest you to fix the layout and content first, then I'd think about working on the colors and maybe switching the background image.

Can't say much about your story page. Personally I'd not make a wall of text like that, at least I'm not interested in reading it because there isn't much to look at and the dark grey is a bit depressing. But maybe that's part of the story.

https://s.put.re/c8AKNkN.png let me ask you a question, so this is not a monologue. What do you notice just in that selection of your page "contributors" ?

#

Ah yeah, thought that's just a bug or WIP. But that's not what I meant.

#

Nailed it, if you want to learn more about it, take a look at "consistency in design and layout" and "color contrasts".

sinful lotus
#

do you need to shard when the bot has music commands?

low owl
#

Consistency basically only refers to staying consistent with your decisions. Basically you don't want to confuse the viewers eyes by choosing a different alignement.

earnest phoenix
#

@sinful lotus no

low owl
#

Your footer also suddenly jumped up, you could make it stick to the bottom 😄

sinful lotus
#

so I dont really need to shard if the vps can handle the load?

low owl
#

But yea, I think that's sufficient for now, might actually be a bit much. But at least you have some points now you can tackle 😄

#

If you want I can review it after you've made some changes again, because I still have some things I'd change, but that's up to you later.

#

I'm really not that proficient with actually implementing front end. Software Engineering and UI/UX is more my thing :S

sinful lotus
#

basically sharding isnt that hard as long as the bot is in one file?

#

one .js file and one .config or json file

low owl
#

Would not say so, still have to figure out how to do my own 😅

unique star
#

Sharding isnt hard with multiple files either lol

#

and you shouldnt clatch everything in one file anyway

sinful lotus
#

im still learning the module exports for now but I dont quite get the gist of it

#

thats why I cant right now

low owl
#

@blissful bear Websockets I guess. You could connect to a service (or directly to your bot) through a tunnel and basically stream the updates to your webserver.

sinful lotus
#

thats where it gets quite complicated for me 😂

low owl
#

Well, you only need to keep the tunnel alive, which is like no data traffic except a heartbeat every now and then. Similar to disocrd.

#

And then when the bot starts playing music you send one little packet with informations about it and the length

#

when it stops or pauses you send a packet again

#

no streaming needed actually

sinful lotus
#

welll quick question why putting all stuff on one file is a pain 😂

low owl
#

Perhaps, yeah

sinful lotus
#

I see ill look on that on future

#

👌

low owl
#

@sinful lotus Think about it this way, what if someone else (or you in 2 years) have to look at it again?

sinful lotus
#

rip to him HAH

#

I already did it the file has 400 lines now

low owl
#

@blissful bear Have fun with your project, sounds like a cool idea you've got there. 😃

sinful lotus
#

rofl

low owl
#

Why 😦

lament reef
#

because code

low owl
#

Ah, what does it express do you?

#

Sorry, a paket just arrived and I hat to inspect it 👀

#

Okay yea, for me it feels like it's actually pretty "dark" and makes the whole page more heavy.

inland flint
#

what is a fork on github? i dont get github 👀

quiet bobcat
earnest phoenix
#

What's the best way to make a play music (in voicechannel) command in discord.js?

inland flint
#

@quiet bobcat ty

quiet bobcat
#

np

earnest phoenix
#

@earnest phoenix ytdl-core

edgy needle
#

Does anyone know how to make my commands case insensetive
Language : Javascript

topaz fjord
#

Just do tolowercade

#

Case

earnest phoenix
#

toLowerCase()

topaz fjord
#

Kek

edgy needle
#

so

earnest phoenix
#

read the docs smh

abstract crystal
#

^

edgy needle
#

message.content.toLowerCase.content == "ping" ?

abstract crystal
#

hmmmmmm

edgy needle
#

is that correct?

abstract crystal
earnest phoenix
#

language?

#

and lib

#

hmm well Idk how to do stuff for specific server yet

#

oof bye i dont understand python

#

oof

#

I use discord.js >:D

#

but I have a python dingus tho

#

but right now I am trying to understand ytdl thingy with my slow brain ¯_(ツ)_/¯

edgy needle
#

message.content.toLowerCase(); does not work

earnest phoenix
#

error?

edgy needle
#

no error

#

command wont run

#

when i try to run the command nothing happens

#

i did var msg = message.content.toLowerCase();

#

and then msg.content

true adder
#

you wouldn't do msg.content

#

just msg

edgy needle
#

ok

#

ty

#

yup it works Ty

abstract crystal
#

@nimble merlin there is no such implementation, but you could do it with the add_check

gilded blaze
#

Anyone have an example of generating a token with js?

#

Or tell me how it works

earnest phoenix
#

?

#

meaning of token gen with js?

#

what do you mean

gilded blaze
#

Figured it out

edgy needle
#

im making a cat command
here is the code
if (msg == prefix + 'cat') {
.get('http://random.cat/meow');
const embed = new Discord.RichEmbed()
.setColor(0x954D23)
.setTitle("Meow 🐱")
.setImage(body.file)
message.channel.send({embed})
}
and the error is
D:\Bot\index.js:77
get('http://random.cat/meow');
^

ReferenceError: get is not defined
at Client.bot.on (D:\Bot\index.js:77:5)
at Client.emit (events.js:180:13)
at MessageCreateHandler.handle (D:\Bot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (D:\Bot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (D:\Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (D:\Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocketClient.internalOnMessage (D:\Bot\node_modules\uws\uws.js:103:17)
at native.client.group.onMessage (D:\Bot\node_modules\uws\uws.js:57:15)

D:\Bot>node .
D:\Bot\index.js:77
.get('http://random.cat/meow');
^

SyntaxError: Unexpected token .
at new Script (vm.js:51:7)
at createScript (vm.js:136:10)
at Object.runInThisContext (vm.js:197:10)
at Module._compile (module.js:613:28)
at Object.Module._extensions..js (module.js:660:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:501:12)
at Function.Module._load (module.js:493:3)
at Function.Module.runMain (module.js:690:10)
at startup (bootstrap_node.js:194:16)

earnest phoenix
#

@edgy needle u need request or something

edgy needle
#

scroll up

#

im trying to make a cat command

earnest phoenix
#

also wat is .get for?

edgy needle
#

to get the msg

#

but i forgot to use get as a var

abstract crystal
edgy needle
#

does anyone know do i split the prefix and what goes after the prefix?
language : JavaScript

#

cuz im trying to make a say command

#

there is startswith

#

but it wont be of use

abstract crystal
#

yes

#

is prefix known?

sinful lotus
#

hmm just wondering what I can do to observe the rate limit of voting, maybe setTimeout could help?

#

put the users into an array then every 30 second check those users if they voted ?

abstract crystal
#

make a cache

#

if cache is outdated then update it

sinful lotus
#

then make a set interval command that checks every 30 seconds?

abstract crystal
#

no

#

as needed

#

never do periodic checks this can be spammy

sinful lotus
#

so make a cache then?

abstract crystal
#

yes

sinful lotus
#

is this cache is like creating a map?

abstract crystal
#

well probbs there is a lib for it

#

you are in js right?

sinful lotus
#

yep

abstract crystal
sinful lotus
#

cache.put is where I can put the users for a while?

#

while they are in pending for checking?

abstract crystal
#

no cache is for caching the api output

#

for pending user check you'd need something better then memory cache since if the bot is restarted the cache will be deleted

#

you'd be better with db or sth

#

and if you want do user checks, if the user has voted, it would be better if you used webhooks

sinful lotus
#

thanks for the tips, ill just look onto those for now

abstract crystal
#

np

lavish mango
#

@edgy needle did you solve the issue?

#

Didn't define body

#

const { body} = await superagent I believe

west current
#

Oh my bad

#

Wrong channel

quiet bobcat
#

oof

lavish mango
#

Yes

scenic burrow
#

how to host bot online ?

earnest phoenix
#

meaning?

abstract crystal
earnest phoenix
#

if you wanna host online ^ oof

west current
#

I need help with the JS version of the DBL Api, I need help checking if the user has voted or not.

abstract crystal
upper ember
#

should I shard my bot at 1400?

abstract crystal
#

YES!!! you should shard when you have 10 servers

#

xd

restive totem
#

@upper ember from 2500 ye

lavish mango
#

I think he knows that why he did that emoji

earnest phoenix
#

It's good practice to shard before the required sharding limit

#

So you know what you're doing

lavish mango
#

Yes

#

Like start sharding at 2,000 maybe

#

Just so you have things set up

abstract crystal
#

at least in discord.py is recommended to shard so you have cca 2500 servers per shard

#

so start sharding at 2500

#

discord allocates servers to a shard with this formula: ```
(guild_id >> 22) % num_shards == shard_id

solemn obsidian
#

U must start it earlier or ur fucked considering after 2500 some guilds won't work

abstract crystal
#

^^

ruby dust
#
def check(reaction, user):
    return user == message.author and str(reaction.emoji) == '👍'
```even by copying this example from the rewrite docs it gives me this error
```TypeError: check() missing 1 required positional argument: 'user'```
abstract crystal
#

rewrite or async?

ruby dust
#

I did mention it's rewrite, tho

abstract crystal
#

sory

#

interesting I'm also on rewrite and I have this: ```python
def check_r(reaction, user):
return client.user != user and reaction.message.id == msg.id and (
str(reaction.emoji) == '👎' or str(reaction.emoji) == '👍')

And it works for me
#

what do you have in wait_for?

west current
#

@supple marlin

abstract crystal
#

?

ruby dust
#

'add_reaction', check = check, timeout = 30

abstract crystal
#

whole line pls

ruby dust
#

await self.bot.wait_for('add_reaction', check = check, timeout = 30)

abstract crystal
#

try: reaction, user = await self.bot.wait_for('add_reaction', check = check, timeout = 30)

#

not sure if it will work but try

ruby dust
#

I kinda just realized, I want it to work only on a message the bot asks to add that reaction onto

abstract crystal
#

oke

ruby dust
#

nothing anyway

abstract crystal
ruby dust
#

oh hahaha, I'd rather figure out myself than ask them

#

it's pretty much the same as dapi

abstract crystal
#

how ever you say

#

@nimble merlin took at this for command cooldowns, it's for rewrite:

#

can't

#

rewrite only feature

#

nevermind

#

i take it back, you can it's just not in the docs

#

it's a cooldown for commands

#

for a message spam filter you should look into on_message event and do a custom check there

west current
#
    if(!dbl.hasVoted(message.author.id)) return message.channel.send("You haven't voted, vote here:\nhttps://discordbots.org/bot/bot_id/vote");
#

This should work right?

abstract crystal
#

test it and you'll see

ruby dust
#

has anyone yet tried using animated emojis in embed titles?

west current
#

The request goes right through,

#

Even if the user hasn't voted

earnest phoenix
#

how do I use user id as permission instead of roles? (discord.js)

#

I dont recommend using that endpoint for commands

#

Or using that method

#

If people use your commands more than 60 times in a minute you get blocked for an hour @west current

#

wew

glossy oracle
#

It's kinda dumb

#

If you bot is... "very active" that means you can't have more than 60 users using the vote cmd per minute

solemn obsidian
#

Stop spamming api and handle votes correctly?

earnest phoenix
#

Just have an upvote array somewhere in your code

#

and then update that array every 10 seconds or so

#

Then make a function to check that array and return a bool

solemn obsidian
#

On bot bootup fetch all votes, then webhook updates new voters

earnest phoenix
#

And you've solved your upvote issue

#

I wonder how much CPU, ram and internet that would take

#

not a lot

#

Just post stats once every hour

#

the ratelimit is the same as everything for /bots

#

If your bot isn't really popular and being added a lot

#

it shouldn't make a difference if you just post on guild join/leaves

#

Otherwise you can just post on ready

#

just post once on your ready event and then you can just update once every restart

#

yeah same

#

but it doesnt matter too much

solemn obsidian
#

Save timestamp of last update, wait in guild join that x amount has passed?

earnest phoenix
#

once every few days, once ever hour, on guild join/leave

#

it doesnt matter too much

#

Yeet

#

-bots @blissful bear

gilded plankBOT
#
ℒℯ 𝓦𝓲𝓷𝓽𝓮𝓻-𝔂 ℱℴ𝓍#9815
Bots <:dblCertifiedDev:401725450470031362>

@crystal pier dblCertified

static silo
#

!ftn

earnest phoenix
#

Just wondering

#

I was just wondering which bot was yours

solemn obsidian
earnest phoenix
#

lol xd

torpid frost
#

i've a question to you developers:
my bot is written in java (whit JDA) i need to add a good action logger
that both prints log on stdout and on a file
any suggestion?
(a server side logger)

spring ember
#

why a file?

#

use slf4j for debugging

#

I do not recommend logging actions though unless in debugging

torpid frost
#

exactly for debug actually it is not in a so stable state and as is hosted on heroku for now the logs are really volatile

loud bear
#
  @commands.command()
    async def userinfo(self, ctx, user=None):
        """Get info on a user."""
        if user==None:
            await ctx.send("Please tag a user you want info on")
        else:
            await ctx.send("`Name: {0}` nickname: {1} `id: {2}` status: {3} `playing: {4}` joined: {5} `top role: {6}`".format(user.name, user.nick, user.id, user.status, user.game, user.joined_at, user.top_role))

this worked before but now its just outputting the error str does not have an attribute name and so on

#
@commands.command()
async def userinfo(self, ctx, user):
    """Get info on a user.""
    await ctx.send("`Name: {0}` nickname: {1} `id: {2}` status: {3} `playing: {4}` joined: {5} `top role: {6}`".format(user.name, user.nick, user.id, user.status, user.game, user.joined_at, user.top_role))

even when i revert it back to this

topaz fjord
#

did you try to console.log(user)

loud bear
#

how would i do that and these did work before

earnest phoenix
#

look if you messed anything up

#

like removed or added something

loud bear
uncut slate
#

Is that twitchcord 👀

#

Also, you seem to be missing a closing "

loud bear
#

ya lol so what your using it too

uncut slate
#

I helped make it >:)

loud bear
#

and i just relized what im missing

#

async def userinfo(self, ctx, user: discord.Member)

#

no wonder it kept giving me errors

#

ok got it working now

earnest phoenix
#

I am talkin about the CPU and ram stuff

topaz fjord
#

use the npm module process or os

#

they both come pre installed with node

low owl
#

@uncut slate Your website is quite delicious 👀

uncut slate
#

Which one 🤔

low owl
#

Twitchcord

#

a bit too much moving part for my taste

uncut slate
#

I didn't make the Twitchcord website, Baked did

low owl
#

but the overall theme and layout is pretty solid

uncut slate
#

Appreciate the compliment though :p

topaz fjord
#

-botinfo @buoyant lance

gilded plankBOT
#
Bot info
ID

375805687529209857

Username

TwitchBot

Discriminator

2800

Short Description

Browse Twitch, get stream notifications, and listen to streams right from your Discord server.

Library
Prefix

twitch

Upvotes

28

Server Count

251 Servers

Owner(s)

@orchid horizon

topaz fjord
#

-botinfo Aetheryx

gilded plankBOT
#

Please include a bot mention

topaz fjord
#

-bots Aetheryx

gilded plankBOT
#
Aetheryx#2222
Bots <:dblMod:401724520806875139> <:dblCertifiedDev:401725450470031362>

@fair grail dblCertified
@bronze sequoia dblCertified
@warm edge dblCertified
@tranquil frigate dblCertified

topaz fjord
#

-botinfo @tranquil frigate

gilded plankBOT
#
Bot info <:dblCertified:392249976639455232>
ID

302864271383986176

Username

Tweetcord

Discriminator

7999

Short Description

A bot that allows you to interact with Twitter

Library

Eris

Prefix

t/

Upvotes

34

Server Count

474 Servers

Owner(s)

@uncut slate dblMod dblCertifiedDev
@languid dragon dblAdmin

loud bear
#

-botinfo @lone nymph

gilded plankBOT
#
Bot info
ID

417900655601254420

Username

CookieBot

Discriminator

4514

Short Description

A bot made for fun on my free time. This is my first bot and I am still kinda new to coding. Still in active dev.

Library
Prefix

C!

Upvotes

1

Server Count

24 Servers

Owner(s)

@loud bear

slim heart
#

How would I would I reply with a message that contains the id of a mysql row, like http://being-banned.is-no.fun/rpa7n6 I wanna reply with "idcensorbot" where the serverid is, well, the server id

#

Ik how to ya know, like WHERE serverid = message.guild.id, but everything I've googled to return it into a variable doesn't work

slim heart
#

Ik how to use query and all dat, i got a kind of basic knowledge of mysql but, I can't set any results to a variable or stuff like that

#

Right I found it out

#

But, does anyone know why tf whenever anyone messages it sends this it????

connection.query('SELECT * FROM censorbot WHERE serverid = ' + message.guild.id, function (err, rows) {

    let go = rows[0].idcensorbot;
    message.reply(go)
    
    
    })
}```
#

It just loops

#

Regardless of message content

inner jewel
#

not really

#

the id won't ever contain user input

#

but yeah, use prepared statements

#

won't ever be user input

slim heart
#

No i found out y

#

It's cuz my if statement had 1 = not 2 :>

solid cliff
#

In the next 24 hours, we will be deprecating the /votes endpoint for bots that currently receive more than 100 votes per month. where do I start for making a webhook url 👀

inner jewel
#

a webserver

slim heart
#
    let go = rows[0].censor
    console.log(go)

    })
    if(go == "0") return:
codeblahblah

Why whenever I do this it ALWAYS crashes with go undefined

#

But when I dont do if(go == "0") return; it console.logs the 0/1 perfectly fine

west current
#
if(!dbl.hasVoted(message.author.id)) return message.channel.send("You haven't voted, vote here:\nhttps://discordbots.org/bot/368158704794861571/vote");```
This shit isn't working, it's not checking if the user has voted or not
inner jewel
#

^ this is the reason the last announcement happened

#

people not caching upvoters

inner jewel
#

not doing that

#

it's API spam

#

set presence

elder rapids
#

Announcement messages 🙄

loud bear
#

how would i stop my bot from responding to the built in help command when called from other bots? discord.py rewrite branch

#

i blocked it on all commands i added but since i did not do the help command how would i do it?

floral stone
#

So, I got a webserver but it's a seperate process from my bot. I'm thinking about using that for webhooks. How do you guys handle your response from webhooks?

hushed oyster
#

i mean

floral stone
#

I'm using flask

hushed oyster
#

i just make a POST-only route that gets the data then does stuff with it

#

i can help you if you want

floral stone
#

I can set up a post-only url

hushed oyster
#

yeah

floral stone
#

It's just about getting the response and sending the data that's in a seperate process.

hushed oyster
#

make sure to import response from flask

#

then in the route

#

response.values is a dict containing the data

floral stone
#

Ok, I can do that but that's not really my problem

#

I do this in my main file: ```async def on_message(message):
if user_check(message):
await bot.process_commands(message)

def user_check(message):
if message.author.bot:
return False``` @loud bear

hushed oyster
#

ok that has nothing to do with your webhook

#

the webhook has absolutely nothing to do with your bot's code

inner jewel
#

you need to use some type of IPC

#

a really simple way is a redis pubsub

floral stone
#

I need to send the response "Hey, enjoy the coins" but it's two seperate processes.

#

IPC?

inner jewel
#

inter process communication

floral stone
#

Oh good, that sounds like work.

hushed oyster
#

why would you need to send that response?

floral stone
#

To let people know they got the coins from upvoting

inner jewel
#

on webhook received -> send to bot via ipc -> add coins and send DM

floral stone
#

The problem is, I have never messed with an IPC or understands how it works.

inner jewel
#

IPC is just a concept

#

i gave you an example above

floral stone
#

I'll google it, not sure what it is though.

inner jewel
#

you can also use localhost sockets

floral stone
#

So, when the webhook does send information to my server, I can make it only receive the bot votes from that day, if I want ofc. Will it reset on a daily basis aswell and turn it back into an empty list?

#

If so, couldn't I save the list (split() ofc) into a .txt file and read it upon command!?

inner jewel
#

I can make it only receive the bot votes from that day, if I want ofc.

#

you don't choose what you receive

floral stone
#

It probably won't change much.

#

What do I receive?

inner jewel
floral stone
#

How would I specify query on webhooks if I don't post the url.

#

How would I specify query on webhooks if I don't post the url.

#

brb

elder rapids
#

hi this are query

#

Good one Natan

inner jewel
#

shh

stiff tartan
#

Hi, i have a problem :/ Can someone help me please?

Idk what is the error... and how to fix it

prime cliff
#

config is not defined pretty ovious

#

🙄

stiff tartan
#

And how i fix it?

earnest phoenix
#

define a variable named config

prime cliff
#

Find out why its null

earnest phoenix
#

load your config into it

#

and dont copypasta code

prime cliff
#

^

stiff tartan
#

uhm...

floral stone
#

@inner jewel I know what a query is but how do I specify the query or url if I'm on the receiving end?

inner jewel
#

you receive the quey strings on the vote page

#

you can give users an url with query params

floral stone
#

ah ok

loud bear
#

@floral stone thanks that helped though i had to do this insted

@bot.event
async def on_message(message):
    if user_check(message):
        await bot.process_commands(message)

def user_check(message):
    if message.author.bot:
        return False
    else:
        return True```
If i did not it just ignored me
floral stone
#

you don't need the else statement

prime cliff
#

Yea he does

#

?

floral stone
#
@bot.event
async def on_message(message):
    if user_check(message):
        await bot.process_commands(message)

def user_check(message):
    if message.author.bot:
        return False
    return True```
earnest phoenix
#

return message.author.bot

#

????

elder rapids
#

I use else in those cases anyways because it makes sense to me 🤷

floral stone
#

yeah

#

@earnest phoenix what no.

elder rapids
#

Just my 2c to that

earnest phoenix
#

why return false/true if message.author.bot is already a boolean

elder rapids
#

also ^

prime cliff
#

True

earnest phoenix
#

return not message.author.bot would be better

floral stone
#

it will only process the command if the statement is True

#

oh

#

yeah

#

I had other statements in my original code

earnest phoenix
#

oof

floral stone
#

I removed some and give it to him

#

but your example is wrong

loud bear
#

wait just relized the code messed up ill fix it

floral stone
#

because return message.author.bot will return True making it only for bot

#

return message.author.bot if False

loud bear
#

nvm

floral stone
#

might work

loud bear
#

lol

floral stone
#

idk

#

@earnest phoenix

loud bear
#

i tried it without the else and it ignored bots and me

earnest phoenix
#

if user is not a bot then process command

loud bear
#

so i tried with the else and it works and ignore bots

earnest phoenix
#

return not message.author.bot

floral stone
#

yeah

#

that should work

loud bear
#

its only 2 extra lines of code no biggie lol

terse badger
#

Its good practice though

floral stone
#

^

#

I don't use else statements unless I need too

loud bear
#

theres a lot of else statements in my code espically in the action commands so the user cant use the commands without the required arguments

#

lol

terse badger
#

Well yea but thats a different scenario

floral stone
#

^

loud bear
#

lol how have i not impamented code to block users from tagging themselves for action commands

loud bear
#

how would i make it give an error if a bot is tagged in an action command?

#

would it be user==user.bot or something

earnest phoenix
#

if (ctx.author.bot) { error, return }

#

compare IDs

idle mountain
#

Anyone have any idea how I'd go about setting up a webhook (like to listen for DBL votes) in C#?

elder rapids
#

HttpServer

idle mountain
#

alright thanks

frigid sierra
#

I'm using EmbedIO as a rest handler for my own api and the vote webhooks. It's just routing middleware for the HttpListener

earnest phoenix
loud bear
#
@commands.command()
async def kiss(self, ctx, user: discord.Member =None):
    if user==None:
        await ctx.send("Please say user you want to kiss")
    else:
        if user==ctx.message.author:
            ctx.send("You can not use this action command on yourself")
        else:
            ctx.send("{} kissed <@{}>".format(ctx.message.author.mention, user.id))

when i forget that user is user: discord.Member =None and just put user=None oof XD
thats kind of important XD

#

hmm seems to work without a tag as well

#

and with id

#

and ya webhook test not working for me ether

earnest phoenix
#

webhook is just dbl sending a post request to your webserver every time somebody votes

loud bear
#

i clicked the test button on the website and nothing happened

earnest phoenix
#

how do you have it set up

loud bear
#

using a discord webhook like in devin's pic

earnest phoenix
#

you have to set up a webserver

solemn obsidian
#

it doesnt work for discord webhooks

#

Its not sending messages to channel, its so you can receive new votes on your end

earnest phoenix
#

I have the strangest thing occurring, so in chrome, and firefox it appears like the image on the left. Except for some reason, in guest chrome, it decides that it will go weird and not obey what I set.

Same on edge
https://discordbots.org/bot/380598116488970261

<style>
    h1 {
        font-size: 50px;
    }

    iframe {
        display: none !important;
        width: 0px !important;
        height: 0px !important;
    }

    #menu,
    #cmd-zone-01,
    #botprofileicon {
        display: none !important;
        height: 0px;
    }

    #bot-details-page {
        padding-top: 1px !important;
    }
</style>

<body bgcolor="71BC78">
    <h1>Kern Bot</h1>
    Kern bot has features including YouTube® search, Trivia, Contests (semi-working), dictionaries, and other miscellaneous functions.
</body>```
jagged birch
#

WHY CANT I INSTALL ANY PACKAGES? I get this error:

npm ERR! path C:\Users\Dylan\Desktop\lmaobotdev\node_modules\async-limiter
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\Dylan\Desktop\lmaobotdev\node_modules\async-limiter' -> 'C:\Users\Dylan\Desktop\lmaobotdev\node_modules\.async-limiter.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Dylan\AppData\Roaming\npm-cache\_logs\2018-03-28T07_36_32_078Z-debug.log```
I've reinstalled nodejs, made a whole new bot and it still won't work. if I go to node_modules to rename the folder there is nothing inside, it deletes everything... anyone got any ideas how to fix it?
earnest phoenix
#

nop

jagged birch
#

why hello there

#

got it working dw

earnest phoenix
#

u need help with anything still?

jagged birch
#

nope all g

earnest phoenix
#

ok 👍

lethal sun
#

How to send a certain object in the console from JSON?

JSON

{
    "appName": "App",
    "appId": "00001"
}```

**Console**

App
00001```

#

Node.JS

#

Im using the npm google-play-scraper package.

#

And trying to get it work.

floral stone
#

in python it's something like json["appID"]

lethal sun
#

yeah but I need JavaScript

floral stone
#

it's the same thing

earnest phoenix
#

how do u. . . change timestamp to date? in js. . . i forgot

#

eh

#

use something else

#

use the

#

date

pulsar cairn
#

Date

#

new Date()

earnest phoenix
#

new Date() makes a new date :S

#

🤦 i have a timestamp of some numbers. . .

#

and i want the numbers to date

#

1489133256000 as an example

#

yes timestamp is numbers but there's another thing

#

like normal people understands dat

#

for example message.author.createdAt

#

ik

#

hmm

#

well

lethal sun
#

undefined...

floral stone
#

because appId isn't in that json or var gg

#

@lethal sun

lethal sun
#

but if you execute the code in var gg it sends out json if you add .then(console.log);...

#

@floral stone

stiff tartan
#

Hi, I want to do a gift to a friend, this gift is a code line but i dont know how to do what i want (sorry for my English, i'm french)

Do you know if it is possible to do a anti-spam not obvious.

Example :

First messages at 08:31 and 10 second

Second message at 08:31 and 12 second

Third message at 08:31 ams 14 second

BOT : - Bip! You sent message to fast, calm down

lethal sun
#

please specify your laungage and library

stiff tartan
#

But, if after my second message, i waif 5 second, the spam is reset and i have no warn. Like this

Second message af 08:31 and 12 second

Third messahe at 08:31 and 17 second

earnest phoenix
#

do u know any coding languages?

stiff tartan
#

Who? Me?

earnest phoenix
#

ya

stiff tartan
#

No 😅 i ask to a other friend and he answer me that is it a system of point... and that for each message the average of the points would be increased, if we exceed the limit we are warned, and if we wait the system of point returns to zero

#

(i use google translate, have mercy D:)

#

Do you understand what i mean?

earnest phoenix
#
  1. why cant u just have a delay of 10 seconds for the gaining points
  2. If it is a discord bot what libary are you using and what coding language is it
  3. i think ur trying to make a point system bot like Mee6?
stiff tartan
#

The language is javascript i think, with node

#

Wait... i reformulate my question

Do you understand what i mean when i say that :
for each message sent in less than 5 seconds, a pointing system is "+1", if this pointing system exceeds 3, we have a warning. But if we wait more than 5 seconds between each message, the pointing system always remains at 1

#

Idk what is the point system of mee6

#

Wait... i go check

#

Oh... no, isn't for level, is it an anti-spam

#

@earnest phoenix

earnest phoenix
#

oof i understand wat ur trying to do but i cant spoon feed people code

stiff tartan
#

Can you repeat please? With more simple word pls 😅

#

"Oof"
"Spoon"

earnest phoenix
#

i cant spoonfeed code aka i cant give u the code

stiff tartan
#

Oh... because you dont know how to do it?

earnest phoenix
#

i know but read the rules we are not allowed to give code :/

stiff tartan
#

Fine

floral stone
#

@lethal sun Send me a url of the code in repl

stiff tartan
#

But can you just tell me how I should formulate what i want?

Or better, some clues?

For search on google, isn't for my code... but for a gift to a friend code so...

low owl
#

If you are new to coding I don't recommend writing a more or less advanced bot

#

You can do it of course, but people won't just "give you the code", because you don't learn anything from it

#

give a man a fish and he will have food for a day, teach a man how to fish and he will have food for the rest of his life

floral stone
#

preach

frail kestrel
#

what does ... mean in javascript?
ie; ...args

uncut slate
meager lintel
#

How do you guys set up your create-react-app in production

steel tinsel
#
module.exports = {
  client.on("messageDelete", (message) => {
  
  let guild = require('./guilds/' + message.guild.id + '.json')
  

  let deleteembed = {embed: {
    color: 0xFFA500,
    author: {
      name: message.author.name,
      icon_url: message.author.avatarURL
    },
    title: ":scissors: Message deleted",

    fields: [{
        name: ":bust_in_silhouette: User",
        value: message.author.tag + ' **['+message.author.id+']**'
      },
      {
        name: ":notepad_spiral: Message content",
        value: message.content
      },
      {
        name: ":bookmark_tabs: Channel",
        value: message.channel.name + ' **[' + message.channel.id + ']**',
        inline: true
      },
      {
        name: ":id: ID",
        value: message.id,
        inline: true
      }
    ],
    timestamp: new Date()
  }
};
}```
#

if i use an external file for each of my events, will this work?

floral stone
#

formulas in json?

steel tinsel
#

?

solemn obsidian
#

u dont define client

steel tinsel
#

but if i define it in my main file, and then import this?

uncut slate
#

you have to pass the variable

steel tinsel
#

?

uncut slate
#

client isn't defined in that context

solemn obsidian
#

everything in ur main file doesn't get moved to the other file

steel tinsel
#

no

terse badger
#

@uncut slate okay so how is having a cluster not the same as adding more servers

solemn obsidian
#

Think about it like this: seperate file, different variables

steel tinsel
#

in my main file, i define client and then import the module

solemn obsidian
#

still wont work

terse badger
#

As far as im aware, clustering just launches more processes

steel tinsel
#

ok

terse badger
#

Similar to adding more servers on which you can run multiple processes if one server is overworked

uncut slate
#

something like this

// Main.js
const client = new Discord.Client(...);
const externalModule = require('./some-module.js');

externalModule(client);


// some-module.js
module.exports = (client) => client.on('event', () => { ... });
steel tinsel
#

ok

karmic parcel
#

@meager lintel It should have a build option for production

#

or are you asking how other people do it?

uncut slate
#

@terse badger only difference being that adding a cluster needs effectively nothing and buying a server means buying server

terse badger
#

...so i was right then

#

The analogy is the same

meager lintel
#

I'm mainly asking how you guys set up the web server

#

For a React app

karmic parcel
#

You can set it up a few different ways

#

depending on what you use

#

do you use Redux at all?

terse badger
#

Feel like a better language should be considered if theres performance issues with the api

karmic parcel
#

If it's a one pager, just running the static files from a server would be fine

#

if you want routes, like a traditional website with multiple pages, something like React Router would be a good option

uncut slate
#

@terse badger that's your opinion, and there's a reason why we don't follow it

#

if you still think you're right and you want to be proven wrong, I would suggest Google

meager lintel
#

I have React Router set up the project with the npm run and I built the production copy

bitter sundial
#

WhY dOeS nEtFlIx UsE nOdE

quiet bobcat
#

idk

solemn obsidian
#

because its the future

quiet bobcat
#

because they can

karmic parcel
#

tbh

quiet bobcat
#

no u

terse badger
#

Because they can afford the costs @bitter sundial

bitter sundial
#

kinda shitpost kinda not

steel tinsel
#

but um, how is this saying unexpected ; ? js fs.writeFile('.guilds/'+guild.id+'.json', JSON.stringify(defaultsettings), (err) => { // throws an error, you could also catch it here };

karmic parcel
#

I mean I get that there is a discussion about that, but meming the guy

#

come on

meager lintel
#

The docs mention to use serve or an express server

terse badger
#

If you can afford to throw more servers etc at the problem /shrug

karmic parcel
#

afaik I believe it runs an express server

steel tinsel
#

quick

#

my bot is going crazy

solemn obsidian
#

Inb4 testing in production

#

Also u arent closing the function u call

steel tinsel
#

?

terse badger
#

Else, an inherently concurrent language will give you a much wider margin of security re. performance

karmic parcel
#

lemme check on that, Pyro

solemn obsidian
#

Every ( needs a matching )

steel tinsel
#

oh

#

right

solemn obsidian
#

If u cant find issue, back to learning js syntax

earnest phoenix
#

bois ya know the os.cpus and stuff in discord.js, but how do I make it show in GB?

solemn obsidian
#

by converting bytes to gb

gilded thunder
#

How would I make a restart command for my bot in discord.py, similar to reload but for the actual program?

#

So I don't need to kill the process every update.

earnest phoenix
#

how to convert that? oof idk

#

am noob ¯_(ツ)_/¯

#

ima google

edgy needle
#

im trying to make a say command but it wont work
command:
if (msg.startsWith == prefix + "say") {
message.delete()
const embed = new Discord.RichEmbed()
.setColor(0x954D23)
.setDescription(message.author.username + " says: " + args.join(" "));
message.channel.send({embed})
}
Language : JavaSript

earnest phoenix
#

ooh

#

you could make

#

@edgy needle start by googling "javascript startswith"

#

const sayMessage = args.join(" ");

#

works tho

solemn obsidian
edgy needle
#

i dont need to google javascript starts with

#

msg.startsWith works fine

solemn obsidian
#

Yes you do

edgy needle
#

i use it for my other cmds

earnest phoenix
#

Okay keep going then 👌

karmic parcel
#

@meager lintel You can grab the build folder and serve it from wherever you want

solemn obsidian
#

you are comparing a function against a string

earnest phoenix
#

up to you mate

edgy needle
#

var msg = message.content.toLowerCase()

solemn obsidian
#

but it must be working blobshrug

karmic parcel
#

I personally just wrote my own webpacking and such and built files and serve it from express

edgy needle
#

thats why i use msg so my cmds are case insensetive

earnest phoenix
#
 if(command === "say") {
    if(!message.member.roles.some(r=>["bot-admin"].includes(r.name)) )
    return;
    
    const sayMessage = args.join(" ");
    message.delete().catch(O_o=>{}); 
    message.channel.send(sayMessage);
  }
``` this is hew I have
#

or had

uncut slate
#

(r=>["bot-admin"].includes(r.name))

#

why

earnest phoenix
#

idk

#

old thing

edgy needle
#

does it still work tho?

solemn obsidian
#

We told you the issue

#

You ignored us

edgy needle
#

the issue is not with msg'

#

msg works fine

#

i have it in all my other cmds

earnest phoenix
#

how do I make a command for a specific user only? Thonk

edgy needle
#

Javascript?

earnest phoenix
#

well I use discord.js :S

edgy needle
#

i think it is

quiet bobcat
#

do you want by id or by permission?

earnest phoenix
#

id

#

user id

solemn obsidian
#

We cant help you if you dont listen to us

earnest phoenix
#

@edgy needle run this javascript code anywhere and you will see why you are wrong:
"potato 123".startsWith == "potato" ? "right" : "wrong";

uncut slate
#

startsWith is a function

earnest phoenix
#

exactly

solemn obsidian
#

no but it isnt wrong!!!

meager lintel
#

@karmic parcel Alright thanks

earnest phoenix
#

he asks before why it sint working when hes comparing to a function

solemn obsidian
#

it works everywhere else!!!

earnest phoenix
#

I tell him to google startswith 🤦

edgy needle
#

this works fine if (msg.startsWith(prefix + 'purge')) {

solemn obsidian
#

Yes now compare it to the new code

earnest phoenix
#

yes, that is different to what you gave us earlier

edgy needle
#

aight it works

#

if(msg.startsWith(prefix + "say")) {

earnest phoenix
#

you should probably check if the message starts with a prefix, then split the rest by spaces

#

otherwise, msg.startsWith(prefix + "say") will return true for a message like !sayt4lcuiscm,zsjkdf

#

so you probably want a space there

edgy needle
#

it acc wont

#

i tested it

#

it deletes my msg and it says what i say after y!say

earnest phoenix
#

its not about whether the code inside the command works, but just command checking that makes sense. you should probably not accept !sayskjfhskdjhf, only !say something

#

and I noticed in your code earlier, you already have your message split by space, so why even use startswith?

coral lichen
#
    const sayP = args.join(" ").split("|");
    message.channel.send(sayP)
    };

earnest phoenix
#

just check if args[0] or whatever is your command is == say

coral lichen
#

Try this

edgy needle
#

i dont need it to accept y!sayssj!

#

also