#development

1 messages · Page 585 of 1

inner jewel
#

retrying won't help

#

a single connection can only handle 2500 guilds

#

more than that and you need to increase the number of connections

bleak dawn
#

thanks!! can you point me to a place to explain how to do that? We are using node.js and discord.js

inner jewel
bleak dawn
#

@inner jewel thanks so much!

fiery quest
agile orchid
#

make a task

#

i can send u a example

fiery quest
#

would be amazing!

agile orchid
#
async def status_task():
	while True:
		await client.change_presence(game=discord.Game(name=""))
		await asyncio.sleep(10)
		await client.change_presence(game=discord.Game(name=""))
		await asyncio.sleep(10)
		await client.change_presence(game=discord.Game(name=""))
		await asyncio.sleep(10)

@client.event
async def on_ready():
	client.loop.create_task(status_task())
 ...```
#

this is for 3 different statuses

fiery quest
#

if i want every 30 minuts i have to put asyncio.sleep(1800) right? btw thank u so much!

agile orchid
#

60*30=1800

#

yep

amber fractal
agile orchid
#

GWmythiFeelsBannedMan me

#

oof

ruby dust
#

if you want to change status frequently, it's recommended to use at least 1 minute as an interval

earnest phoenix
agile orchid
#

brb

fiery quest
#

@ruby dust got it! ty

agile orchid
#

k i'm back

lost cove
#

I really don't understand what this means, could someone enlighten me on what I need to do to resolve this?

agile orchid
#

Your Help command doesnt show up the commands of this bot

#

i think

lost cove
#

Like a commands list?

#

I have them separated by category through another command because there are so many it would be too much text to write in one cmd

rustic grove
#

Make it so it sends it in separated messages?

amber fractal
ruby dust
#

then rip me and my spotify timeline

amber fractal
ruby dust
#

I tend to skip a lot of songs, and jump to a lot of places of them

amber fractal
#

rip

fiery quest
#

anyone know if there's any way to send personal emojis on other discord server? from a bot obv

amber fractal
#

Bots can send emojis from any guild

fiery quest
#

yep, but i have on my discord my personal emojis, like python one, and if i want my bot send it on other servers, is it possible, sorry for the syntax

#

is it possible?*

earnest phoenix
#

Yes

fiery quest
#

how?

earnest phoenix
#

What languages do you speak? @fiery quest

fiery quest
#

italian

earnest phoenix
#

Oh shit

fiery quest
#

lol

earnest phoenix
#

I dont understand everything in english

#

But you want to say a specific emotes in a guild?

#

With your bot

inner jewel
#

bots can send any emotes from any guilds they're in

#

as long as it's in a DM or a channel they have external emoji permission

fiery quest
#

@earnest phoenix yes

earnest phoenix
#

@fiery quest do \:emojiname:

inner jewel
#

\:emojiname:

earnest phoenix
#

yes

fiery quest
#

@inner jewel yeppa, ty

#

thank you so much guys!! 😄

modern sable
#

so the main function of a C# windows form has a dynamic tournamentObject variable which i need to put into a function that executes on a button click

but for some reason i'm unable to figure out how to do this drinkblob

slim heart
#

is there a way in php to have it like .com/place/THING..
where THING could be like an id or usernames and then said thing is turned into a js variable or just something i can use to set as data from an endpoint using that /THING as a param etc. u get the point, i know you can do things like place.php?id=etc or what i have right now is /place/#id but im curious if theres a way to do it just like /place/THING/ (obv without having each id as its own seperate file which'd be dumb.) i dont even know what its called so if someone can tell me aswell that'd be nice but also i just want to know if its even possible in php since it is a scripting thing right? so, there should™ be a way..

earnest phoenix
#

i literally got none of that

#

you want to have a rest api?

inner jewel
#

using path parameters in php

slim heart
#

tysm

junior summit
#

wot

#
                ^

TypeError: Cannot read property 'setActivity' of null
    at Timeout.client.setInterval [as _onTimeout] (C:\Users\chill\Desktop\chill\discord-bot\bot.js:44:17)
    at ontimeout (timers.js:436:11)
    at tryOnTimeout (timers.js:300:5)
    at listOnTimeout (timers.js:263:5)
    at Timer.processTimers (timers.js:223:10)```
#

wot

bright spear
#

you're probably on a really old version of discord.js

junior summit
#

how to upgrade

bright spear
#

for stable npm i discord.js should work ig

junior summit
#

k

#

k

#

still being dumb

lilac geyser
#

am i right to say that, if the bot has manage channels, it can see all categories regardless?

earnest phoenix
#

Can someone tell me how to fix this code? I got problems on from snekfetch to node-fetch.

const request = require(‘node-fetch’);

return request(url, {

    method: 'GET',

    headers: {

      Accept: 'text/html, text/plain, text/sgml, text/css, application/xhtml+xml, */*;q=0.01',

      'Accept-Encoding': 'gzip, compress, bzip2',

      'Accept-Language': 'en',

      'User-Agent': 'Lynx/2.8.8rel.2 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/1.0.2l'

    },

      get 'Set-Cookie'() { return setCookie; },

    })
#

What’s the other thing

#

what other thing?

#

url is a google image search url

#

don't scrape google

#

you'll easily get ip banned

#

scrape duckduckgo which allows it

mossy vine
#

is there a way to do this more efficiently? i only want to add "And more..." if elements of the array needed to be removed

naive gull
#

Is this only for js?

mossy vine
#

yes

naive gull
#

Oof

mossy vine
#

i mean, this method works but its kinda ugly so i want to know if anyone has a better solution for it

terse pier
#

Is there any way how to catch timeout exceptions in discord.py without shutting off the bot?

vapid rune
#

idk about php but my guess is you'd probably need a ?id=value sort of thing still

#

wow

#

i didn't scroll down again

late hill
#

@mossy vine You could avoid the while loop by using slice?

#

or splice

#

idk anymore

mossy vine
#

yes, but i want as many entries as possible

late hill
#

ree

mossy vine
#

thats why the while loop is needed

late hill
#

Surely there's a way to remove from -> to

#

?

mossy vine
#

yes, array.slice(from, to)

#

or splice

#

i dont remember what i used before

late hill
#

It's splice

mossy vine
#

but i want to allow as many entries as possible, as their length can vary a lot

late hill
#

You can remove starting at index 1000

#

Till the length of the array

#

-1

mossy vine
#

that didnt work

late hill
#

oof

mossy vine
#

but i want as many entries as possible, which is what the code does, but its ugly

late hill
#

Then add the push thing to that

#

As it will only be executed if it had to remove something

#

Like you asked

#

?

mossy vine
#

but the thing is

#

i dont know what max would be

#

as entries can vary between 50 to ~200 characters

late hill
#

In your example max is 1000

#

?

mossy vine
#

no, in your example max is 2
in my code max is however many fit in the embed

late hill
#

In the code you showed it's hardcoded as 1000 no?

mossy vine
#

1000 is the number of characters that fit in the embed field

#

but i dont know how long an entry is

late hill
#

What is manuals

mossy vine
#

if an entry is 600 characters, hardcoding 2 to fit is too much

late hill
#

An array of strings

#

?

mossy vine
#

yes, and the string lengths vary between 50 and 200-300 characters

late hill
#

Oh right

#

I see

mossy vine
#

so hardcoding a number of manuals to fit wouldnt work

late hill
#

hmm

mossy vine
#

thats what my code does

#

but its ugly

late hill
#

😂

#

Without the var

mossy vine
#

no xd

#

i might just keep this as meme code tbh

late hill
#

🤷

#

😂

keen sundial
#

guild.owner for this server return undefined....

#

help?

late hill
#

Because the owner isn't cached

keen sundial
#

some bots show the owner name..

late hill
#

Yeh

#

You can cache all users

topaz fjord
#

But why

late hill
#

Or probably get the id somehow

#

And then get the user with that

keen sundial
#

hmmmm

#

wouldnt it take time time cache 39k users?

late hill
#

Yes

#

Better not to

keen sundial
#

so it is better to let my bot show undefined...

#

thanks!

late hill
#

No

keen sundial
#

oh?

late hill
#

Check the docs for your library

#

There's most likely a way

#

To get the id of the owner

keen sundial
#

.ownerID

late hill
#

yes

keen sundial
#

i tried that

#

it just returned an error

late hill
#

what error

keen sundial
#

ill try it again

#

const owner = await message.guild.members.get(message.guild.ownerID);

#

it does not return error

#

just undefined

late hill
#

client.users.get

#

?

keen sundial
#

mmmmm

coral trellis
#

What lib are you using?

keen sundial
#

ill try find

#

discord.js

coral trellis
keen sundial
#

ownerID exists

late hill
#

It's ownerID in Eris 😩

keen sundial
#

wait a sec

coral trellis
#

No it exists in discord.js as well

keen sundial
#

yes

#

checked in documentation

iron coral
#

Wesley how long did ur bot get approval?

coral trellis
#

So when you use the get function it grabs it from cache and most likely the owner isn't cached

late hill
#

3 days aghits

#

does discord.js have

#

restmode

#

getRESTUser

#

👀

keen sundial
#

so only way i can display the owners name in this bot is by cacheing all members?

iron coral
#

Priyanth how long did ur bot get approval?

keen sundial
#

i dunno a week ago or something

#

maybe more

#

why?

marble needle
#

it takes up to a week would you mind not interrupting development discussions with offtopic

iron coral
#

So long

coral trellis
#
const owner = message.guild.members.get(guild.ownerID)
message.channel.send(owner ? owner : "Can't get owner")
#

You can do it this way

#

If you want you can add the member to cache

keen sundial
#

okay

coral trellis
#

Which I don't suggest cause discord.js is already ram heavy in terms of their caching system

keen sundial
#

thanks

dull bobcat
#

[ PY ] Help? :
[main.py]:

names = json.loads(open('names.json'.names).read())
emails = json.loads(open('emails.json').read())

for name in names:
    name_extra = ''.join(random.choice(string.digits))
    email_chosen = ''.join(random.choice(emails))
    username = name.lower() + name_extra + email_chosen
    password = ''.join(random.choice(chars) for i in range(8))

[names.json]:

{
  "names": [
    "Liam",
    "Noah",
    "William"
    etc...
   ]
}

Error:

Traceback (most recent call last):                                                                                        File "scam.py", line 12, in <module>                                                                                      names = json.loads(open('names.json'.names).read())                                                                 AttributeError: 'str' object has no attribute 'names'
vapid rune
#

remove .names

#

a file wouldn't have anything like that

dull bobcat
#

well that doesnt work either

vapid rune
#

._.

dull bobcat
#

this is the output

slender thistle
#

open('names.json'.names) is wrong

dull bobcat
#

ok

#

ok i get it

#

but then how do i get the all the names inside of the names array?

slender thistle
#

You need to open the file itself first

dull bobcat
#

Ok?

#

and then?

slender thistle
#

aka don't use .names on that string

earnest phoenix
#

names is the json object itself

dull bobcat
#

oh ok

earnest phoenix
#

you need to call names once more to have it return your array

dull bobcat
#

hmm

#
names_file = json.loads(open('names.json').read())
names = json.loads(open('names').read())
vapid rune
#

when you use open() on names.json, it should bring back string

dull bobcat
#

something like this?

earnest phoenix
#

read your code

vapid rune
#

then json.loads makes it a dictionary :3

earnest phoenix
#

and understand what you have just written

slender thistle
#

Tbh you should .close() the files later or use context manager

dull bobcat
#

why?

slender thistle
#

Limit on opened files in memory

dull bobcat
#

@vapid rune names = json.open('names').read()

#

something like this?

slender thistle
#

Wrong

earnest phoenix
#

no

#

read what you have just written

dull bobcat
#

hmm

#

i am 🤔

vapid rune
#

go through the steps of what you need your code to do

#
names_file = json.loads(open('names.json').read())
names = json.loads(open('names').read())

is probably the closest to correct

dull bobcat
#

open the names file

#

then read the array

vapid rune
#

mhm

dull bobcat
#

yeh. idk how to.

vapid rune
#

make it print names and names_file

#

you can see where you went wrong maybe

dull bobcat
#

names is not a file or a directory

#

so

#

open() wont work.. i guess

#

json.loads(read('names'))?

slender thistle
#

Will work

#

You're just doing it not the right way

dull bobcat
#
names_file = json.loads(open('names.json').read())
names = json.loads(open(names_file).read('names'))
#

?

slender thistle
#

You've been sent the code needed, but I would recommend using context managers later anyway

#

Using open on a dict

#

meh

vapid rune
#

you already read names.json

slender thistle
#

Google how to work with dicts and open files in Python

dull bobcat
#

...

slender thistle
#

json.loads(open(names_file).read('names'))

#

Do you see anything wrong?

dull bobcat
#

not in my eyes no

slender thistle
#

Alright

vapid rune
#

oh wait

#

you tried to read 'names' as json but before json could even parse it

slender thistle
#
  1. names_file is a dictionary already.
  2. You are doing open() on that dictionary.
  3. read() takes no args.
vapid rune
#

^

dull bobcat
#
names = json.loads(open('names.json').read())
print(names['names'])
```?
slender thistle
#

Now that's better

#

Yes

vapid rune
#

yes

#

works

dull bobcat
#

Ty guys

vapid rune
#

yw

dull bobcat
#

Anything else you guys can suggest me with my code?

#
import requests
import os
import random
import string
import json

chars = string.ascii_letters + string.digits + '1234567890'
random.seed = (os.urandom(1024))

#url = ''

names_file = json.loads(open('names.json').read())
names = names_file['names']

emails = json.loads(open('emails.json').read())

for name in names:
    name_extra = ''.join(random.choice(string.digits))
    email_chosen = ''.join(random.choice(emails))
    username = name.lower() + name_extra + email_chosen
    password = ''.join(random.choice(chars) for i in range(8))

    #requests.post(url, allow_redirects=False, data={ 'asd': username, 'asd': password })

    print('sending username "%s" and password "%s"' % (username, password))
slender thistle
#

Context manager

dull bobcat
#

What is that?

slender thistle
#
    with open('names.json') as some_var:
        # do stuff
dull bobcat
#

wha..

slender thistle
#

Seriously, why don't you Google context managers in Python

slender thistle
#

There are many examples out there as well as explanations on the Internet

dull bobcat
#

ok ty

pallid zinc
#

Where to get loco api

fiery quest
#
def getInfo(name):

    address = "https://ow-api.com/v1/stats/pc/global/%s/profile"%(name)
    response = requests.get(address)
    data:Dict[str, any] = json.loads(response.content, encoding = "utf-8")

    if response.status_code == 404:
        embed = discord.Embed(title = ":slight_frown: Account not found. Please try again!", color = 0xFF0000)
        return embed

    elif response.status_code == 403:
        embed = discord.Embed(title = ":slight_frown: An error occurred. Please report it to the developer by typing `!owbug`")
        return embed

    return data

ERROR:
Ignoring exception in on_message
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/discord/client.py", line 307, in _run_event
    yield from getattr(self, event)(*args, **kwargs)
  File "/Users/davide/Desktop/Bots Online/OverBot/OverBot.py", line 334, in on_message
    data = getInfo(player)
  File "/Users/davide/Desktop/Bots Online/OverBot/OverBot.py", line 32, in getInfo
    data:Dict[str, any] = json.loads(response.content.decode("utf-8"))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)```
#

can someone help me? i dont understand why im getting this error

pallid zinc
#

Js

slender thistle
#

First of all, I would like to mention that requests is blocking

#

Use aiohttp for HTTP requests instead

pallid zinc
#

How to get loco api

slender thistle
#

loco API? WaitWhat

fiery quest
#

but i'm using the same method with another api (apex legends one) and it works perfectly, and i know why, if i analyze the json on my browser, in apex api i can see that there is "content-type application/json; charset=utf-8" while in overwatch one is equals but without utf-8, and i dont know what to do, sorry for the syntax, lol

pallid zinc
#

Thanks

slender thistle
pallid zinc
#

Lol

fiery quest
#

@slender thistle i'll try, thanks fot the help!!

slender thistle
#

Now, this is weird

dull bobcat
#

@slender thistle Hey can you help me with one thing?

slender thistle
#

Which is?

dull bobcat
#

so

#

my code

#

Everytime i run this code

#

The emails are in the same order

#

How can i make that the names for the emails always changes?

fiery quest
#

@slender thistle Maybe I expressed myself badly. Normally with the method of requests it works, but occasionally, that error occurs at random, and i dont know why

slender thistle
#

@dull bobcat What's the order of keys in that dict do you get?

dull bobcat
#

What?

slender thistle
#

@fiery quest Probably API fucking itself up RenShrugGif

#

How does the dict look

dull bobcat
#

everytime i run the code, the accounts have the same name order as the json EVERYTIME

fiery quest
#

@slender thistle same things that i thought too, lol. And what can i do? maybe an exception with an error message?

dull bobcat
#

but i wanna change so the names are random

slender thistle
#

Yeah, an error message would work, I believe. Just hope your users won't start hating you for unknown reasons :p

dull bobcat
#

welp?

slender thistle
#

I mean, that's normal

dull bobcat
#

?

slender thistle
#

Order of dict won't always change

dull bobcat
#

Yeah ik

#

But how do i make it random

fiery quest
#

@slender thistle yeah, i hope too lol

vapid rune
#

make it into an array?

slender thistle
#

Tbh idek why you are bothering yourself about that

dull bobcat
#

random.choice(names) is not working

#

help?

vapid rune
#

maybe if you get the actual value of name_of_dict['names'] and turn it into a list

#

it might work

fiery quest
#

@slender thistle thanks, again!

dull bobcat
#

how?

#

like

#
names_file = json.loads(open('names.json').read())
names = names_file['names']
names_list = [
    names
]
#

?

vapid rune
#

names_list = names

#

wait what

#

idek

dull bobcat
#

..

vapid rune
#

you already turned names into a list

pallid zinc
#

Yup

dull bobcat
#

so

#

how can i get the names random?

vapid rune
#

random.choice(names) should work man

dull bobcat
#

i do that

#

but guess what

#

it just outputs the first character of the name

vapid rune
#

send the code

dull bobcat
#
names_file = json.loads(open('names.json').read())
names_list = names_file['names']
names = random.choice(names_list)
vapid rune
#

that picks one random name from the whole list

#

and sets that as name

dull bobcat
#

wha

#

you told me to do like this though

vapid rune
#

does random.choice work?

dull bobcat
#

yes?

#

what are you on?

vapid rune
#

python

#

anyway im using the interpreter in the command prompt

#

but it should be the same

#

what do you actually want to do with the list of names?

dull bobcat
#
{                                                                                                                           "email" : "x42@hotmail.com",                                                                                            "password" : "AMLRO9ty"                                                                                             }
#

This is the output i get when i use random.choice()

#

this is the output i expect to get

#
{                                                                                                                           "email" : "jaxx97@gmail.com",                                                                                           "password" : "mLWM4qeF"                                                                                             }
#

Which i get when i dont use random.choice()

#

but, then the names are in the same order everytime

vapid rune
#

??????????????????????

dull bobcat
#

?

vapid rune
#

i am not sure how at all

dull bobcat
vapid rune
#

ik

dull bobcat
#

How do i get the full name?

vapid rune
#

i'm not sure what your python installation is smoking, because if i do random.choice(names) it gives me the full name

#

thjis has entered the chat

zenith jetty
#

xD

dull bobcat
#

Where do you put that though?

#

this is my code

#

this is my output

zenith jetty
#

If i edit a message in a channel, my discord.js bot wil nicely log the old and new message in a embed to a log channel. But if I post a message, wait 30 seconds and the edit it, my bot wil crash with RangeError: RichEmbed fields cannot be empty. How do i fix this?

dull bobcat
#

Cooode?

vapid rune
#

maybe remove . digits, i've never seen that but it looks like you're selecting part of the name @dull bobcat

sinful lotus
#

@zenith jetty It means dont leave Embeds Empty

#

if you ask what part of code

#

unfortunately those kind of errors are "manual tracking"

#

you gotta skim the code yourself and find it

dull bobcat
#

@vapid rune but the digit has nothing with the names to do?

zenith jetty
#

If i post a msg and immidiatly edit it, it wont give an error

#

Sorry for my bad english 😂

vapid rune
#

what is it like without .digits?

dull bobcat
#

Where?

sinful lotus
#

things will be different if you dont instantly edit it

vapid rune
#

oof typo

dull bobcat
#

where though?

vapid rune
#

if you do string instead of string.digits does it work?

zenith jetty
#

@sinful lotus i will console.log it and see what's the problem

dull bobcat
#

@vapid rune But those has nothing with the name to dooo

zenith jetty
#

I only pass newMsg.content thru to my embed though

dull bobcat
#

@vapid rune

pallid zinc
#

Lol

vapid rune
#

.__________.

#

i realised that when i looked again

#

i think names = random.choice(names_list) is the problem

dull bobcat
#

how..

vapid rune
#

it's taking a name from names_list, so that when you need to pick a random name, it actually picks a random character from a name

pallid zinc
#

Yup

dull bobcat
#

oh..

#

so..

#

how tf do i change that...

#

👀

vapid rune
#

remove that line

dull bobcat
#

ok

#

what now.

vapid rune
#

change for name in names: to for name in names_list:

#

does it work?

dull bobcat
#

yes but thats what ive been trying to change in the last hours

#

and what i have been saying the whole time

#

that send the names in the same order

#

i want the names to be randoooom

vapid rune
#

ahhhh

#

one problem to another we can get through this

dull bobcat
#

xD

vapid rune
#

then put name = random.choice(names_list) in the for name in names: statement

#

because then it picks a random name for every name in the list

dull bobcat
#

Works way better

#

Thanks sir

#

Wait

#

Is it possible that it picks same name twice?

vapid rune
#

it can

dull bobcat
#

how do i prevent it from doing that?

vapid rune
#

idk

#

there's so many names

#

that the chance is even smaller

#

so i think it would be minor

merry stirrup
vapid rune
#

calling all node bois and gorls

merry stirrup
#

?

dull bobcat
#

what is path and newV defined as?

merry stirrup
#

it's a function
update(message.guild.id, "settings.botPrefix", "?")

#

it's in a message event

#

@dull bobcat sorry for ping but do you maybe know it?

quartz kindle
#

Maximum call stack size means its stuck in an infinite loop

#

I cant pinpoint the origin from just that code, maybe is some weird behavior thats less obvious

vapid rune
#

man like tim with the diagnosis

earnest phoenix
#

@earnest phoenix

#

@modern peak

#

/ping

#

/eval

amber fractal
#

Pong! Latency: 2400000ms

earnest phoenix
#

question for lavalink. I tried to play a playlist and i console logged it and it came up with this. But it says selectedTrack: -1. Why is that?

inner jewel
#

you can ignore that

#

it just means no track was selected

earnest phoenix
#

but i only plays the first song of the playlist

#

not the whole playlist

inner jewel
#

tracks is an array of tracks

#

selectedTrack doesn't mean anything for playback

mossy vine
#

so i have 2 textareas in my html, one of them has the id input and the other output but i cant change their content with javascript. i tried setting .value and .innerHTML, but neither of them work. output is readonly, but input doesnt work either

#
var $ = document.getElementById

document.onload(function() {
    $('input').innerHTML = 'hi'
})
#
    <div><textarea class="field" id="input"></textarea></div>

    <div><p>this is text</p></div>

    <div><textarea class="field" id="output" readonly></textarea></div>```
earnest phoenix
#

are you sure that you even fetch the element properly

mossy vine
#

It works on the other elements if i give them ids

inner jewel
#

innerText?

quartz kindle
#

If you have ids, you dont need getelementbyid

#

input.innerText = "bla"

earnest phoenix
#

``` let lastDaily = await db.fetch(lastDaily_${message.author.id})
try {
db.fetch(account_${message.member.id}).then(bucks => {
if(bucks == null || 0){
db.set(account_${message.member.id}, 50)}

else if (lastDaily !== null && cooldown - (Date.now() - lastDaily) > 0) {
    let timeObj = ms(cooldown - (Date.now() - lastDaily))``` cannot read property 'then' of null
mossy vine
#

@inner jewel @quartz kindle neither of those work

#

and yes, the javascript file is requirerd

inner jewel
#

setting innerText works for me

mossy vine
#

actually nevermind

#

it doesnt load Thonk

#

nevermind, its working now

#

but its window.onload im stupid

#

and now im going to be arrested

#
var $ = document.getElementById

while(true) {
    $('output').innerText = $('input').innerText
}```
#

nevermind i think i know whats going on

#

nevermind

#

illegal invocation

#

reee

inner jewel
#

document.getElementById.bind(document)

#

or just remove var $ = document.getElementById

#

also that won't work

#

not only will it kill your cpu but also block rendering

mossy vine
#

so how would i set output to the same text thats in input?

#

in the future i also want to do things with input, then generate an output based on that

inner jewel
#

oninput

mossy vine
#

?

inner jewel
#

input.oninput = () => output.innerText = input.innerText

mossy vine
#

it says input is not defined

inner jewel
#

don't just copy paste

mossy vine
#

i didnt copypaste, i typed what you sent with (function(){}) instead of arrow function

#

angery

#
document.getElementById('input').oninput(function(){
    document.getElementById('output').innerText = document.getElementById('input').innerText
})
#

okay here is what i have now

#
<div><textarea class="field" id="input" oninput="yeet()"></textarea></div>```
#
var $ = document.getElementById

function yeet() {
    $('output').innerText = $('input').innerText
}
#

the $ obviously works

#

but i get illegal invocation

inner jewel
#

stop trying to fake jquery

mossy vine
#

if i use another character will you accept it

inner jewel
#

no

mossy vine
#

its shorter, and just the id doesnt work

inner jewel
#

the issue is whatever = document.getElementById; whatever() will never work

mossy vine
#

why the hell does it work in nodejs but not in browser

#

wat

quartz kindle
#

Why do you even need getelementbyid?

mossy vine
#

because just typing input.blabla doesnt do anything

#

and right now its still not working

#

and i have no idea why

quartz kindle
#

Try console.log(input)

mossy vine
#

that works Thonk

inner jewel
#
class X { y() { console.log(this); } }
const x = new X();
const f = x.y

x.y();
f()```
#

try this in node

#

and you'll se how """it works in node"""

mossy vine
#

but doing input.innerText does nothing

quartz kindle
#

Im on the phonr so i cant test, but either that or value should work

mossy vine
#

okay there we go, its working with value

#

thanks!

quartz kindle
#

Open the console, tyoe something in the textarea, and test your code there

earnest phoenix
#

how's this as a basic bot code:

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

client.on('ready', () => {
  console.log('Logged in as HakPak!');
});

client.on('message', msg => {
  let x = msg.content;
  if (x.charAt(0) === '!') {
    if (x.includes('hello') | x.includes('hi') | x.includes('hey')) {
      msg.reply('hello!');
    } else {
        msg.reply('how may I assist you?');
    };
  }
});

client.login('token');
#

very basic though xD

late hill
#

charAt wtf

#

Didn't even know that existed

earnest phoenix
#

@late hill charAt detects the character at a certain position

late hill
#

Yes

earnest phoenix
#

so 0 is the first position (i assume you know that)

late hill
#

But you could also string[index]

earnest phoenix
#

true

#

i prefer charAt

#

it's easier lol

late hill
#

How is it easier

#

Confusion

ripe oak
spare glen
#

anyone know why this is happening
why isnt it aligned correctly

silent cloud
#

guys

#

somebody can help me with ember

#

I can't made it

#

.

spare glen
#

can someone help me with my problem above

silent cloud
#

@spare glen

spare glen
#

yeah

#

im here

#

i need help

silent cloud
#

u can help me with ember

spare glen
#

wtf no

silent cloud
#

see how it

#

ohh

#

sec

#

why

#

ohh

#

again

#

somebody can help me with ember

ruby dust
#

what is ember

grim aspen
#

you mean embed?

silent cloud
#

oh ye

#

embed

#

xD

#

how i can add it to js code

#

when i add it to code

#

my bot go offline

grim aspen
#

i don't know how i managed to understand "ember" as "embed"

silent cloud
#

= wrong code

#

embed

#

xD

#

sry

grim aspen
#

what's the error?

silent cloud
#

idk xD

#

can u teach how?

grim aspen
#

🤦

silent cloud
#

xD

#

rly

ruby dust
#

yeah, teach him how to get the error

silent cloud
#

not error

#

how to made embed

#

xD

ruby dust
#

by reading discord.js documentation

silent cloud
#

maybe i do something wrong

#

i was reading

#

and no

#

bot go off

ruby dust
#

then fix your syntax

grim aspen
#

what does the error say on the console?

silent cloud
#

idk in a host closed now console

#

my bot in a host, but now im from telephone

#

have you a video or can u say how to do

grim aspen
#

no

#

read the docs

ruby dust
#

everything about coding is reading and writing, if you can't read the docs then you can't write code

silent cloud
#

i was read, but no, nothing new

#

again error

neat falcon
#

send error

grim aspen
#

what's the error?

scarlet bane
#

we can't help if we dont know the error

grim aspen
#

should say it in console

#

but they're saying that the console was closed by host which makes no sense

spare glen
#

help^^^

scarlet bane
#

Didnt know we helped design websites

#

last time i checked this was for bot development

spare glen
#

well

neat falcon
#

It is (bot) development

#

not forcing bot

scarlet bane
#

ah i c

ruby dust
#

the longer I interact with these people, the more I assume that they think that if they read docs their code is magically good

scarlet bane
#

well, either way, just a css file wont really help

neat falcon
#

also that paste site times out for me

spare glen
#

can i get help

neat falcon
spare glen
#

with my site

neat falcon
#

cant if i cant even read the css

grim aspen
#

there's a huge ass bee flying around my kitchen

spare glen
#

thats it

neat falcon
#

ok now it loads

spare glen
grim aspen
#

shit wrong chat

scarlet bane
#

like i said

spare glen
#

this is issue

scarlet bane
#

CSS wont help

#

this is most likely an HTML problem

spare glen
#

ok wait

neat falcon
#

fax

grim aspen
scarlet bane
#

Most likely, both of your divs are display:block somehow

spare glen
#

this is the html code

scarlet bane
#

Yeah, make .btn-group and #commands both display:inline-block

#

and it should work

spare glen
#

wait

#

still nothing

#

@scarlet bane

scarlet bane
#

same as before?

#

maybe cached

spare glen
#

this happend

scarlet bane
#

hMM

spare glen
#

the table is now a block

scarlet bane
#

alright hold on lmao

spare glen
#

lollol

#

i deleted the inline block on #commands

#

now its this

#

why arent they aligned

scarlet bane
#

man honestly

#

just uh

spare glen
#

ye?

scarlet bane
#

put both of the divs insied a bigger div

#

and make the bigger div display:flex

spare glen
#

do i make the big div a class

scarlet bane
#

that's your call

#

im not good enough at html to give you an actual proper solution, this is the best i can think of on the spot

spare glen
#

it worked

#

omfg

#

ty so much

#

now i can style better

#

and ty so much @scarlet bane

scarlet bane
#

lol

#

np

spare glen
#

and @scarlet bane

#

1 more thing

scarlet bane
#

mhm?

spare glen
#

how do i add link to that button

scarlet bane
#

take your actual invite link

spare glen
#

ye

scarlet bane
#

like, the invite link that you submitted

#

and put it in place of the "invite"

#

the full link, http and everything

spare glen
#

instead of invite

#

yeah

scarlet bane
#

yes

spare glen
#

lemme try

#

didnt work

#

nvm

#

it did

scarlet bane
#

should work

spare glen
#

but how to open in a new page

#

target="_blank"

scarlet bane
#

yes

spare glen
#

perfect

#

ty

#

@scarlet bane

#

how do i add href here

#

it doesnt work to add href

scarlet bane
#

<a> around the whole button

#

so like <a><button ... </button></a>

#

and then href in the a

spare glen
#

k

#

lemme try

#

won't a mess the styling up

quartz kindle
#

a is unstyled by default, unless you added css for it

spare glen
#

i could do this too

#

this works

amber fractal
#

I thought a automatically was blue and underlined Thonk

spare glen
#

how do i change that blue color

#

@scarlet bane

scarlet bane
#

no clue

spare glen
#

lol

#

ugh

#

how do i make the table go all the way on the right

#

@scarlet bane

scarlet bane
#

man

#

you're asking questions beyond my iq

amber fractal
#

Html is beyond everyone's iq

spare glen
#

lmao

quartz kindle
#

well, yeah, a has some blue stuff, but its browser-dependent

#

the blue thingies is because of that too

#

different browsers have different defaults

silent cloud
#

fuys

#

guys

#
bot.on('message', msg => {
    if (msg.content.startsWith(prefix + 'avatar')){
      let embed = new Discord.RichEmbed()
    .setImage(msg.author.avatarURL)
    .setColor('0x2c69d3')
      msg.channel.send(embed)
    }
});```
#

why dont work

dusky marsh
#

Just wrap the table in a div and float that bih

#

What isn't working @silent cloud

silent cloud
#

when i write *avatar

#

nothing

#

no react

dusky marsh
#

No error?

silent cloud
#

i cant seen console

dusky marsh
#

Try msg.author.displayAvatarURL

silent cloud
#

sec

#

test

#

no dont work

dusky marsh
#

So you can't see your console?

#

Cause debugging without a console is not any fun

lofty hamlet
#

My bot sometimes has a socket error hang up but it does not crash however no command responds and I am forced to reload my bot you have a solution?

silent cloud
#

my bot in a hose

#

host

#

creeper

#

yo

#

can help?

dusky marsh
#

Do you have the error event handled? @lofty hamlet

lofty hamlet
#

My bot does not respond after this error socket hang up

#

@dusky marsh

silent cloud
#

i have logs

#

yeee

#

2019-03-10T20:49:45.562227+00:00 heroku[worker.1]: State changed from starting to up2019-03-10T20:49:48.232408+00:00 app[worker.1]: (node:4) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added. Use emitter.setMaxListeners() to increase limit2019-03-10T20:49:48.836829+00:00 app[worker.1]: I am ready!

wet forge
#

@spare glen if you're wanting it to go all the way to the right, you could mess around with float: right;. There's also some other properties that can define object positions with position: absolute;, from which can be controlled with left: 0; right: 0; top: 0; bottom: 0;, which are just position definers, in the case of it being absolute

dusky marsh
#

WHY DO YOU have 11 message listeners

lofty hamlet
silent cloud
#

2019-03-10T20:58:19.809204+00:00 app[worker.1]: (node:4) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message2019-03-10T20:58:19.809257+00:00 app[worker.1]: at item.request.gen.end (/app/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:68:65)2019-03-10T20:58:19.809260+00:00 app[worker.1]: at then (/app/node_modules/snekfetch/src/index.js:215:21)2019-03-10T20:58:19.809263+00:00 app[worker.1]: at process._tickCallback (internal/process/next_tick.js:68:7)2019-03-10T20:58:19.809279+00:00 app[worker.1]: (node:4) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)2019-03-10T20:58:19.809347+00:00 app[worker.1]: (node:4) [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.

#

so?

#

what problem?

#

@dusky marsh

#

can help?

night imp
#

You are trying to send an empty message

#

@silent cloud

silent cloud
#

but why

#

it not empty

night imp
#

Send code pls

silent cloud
#
    if (msg.content.startsWith(prefix + 'avatar')){
      let embed = new Discord.RichEmbed()
    .setImage(msg.author.avatarURL)
    .setColor('0x2c69d3')
      msg.channel.send(embed)
    }
});```
night imp
#

Soooo to send an embed do

#

msg.channel.send({embed})

#

And if it is still not working add a description / title / field

silent cloud
#

k

#

ty

#

i try

amber fractal
#

You shouldnt need the {}, atleast I dont

silent cloud
#

umm

#

why

earnest phoenix
#

wait is it bot.on?

amber fractal
#

Let me try something

earnest phoenix
#

thought it was client.on

silent cloud
#

ye it work

amber fractal
#

If his client is defined as bot

earnest phoenix
#

i see

amber fractal
#

Then its bot

silent cloud
earnest phoenix
#
const Discord = require('discord.js');
const client = new Discord.Client();

client.on('ready', () => {
  console.log('Logged in as HakPak!');
});

client.on('message', msg => {
  let x = msg.content;
  if (x.charAt(0) === '!') {
    if (x.includes('hello') | x.includes('hi') | x.includes('hey')) {
      msg.reply('hello!');
    } else if (x.includes('help')) {
      msg.reply('I have not been programmed enough to help you. Sorry.');
    } else {
      msg.reply('I have not been programmed enough to respond to your statement. However, I believe you said \"' + (x.substr(1, x.length)) + '\".')
    }
  }
});

client.login('token');
#

lol i need this for a hackathon on thursday

#

i'm just struggling to learn this asap

#

😂

#

all i need to do is a prototype

#

so nothing that big

#

just something to guide

#

doing a regents prep site

silent cloud
#

hey guys

#

how to do

#

how bot use him emoji's

#

look that

wet forge
#

They refer to custom emojis that the bot can use, because it's in the server that has them.

You can usually get the name of those emojis by typing in the message box \{EMOJI_NAME} on the server that has them.
If you can't, the structure of a custom emote as a string is
<:{EMOJI_NAME}:{EMOJI_ID}>
If the emoji is animated, use <a:{EMOJI_NAME}:{EMOJI_ID}>
You could also probably get emojis by referring to the guild that the bot is in, and getting the collection of emojis from that

silent cloud
#

ty

#

@wet forge

#

bur how like look in code

#

can help

#

.setFooter('....')

#

emoji name :vopros:

wet forge
#

oh custom emojis can't be used in a footer.
it can only be placed on the title or description of an embed.

silent cloud
#

ohhh

#

but

#

and

#

how use discord emojis in footer?

amber fractal
#

Thats a title

#

Not title

#

description

wet forge
#

i can't tell too well from the image, since mobile is stylized differently
would it be okay to get the message link, or a screenshot from desktop?
my guess from the mobile screenshot is that the icon is a picture uploaded to the image, the bottom text is an image, the icon ℹ is used, but stylized in your mobile device's emoji style

#

hm

#

it's really hard to tell on the mobile screenshot

#

for me at least

amber fractal
#

I think it's a description anyways

wet forge
#

i'm willing to go with

#

they used ℹ as the emoji

amber fractal
#

because it has no black space for the title so it isnt a field

wet forge
#

but since their mobile device shows emojis differently

#

it's shown as that round one

amber fractal
#

Mobile shows an i

wet forge
#

because that diamond on the bots name is different

#

from the discord one

amber fractal
#

wet forge
#

well, i mean it depends on the phone

amber fractal
#

Or it's unicode

#

But color

#

nvm

wet forge
amber fractal
#

You're also on iphone

wet forge
#

so what i'm thinking is that

#

the phone that they're using overrides the discord emojis with their set

bright spear
#

no

#

in footer it doesnt show twemoji

#

it shows the native emoji

#

for all devices

silent cloud
#

but

#

how add to footer emoji?

#

in a code

bright spear
#

just add the emoji

#

as the unicode

#

like \ℹ

silent cloud
#

umm

bright spear
#

or just use your computer's emoji selector

silent cloud
#

#

oops

#

ℹ️

#

ummm

bright spear
#

what

silent cloud
#

how i can do it look a bubble xD

amber fractal
#

ℹ️

silent cloud
#

#

wtf

#

like ℹ

amber fractal
#

It's only like that in the footer

bright spear
#

\:information_source:

silent cloud
#

\ℹ

#

ooo

#

rly

bright spear
#

it depends on the device

#

that shows what it looks like in all devices

amber fractal
#

Yes

#

Oops

silent cloud
#

ty

wet forge
#

what phone model are you using(?)

bright spear
#

old android it seems

silent cloud
#

Xiaomi

#

Xiaomi Redmi Note 2

#

2015 year

#

end of 2015

bright spear
wet forge
#

there we go

#

thanks

silent cloud
#

ty very much

#

all

#

i go sleep xD

wet forge
#

gn

silent cloud
#

ty, u have too

hushed berry
visual zenith
visual zenith
#

so how can I fix this? @earnest phoenix

earnest phoenix
#

okay

#

anyone can help me with reactions

#

i want to do a bot that can quiz you

#

and idk how to make the bot add reactions and detect your reactions

pseudo scroll
#

Look in the pins

#

They have exactly what you need

amber fractal
#

Nice

pseudo scroll
#

whoops

amber fractal
#

Lol

#

regen that

pseudo scroll
#

Time to kill my bot

#

yep

#

thanks for the tip

amber fractal
#

Lol tony is muted tho

pseudo scroll
#

That was actually pretty fast

#

literally 5 seconds of this token being available

amber fractal
pseudo scroll
#

ah fuck

#

it killed my personal server

#

good thing I still have all the images from there

earnest phoenix
#

yeah

#

rip us

#

so anyway, our server is dead

#

and it's likely that it wasn't a person who did it, but rather a bot

amber fractal
#

I wouldnt be surprised if some nerd had a bot scanning this channel for leaked tokens then spamming them

pseudo scroll
#

It wasn't a real server

#

just a small testing one

#

The nerd did get my personal server though

hushed berry
#

wait was it just in your clipboard?

pseudo scroll
#

yeah

hushed berry
#

im impressed

pseudo scroll
#

I wanted to give the link

hushed berry
#

whoever did that -- im impressed

bright spear
#

inb4 its nik

hushed berry
#

😂

#

i mean

#

i did make a token scanning bot

#

but

#

it didnt involve doing that

pseudo scroll
#

Some big nerd

amber fractal
#

gigantic nerd

hushed berry
#

I should make a identify spammer

amber fractal
#

@nik

hushed berry
#

to like insta reset a bots token

bright spear
#

ws connection timeouts make it hard to test stuff

hushed berry
#

wdym

bright spear
#

cuz i restart

#

and it wont start again

#

cuz discord wont connect

#

and i need to restart again

#

its also annoying when it spontaneously breaks the bot

empty owl
#

Refrence Error advaith isnt defnied ldn; fvANJcAdc

#

for discord brain F

#

how to fix???

earnest phoenix
#

any good eris framework?

#

lol

#

my boy andy

#

sent his bot token

#

and i punished his bot

#

by not giving it admin in the new server

#

😉

#

it's kind of development, it's about how he posted his token and got HACKED

pseudo scroll
#

doesn't matter anymore

#

We got the reaction help guide thing so we're good

earnest phoenix
#

i guess

#

lol

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

client.on('ready', () => {
  console.log('Logged in as HakPak!');
});

client.on('message', msg => {
  let x = msg.content;
  if (x.charAt(0) === '~') {
    if (x.includes('hello') | x.includes('hi') | x.includes('hey') | x.includes('Hello') | x.includes('Hi') | x.includes('Hey')) {
      msg.reply('hello!');
    } else if (x.includes('help')) {
      msg.reply('I have not been programmed enough to help you. Sorry.');
    } else if (x.includes('quiz') | x.includes('test') | x.includes('challenge') | x.includes('Quiz') | x.includes('Test') | x.includes('Challenge')) {
      msg.reply('I haven\'t been programmed to quiz you yet, but I will be soon!');
    } else {
      msg.reply('I have not been programmed enough to respond to your statement. However, I believe you said \"' + (x.substr(1, x.length)) + '\".');
    };
  };
});

client.login('mTc1mek9vY.e9JDnKW84jK1jf1');
#

Hows this code

ruby dust
#

Beautiful, same as your token

earnest phoenix
#

👌

amber fractal
#

...

#

regen it

earnest phoenix
#

what

#

it's a fake code lol

#

i wanted to see if the bots would try to hack it

amber fractal
#

Why are you posting it here

#

;-;

ruby dust
#

But how would you tell if they did try to hack it if it's a fake token

earnest phoenix
#

idk

#

lol

#

i just wanted to bait the bot

pseudo scroll
#

hmm

#

ok

minor kelp
#

I say the right prefix and command, but it wont do anything
so my code is broken or my bot is broken.
These are the things im importing: http://prntscr.com/mw4hnp
This is one of the commands that don't work (only help does): http://prntscr.com/mw4hw5
It does have Client.run: http://prntscr.com/mw4i8d
When it starts it says this: http://prntscr.com/mw4ift

Lightshot

Captured with Lightshot

Lightshot

Captured with Lightshot

Lightshot

Captured with Lightshot

Lightshot

Captured with Lightshot

visual zenith
loud salmon
#

change cmd_ping to just ping @minor kelp

minor kelp
#

Remove @ cmd?

loud salmon
#

no

#

just change the name

minor kelp
#

To ping

loud salmon
#

yes

minor kelp
#

alrighty

loud salmon
#

with my rudimentary knowledge of python discord bots the function name is the name of the command

#

so if you ran !cmd_ping then the command should have worked

minor kelp
#

oh frick

loud salmon
#

it worked?

minor kelp
#

cant add it

loud salmon
#

oh

minor kelp
#

@loud salmon idk how to describe it

#

its a simple bot

loud salmon
#

are you still having that problem?

#

about it not selecting the server?

minor kelp
#

im trying to get it added rn

#

and yeah

#

i did look in the faq

#

???