#development

1 messages · Page 416 of 1

topaz fjord
#
    server := "localhost:80"
    c, _, err := websocket.DefaultDialer.Dial(fmt.Sprintf("ws://%s", server), nil)
``` it comes from this when i try to open the connection through go
earnest phoenix
#

How do you make your let the user invite it to your own server?

topaz fjord
#

give them the oauth link

earnest phoenix
#

Whats that

#

Oh, THANK YOU SO MUCH

#

I GOT IT

#

😃

earnest phoenix
#

Ok where do i put it tho

#

😂

#

@topaz fjord

#

Someone?

#

Help

topaz fjord
#

in your url box

#

lmao

earnest phoenix
#

The website link?

#

Or the Github link?

topaz fjord
#

the bot invite link

earnest phoenix
#

In the Invite URL?

topaz fjord
#

what invite do you even want?

earnest phoenix
#

Ok

topaz fjord
#

"ok" is not an answer to my question

earnest phoenix
#

Which bot invite link!

topaz fjord
#

tf does that mean

shy verge
#

!?

topaz fjord
#

@shy verge hai

earnest phoenix
#

Ok, I want users able to invite the bot to their own servers. Right now, it only directes to the support server

#

Where do I put the Ouath2 link in the add bots page?

topaz fjord
shy verge
#

you're overcomplicating things with OAuth

topaz fjord
#

and replace botid with your bots id and perms with your perms

shy verge
#

Bots don't fuck with OAuth much anyway

#

afaik

topaz fjord
#

@shy verge its the link you use to invite bots u weeb

shy verge
#

no u

earnest phoenix
#

Why cant I edit it?

shy verge
#

ok

#

go to your application page on the discord developer site

earnest phoenix
#

I did generate it

shy verge
#

then what are you trying to do with it

#

do you mean the listing on DBL?

#

they have a box for you to paste invite url

earnest phoenix
#

Which box

#

The last one?

#

@shy verge

shy verge
earnest phoenix
#

Thank you

delicate zephyr
#

Question:
How to get epoch / unix time
Language:
D.py (Python)
Extra
Im basically trying to get the epoch / unix time of when a user with created using user.created_at

abstract mango
#

user.created_at is a datetime.datetime object

earnest phoenix
#

How come my bot can't run multiple commands at the same time

#

Like I mean

#

I can't say two commands that are 3 seconds apart

#

I have to wait a while

#

Suggestions?

low owl
#

How are we supposed to know? :P
It could be anything, faulty logic, threading, ...

#

The only option you have is to pin point certain parts in your code that could potentially be responsible for it and show us or debug it yourself

earnest phoenix
#

😂

#

Ok

#

what brian said, if you give us more info we'd be happy to help you

shy verge
#

could it be possible he's running things synchronously?

#

lmao

earnest phoenix
#

its hard to tell without more info on how he handles the commands or the lang

shy verge
#

guess he just gave up?

#

¯_(ツ)_/¯

earnest phoenix
#

What

#

"??

#

Ah ha, it says a recivemessage handler is blocking the task

#

@shy verge

shy verge
#

it means whatever you're processing is taking longer than 3 seconds

#

might be code-spaget issue

#

or shiternet

lament reef
#

can someone give me assistence

#

o.0

#

Node.js (discord.js)

brisk notch
#

you habe to end the typing

lament reef
#

i do

#

but either way it shouldnt do it more than 10 seconds

#

yet it runs forever

topaz fjord
#

can you point us to the code where you stop it

shy verge
#

lines?

#

this is a lot

lament reef
#

about line lemme seee

earnest phoenix
#

at which command it doesn't stop typing

#

any?

shy verge
#

reeee you aren't using lambdas

lament reef
earnest phoenix
#

so when you say Seb, crazyimg it won't stop typing? xD

lament reef
#

yep

shy verge
#

does the command execute without any issues?

lament reef
#

no

#

it just starts typing and never stops

shy verge
#

logs?

lament reef
#

meanwhile i can do other commands

#

it will start typing for those commands, then stop for like 2 seconds, then it will just start typing forever again

shy verge
#

if a function fucks midway through then you never get to the stopTyping() line

#

we need to know why the function dies before that line

lament reef
#

but it should stop after 10 seconds!

#

discord.js!!!

topaz fjord
#

it cant be discord.js's fault

shy verge
#

does djs really have a safeguard for that?

lament reef
#

YES!

shy verge
#

huh

topaz fjord
lament reef
#

but still..

#

ok

#

i will

earnest phoenix
#

So, @shy verge, how do I make it not delay 3 seconds?

#

Internet is good

#

I just checked it

shy verge
#

try running in release mode

earnest phoenix
#

Release mode?

topaz fjord
#

it could be hardware

earnest phoenix
#

Im using Microsoft Visual Studios

shy verge
#

change your build configuration to Release

#

debug mode has a bunch of boilerplate that fucks performance

earnest phoenix
#

yeah

#

Ok so how to change to release?

#

I only have Build, Build Order, Debug, Intellisense, and Package Manager

#

you should also catch promise errors inside callback functions @lament reef

shy verge
#

that debug button is a dropdown

#

or it should be

earnest phoenix
#

It is

shy verge
#

👀

earnest phoenix
#

But only Build, Build Order, Debug, Intellisense, and Package Manager options are available

#

Is there supposed to be a released option?

#

Remember, Im using Microsoft Visual Studios

shy verge
#

which year

#

2017?

earnest phoenix
#

are you sure its not just 🍝 await code

shy verge
#

nah, i had the same issue

#

in debug mode, things like WebClient.DownloadString() would take fucking ages

earnest phoenix
#

I played just a little bit with d.net the only thing I remember regarding this was RunMode

shy verge
#

runmode is deprecated i think

#

idk im using 2.0

earnest phoenix
#

could be, I tried it like a year ago or so

shy verge
#

@earnest phoenix what vs version are you using?

earnest phoenix
#

Im using the 2017 version

#

@shy verge

shy verge
#

dropdown

earnest phoenix
spring ember
#

stats.getInfo is not a function

earnest phoenix
#

What is the solution?

spring ember
#

read the docs

quiet bobcat
#

not using stats.getInfo GWlulurdMegaLul

earnest phoenix
#

😅

quasi raptor
#

how should i do to make a simpliest timer in C++?

abstract crystal
#

wait is there a discord lib for c++?

earnest phoenix
#

How do you put the time next to a ping?

abstract crystal
#

wdym

earnest phoenix
#

Like Pong! (189ms)

quasi raptor
#

ping! ?

earnest phoenix
#

How do you calculate the time?

abstract crystal
#

ooh well you calculate or retrieve ping from your lib

quasi raptor
#

timer start and after a minite the timer stops

earnest phoenix
#

😫

abstract crystal
#

in python it's datetime1 - datetime2
(each variable is a separate instance of datetime.datetime.now(), one at the start and one at the end, BUT not the best solution, consult your library's docs)

quasi raptor
#

Or set timeout to do with functions

earnest phoenix
#

Does anyone have a code solution?

quasi raptor
#

like t.setTimeout in javascript

earnest phoenix
#

What is the code for Microsoft Visual Studio?

abstract crystal
#

Microsoft VS is a software to do coding?

#

it's not a programming lang

lament meteor
#

lmao

#

this person seems to be a... coding nub

#

but ok

abstract crystal
#

noooo

#

what?

earnest phoenix
#

I am a coding nub

lament meteor
#

@earnest phoenix do u know what coding language you are using

#

did u have to do something like npm install discord.js ???????

abstract crystal
#

or pip install discord

low owl
#

In Disord.Net is a member with the name Latency under IDiscordSocketClient (I think)

lament meteor
#

or telk pls install my meme

earnest phoenix
#

No

#

I have like public async Task ReplyAsync("Your mom")

prime cliff
#

Yea the d.net client has latency

low owl
austere meadow
#

is there any clean way to dynamically call a function in node.js

#

without eval

spring ember
#

umm in python there is exec so maybe

low owl
#

Basically an eval command @austere meadow without.. eval?

austere meadow
#

im not making an eval command

low owl
#

What's your end goal?

restive silo
#

what you exactly mean with "dynamic" calling a function

austere meadow
#

https://please.zbot.me/QHoOjEVz.png
i have these default values in a model, but they are stored as a function
i want to loop over all of these values so i can compare them against a user in my database and if they are missing any values, i can add them

#

so i'd want to do something like

for (let i in Object.keys(User._defaultValues)) {
    Object.assign(this.defaultValues[i], profile.get(i))
}
languid dragon
austere meadow
#

thats sample code but yes

#

that unfortunately doesn't work @languid dragon

restive silo
#

why you use a in with .keys()

austere meadow
#

says "object[value] is not a function"

languid dragon
#

user._defaultValues"userID" doesn't work?

austere meadow
#

yeah

#

@restive silo sorry?

#

oh

#

use of instead

#

ok

languid dragon
#

does .userID() work?

austere meadow
#

it does

#

but thats a bit useless

#

since i want to dynamically do it

languid dragon
#

well u could do

for (const thing of User._defaultValues) {
    thing(); // should work IIRC
}
austere meadow
#

oh fuck you guys are geniuses ok i got it going

languid dragon
#

oh

low owl
#

That doesn't solve your specific problem, but software engineering wise it also sounds like a lot of mutability is involved.
Maybe an approach with immutable data objects might help you out in other ways.

austere meadow
#

thank you hart

languid dragon
#

np

austere meadow
#

i think changing in to of fixed it

languid dragon
#

its a collection isn't it? (or a map?)

austere meadow
#

my data is an object

#

but using of is better

languid dragon
#

oh ok

#

do you know what of does

austere meadow
#

honestly

#

after all this time ive used javascript i dont really know the difference between in and of

#

most of the time i just use in and it works

languid dragon
#

pretty sure in only gets the indexes and of actually grabs the object

restive silo
#

for/of is way faster than for/in and in your case you already used .keys() to get an array and for/in would give you the index of that array and not the actuall value

languid dragon
#

thats how i see it lmao

low owl
#

Js is weird yo 👀

austere meadow
#

ah okay

restive silo
#

no u

austere meadow
#

thanks again hart

restive silo
languid dragon
#
restive silo
#

yup

#

mdn is bae

austere meadow
#

^^ true

#

ah yeah i get it now

languid dragon
#

dang it, now i wanna do some JS but im doin design angery

austere meadow
#

design some js

#

or what if you made a program to automatically do css for you

restive silo
#

owo

#

js framework to generate css

#

that would be something funny

languid dragon
#

would use, only to create my basic template

#

actually i could do that rn lmao

storm sundial
#

Why is my server count N/A

quiet bobcat
#

because you haven't posted it

prime cliff
quiet bobcat
#

^

upper ember
#

how do I check if my bot is in server using php

#

?

elder rapids
#

Request the guild

spring ember
#

oh no

torpid frost
#

i got a strange erron in my log....
ERROR net.dv8tion.jda.core.requests.WebSocketClient - Encountered exception on lifecycle level

ideas?

spring ember
#

probably discord had a minor outage

elder rapids
#

Shit happens

torpid frost
#

🤷

#

hope it does not have blocked my BOT

elder rapids
#

You'd have a different error mate

restive silo
#

yea discord has internal erros atm

earnest phoenix
#

Comment surmonter une erreur ?

night imp
#

Check the docs again, the command you are trying to run isn't a function. (stats.getInfo(username, platform).then(data => {)

#

French - Vérifiez à nouveau les docs, la commande que vous essayez d'exécuter n'est pas une fonction

earnest phoenix
#

Quelle est la solution à ce problème

delicate zephyr
#

@abstract mango Thanks for the help

abstract mango
#

np :p

lament reef
#

this is probably dumb.. but how do i set up shards?

spring ember
#

What lib?

lament reef
#

discord.js

spring ember
#

Oof sorry I never used d.js

lament reef
#

😕

mental solstice
#

I need to learn sharding in c#

quiet bobcat
#

Google

earnest phoenix
#

YouTube

#

GitHub

#

Tumblr... And on I can go...

mental solstice
#

What about Bing?

#

Internet explorer uses that by default

elder rapids
#

Sharding in C# really isn't that hard ;P

mental solstice
#

I hope not :) once i get time to sit down and work on stuff again, ill need to get it done.. need my bot back on track.. Almost 100 servers a day for the first 3 days.. then rip by discord, should have learned sharding before

earnest phoenix
#

why rip by discord at 300 servers

mental solstice
#

Idk.. they said i need to do sharding once over 100 servers.. atleast thats what the email said in response to why i got rate limited

inner jewel
#

1000

#

but you can have up to 2500/shard

#

although that's not recommended

earnest phoenix
#

I actually thought its more than 1k its just a safe place to start

#

yeah what trixter said

abstract crystal
#

i'm sitting on 8900 servers and 4 shards and i'm just fine

mental solstice
#

They told me 100.. idk

abstract crystal
#

what trixter said it's the recommended one

inner jewel
#

usually music bots require more shards

#

because of how discord handles VC join/leave/move

mental solstice
#

Maybe was a typo. I didnt write them back

lament reef
#

does anyone here know how to write to a file on heroku? yes, yes, i know heroku is bad, but still.

earnest phoenix
#

i feel the same way when i have to tell people i wrote a bot in javascript

#

"i know javascript is lazy but still"

lament reef
#

not helpful

elder rapids
#

why would you want to write a file on heroku Thonk

lament reef
#

well writing files is out

#

now im just using process.env["filething"] = "filevar"

ruby dust
#

heroku doesn't even save databases, so what do you think?

lament reef
#

its a temp file anyway

#

does anyone here have any experience with gm for node.js? if so, i need help.

#

(mention me)

delicate zephyr
#

how to do you get the guildcount in python?

slender thistle
#

You mean, post the server count to DBL?

delicate zephyr
#

Nope

#

d.py's server hate me lmao

slender thistle
#

Just get it from bot's page?

delicate zephyr
#

I mean getting the guild count in Python

#

on a working bot

slender thistle
#

Ah.

#

len(bot.guilds) in rewrite.

delicate zephyr
#

Thanks

slender thistle
#

len(bot.servers) in async.

delicate zephyr
#

Im on rewrite 👌🏼

slender thistle
#

👌

delicate zephyr
#

Wanna hate me forever?

slender thistle
#

Yeah sure.

delicate zephyr
#

I wrote my own Command Handler

#

XD

slender thistle
#

I hate you now. GWchadThink

delicate zephyr
#

without using discord.ext.commands :3

slender thistle
#

Nah jk love ya.

delicate zephyr
#

its funny cause its open source

#

xD

slender thistle
#

I am totally not lazy to check it out.

delicate zephyr
#

im waiting for someone to send a PR to fix it all inline with d.ext xD

#

I can see someone doing that

slender thistle
#

I PR's my weird code to DBLPY lib, waiting for any comments on it. 😂

#

At least, it works properly for me.

#

Damn asyncio. GWnanamiChenSad

delicate zephyr
#

yep

#

What does asyncio even do

slender thistle
#

The only thing I use it for is delaying.

#

And loops.

delicate zephyr
#

oh

#

so not use to me 😛

slender thistle
spring ember
#

Why?

#

Why bother making a command handler

slender thistle
#

To handle the commands the way you like. GWrjkKappaLUL

lament reef
#

Why can I not write to the /temp/ directory in heroku?

abstract crystal
#

*writes his own dbl wrapper*

#

: ^)

lament reef
#

?

spring ember
#

Because you don't @lament reef

lament reef
#

then how do i store temporary files?

#

*for free

spring ember
#

Umm save it to the project files

#

Like ./temp/

lament reef
#

wdym

spring ember
#

I think it will work

abstract crystal
#

or BinaryIO

spring ember
#

Relative

lament reef
#

but

abstract crystal
#

if it's short lived

lament reef
#

i writed to /temp/ with the output for gm

#

and it says theres no file

spring ember
#

If it's image processing then heroku probably won't be good

lament reef
#

then what do i use?

abstract crystal
#

proper vps

lament reef
#

i need a good free host

topaz fjord
#

free hosts are never good

abstract crystal
#

like do (see pins)

spring ember
#

Sorry

slender thistle
#

Use SkySilk.

topaz fjord
#

use GalaxyGate

spring ember
#

Free hosts cannot handle image manipulation

slender thistle
#

It's at least any reliable. The free plans are not quite bad.

#

SkySilk is an actual VPS. :p

lament reef
#

ok

topaz fjord
#

@slender thistle so is galaxy gate

slender thistle
#

It's free or just cheap?

abstract crystal
slender thistle
#

Well, they are free until the beta ends.

topaz fjord
#

$5 for 1 core cpu, 2gb ram, 30gb disk, 500mbps net, unlim bandwith

slender thistle
#

Well, I am a poor kid. GWjiangoNegaLUL

topaz fjord
#

i use the $10 one tho

spring ember
#

It's great

abstract crystal
#

Scaleway (2.99)

slender thistle
#

Okay, that's quite interesting.

abstract crystal
#

but i actually use DO

spring ember
#

Ovh also is very good

#

And reliable

slender thistle
#

Imma just bother with it later. When I get money.

topaz fjord
#

ovh uptime is shit

earnest phoenix
#

hoi

topaz fjord
#

like tf

abstract crystal
#

network performance *laughs*

topaz fjord
#

how can you not control ur shit

abstract crystal
#

why do they have ADSL

#

huh

delicate zephyr
#

How to get shard uptime in d.py

#

cant find on docs

abstract crystal
#

set a variable when the bot starts

#

(you can't get shard specific uptime)

delicate zephyr
#

oh ok

abstract crystal
#

nor the uptime of the bot, you must set it yourself

delicate zephyr
#

👍🏼

tardy hatch
#

Hello

#

I have this problem:

#

Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/discord/ext/commands/bot.py", line 846, in process_commands
yield from command.invoke(ctx)
File "/usr/local/lib/python3.5/dist-packages/discord/ext/commands/core.py", line 374, in invoke
yield from injected(*ctx.args, **ctx.kwargs)
File "/usr/local/lib/python3.5/dist-packages/discord/ext/commands/core.py", line 54, in wrapped
raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: UNAUTHORIZED (status code: 401): 401: Unauthorized

topaz fjord
#

ur unauthorized

#

it says it right there

tardy hatch
#

Mindfuck

#

How can i authorize?

#

I have this code

#
    @commands.command()
    async def cacazip(ctx):
     embed = discord.Embed(title="Commands", description="All commands list", color=0x7cedd9)

     embed.add_field(name="help", value="Show this menu", inline=False)
     embed.add_field(name="$multiply X Y", value="pil", inline=False)
     embed.add_field(name="$greet", value="Gives a nice greet message", inline=False)
     embed.add_field(name="$cat", value="Gives a cute cat gif to lighten up the mood.", inline=False)
     embed.add_field(name="$info", value="Gives a little info about the bot", inline=False)
     embed.add_field(name="$help", value="Gives this message", inline=False)
     await bot.say(embed=embed)```
#

What is wrong?

#

I just try from await bot.say to edit in await ctx.send

#

But again, error

ruby dust
#

unauthorized to edit a message? never seen this before 🤔

#

are you sure you are trying to edit own message?

tardy hatch
#

Okay

#

Then

#

Unauthorized error i solved

#

But now

#

A command don t load

#

..

floral stone
#

@tardy hatch We first, you forgot to indent after async def cacazip(ctx):

#

or is it

#

I can't tell

static lynx
#

need someone to help with discord.py--

#

oh

uncut slate
#

remove the token and try again

#

also ffs reset it

static lynx
#

i was just gonna change the token afterwards

uncut slate
#

you are overestimating strangers on the internet smh

static lynx
#

/:

#

tbh its my bot, if something happens, its my fault. thank you though

#

anyways

#
Traceback (most recent call last):
  File "C:\Users\---\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\---\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 367, in invoke
    yield from self.prepare(ctx)
  File "C:\Users\--\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 345, in prepare
    yield from self._parse_arguments(ctx)
  File "C:\Users\---\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 304, in _parse_arguments
    transformed = yield from self.transform(ctx, param)
  File "C:\Users\---\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 212, in transform
    raise MissingRequiredArgument('{0.name} is a required argument that is missing.'.format(param))
discord.ext.commands.errors.MissingRequiredArgument: self is a required argument that is missing.```
#

i get that error

lament reef
#
2018-05-20T00:46:27.305074+00:00 app[worker.1]: { Error: ENOENT: no such file or directory, stat '/tmp/output-299708692129906692.PNG'
2018-05-20T00:46:27.305077+00:00 app[worker.1]:   errno: -2,
2018-05-20T00:46:27.305080+00:00 app[worker.1]:   code: 'ENOENT',
2018-05-20T00:46:27.305082+00:00 app[worker.1]:   syscall: 'stat',
2018-05-20T00:46:27.305085+00:00 app[worker.1]:   path: '/tmp/output-299708692129906692.PNG' }
gm(request(img))
            .flip()
            .magnify()
            .rotate('green', 45)
            .blur(7, 3)
            .crop(300, 300, 150, 130)
            .edge(3)
            .toBuffer('PNG',function (err, buffer) {
              if (err) console.log("!!!!!!!!!!!!!!!  " + err); return;
              process.env['output-' + message.author.id + '.buf'] = buffer.toString('utf-8');
              fs.writeFileSync('/tmp/' + name, buffer, function(err) {
                  if(err) {
                  return console.log(err);
                  }
                  message.reply("Success, reading file contents...");
              }); 
            });

Any help?

brisk notch
#

it says

#

there is not file or dir

#

@lament reef

lament reef
#

ik

#

but why

#

you see the line

#

@brisk notch

brisk notch
#

ye

lament reef
#

so?

brisk notch
#

idk

#

wait

dusty shuttle
#

i need help with discord.js

earnest phoenix
#

I can help a little.

#

So mind stating the problem?

frail kestrel
#

@ruby dust if you've sent a message in a channel and no longer have permission to send messages to that channel, you won't be able to edit any of your messages there

#

and @dusty shuttle whats your problem

#

if you dont state what you're having trouble with, we wont be able to help

verbal night
#

^

#

Well i mean, they are both offline @frail kestrel

#

or invisible

ruby dust
#

Oh I totally forgot about that too

frail kestrel
#

@verbal night aware

quasi raptor
#

why my python had stopped and BOT offlined when my computer is idle for several minutes?

solid cliff
#

any errors ¯_(ツ)_/¯

quasi raptor
#

but my computer is used in AC mode

#

and computer is set to never sleep

spring ember
#

Yeah somehow it always sleeps

#

I did that too

abstract crystal
#

does it go to blank screen too? or did you turn that off

spring ember
#

Is there a lib for a thing that you can restart your code like a boot manager for code in Java

abstract crystal
#

maybe this

spring ember
#

Java

abstract crystal
#

oh sorry idk

inner jewel
#

wdym restart your code

#

easiest way is killing the process and starting a new one

#

but that needs something else to start the process after it exits

spring ember
#

Yeah that's what I am looking for

ruby dust
#

is it possible to use a for loop, but exclude a specific object in the list?

spring ember
#

If x {continue}

slender thistle
#

That's python-related.

spring ember
#

Continue is also in Python

slender thistle
#

Ah.

ruby dust
#

oh yeah

icy lynx
#
/* Remove div height if user is using an adblock */
#cdm-zone-01:empty {
  height:0px !important;
}
#

^ CSS code to hide the div when the user is blocking ads

#

this does not remove the ads, just the div when it's empty (meaning the ad is blocked by an adblocker)

spring mesa
#

excuse me for the question: i have my own server, powered by my own bot, and said server has 30 members. is it against ToS to send a DM to everyone in there containing a google form for server feedback?

abstract crystal
#

it's not against the ToS to send a DM to everyone, but it is against the ToS to spam the API. For example if you send a message every few seconds you are fine, but if you are sending in 5 times a second is no ok.

#

Maybe doing @everyone would be better

slender thistle
#

Or a role ping, because people tend to suppress @everyone mentions.

spring mesa
#

i prefer individual messaging though

#

more like to be noticed

slender thistle
#

Gl with users who have DMs off. :^)

spring mesa
#

not many actually

#

or is DMing the users by myself actually illegal?

abstract crystal
#

nope

#

just don't use a selfbot

slender thistle
#

Use a userbot instead. GWrjkKappaLUL

spring mesa
#

i won't

abstract crystal
#

myselfbot

spring mesa
#

30 is not that many

abstract crystal
#

if it was only 30 members i'd do it with my bot, but wait 1 second between messages

spring mesa
#

👌

ruby dust
#

just don't mess up and end up DMing everyone in general

slender thistle
#

DM everyone from here.

earnest phoenix
#
hola
spring mesa
#
if(message.author.id !== '256460316660072448') return;
      
      
      for (i = 0; i <= message.guild.members.size; i++) {
        setTimeout(function(){ 
          message.guild.members[i].send('blah blah');
        }, 1000);
      }```
earnest phoenix
#

(node:19077) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toLowerCase' of undefined
warning.js:18
at new User (/media/shon/01D371210ADE0BE0/fs.js/node_modules/fortnite/src/User.js:13:73)
at /media/shon/01D371210ADE0BE0/fs.js/node_modules/fortnite/src/Client.js:61:24
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
(node:19077) 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: 1)
warning.js:18
(node:19077) [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.

glossy mason
#

Wouldn't that just schedule all of them to run after 1 second, and since the loop would complete quickly (since it doesn't wait for the timeout to complete before continuing on the code), they'd all happen at about the same time?

#

@spring mesa

spring mesa
#

right

#

i used settimeout instead of setinterval

#

right?

ruby dust
#

how do I get a link of an image embedded by a link in the message?

earnest phoenix
#

🤔

glossy mason
#

Yeah, but from what I recall, when you call settimeout it doesn't wait for the timeout to complete first. It will just set the inner function to run after 1 second, and continue with the loop not waiting that 1 second before continuing.

spring mesa
#

right

#

still it doesn't send

#
setInterval(function(){ 
          
          var i = 0;
          for (; i <= message.guild.members.size; i++) {
          console.log(message.guild.members[i]);
         
      }}, 1000);```
#

returns a lot of undefined

glossy mason
#

Is message in the scope of the inner function?

spring mesa
#

🤔

#

dunno

glossy mason
#

What do you get if you console log only message?

spring mesa
#

let me see

#

nothing seem to happen

#

not even an undefined

#

wait

#

i added a return to stop the madness

#

but the object is in fact present

topaz fjord
#

As far as I know you can't change a a variable

#

So it has to be let I = 0;

#

@spring mesa

spring mesa
#

idk

#

i can't seem to get it off

topaz fjord
#

Try let i = 0;

spring mesa
#

i give up

topaz fjord
#

Ok

spring mesa
#

i have no idea of how to do that wihout spamming the api

glossy mason
#

You can change a variable, that's why it's called a variable. var has been around forever, let is the new thing.

jolly mist
#
double neuron::eta = 0.15; // net learning rate
double neuron::alpha = 0.5; // momentum

 neuron::neuron(unsigned numOutputs, unsigned myIndex)
{
    for (unsigned c = 0; c < numOutputs; ++c) {
        outputWeights.push_back(Connection());
        outputWeights.back().weight = randomWeight();
    }

    m_myIndex = myIndex;
}

void neuron::updateInputWeights(Layer &prevLayer)
{
    for (unsigned n = 0; n < prevLayer.size(); ++n)
    {
        neuron &neuron = prevLayer[n];
        double oldDeltaWeight = neuron.outputWeights[m_myIndex].deltaWeight;

        double newDeltaWeight = eta * neuron.getOutputVal() * gradient + alpha * oldDeltaWeight;
        neuron.outputWeights[m_myIndex].deltaWeight = newDeltaWeight;
        neuron.outputWeights[m_myIndex].weight += newDeltaWeight;
    }
}

double neuron::sumDOW(const Layer &nextLayer) const
{
    double sum = 0.0;

    for (unsigned n = 0; n < nextLayer.size() - 1; ++n)
    {
        sum += outputWeights[n].weight * nextLayer[n].gradient;
    }

    return sum;
}

void neuron::calcHiddenGradients(const Layer &nextLayer)
{
    double dow = sumDOW(nextLayer);
    gradient = dow * neuron::activationFunctionDerivative(outputVal);
}
void neuron::calcOutputGradients(double targetVals)
{
    double delta = targetVals - outputVal;
    gradient = delta * neuron::activationFunctionDerivative(outputVal);
}

double neuron::activationFunction(double x)
{
    //output range [-1.0..1.0]
    return tanh(x);
}

double neuron::activationFunctionDerivative(double x)
{
    return 1.0 - x * x;
}

void neuron::feedForward(const Layer &prevLayer)
{
    double sum = 0.0;

    for (unsigned n = 0; n < prevLayer.size(); ++n)
    {
        sum += prevLayer[n].getOutputVal() *
            prevLayer[n].outputWeights[m_myIndex].weight;
    }

    outputVal = neuron::activationFunction(sum);
}
topaz fjord
#

@jolly mist whats the problem

desert bough
#

could someone help me with my discord.js bot, im trying to get the bot to do something when someone clicks a reaction on the msg

wanton needle
#

Hey, I need help with customizable prefix command (discord.js)

#

Please DM me if you can help

halcyon abyss
#

@spring mesa message.guild.members is a collection, not an, array

knotty steeple
#

@desert bough you could do awaitReactions

#

or ReactionCollector

abstract mango
#

maybe that'd be of use

desert bough
#

@abstract mango how would tha tbe used

abstract mango
#

do you have a on ready handler in your code?

desert bough
abstract mango
#

like whenever your bot starts up you get a message in your console that says 'ready' or similar

#

yeah like that

#

bot.on lets you handle events that the d.js client emits

#

the messageReactionAdd event is one of them

#

i'm not sure if it's reactions for all messages

knotty steeple
#

why u need it to be async tho thonkku

abstract mango
#

you should probably use samuraistacks's solution :p

wanton needle
#

Anyone know howda do a customizable prefix for diff servers?

earnest phoenix
#

messageReactionAdd is only for cached messages

knotty steeple
#

database

earnest phoenix
#

yes

#

database/some kinda storage system (e.g. json)

knotty steeple
#

i use json for now :v

desert bough
#

@knotty steeple could u explain awaitreactions to me

abstract mango
earnest phoenix
#

sure

#

PM me

knotty steeple
#

^ up there

abstract mango
#

there's a example here :^)

desert bough
#

thanks guys

earnest phoenix
#

PM me if ya like

abstract mango
#

np

knotty steeple
#

np

earnest phoenix
#

although there are examples on Docs

wanton needle
#

Rip me I guess

desert bough
#

guys im a little confused as to how its used can i pm someone to tell themn my exact predicament

knotty steeple
#

how to set watching status on a bot

#

discord.js

topaz fjord
#

nou

#

click PresenceData, then click ActivityType

knotty steeple
#

ok ty

desert bough
#

@abstract mango see the number, in the collection that is, is that milliseconds, seconds, minutes?

gilded blaze
#

isn't type 3?

abstract mango
#

uhh the collection in what? :p

topaz fjord
#

@desert bough its a number

#

just represents the type of status

abstract mango
#

yeah if you're referring to type that's just a number

desert bough
#

time

topaz fjord
#

game.type

abstract mango
#

oh

topaz fjord
#

that time is ms

abstract mango
#

the example says { time: 15000 })

#

i'm assuming ms

#

15000 ms = 15 seconds

spring ember
#

probably timestamp

topaz fjord
#

why would it be a timestamp

#

time in js is always ms

wicked atlas
#

dsa

spring ember
#

oh wait

#

nvm

desert bough
#

it doesnt seem to work tho

topaz fjord
#

if you put 1

#

then thats fast as fuck

#

1000 = 1 second

#

1 = 1/1000 second

spring ember
#

do 30000

#

just for testing

topaz fjord
#

i doubt you can react that fast

spring ember
#

I usually do 20s in these scenarios

desert bough
#

oh ok

desert bough
#

it doesnt appear to be working

storm sundial
#

I get that error

#

if (msg.author.bot) return;

#

There is the code

spring ember
#

author is undefined

earnest phoenix
gilded blaze
#

are you slow

#

just test it out

#

don't ask us

tardy hatch
#

Hello there

#

Anyone have a code for shutting down python bot from a command?

#

For example.. stop or shutdown

shy verge
#

I believe there's a method in the sys module that gracefully kills the process

#

Just call that in a kill command and there you go

#

sys.exit() I think

prime cliff
#

Yup

shy verge
#

wew

tardy hatch
#

Thanks

abstract mango
#

or you can use bot.logout like
await bot.logout()

#

it should exit that way as well

floral stone
#

does it kill the process though?

earnest phoenix
#

Ok, you know the 8 ball command?

#

I need the parameters to make the bot read what you're saying

shy verge
#

maybe

earnest phoenix
#

Like, the bot won't read d!8ball Are you orange

#

Because I dont have parameters

shy verge
#

language?

earnest phoenix
#

C#

#

Microsoft Visual Studio

shy verge
earnest phoenix
#

Yeah

shy verge
#

are you using the CommandService?

earnest phoenix
#

Yep

shy verge
#

You can use the Remainder attribute

#

so like in the method signature

#
public async Task EightBall([Remainder]string question)
earnest phoenix
#

So, like [Remainder] string text

shy verge
#

yes

earnest phoenix
#

Ok, thanks

shy verge
#

:D

earnest phoenix
#

Hello

solid cliff
#

hi

earnest phoenix
#

oof

night imp
#

Hello. Does anyone know how I would be able to make the image overlap the other content? My animation keeps bieng cut off by the container above it

frail kestrel
#

mm

night imp
#

relevant code:

  .bot-img img {
      border-radius: 50%;
      overflow: visible;
    animation: float 4s infinite alternate;
    animation-timing-function: ease-in-out;
  }
  @keyframes float {
          0% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
      100% {
          transform: translateY(5px);
      }
  }
frail kestrel
#

move it below where you're trying to place it?!

night imp
#

wdym?

#

nvm found answer

earnest phoenix
#

is it possible to use any databases with python, I'm more use to python and would like to see if I can get a DB for my bot

#

I wanna set like server prefixes and i wanna know how to do that

uncut slate
#

sure, there's tons of databases you can use with python

#

it's hard to recommend one database for you without knowing what your preference is or what you find simple, but googling gets you a long way

earnest phoenix
#

if it's a small bot or you can just use a .json file or something

#

medium bot maybe use sqlite

#

large bot postgres, mongodb, mysql, cassandra

#

but yeah, google and do your own research

uncut slate
#

I would advise against using json files as a database no matter the scenario, it's a pretty bad practice

earnest phoenix
#

I only use a .json for my bot's blacklist db

#

which is only updated like once every other week

elder rapids
#

You have to check on guild available / join though right?

#

Which means you need to constantly read the file (which is inefficient)

earnest phoenix
#

the blacklist? that's only for users

#

and there's only 12 users blacklisted so far

elder rapids
#

You'd still have to read it then on every message or something

earnest phoenix
#

I thought only excessive writes caused locking

#

reading a static file without writing shouldn't be that bad

#

on another note

#

just returns an empty array for me

elder rapids
#

Reading/Writing is both locking/has problems

#

Databases don't always read from files

#

So don't confuse it being how databases work. There's a reason databases exist instead of just purely reading/writing to a file

mental solstice
#

lol, i hope everyone uses queries properly too. sql injection is a real thing.. even the top guy in Bot Developers role being funny, which reminded me of it

worn sparrow
#

image y u so small

vale hedge
#

im getting better at discord.js

frail kestrel
#

ok is that development-related

fresh cedar
#

development of coding skills

earnest phoenix
#

Please Dm me the answer, like this (age, sex, answer). What would you rather, be deaf or blind?
or just tag me

austere meadow
#

@earnest phoenix not development related at all, and asking for age is just weird. keep that shit out of here unless you are conducting a proper survey (for whatever reason) and go to #memes-and-media

earnest phoenix
#

ok

#

its a legit survey

#

for math class

#

though XD

fluid basin
earnest phoenix
#

Hmm my bot got declined because glitch.com suddenly made my bot go offline

#

Any fix?

spring ember
#

Don't use glitch GWqlabsKek

#

Umm but seriously make sure the code runs correctly

floral stone
#

^

earnest phoenix
#

What should I use then @spring ember

spring ember
#

A normal vps

#

Like one from the pinned message

sinful lotus
#

do using require on every command used is bad?

floral stone
#

require?

sinful lotus
#

module.exports

#

something like
let command = require(command.js is here)

fluid basin
#

why is it bad Thonk

knotty steeple
#

if its repeated then get a proper command handler

sinful lotus
#

because guys on some discord server said that I should load the commands in memory first

floral stone
#

why not require it on the file rather than every command

sinful lotus
#

but Im having troubles because what exactly this load the commands in memory first

earnest phoenix
#

@earnest phoenix That the bot goes off and you have to turn on manual, right?

floral stone
#

is there any way to use phpmyadmin with a flask webserver?

#

or equivalent for it

fluid basin
#

PHPmyadmin

#

It uses PHP xD

#

Get a desktop client for MySQL or smth

shell blade
#

How do I send a DM to a specific user using their ID with Discord.js?

topaz fjord
#

Fetch the user

fluid basin
#

@shell blade javascript bot.users.get('mylittleID').send('Hallo');

topaz fjord
#

Send a message to that user

#

Why spoon-feed tho

shell blade
#

lol

fluid basin
#

¯_(ツ)_/¯

#

Cuz I feel like it

topaz fjord
#

No

#

Rule 7B

shell blade
#

I'm not really familiar with .get(), so I should probably learn that.

fluid basin
#

Actually surprised your bot has auto levelup messages xD

#

And it doesn't work as well

#

anyways

shell blade
#

Huh?

fluid basin
#

no not u

shell blade
#

Oh, sorry lol

#

Thanks for the help

fluid basin
#

nah its k

#

np

#

Remember to use the docs next time, they come in really handy

shell blade
#

I searched through it and couldn't find anything 😕

fluid basin
#

Basically a collection is an array with its ids mapped

shell blade
#

Okay, cool thanks.

#

And sorry for the late reply haha

halcyon abyss
#

@sinful lotus requiring when an user type a command can potentially do unintended stuff like $../random_file

#

In best cases bots crash

sinful lotus
#

@halcyon abyss yep I already fixed that

#

I did a require on boot of my bot
then put them in ram
then just get them from ram

So I dont need to do a require every command ran

shell blade
#

@fluid basin I'm getting this error when I try DMing myself:

- TypeError: Cannot read property of 'user' of undefined
knotty steeple
#

what ur code?

shell blade
#

One sec, I'll get it.

prime cliff
#

Sounds like user is not set

shell blade
#
const prefix = process.env.PREFIX,
      Discord = require('discord.js');

module.exports = {
    name: 'suggest',
    description: 'Suggest a feature for Translator directly to the developers!',
    aliases: ['sugg','s'],
    usage: `\`c>suggest <any ideas>\``,
    cooldown: 300,
    execute(message, args, bot) {
    args = message.content.slice(prefix.length).split(/ +/).splice(1).join(' ');
    
    if (message.author.id != '250811963334983683') return;
    return bot.users.get('250811963334983683').send(args);
    }
};
knotty steeple
#

can the bot dm you?

shell blade
#

Do you mean does it have permission?

knotty steeple
#

permission to dm you?

shell blade
#

Yeah

knotty steeple
#

so does it

shell blade
#

Yes, it does.

#

I just tried logging bot and it said undefined.

#

Ohh, I hadn't declared bot yet lol.

floral stone
#

@fluid basin I understand the php in the name. I'm looking for a server client like phpmyadmin but with flask rather then a desktop client.

#

or a hacky way to use phpmyadmin with flask

spring ember
#

Phpmyadmin probably is not the way with flask

floral stone
#

then what is?

spring ember
#

Umm you want a manager type of program for flask?

#

It's just an SQL manager

#

Use MySQL client for windows

floral stone
#

I don't have windows

#

I don't want to use a desktop client

spring ember
#

So MySQL client for Linux or Mac

#

Do what do you want

#

So*

#

You can make an api

floral stone
#

I just said earlier

#

what I wanted

spring ember
#

Umm you can host phpmyadmin server probably

floral stone
#

I tried doing it on another port via nginx but php just won't work

spring ember
#

Then make it work

#

Wtf

floral stone
#

I wouldn't be here if it was working

earnest phoenix
#

cooldown on command.. hmm

#

how do I do that?

#

like the way I can fix it in like 10 min*

prime cliff
#

Pretty easy just use datetime and compare it

knotty steeple
#

there is an example on an idiots guide ;p

floral stone
#

d.py has cool downs as well

knotty steeple
#

but yea what builder said

earnest phoenix
#

oh, wheres that idiot guide @knotty steeple ? XD

knotty steeple
earnest phoenix
#

thx mate 😃

earnest phoenix
#

no

quiet bobcat
earnest phoenix
#

anyone know why READ_MESSAGES is deprecated?

restive silo
#

use VIEW_CHANNEL instead

earnest phoenix
#

thank you

desert bough
#

could someone hmu with some help via dms, Discord.JS bot please and thank yous

topaz fjord
#

Ask the question here and someone will help you

desert bough
#

how can i make my bot do an event when a reaction is added to a msg

earnest phoenix
#

so ah need halp

topaz fjord
#
#

The top is for doing it with css and the bottom is for doing it with html @earnest phoenix

lament reef
#

How to get a guild by name? (Not by ID)

#

discord.js

spring ember
#

I don't think there is a way without iterating over the map, but you shouldn't fetch by name

halcyon abyss
lament reef
#

what?

#

how does that get users who reacted with an ❌ emoji?

spring ember
#

Tonkku has voted!!!

#

also you should do check

lament reef
#

what?

#

me?

#

?

spring ember
#

no

#

you use a webhook

#

ok

#

how do you store the data?

#

votes

lament reef
#

Okay how do you create a reaction collector (discord.js)? This code doesn't work:

var msg = null;
message.reply("Hello").then(m => msg = m);
setTimeout(function(){
msg.react("❌");
message.createReactionCollector((reaction, user) => reaction.emoji.name === '❌' && user.id !== client.user.id, { time: 60000 }).on('collect',  console.log);
}, 1000);

(Not real code, just for test purposes but still, it doesn't work.)
node.js (discord.js)

earnest phoenix
#

how to make bot to not reply with other bots

#

😕

lament reef
#

if (!message.author.bot){}

#

@earnest phoenix

inner jewel
#

if(bot) return

ruby dust
#

depends on the language

lament reef
#

does anyone know?

earnest phoenix
#

p y t h o o n

#

*python

ruby dust
#
@bot.event
async def on_message(message):
    if message.author.bot:
        return

    await bot.process_commands(message)

add this peace of code into your main file

earnest phoenix
#

thanks deivedux

ruby dust
#

on discord?

lament reef
#

for anime @earnest phoenix?

spring ember
#

weebhook GWqlabsMmLol

earnest phoenix
#

@lament reef did you got it to work? I can help you if not

lament reef
#

nope

#

please help

#

@earnest phoenix

earnest phoenix
#

bot reacts but nothing happens when you react?

lament reef
#

yes

spring ember
#

send code

earnest phoenix
#

you are creating the collector on the received message

#

but you are reacting on the reply

#

xD

#

anyway I'd suggest you drop timeout because its not proper way to handle promises, either use then nesting or better await

#

@spring bone

mental solstice
#

you can set the background color as transparent?

spring bone
#

;-;

earnest phoenix
#
body {
  background-repeat: no-repeat;
  background-size: cover !important;
  background-attachment: fixed !important;
  background-image: url("link") !important;
}
</style>```
#

use that

#

@spring bone

spring bone
#

Oh...

#

Ty

earnest phoenix
#

👍

spring bone
#

If i want a color hexadecimal i set background-color yeah?

#

@earnest phoenix

#

(sorry for the ping)

mental solstice
#

yes

earnest phoenix
#

yes

spring bone
#

ty

earnest phoenix
#

👍

mental solstice
#

Mascu, idk which buttons youre having issues with, but you can set them to have transparent backgrounds

earnest phoenix
#

@mental solstice sad

mental solstice
#

?

earnest phoenix
#

You do not know how to do that?

#

ripp

mental solstice
#

im not sure what youre saying lol

mental solstice
#

you want the background of those to be white

#

?

earnest phoenix
#

The background is done, what is missing is that I want to change the color of the letters to white

mental solstice
#
.bot-stats {
  color: white;
}
earnest phoenix
#

ok

#

i try

#

no working

mental solstice
#

#bot-stats p {

#

sorry

earnest phoenix
#

ok

mental solstice
#

might have to put !important

earnest phoenix
#

in?

#

?

mental solstice
#

#bot-stats

earnest phoenix
#

?

#

replace . with #

#

ok

#

try

#

no works

topaz fjord
#

Inspect element is always a thing :^)

earnest phoenix
#

yeah

topaz fjord
#

Also

#

It's not

#

White; !important;

#

it's white !important;

earnest phoenix
#

ok

#

awh

#

yeah

#

now working

#

thank you

#

@topaz fjord

topaz fjord
#

np

elder rapids
#

#ffffff > white

earnest phoenix
#

^

#

one question

topaz fjord
#

@elder rapids ur #fff

elder rapids
#

No u

earnest phoenix
elder rapids
#

You're #ff0000

earnest phoenix
#

or no?

#

why would ya want to

#

wtf

elder rapids
#

Idk why not give error

earnest phoenix
uncut slate
#

? true : false pls no

topaz fjord
#

Also wtf

mental solstice
#

@earnest phoenix u cant change the color of an image with css.. but you can change the color of the text below it

topaz fjord
#

So much embeded if else

earnest phoenix
#

how should I do then?

mental solstice
#
.titleandvote {
   color: white !important;
}
topaz fjord
#

@earnest phoenix you can do message.guild.ownerID

#

To find the owners id

#

But that's besides the point

earnest phoenix
#

inspect the webpage

topaz fjord
#

The only way to change the icon is to manually change the image color

earnest phoenix
#

whats the problem with? true : falsewhat should I use instead?

#

see what class/id it is then ask for help on css here

mental solstice
#

what browser are u using Mascu?

earnest phoenix
#

firefox

#

quantum

#

hmm

#

btw I love you @topaz fjord you helped me so much XD

shy verge
#

gae

earnest phoenix
#

(no homo lmao) XD

topaz fjord
#

How tho

#

I just gave one thing zoomeyes

earnest phoenix
#

chill yo I aint gay XD

#

Ye

#

It fixad 15 problems and errors lmao

#

whipping out the big XDS

topaz fjord
#

Well then

#

But im still confused how a guild has no owner

earnest phoenix
#

yes

#

that was my big fkn problem

topaz fjord
#

lmao

uncut slate
#

@earnest phoenix if you think about it, ? true : false adds absolutely nothing

#

instead of condition ? true : false you can just do condition

#

if you really need a boolean out of it, you can Boolean(condition), but you probably don't

knotty steeple
#

ternary operators Thonk

shy verge
#

ternary operators are good if you aren't a retard about them

topaz fjord
#

@earnest phoenix I see why .user of owner is undefined

#

It's because the guild owner isn't cached

earnest phoenix
#

yes

#

now it finds guild oner

#

which it didnt befor

#

(meme == true ? true : false)

#

ultimate meme

shy verge
#

oh yes

tardy hatch
#

Hello

#

How to make python bot to send a mesaage in dm?

#

For example:

shy verge
#

a user is also a channel, just do user.send

#

unless py works differently

tardy hatch
#

await self.bot.say('Check DM.')

#

And

#

to say in dm one more message