#development

1 messages Β· Page 509 of 1

earnest phoenix
#

,,play 30 seconds of nothing

#

,,play 30 seconds of nothing

west raptor
#

thonk

#

why

earnest phoenix
#

try it

#

Β―_(ツ)_/Β―

west raptor
#

i know it exist

#

thats not the issue

earnest phoenix
west raptor
#

its the end event

earnest phoenix
#

fuck this isnt testing 1

#

lol

#

i keep running commands in not testing channels

#

lmao

earnest phoenix
#

Cloudflare seems to be blocking some of my requests on discord.. maybe it thinks its a DDoS attack... js (node:8996) UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT 104.16.58.5:443 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1113:14) (node:8996) 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: 5793) I think this may be because I'm doing js message.channel.fetchMessages({limit:2}).then(MSGS => { on Each message.. if this is true.. is there any way I could do the same thing without spamming the API?

lethal sun
#

why the developer portal is constantly generating tokens?

gilded blaze
#

Well don't spam the API.

lethal sun
#

what do you mean?

earnest phoenix
#

well is that API spam?

lethal sun
#

Everytime I refresh the page, a new token is generated

earnest phoenix
#

I mean fetchMessages could always be client-side

gilded blaze
#

You should not ever need to fetch messages every single message

earnest phoenix
#

thats how it works @lethal sun

#

it says so itself

lethal sun
#

how to stop it @earnest phoenix

earnest phoenix
#

you don't

#

lemme message you tonkku I'll explain myself

lethal sun
#

how to get the token then

#

I copy the token then enter it to my code and then it says incorrect login details

#

...

#

@earnest phoenix ?

earnest phoenix
#

what

lethal sun
#

I copy the token that I revealed then I enter it in my code and when I run it, it says incorrect login details

earnest phoenix
#

incorrect token then

lethal sun
#

but everytime I copy a different token, I get that error

earnest phoenix
#

hmm

#

ok

lethal sun
#

so...

earnest phoenix
#

try regenerating it

lethal sun
#

did that

earnest phoenix
#

ok

#

put it in you code

lethal sun
#

yeah?

earnest phoenix
#

dont refresh the page lmfao

lethal sun
#

I know

lost scarab
#

const Discord = require('discord.js');
const client = new Discord.Client();
const economy = require('discord-eco');
  
client.on('message', message => {
  let prefix = 'c.';
  let msg = message.content.toUpperCase();
  
  
  if (message.content.toUpperCase() === `${prefix}PING`) {
    message.channel.send('Pong');
  }
  
  if (msg === `${prefix}BALANCE` || msg ===  `${prefix}MONEY`) {
    economy.fetchBalance(message.author.id).then((i) => {
      const embed = new Discord.RichEmbed()
      .setDescription(`${message.guild.name} Bank**`)
      .addField('Accound Holder', message.author.username)
      .addField('Account Balance',i.money,true)
      
      message.channel.send({embed})
    })
  }
});

client.login('token');
#

error unexpected end of input

earnest phoenix
#

means u have a typo

topaz fjord
#

You didn't close a parenthesis of bracket

earnest phoenix
#

so fiz it

#

u potat

lost scarab
#

wut

#

tom are u ok?

#

xd

topaz fjord
#

most editors have syntax highlighting

#

does your editor even show it

lost scarab
#

nope

#

πŸ€”

#

rip

earnest phoenix
#

discord bots β„’

topaz fjord
#

Tom pls

earnest phoenix
#

u mean unexpected end of input

#

what is discord-eco anyways

#

r u real thats not dev question

#

discord eco is autism eco for people for hmnever spent 5 minute learning the concept of using a db

#

and actually doing points

#

so is it a discord economy system in a npm package

topaz fjord
#

yes

#

For lazy people

earnest phoenix
#

haha sad

drowsy yew
#

class CoinFlipCommand extends commando.Command

{
    constructor(client)
    {
        super(client,{
        name:'flip',
        group: 'simple',
        memberName: 'flip',
        description: 'Flips a coin, landing on Heads or Tails!'
    });
}
async run(message, args)
{
    var chance = Math.floor(Mathf.random() * 2);
if(chance == 0)
{
    message.reply("Your coin landed on Heads!!!");
}
else
{
message.reply("Your coin landed on Tails!!!");
}
}
}

module.exports = CoinFlipCommand;```
#

Is there something wrong with my code?

#

The command isn't executing

earnest phoenix
#

the problem is you learned ur code style from a C tutorial

drowsy yew
#

πŸ‘

#

I only did this command via a video

#

Everything else is fine

earnest phoenix
#

you have Mathf

#

Mathf isn't a thing

drowsy yew
#

ofc

earnest phoenix
#

it is in dbl bakagain

#

haha

#

classic dbl tickYes

#

syntax error tickYes asking for help FeelsWeirdMan

#

if/else statements tickYes

#

Client.commands.register("8BALL", (args, message) => { let rand = [ "Yes", "No", "Why are you even trying?", "What do you think? NO", "Maybe", "Never", "Yep" ]; let result = rand[Math.floor(Math.random() * rand.length)]; message.reply(message, "Your anwser is: " + result); if (!args [0]) { message.reply.("Please ask a question to me. I am friendly."); return; } }); is giving me a error

gilded blaze
#

Why do you check args after you run 8ball...

earnest phoenix
#

It should be before?

gilded blaze
#

You should learn JavaScript first.

earnest phoenix
#

When do I check args?

#

And I am new to coding

#

then learn javascript before making a discord bot

#

then you won't have to ask these questions

#

Either way I will

#

Like, I am hard to teach so stfu

#

what

#

I can't really be taught anything

#

sad

#

well

#

theres a lot of online tutorials so

#

That probably won't teach me but ok.

#

or get a JS book

#

and read it

#

like

#

all of it

#

^

#

reading makes you smarter

#

but doesn't teach me shit

#

ya sure?

#

it does if read it

#

im not normal

ruby dust
#

cool

earnest phoenix
#

no one is

#

I am nothing

ruby dust
#

I can tell by your memey pfp

earnest phoenix
#

I don't understand memes.

ruby dust
#

me neither

earnest phoenix
#
var answer = document.getElementById("answer");
var button = document.getElementById("button");
var input = document.getElementById("input");

var options = [
  "It is certain",
  "It is decidedly so",
  "Without a doubt",
  "Yes – definitely",
  "You may rely on it",
  "As I see it, yes",
  "Most likely",
  "Outlook good",
  "Yes",
  "Signs point to yes",
  "Don’t count on it",
  "My reply is no",
  "My sources say no",
  "Outlook not so good",
  "Very doubtful",
  "Reply hazy, try again",
  "Ask again later",
  "Better not tell you now",
  "Cannot predict now",
  "Concentrate and ask again"
];

button.addEventListener("click", function(){
  if (input.value.length < 1) {
    alert("Please enter a question!");
  } else {
    eight.innerText = "";
    var num = input.value.length % options.length;
    answer.innerText = options[num];
  }
});

#

is that right?

#

?

#

for 8ball

#

pleaee come back when u know how to code

#

sir

#

thats js code for html
?

#

i am not a sir

#

well

#

sorry

ruby dust
#

mis

earnest phoenix
#

he got from stackoverflow obviously

#

lamoa

#

cant be bothered to learn lmaoooo

harsh musk
#

lmao i can't be taught JS

earnest phoenix
#

time to test this 8ball

harsh musk
#

then don't try making discord bots

#

it's not for everybody

earnest phoenix
#

IM about to delete my discord acc

#

please do

#

js code for html tickYes js code for html isn't even for anything tickYes classic dbl tickYes

harsh musk
#

if you're too stupid to read a book and learn from it, go pay for someone to make you a discord bot

earnest phoenix
#

...

#

that 8ball code

#

is for html

#

fuck

#

i quit

#

l

#

its true

harsh musk
#

πŸ™‹

earnest phoenix
#

coding seems to be the only thing

#

where people arent embarassed to ask

#

dumb ass fucking questions

#

nd then say thaay dont wanna learn

#

blows my mind

#

I can't learn

#

I try but I can't

#

tickNo wrong

#

I am no where near as normal as anyone else, I can't be taught.

harsh musk
#

that means your IQ is too low to do a high iq job

earnest phoenix
#

are you saying you have a learning disability @earnest phoenix

#

hopefully u dont

#

but

#

@earnest phoenix Ya

#

googling codeacademy and following step by step is not hard

#

i dont judge

#

but this guy got stuck on step 1

harsh musk
#

if i don't see a doctor notice it's just another depressed 16 year old

earnest phoenix
#

gave up

#

nd said hes not teachable

#

lmao

#

I ain't a he

#

she?

#

then thats a you problem you'll need to figure out by yourself

#

Yea

#

ok

harsh musk
#

That doesn't change anything

earnest phoenix
#

lets not say what we are thinking lads zoomeyes

#

why not

harsh musk
#

yah she's a she

#

watch out

earnest phoenix
#

dbl makes me.happy sometimes

#

I just noticed how stupid I am

#

oh cool

#

I didn't have JavaScript on glitch

#

glitch..........

#

Yes... Glitch

#

glitch does have javascript tho

#

glitch only has javascript actually

#

I have to install it thru console

harsh musk
#

yeah it's not magic

earnest phoenix
#

well

#

you can't install a prebuilt language

#

being a dev means u have to do shit through the console

#

Ohhh

#

I know that Apap

harsh musk
#

LOL

earnest phoenix
#

lmao

#

did u

#

Yea

#

I did lmfao

#

do u have node

#

then ur good

harsh musk
#

-installs javascript throught nodejs tool

earnest phoenix
#

"no such file of directory"

#

I have node

harsh musk
#

300 IQ

earnest phoenix
#

ARE U BLIND

#

why are trying to install a language through npm @earnest phoenix

#

then u dont need to download js

#

lmaoa

#

im dying

#

this isnt a coding problem

#

like when this person tries to start they car

#

ndd it dont start

#

they just give up?

#

But I can't start my bot because of 8ball I need a different language to use it.

#

i wanna die

#

they don like... google it or look for clues of the problem

#

@earnest phoenix no it doesn't

#

u can make an 8ball command

#

in JS

#

syntax error

#

you're using HTML js code

#

plain as day

#

for the 8ball com

#

not rocket science

#

thats an javascript error

#

If I remove the 8ball command

#

it works

harsh musk
#

yes

earnest phoenix
#

yes

#

JUST GOOGLE It

harsh musk
#

Magic

earnest phoenix
#

lmao

#

how did u get through school

#

booted

#

Bc i did

harsh musk
#

Oh god

#

Don't link him tutorials

earnest phoenix
#

I changed it so it said booted

#

good

#

I am not a him god damn

#

job

harsh musk
#

Then he will just copy line after line and not learn anything

earnest phoenix
#

please send this person tp anidiots guide

#
console.log("booted")```
#

ez

#

inb4 remedial classes

#

Yup

#

they accommodate clueless stubborn people

#

That was easy ad

#

please

#

af&

#

af*

#

af?

#

as fuck

#

bye

#

I clicked the link lmfao

#

yes

#

so

#

go there

#

good

#

they help u

#

watch

#

not us

#

watch all of it

#

please

#

They better

#

your saying you were in remedial classes @earnest phoenix

#

ok

#

they more willing to work with...

#

I wasn't talking to you @earnest phoenix

#

people w no clue

#

lol

#

hmm

#

My lord, this gonna hurt me head

#

my*

hushed berry
#

hi devverinos

earnest phoenix
#

hey nik

#

Ima just steal this command xD

#

Sike

#

oof

#

I am not a him lmfao

hushed berry
#

hmmmmmm should i try and move to the new server infrastrucutre

earnest phoenix
#

yes

hushed berry
#

hmmmmmm

earnest phoenix
#

I might just start coding from scratch

harsh musk
#

wedc

hushed berry
#

nvm ill do it next weekend

#

kek

earnest phoenix
#

Ima go make a new bot and start from scratch

#

ok

#

gl

#

I'll need it

#

learn js while your doing it k thx

#

no

#

I'll read through all that js work

#

and learn nothing

#

you'll never get anything done then

#

learn what is a variable

#

then what is eachdata type

#

then ur done

#

z clap

#

`var answers = [
"Audible",
"Bolt d'\Oro",
"Bravazo",
"Combatant",
"Enticed",
"Firenze Fire",
"Flameaway",
"Free Drop Billy",
"Good Magic",
"Hofburg",
"Justify",
"Lone Sailor",
"Magnum Moon",
"Mendelssohn",
"My Boy Jack",
"Noble Indy",
"Promises Fulfilled",
"Instilled Regard",
"Solomini",
"Vino Rosso",
"No one on your tickets!"
];

document.getElementById('answerButton').onclick = function () {var x = document.getElementById("eight");
if (x.innerHTML === "8") {
x.innerHTML = "";
} else {
x.innerHTML = "";
}
var answer = answers[Math.floor(Math.random() * answers.length)];
document.getElementById('answerContainer').innerHTML = answer;
};` my attempt

#

THATS CODE FOR HTML

#

FUCK

#

JS HTML

#

someone mute

#

this is a bait

#

troll

#

not real

#

no it not

#

Mute me for nothing :/

#

@earnest phoenix do you know the difference between node.js and js fot html

#

nope

harsh musk
#

go ahead and learn

earnest phoenix
#

Why would you use HTML for a Discord bot anyways....?

#

I don't get that.

#

@earnest phoenix learn the difference before doing anything with a bot

#

omg

#

lmfaooo

#

@earnest phoenix Ok

#

GOOGLE IT

#

@earnest phoenix also e=why do you keep installing npm packages

#

like

#

smh

#

Make me

#

seriously

#

i wanna kms

#

helpless

#

I do to.

#

Is it a sin here to use the Discord Bot Maker?
Also, is there another way to host a bot remotely through a console other than node.js? I don't plan on switching yet, but if there's something better I'd consider it.

#

yes and yes

#

if you don't want to learn then you don't want to make a discord bot

#

any language u just run on a remote machine in the cloud

#

I do

#

and dont use dvm

#

no you don't

#

wait what

#

discord bot maker?

#

You think I don't, but I do.

#

@earnest phoenix if you did you would've went and learned how to

#

Shibotya is my first attempt at making a bot. I'm only using DBM for the code blocks, then fixing the scripts later after they're compiled.

#

huh

#

dont use dbm learn the code

#

dont edit it its not the same

#

I learn piece by piece, usually. I mean, most of DBM seems to be basically just if else statements everywhere, which is satan in itself.

#

yeah

#

I just haven't figured out switchcases

#

dbm is bit of a waste of money

#

Only if you try to run a bot out of it directly.

#

I mean, over the two days I spent making Shibotya, the bot went down with only a "There was an error" message on the screen, and that didn't even tell me how to fix it. That's why I switched to node.js and an admin cmd window.

#

I just don't know if there's a better way to host it locally.

earnest phoenix
#

I tried to make an alternative to fetchMessages.. so I don't spam the api.. but its not working out.. ```js
async function lastMessage(message) {

if(!message.hasOwnProperty('content')) return;
if(!message.hasOwnProperty('channel')) return;
if(!message.channel.hasOwnProperty('id')) return;

var channelid = message.channel.id

var MessageCache = message.client.table.fetch('MessageCache')

if(!MessageCache) MessageCache = {}

if(MessageCache[channelid]) {
var before = MessageCache[channelid]
MessageCache[channelid] = message
console.log(message.channel.name + " | " + before)
return before
} else {

message.channel.fetchMessages({limit:2}).then(msgs => {
  var before = msgs.last()
  MessageCache[channelid] = message
  console.log(message.channel.name + "    |    " + before)
  return before
})

}

console.log(MessageCache[channelid])

message.client.table.set('MessageCache', MessageCache)

}

earnest phoenix
#

Hey, if you could help me out here how do i make my bot not respond to other bots?

queen sentinel
#

or something like that

earnest phoenix
#

it wont work for me though

#

i tried

#

and the bot just crashes

#

@earnest phoenix

#

it couldn't define "msg" or "message"

queen sentinel
#

that's cus you haven't defined message earlier in your code

earnest phoenix
#

yes i did

queen sentinel
#

Unless you've defined it wrong

#

Β―_(ツ)_/Β―

earnest phoenix
#

i didn't

#

exact words.

#

it could start running without that code.

#

see

#

lax!help

#

wow

#

automuter?

#

@earnest phoenix

slender thistle
#

No bot responds outside of testing and bot-help channels

earnest phoenix
#

oh

#

right

slender thistle
#

And,

earnest phoenix
#

i forgot to check

slender thistle
#

you just need to use whatever variable you are ysing for the message instead of simply slapping that piece of in your file

earnest phoenix
#

i did use what variable i am using

#

message and msg wont work

queen sentinel
#
bot.on("message", message => {
  if(message.author.bot) return;```
That's how I have it shrug
earnest phoenix
#

alright

#

can i have permission to use it?

#

its okay if not

slender thistle
#

Copyrights on public piece of code

queen sentinel
slender thistle
#

cough

#

That's something new ThinkLMAO

earnest phoenix
#

i got in trouble for using something public without permission.

slender thistle
#

Well, Jonny didn't post it for shits and giggles
Or did he? ThinkButUpsideDown

queen sentinel
#

Just use it, if anything I took it from someone else

#

But you didn't hear that from me

slender thistle
#

Watch DBL secretly become code stealing community

earnest phoenix
#

-ok-

#

lole

#

Anyone here who use d.js can help me with getting the duration of a video(ytdl-core)
in hours, min, sec

sweet timber
#

when u say duration do u mean played so far or total?

earnest phoenix
#

no

#

only the currently playing song

sweet timber
#

i mean like how long the video HAS played for or how long it WILL play for

earnest phoenix
#

how long it is

#

i can do both as well

sweet timber
#

well for the length of the video ull have to read the metadata(idek if ytdl shows metadata, i use youtube-node for metadata).
for counting how long it has played for u just start a times when it starts playing

earnest phoenix
#

well

#

i use ytdl-core

#

and in the longs it shows

#

duration so i did duration.minutes

#

but it returns as objects

sweet timber
#

returns this:[object] ?

earnest phoenix
#

yea

#

[object Object]

sweet timber
#

yea that

#

basicly

#

u use google-fu

#

and learn JavaScript

topaz fjord
#

did you try logging the object

earnest phoenix
#

ok

topaz fjord
#

to see whats inside it

earnest phoenix
#

alright

keen drift
topaz fjord
#

gg > *

knotty steeple
#

elastic

#

compute

#

cloud

#

sounds ugly

keen drift
#

if I switch to aws

#

I wonder what my bill is

#

yeah not happening

#

non interrupted one is expensive

#

about 6x of my current price

topaz fjord
#

or @keen drift

#

switch to GG

keen drift
#

what's gg again

west raptor
#

galaxy gate i think

topaz fjord
#

fishy

#

how much do u pay

keen drift
#

uh

#

let me see

knotty steeple
#

yes @west raptor

west raptor
#

ok

keen drift
#

15.90 euro for 4vpu, 16gb of ram, 160 GB SSD, and 20 TB traffic

#

@topaz fjord

topaz fjord
#

better than gg

keen drift
#

yes

#

and I can get better offer

#

but I'm waiting for demand of my bot to scale

hot flax
#

how to fix websockets errors?

bright spear
#

@hot flax thats very vague, can you give more details? your code, the exact error, screenshot(s), etc

hot flax
#

Ok

knotty steeple
#

Error: Received unexpected end-of-file from SFTP server i get this error when i try to connect to a vps anyone know why?

hot flax
#

lmao i cant find the error any more

knotty steeple
#

ok my friend found out the problem nvm

native folio
#

how would I make a command called like
?invite bot id
And they do the command but they can add the bot id after it and when the bot returns it will go
User has invited
bot id
to the queue!
It will be reviewed shortly!

hexed hornet
#

.ping

#

.links

knotty steeple
#

@native folio what

native folio
#

what whar

#

what*

earnest phoenix
#

are you asking how to make the command

native folio
#

yes because Idk how

knotty steeple
#

what exactly does it do

native folio
#

so

earnest phoenix
#

log the bot into the database

#

boom

#

your done

west raptor
#

you're*

#

u dont

earnest phoenix
#

@fluid coyote you can't

west raptor
#

(x) doubt

native folio
#

like you do
?invite botid
And it says User has invited the bot into the queue it will be reviewed soon and it says the bot id aswell

earnest phoenix
#

Why do you ask if you can?

west raptor
#

no libs for lisp afaik

earnest phoenix
#

@native folio log the bot id

west raptor
#

up to u

earnest phoenix
#

there isn' t one

#

Use whatever you like

native folio
#

I like python

west raptor
#

ts/js is a good one imo

earnest phoenix
#

@fluid coyote js is a good start

hexed hornet
#

.ping

earnest phoenix
#

I prefer JS

west raptor
#

uh

native folio
#

really

west raptor
#

@loud salmon

earnest phoenix
#

@hushed berry selfbot thx

queen sentinel
#

@fluid coyote don't ping people like that

native folio
#

@fluid coyote just leave

west raptor
#

selfbot

#

ban

#

now

queen sentinel
#

oof

#

is it?

loud salmon
#

fuck

west raptor
#

yes

queen sentinel
#

Β―_(ツ)_/Β―

earnest phoenix
#

yes

loud salmon
#

i was going to delete messages

queen sentinel
#

yea

west raptor
#

someone cant send messages that fast

earnest phoenix
#

they didn't have a typing indicator

west raptor
#

no way

terse sky
#

dammit why did you ban it without setting message deletion to "don't delete any"?

earnest phoenix
#

They could have sendkeys'd their messages in.

queen sentinel
#

anyone screenshot it? Thonk

west raptor
#

no

queen sentinel
#

like it matters anyway

earnest phoenix
#

sad

west raptor
#

didnt have time

queen sentinel
#

we've got witnesses

earnest phoenix
#

all those people got ghost pinged

terse sky
#

Can I get the id of it real quick?

west raptor
#

?

native folio
#

505855671980261384 is there id

storm tulip
#

I got pinged?

west raptor
#

selfbot

queen sentinel
#

@storm tulip some selfbot going around pinging people

storm tulip
#

hm

hexed hornet
#

Is anyone else salty from that mass mentioning?

native folio
#

how would I make a command like this?
?invite botid
And it says User has invited the bot into the queue it will be reviewed soon and it says the bot id aswell

earnest phoenix
#

i told you 2 times

#

the log the bot id

native folio
#

I don't know how to do that

earnest phoenix
#

use enmap

native folio
#

I don't understand what you mean

#

what is enmap

earnest phoenix
#

its a database

#

This is probably going to be a stupid question, but how would I set up a custom welcome message for when members join a server in JavaScript? Every time I've tried to find a way it ends up breaking and not sending.

topaz fjord
#

the guildMemberAdd event

earnest phoenix
#

Okay but... I don't know what that is??

#

I've only been working with a bot for two days so far

west raptor
#

events

earnest phoenix
#

Can I assume that you are using discord.js?

west raptor
#

when x happens do y basically

earnest phoenix
#

I actually can't remember what I'm using, but it might be discord.js?

#

lol?

#

Okay

#

That's..very important that you know

#

lmao sorry im an idiot and forget what I'm supposed to be doing half of the time

west raptor
#

didnt you say earlier that u use dbm?

earnest phoenix
#

Yeah, I do.

#

I've been using the input raw code function instead of the code blocks, though.

#

Hmm

#

Can't speak much about that

west raptor
#

ask DBM support

earnest phoenix
#

never used a bot maker

#

Yeah, it runs on discord.js

#

I still have no idea what to do here though, because previous attempts have lead to error messages in the console.

west raptor
#

ask DBM support or server

#

idk

earnest phoenix
#

I tried :')

earnest phoenix
#

I don't know what I did?

tulip axle
#

I'm able to edit my bot's message fine with the message.edit() method, but when i call clearReactions, it throws an error

#
DiscordAPIError: Missing Permissions
earnest phoenix
#

because it doesn't have permissions

tulip axle
#

but what extra permissions are necessary to clear reactions?

#

my bot has all the text permissions

earnest phoenix
#

Raise the bot's role level to be higher than the user role of the reactions you're removing.

#

i mean as in the user who put the reactions there

#

^

tulip axle
#

oooh

#

interesting ill try

#

worked! thx

#

didnt realize roles are a factor

earnest phoenix
#

If the bot role is below the member role, Discord assumes that the bot takes lower priority than the user.

#

It's sort of like how moderator roles are above members, but admins are above mods.

rocky gazelle
#

Pinged?

west raptor
#

Selfbot

#

mass pinged

wheat marten
#

Are you able to host a bot with t mobile jazz?

earnest phoenix
#
const { RichEmbed } = require('discord.js');
const fs  = require('fs');
let co = require('../../database/cookieOut.json');
let ci = require('../../database/cookieIn.json');

exports.run = async(client, message, args, color, prefix) => {
	
	let cookieAns = require('../../assets/json/cookies.json');
	let cookieAnsRandom = cookieAns[Math.floor(Math.random() * cookieAns.length)];
	
	let user = message.mentions.users.first() || client.users.get(args[0]);
	if(!user) return args.missing(message, 'You need to mention user to give a cookie', client.commands.get('cookie').help);
	
	if(!co[message.author.id]) {
		co[message.author.id] = {
			cookie: 0
			};
		} 
	if(!ci[user.id]) {
		ci[user.id] = {
			cookie: 0
			};
		} 
		
	let curCo = co[message.author.id].cookie
	let curCi = ci[user.id].cookie
	let amount = parseInt(1);
  
	let embed = new RichEmbed() 
	.setColor(color)
	.setThumbnail(user.displayAvatarURL)
	.setAuthor('Cookie πŸͺ!', message.author.displayAvatarURL) 
	.setDescription(`**${message.author.username} has given ${user.username} a cookie**!\n${cookieAnsRandom}`)
	.setFooter(`πŸ“₯ ${curCo} | πŸ“€ ${curCi}`)
	
  co[message.author.id] = curCo + amount
	fs.writeFile('./src/database/cookieOut.json', JSON.stringify(co, null, 2), (err) => {
		return message.channel.send(embed);
		if(err) console.log(err);
  });
  
  ci[user.id] = curCi + amount
	fs.writeFile('./src/database/cookieIn.json', JSON.stringify(ci, null, 2), (err) => {
		if(err) console.log(err);
  });
	
	} 
	
exports.conf = {
	aliases: [], 
	cooldown: '0'
	} 
	
exports.help = {
	name: 'cookie', 
	description: 'give someone a cookie', 
	usage: 'cookie <@user | ID>' 
	}

Help me please, i confused in total cookie ( curCo and curCi ) output is undefined
If you don't like JSON just shut up, Don't bully me :(

knotty steeple
#

problem with json is

#

ez corruption

#

if writing and crash

#

iirc

earnest phoenix
#

Please read the footer what i sayd

quartz kindle
#

let amount = parseInt(1); ... why

earnest phoenix
#

hehe

#

add the amount to json

knotty steeple
#

why are you parsing 1

earnest phoenix
#

for add to json

knotty steeple
#

you dont need to parse that int tho GWvictoriaNotLikeBlob

quartz kindle
#

let amount = 1 @_@

topaz fjord
#

parsing a number

earnest phoenix
#

Still same, the total cookie when i use the command 2 times they going give me output undefined

#

the first time i use its okay work

knotty steeple
#

i just cant

earnest phoenix
#

alright

#

lemme try and try again πŸ˜‚

knotty steeple
#

pls use a database

earnest phoenix
#

Yeah

#

i'm waiting for my friend, they making a module to save data based on sqlite

knotty steeple
#

huh

#

??

earnest phoenix
#

they want to make sqlite more easy to use, friendly beginner πŸ˜ƒ
but still on progress

#

πŸ˜„

knotty steeple
#

well

#

ur wait

#

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-GDIJQW/aiohttp/ anyone know why i would get this error when im installing discord.py

#

well aiohttp but meh

knotty steeple
#

oh it was a problem with pip version

#

was for 2.7 python

#

not 3.6

#
Traceback (most recent call last):
  File "/home/samuraistacks/.local/lib/python3.6/site-packages/discord/client.py", line 307, in _run_event
    yield from getattr(self, event)(*args, **kwargs)
  File "botta.py", line 60, in on_message
    if not bot.is_ready() or msg.author.bot: return
  File "/home/samuraistacks/.local/lib/python3.6/site-packages/discord/client.py", line 296, in __getattr__
    raise AttributeError(msg.format(self.__class__, name))
AttributeError: '<class 'discord.ext.commands.bot.Bot'>' object has no attribute 'is_ready'
``` well shit
#

this was working before?

mild quarry
#

Sooo when the bot joins a server, it's supposed to send a message in #general (if there is one) but for some reason this code isn't working

@client.event
async def on_guild_join(guild):
    general = find(lambda x: x.name == 'general',  guild.text_channels)
    if general and general.permissions_for(guild.me).send_message:
        await general.send('message')```
#

i also have from discord.utils import find at the top

native folio
#

idk why this is happening and i dont understand why can i get some help?

#
Traceback (most recent call last):
  File "C:\Users\Keagan\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\bot.py", line 846, in process_commands
    yield from command.invoke(ctx)
  File "C:\Users\Keagan\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 374, in invoke
    yield from injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Keagan\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 54, in wrapped
    raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: InvalidArgument: Destination must be Channel, PrivateChannel, User, or Object. Received NoneType```
earnest phoenix
#

invalid argument

native folio
#

how do i fix it

earnest phoenix
#

Command raised an exception: InvalidArgument: Destination must be Channel, PrivateChannel, User, or Object. Received NoneType

#

give it an argument that is the type it asks for

#

and if u dont know what that means

#

πŸ‘‰ google

sonic glade
#

@mild quarry , You can use this code : client.on('guildMemberAdd', member => { member.guild.channels.get('channelID').send("Welcome"); });

loud salmon
#

dont spoon feed 😠 (unless its bad code idk node all that much)

earnest phoenix
#

i would allow that spoonfeed

#

since its completely broken

#

and will only lead to more problem down the road

loud salmon
#

lmao

earnest phoenix
#

for the poor person who too lazy to learn

fossil oxide
earnest phoenix
#

giving someone javascript code when they're using python

#

classic dbl tickYes

serene glen
#

-bot

earnest phoenix
#

how can i have a command say how many users are online in the server
by status
im having a command say how many is dnd, idle, online, streaming and offline

#

this work?
${message.guild.users.online.filter()}

midnight widget
#

Would be a big help if we knew the library

earnest phoenix
#

java

bitter sundial
#

...script?

earnest phoenix
#

yes

midnight widget
#

java and javascript are 2 different languages

earnest phoenix
#

i know

bitter sundial
#

discord.js?

earnest phoenix
#

yes

midnight widget
#

Look there

earnest phoenix
#

message.guild.users.online.filter() joyemote

#

im dead

#

point is, i tried that

#

Point is, you should read some docs bloblul

slender thistle
#

@mild quarry Hey

#

it's send_messages

#

Not send_message

#

@knotty steeple Reinstall d.py and try again

earnest phoenix
#

i tried this

${message.guild.users.online.filter()}

error:

(node:6544) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'online' of undefined
#

because guild doesn't have a property of users

#

also users.online isn't a thing, so it can't be mapped @earnest phoenix

#

guys anyone know how to fix this error TypeError: Cannot read property 'online' of undefined?

#

should i reinstall windows xp?

slender thistle
#

MS-DOS ftw

bitter sundial
#

install windows me for good measure

midnight widget
earnest phoenix
#

@earnest phoenix delete system 32 first then try again

knotty steeple
#

@slender thistle i did

#

same thing

slender thistle
#

Huh

#

discord.version?

knotty steeple
#

well

#

when im installing i get discord.py-0.16.12

slender thistle
#

Ew

#

Using async branch in 2k18

knotty steeple
#

well i dont want to

#

my bot is rewrite

#

im literally doing python3 -m pip install -U discord.py

#

nvm got it

earnest phoenix
#
bot.on('message', message => {
    let channel = bot.channels.get("503660117015658503")
  if(message.author.bot) return;
  let spam = bot.channels.get("505813580457967620")
if(spam.send) return;
channel.send(`[<#${message.channel.id}> [${message.channel.name}] | ${message.guild.name}] | <@${message.author.id}> [\`${message.author.tag}\`] | msg: ${message.content}`)
});

let spam = bot.channels.get("505813580457967620")
if(spam.send) return;
this not work
.send its the error
TypeError: Cannot read property 'send' of undefined

#

Cannot read property 'send' of undefined

#

so whatever you are trying to .send on is undefine

#

so the channel

#

doesnt

#

fucking

#

exist

#

pls

#

thats not even proper js

#

also why are you calling the channel spam?

#

like

#

if(spam.send) return <-- what is this even

#

checking for undefined to prevent property of undefined error drakeno
checking a property of undefined, getting property of undefined error and asking why it doesnt work drakeyea

the competence of the average "developer" who makes discord bots

midnight widget
earnest phoenix
#

but

#

@topaz fjord mmLol

#

my question is why is he trying to send a message for any message currently being sent in all the servers his bot is in

#

i mean

#

thats one of quickest way to get rate limited

midnight widget
#

Apart from rainbow roles

earnest phoenix
#

yeah

#

but this is faster 😎

topaz fjord
#

.send() is a method

#

smfh

earnest phoenix
#

u can if it and it will be true

#

but channel undefined

#

so breaky breaky

topaz fjord
#

ur a breaky

earnest phoenix
topaz fjord
#

commandfile.run(client, message, args, con, cmd, DBL, dbl, errors);

module.exports.run = async(bot, message, args, con, dbl, DBL) => {

#

@earnest phoenix does this give you cancer

earnest phoenix
#

yes

#

all my cmd take 2 arg lol

topaz fjord
#

^

#

I only take in message and args

earnest phoenix
topaz fjord
#

and then I have a constructor which takes in the the client

earnest phoenix
#

double tickYes

quartz kindle
#

the the client

topaz fjord
#

@quartz kindle shut

earnest phoenix
#

so wait

#

java has its own complier

topaz fjord
#

afaik yes

earnest phoenix
#

goat

#

no u compile to bytecode and jre uses it

raw wharf
#

How can certification be obtained?

topaz fjord
#

once it's open

raw wharf
#

okay

earnest phoenix
#

ok

hot flax
#

ok i get my error again

#

every time i get this error 10 times

#

if i remove something in my code it will crash

marble elm
#

ok

hot flax
#

so how to fix

#

?

knotty steeple
#

connection error

earnest phoenix
#

@hot flax its a connection error

#

so you don't fix

knotty steeple
#

you fix with better internet

earnest phoenix
#

^

hot flax
#

lol

#

ok ty xD

earnest phoenix
#

lole

#

Does anyone know lua

#

??

frail terrace
#

yes

#

@earnest phoenix

earnest phoenix
#

Bro can I talk to you

frail terrace
#

sure

earnest phoenix
#

Bro, so I have this idea

#

We should go in private chat

#

But I cant message you

gilded plankBOT
#
FighterMan0#7874
Bots

@charred garnet

earnest phoenix
#

-bots @frail terrace

gilded plankBOT
#
FighterMan0#7874
Bots

@charred garnet

earnest phoenix
#

@inner jewel

#

Bot is broken

#

Help me please

gilded mountain
#

-bots @loud salmon

gilded plankBOT
#
Spider#5879
Bots <:dblMod:483995659054088193> <:dblCertified:392249976639455232>

@median gust dblCertified

earnest phoenix
#

That's what I done

#

And it shows me mine

#

-bots @frail terrace

gilded plankBOT
#
FighterMan0#7874
Bots

@charred garnet

earnest phoenix
#

Aaaaaa

inner jewel
#

@earnest phoenix

earnest phoenix
#

Yes

#

Help me

inner jewel
neat falcon
earnest phoenix
#

@inner jewel I didnt got there because I thought that was not part of testing. Anyway can you help me with the bot?

#

Issue?

inner jewel
#

i already told you

topaz fjord
#

there is no issue with luca

inner jewel
#

you have two spaces

earnest phoenix
#

@topaz fjord scroll up

inner jewel
#

-bots <name> vs
-bots <name>

topaz fjord
#

^

earnest phoenix
#

I only put one

#

Space

inner jewel
#

no

#

you put two

topaz fjord
#

when mentioning it adds another

earnest phoenix
#

Oh

#

Forgot that

topaz fjord
#

well at least it does for me

earnest phoenix
#

Sorry I dont click on links

#

That .mp4

topaz fjord
#

it embeded for me

earnest phoenix
#

You never know what sound it could be

topaz fjord
#

why would a mod try to do stuff for you Thonk

earnest phoenix
#

Because I am a customer

topaz fjord
#

wut

neat falcon
#

this aint mcdonalds

earnest phoenix
#

I am saying all of us are customers

topaz fjord
#

Im not a customer ok

earnest phoenix
#

And customers are"always right"

topaz fjord
#

thats bs

neat falcon
#

always right what

topaz fjord
#

its a shitty saying

#

"customer is always right"

#

even tho you tell the person something that is wrong

earnest phoenix
#

See

topaz fjord
#

I dont believe that shit for a second

earnest phoenix
#

See the service is dbl

neat falcon
#

i can't see any proof

#

since when was dbl a service

topaz fjord
#

I dont buy from dbl

neat falcon
#

smart turtle

earnest phoenix
#

They make money from us

inner jewel
frail terrace
#

what @earnest phoenix

neat falcon
inner jewel
#

because this isn't development related at all

topaz fjord
#

they are making money from ads

earnest phoenix
#

@inner jewel is dbl a services?

topaz fjord
#

ok natan

frail terrace
#

am cleaning keyboard rn

earnest phoenix
#

They are helping us

#

Get our bots in other servers

inner jewel
#

last chance

earnest phoenix
#

Sorry natan

#

@frail terrace when do we talk?

frail terrace
#

when my keyboard is clean

topaz fjord
#

lmfao

earnest phoenix
#

@frail terrace there is that little hair on the left side of the w key

#

Make sure you get that

#

Please

frail terrace
#

huh

earnest phoenix
#

Is your keyboard clean?

frail terrace
#

ish

earnest phoenix
frail terrace
#

then i have to put screws back in and keycaps

native folio
#

how would one define reason
reason = ????

#

im using it for a kick command

earnest phoenix
#

Just

#

@native folio a cause , explanation, justification for an action or an event

native folio
#

so
reason = explanation?

earnest phoenix
#

Yea

#

You can use any example I wrote you

hushed berry
#

Does anyone here have experience running java applications inside docker containers?

lost scarab
#
// Call Packages
const Discord = require('discord.js');
const economy = require('quick.db');

// Define client for Discord
const client = new Discord.Client();

// This will run when a message is recieved...
client.on('message', message => {

    // Variables
    let prefix = 'c.';
    let msg = message.content.toUpperCase();

    // Commands

    // Ping - Let's create a quick command to make sure everything is working!
    if (message.content.toUpperCase() === `${prefix}PING`) {
        message.channel.send('Pong!');
    }

    // Balance & Money
    if (msg === `${prefix}BALANCE` || msg === `${prefix}MONEY`) { // This will run if the message is either ~BALANCE or ~MONEY

        // Additional Tip: If you want to make the values guild-unique, simply add + message.guild.id whenever you request.
        economy.fetchBalance(message.author.id + message.guild.id).then((i) => { // economy.fetchBalance grabs the userID, finds it, and puts the data with it into i.
            // Lets use an embed for This
            const embed = new Discord.RichEmbed()
                .setDescription(`**${message.guild.name} Bank**`)
                .setColor(0xD4AF37) // You can set any HEX color if you put 0x before it.
                .addField('Account Holder',message.author.username,true) // The TRUE makes the embed inline. Account Holder is the title, and message.author is the value
                .addField('Account Balance',i.money,true)


            // Now we need to send the message
            message.channel.send({embed})
        })
    }
});
#

this is not working πŸ€”

#

yes i have client.login('token'); after

knotty steeple
#
// Call Packages
const Discord = require('discord.js');
const economy = require('quick.db');

// Define client for Discord
const client = new Discord.Client();

// This will run when a message is recieved...
client.on('message', message => {

    // Variables
    let prefix = 'c.';
    let msg = message.content.toUpperCase();

    // Commands

    // Ping - Let's create a quick command to make sure everything is working!
    if (message.content.toUpperCase() === `${prefix}PING`) {
        message.channel.send('Pong!');
    }

    // Balance & Money
    if (msg === `${prefix}BALANCE` || msg === `${prefix}MONEY`) { // This will run if the message is either ~BALANCE or ~MONEY

        // Additional Tip: If you want to make the values guild-unique, simply add + message.guild.id whenever you request.
        economy.fetchBalance(message.author.id + message.guild.id).then((i) => { // economy.fetchBalance grabs the userID, finds it, and puts the data with it into i.
            // Lets use an embed for This
            const embed = new Discord.RichEmbed()
                .setDescription(`**${message.guild.name} Bank**`)
                .setColor(0xD4AF37) // You can set any HEX color if you put 0x before it.
                .addField('Account Holder',message.author.username,true) // The TRUE makes the embed inline. Account Holder is the title, and message.author is the value
                .addField('Account Balance',i.money,true)


            // Now we need to send the message
            message.channel.send({embed})
        })
    }
});``` because codeblock is in wrong language
#

also what exactly isnt working

earnest phoenix
#

let msg = message.content.toUpperCase();

#

if (message.content.toUpperCase() ===

#

y

knotty steeple
#

and why uppercase

earnest phoenix
#

also it won't react because it'll automatically turn the c. in the message into C.

#

also copied code

heady zinc
#

that's not the issue

earnest phoenix
#

it is

heady zinc
#

the issue is that this code is obviously from a tutorial, but is actually awful

#

what kind of trash tutorial is this

earnest phoenix
#

no its copied

#

because

#

the comments are still there

heady zinc
#

i didn't say it wasn't copied

#

baka

earnest phoenix
#

thats my name

#

don't wear it out

#

πŸ‘

#

also im 99% sure fetchBalance() is not a function in quick.db

#

did i hear "bad tutorials"? zoomeyes

#

anidiotsguide

#

time to get york

queen sentinel
slim heart
#

Really quite confused,

let serverdat = JSON.parse(fs.readFileSync('C:/Users/ninja/Desktop/bot/priv/server_data/' + message.guild.id + '.json'))
        if(serverdat['filter'][0]) {
        let serverfilter = serverdat['filter']
        stopcustom = false
        serverfilter.forEach(word => {
            let custsio = new RegExp(words, 'gi')
            if(arg.match(custsio)) {
                stopcustom = true
            }
        })
        if(stopcustom) {
            stopped('Custom Filter', arg)
            return;
        }
    }```
keeps throwing an error saying things like cant read property 0 of undefined etc. But in all my server files they all have `"filter": []`
earnest phoenix
#
  1. why do you have a json file for each guild
slim heart
#

sh

earnest phoenix
#
  1. json for database
slim heart
#

It's very specific deployment

#

Dw

#

I moved from a mysql db to json

#

That's besides the point

#

I also tried to do for(i = 0; i < serverfilter.length; i++)

earnest phoenix
#
  1. i'm 37% sure its because theres nothing in the arrays
slim heart
#

but it said cant find length of undefined

earnest phoenix
#

json db tickYes sync io in nodejs tickYes dbl tickYes

slim heart
#

so i need to have like '' in the array?

earnest phoenix
#

no

#

any array will have .length

slim heart
#

cuz in my other jsons with other things, there are just [], and it doesnt error

earnest phoenix
#

dont matter if empty

#

its just undefined

slim heart
#

yeah

#

exactly

#

ye

#

so

#

i really dont know

earnest phoenix
#

its undefined

slim heart
#

i even tried doing eval with the code i had

#

it only errors when i actually PUT it in the code

earnest phoenix
#

also it might be because the json file doesn't exist

slim heart
#

yeah thats what i was thinking

earnest phoenix
#

also why you move?

slim heart
#

i saw an id at some point

#

How can i just return if the file doesnt exist?

earnest phoenix
#

if(!serverdat) return

#

also go back to sql

slim heart
#

its still giving me the error

#
let serverdat = JSON.parse(fs.readFileSync('C:/Users/ninja/Desktop/bot/priv/server_data/' + message.guild.id + '.json'))
        if(!serverdat) return;
        if(serverdat['filter'][0]) {
        let serverfilter = serverdat['filter']
        stopcustom = false
        serverfilter.forEach(word => {
            let custsio = new RegExp(words, 'gi')
            if(arg.match(custsio)) {
                stopcustom = true
            }
        })
        if(stopcustom) {
            stopped('Custom Filter', arg)
            return;
        }
    }```
sonic glade
#

arg.match undefined

slim heart
#

it says arg.match isnt a function

#

not undefined

sonic glade
#

canΒ΄t read property of if(serverdat['filter'][0]) 0

knotty steeple
#

its still undefined

#

if it isnt a function

slim heart
#

arg is defined

knotty steeple
#

match is not a function

sonic glade
#

and error on sql system

slim heart
#

shh

#

its my restart command

knotty steeple
#

what exactly is arg

slim heart
#

anyways

#

const arg = RemoveAccents(message.content.replace(/[.]/g, '')).slice().trim().split(/ +/g)

#

and later down in the code i match arg and it works

#

i just realized i have to forEach arg

#

hummanauuuuh

#

but still doesnt explain why 0 is undefined

#

ok actually now it works

#

but now my console is still being spammed

#

I console.log'd the server id everytime its sent and it has no consistency on which server doesnt seem to have a file

#

ok nvrm turns out there is a consistency accross multiple servers

#

and a few of my server files dont have "filter": [] but i did this before:

bot.guilds.array().forEach(server => { let serverdata = JSON.parse(fs.readFileSync("B:/priv/server_data/" + server.id + ".json")); serverdata['filter'] = [];fs.writeFile('B:/priv/server_data/' + server.id + '.json', JSON.stringify(serverdata))})```
so why don't they all have it?
#

a lot of them do

#

but some dont

#

and either way i did

if(serverfilter['filter']) {
...
}```
so why does it still throw errors?
wide ruin
#

docs:
guildBanAdd

Emitted whenever a member is banned from a guild.
Parameter Type Description
guild Guild The guild that the ban occurred in
user User The user that was banned

#
client.on("guildBanAdd", user, guild => {
  
});```
earnest phoenix
#

"guildBanAdd", user, guild

wide ruin
#

whats it meant to be?

topaz fjord
#

(user, guild) =>

wide ruin
#

oooh

#

ok

#

thanks

topaz fjord
#

user, guild will never work in js

#

user => will

#

but since you have 2 it needs to ne (user, guild) =>

wide ruin
#

client.on("guildBanAdd", (user, guild) => {
  
});```
#

thanks

#

how can i find a channel with a specific name in guild?

topaz fjord
#

check the docs

wide ruin
#

guild.channels.find('name here')

#

?

earnest phoenix
#

para just search this guys name in #development and decide if u wanna keep responding

topaz fjord
#

thats not how .find works @wide ruin

#

@earnest phoenix brb 1 min

earnest phoenix
#

How do you get a discord.Message reactions as a discord.Reaction

hushed berry
#

you ask it really nicely

earnest phoenix
#

very helpful

hushed berry
#

:^)

earnest phoenix
#

I added a reaction using await ms.add_reaction(reaction). Now how would I get it as a discord.Reaction object in discord.py?

slender thistle
#

message.reactions

#

is a list of discord.Reaction

earnest phoenix
#

Ok thank you! πŸ˜ƒ

slender thistle
simple grove
#

Collection#find: pass a function instead

#

Whats This?

earnest phoenix
#

@simple grove Collection.find(item => ...)

simple grove
#

@earnest phoenixWhere should I write

earnest phoenix
#

sigh Show your code

simple grove
#

700 line

#

Bot.js code

topaz fjord
#

.find is how you look in a collection

#

put it wherever you need it

simple grove
#

Ok

#

Collection.find(item => ...) this code? @topaz fjord

topaz fjord
#

whats the collection you're finding from

simple grove
#

No collection

topaz fjord
#

what

#

then why do you need .find

earnest phoenix
#

sigh