#development

1 messages ยท Page 1194 of 1

slender thistle
#

Authorization is supposed to be in the request headers

wheat mesa
#

Nevermind, it's working now, just took some time to update

earnest phoenix
#

@slender thistle lol

fluid basin
#

use an http request library, or a command line http client, or an API testing software like Postman

#

you cannot send the authorization header directly in a browser without using code

earnest phoenix
#

man idk

#

this garbage aiohttp library

#

causing me too many errors

slender thistle
#

"garbage"

earnest phoenix
#

bro when i was using requests this code worked perfectly

#

it's just that you are refusing to accept that your code is not working perfectly

#

it worked perfectly

slender thistle
#

How is it a module's fault though

earnest phoenix
#

because async

#

that's why

#

it's awful

slender thistle
#

Define "awful"

earnest phoenix
#

bad

#

unneeded

slender thistle
#

๐Ÿค”

earnest phoenix
#

or are you just not trying to accept that your code is wrong

leaden lake
#

@fluid basin so my link is good but must to be in the code using request library ?

earnest phoenix
#

my code isn't wrong

#

it worked with the requests library

#

well why are you asking for help then

#

if your code is correct

#

because async is trash

#

and i have to go through loops

#

just leep across the border

#

so you just came to say async is trash?

#

just to get a request

#

i came for help

slender thistle
#

Try using except Exception as e: and printing e instead of handling certain exceptions

earnest phoenix
#

but clearly no one can try it

#

i did that

#

there are no errors lol

#
  • i know which errors i need to catch and not catch
#

as i said, it worked with requests

#

you're breaking rule 1 (indirectly saying you're a potato)

slender thistle
#

Handling AttributeError for int() told me the opposite

#

Do you still have the code with the requests library

earnest phoenix
#

yes

#

works perfectly fine

slender thistle
#

Can you send it

earnest phoenix
#

request is deprecated in node.js ๐Ÿ˜ญ

#

who's talking abt node.js

#

what

faint prism
#

what language are you using?

earnest phoenix
#

python

#

that's me using requests

#

works

#

100% of the way

leaden lake
#

where must I post the request ? in init ?

slender thistle
#

why do I see different URLs in both code snippets

steady wharf
#

how can i add my bot?

slender thistle
faint prism
#

f.read or something is probably what he means

earnest phoenix
#

because

#

i removed the first urls

#

but idc anymore

slender thistle
#

Yeah. f.read()

earnest phoenix
#

this guy is literally explaining that "my code is perfect"

#

i don't care abt f.read()

#

token = f works fine

#

gonna press Alt + F4

#

ok

#

didn't ask

#

whitename

violet haven
#

l$botinfo

earnest phoenix
#

whitename

faint prism
violet haven
#

shit sorry

earnest phoenix
#

minimodding

#

shivaco's online mate

slender thistle
#
>>> with open("test.txt") as file:
...     token = file
...
>>> token
<_io.TextIOWrapper name='test.txt' mode='r' encoding='cp1251'>
>>> str(token)
"<_io.TextIOWrapper name='test.txt' mode='r' encoding='cp1251'>"
``` you should start caring
#

because if you need file content, you need to use .read

faint prism
#

Are you saying I shouldn't point someone in the right direction?

earnest phoenix
#

yeah

#

do any of you have weird/cool libraries to share

#

yeah

#

read my status

#

hey bro that's weird

#

bye

#

why does it work for me?

#

cuz

#

you cared

#

SMH

slender thistle
#

code leave it

knotty steeple
#

ok so would anyone know how to get the most significant bit of an int

earnest phoenix
#

code leave it yeah man

#

im master coder

#

ur guys aren't

#

clearly

#

ok so would anyone know how to get the most significant bit of an int
@knotty steeple huh???

slender thistle
#

either you're not sending me your up-to-date code or it doesn't actually work

faint prism
#

ok so would anyone know how to get the most significant bit of an int
@knotty steeple shit I should know this, that was just covered in my class

slender thistle
#

and drop that attitude, both of you

knotty steeple
#

i kinda need it for a chip8 opcode

earnest phoenix
#

@slender thistle uh what?

#

i sent u the working code

#

and the nonworking code

#

async is clearly the problem here

#

only if ppl knew how to use threads

slender thistle
#
"https://example.comname=test yo&year=2016&token=<_io.TextIOWrapper name='test.txt' mode='r' encoding='cp1251'>"
``` does this look like a valid URL to you
faint prism
#

@knotty steeple I have a PDF that covers bitwise operations, and probably has what you need

earnest phoenix
#

are you proud of this @earnest phoenix

#

why does it have to be valid

#

lol

knotty steeple
#

aaaaaa

earnest phoenix
#

of course no

#

mine doesn't show

slender thistle
#

.....?????????

earnest phoenix
#

mainly for fun

#

<_io.TextIOWrapper

fluid basin
#

@knotty steeple manually iterate?

earnest phoenix
#

mien doesn't show that man

#

for some reason it got 1000+ downloads in a week

#

this site is quality

#

just btw

fluid basin
#

while number > 0, rightshift by 1?

tight cargo
#

hellooo

knotty steeple
#

oh ok

faint prism
slender thistle
#

Your code seems to be out of sync with the actual running script

fluid basin
#

then keep the last bit or something

leaden lake
earnest phoenix
#

br

#

im

#

ok

#

async

faint prism
earnest phoenix
#

runs out of sync

slender thistle
#

@leaden lake request headers, not query parameters

earnest phoenix
#

does it not?

#

that's the issue with this entire thing,whoever thought of async

#

a mad man

slender thistle
#

I didn't mean that

leaden lake
#

how ? @slender thistle

knotty steeple
#

bro my head that doesn't help

faint prism
#

@knotty steeple The first bit is the most significant

slender thistle
#

I suggest you use Google, JeSuis

leaden lake
#

okay

slender thistle
earnest phoenix
#

im sorry for any attitude this async is retarded man

#

where is the error right here ? it give me the responses [404]
@leaden lake why is there a : in the URL that isn't a valid query

slender thistle
#

Restart your code and see if you have any issues on your end with syncing your actual script with the code

fluid basin
#

@knotty steeple or the easy way, take log base 2 and round down

earnest phoenix
#

query example: https://somewebsite.com/somefile?somequery=somevalue

#

Wrong

slender thistle
#

because line 117 doesn't contain a valid URL, which you must enter in order to properly send a request

earnest phoenix
#

wait what

#

query example: https://somewebsite.com/route?somequery=somevalue

slender thistle
#

how is it wrong

#

eh that's mostly nitpicking

earnest phoenix
#

well if yall need an api i have a certain repo i could shill :^)

slender thistle
#

rule 5

earnest phoenix
#

@earnest phoenix hey waft what do you think of my package

#

especially the docs page

#

the docs are beautiful

#

This website is powered by DOGE

#

????

#

lmao wut

#

@earnest phoenix nice little ad

#

?

#

i didnt post anything

#

what are you on about alhassan

#

we're talking about my package that he brought up

#

we're not advertising

#

just chatting

#

well if yall need an api i have a certain repo i could shill :^)

#

oh he thought i was ad'in for you

#

Selamleykรผm

#

???

#

i love when green names micromod

#

and they dont even know the context

#

but off topic

#

Sa

slender thistle
#

-notr

earnest phoenix
#

also in my package am I correct with naming all the thingys Functions instead of Methods

gilded plankBOT
#

ฤฐngilizceden baลŸka dillerde sohbet etmek iรงin #memes-and-media kanalฤฑnฤฑ, top.gg hakkฤฑnda (Tรผrkรงe olarak da) destek almak iรงin #support kanalฤฑnฤฑ kullanฤฑn.
Bu kanalda Tรผrkรงe konuลŸmayฤฑn.

earnest phoenix
#

since all of em are properties of exports object

slender thistle
#

functions attached to classes or objects are methods

earnest phoenix
#

methods are functions in js

#

so naming them functions is correct

#

kinda

faint prism
#

And here I was thinking only C# called their functions "methods"

earnest phoenix
#

litterally everyone but scripting languages do

#

so like java c# c++ etc etc

#

methods

fluid basin
#

methods are functions but are usually called so in the context of classes/objects

earnest phoenix
#

python js etc

#

funcs

fluid basin
#

but general functions are functions

faint prism
#

gotcha

sudden geyser
#

Kotlin calls them member functions

earnest phoenix
#

methods are functions but are usually called so in the context of classes/objects
@fluid basin what about in the context of a useless npm package

fluid basin
#

C# is a strictly OOP languages, so all functions are methods

#

if your function is within a class, its a method

earnest phoenix
#

C# is a strictly OOP languages, so all functions are methods
unity supports C# more than they love their mom

#

technically functions are classes in js :^)

sudden geyser
#

what about arrow functions

earnest phoenix
#

if your function is within a class, its a method
@fluid basin i just set em like:

exports.someFunction = function() {}
sudden geyser
#

those can't be initialized with new

earnest phoenix
#

arrow functions are just anonymous functions

faint prism
#

what about arrow functions
@sudden geyser aka lambda, or anonymous functions

leaden lake
sudden geyser
#

ah

#

forgot

fluid basin
#

please, all methods are functions but not all functions are methods

faint prism
#

anyone take math notes as psudocode?

fluid basin
#

technically functions are classes in js :^)
functions are not classes, they're objects in JS

earnest phoenix
#

but yes behold simpletons ```js
function amAClass() {
this.number = 1
}

let a = new amAClass()
console.log(a.number)```

#

truley disgusting

#

no

#

that's a constructor

#

this is a class:

faint prism
#

JS has interfaces right?

fluid basin
#

no

earnest phoenix
#

nop

faint prism
#

does TS? might be what i'm thinking of

topaz fjord
#

typescript does

opal plank
#

ts does

#

quite a lot actually

#

its the whole point of ts

topaz fjord
#

but ts types are compile time only

leaden lake
#

Can anyone help me ? it responses 418 ๐Ÿ˜ญ```import requests

url = 'https://top.gg/api'
headers = {'Authorization':'eyJh..........JslLg8'}

res = requests.get(url, headers=headers)

print (res)

earnest phoenix
#
class someClass {
  constructor smth(smth) {
    this.smth = smth
}
  someMethod () {

}
}

Classes can store stuff like constructors and methods (they can be constructors on they're own too but not vice versa)

faint prism
#

Google what 418 http status code is

cinder patio
#

classes are syntactic sugar, Waft's snippet and the class keywrod are the exact same thing, using classes is cleaner

floral creek
earnest phoenix
#

node classes are litterally just function expressions

floral creek
#

in python

fluid basin
#

thats why old syntax is confusing

#

you can't do that in es6

earnest phoenix
#

"special functions"

#

as described

#

by mdn

#

lol

leaden lake
#

Google what 418 http status code is
@faint prism lmao it's "I'm a teapot" error

earnest phoenix
#

they are truley special

faint prism
#

lmaooooo

opal plank
#

i still get confused with this quite a lot

#

bind and all that jazz

leaden lake
#

search yourself lmao you'll see

fluid basin
#

tl;dr use ES6, functions will be functions and classes will be classes

sudden geyser
#

represents the current instance of a class but JS likes to be JS so it differs in some ways to some degree

opal plank
#

es6 pff

#

use es 2020

faint prism
#
418 I'm a teapot (RFC 2324, RFC 7168)
This code was defined in 1998 as one of the traditional IETF April Fools' jokes, in RFC 2324, Hyper Text Coffee Pot Control Protocol, and is not expected to be implemented by actual HTTP servers. The RFC specifies this code should be returned by teapots requested to brew coffee.[53] This HTTP status is used as an Easter egg in some websites, such as Google.com's I'm a teapot easter egg.[54][55]
fluid basin
#

the concept of classes do not exist before es6

earnest phoenix
#

yessurrytheydonot

#

cant you also typelock objects in node now?

fluid basin
#

much better

opal plank
#

ts does that tbh, assigning types to objects[

cinder patio
#

The only reason that doesn't work it's because it's an anon function, and they don't have this, willi

leaden lake
#
418 I'm a teapot (RFC 2324, RFC 7168)
This code was defined in 1998 as one of the traditional IETF April Fools' jokes, in RFC 2324, Hyper Text Coffee Pot Control Protocol, and is not expected to be implemented by actual HTTP servers. The RFC specifies this code should be returned by teapots requested to brew coffee.[53] This HTTP status is used as an Easter egg in some websites, such as Google.com's I'm a teapot easter egg.[54][55]

@faint prism it doesn"t help me to have a functionnal request lmao

cinder patio
#

this behaviour still works

earnest phoenix
#

yea obligatory Ts IscOmPilED_JA_VascRipt

faint prism
#

It's a meaningless status code

opal plank
fluid basin
#

so you're saying function() {} is not anon

opal plank
#

you set types like that

#

it reserves that object with the interface/type you specified

earnest phoenix
#

doesnt that require 'use strict' though

opal plank
#

it does

#

you can use lax if you wish

earnest phoenix
#

like im talking regardless you cant change type iirc

opal plank
#

which completely defeats the purpose of ts tbh

#

also any

#

js allows it

earnest phoenix
#

i never could bother getting into ts because ts is just js

cinder patio
#

Uh, that is an anon function, but you can still use functions instead of the class keyword

opal plank
#
let a = 1;
a = '1';
fluid basin
#

es6 functions do have their own scope, so I don't see why they are not considered anon functions

opal plank
#

try that

#

actually

#

i can do that rq

faint prism
#
let a = 1;
a = '1';

@opal plank I hate how it's a dynamic data type

opal plank
#

no errors

fluid basin
#

@cinder patio yes, I know, I am referring to strictly es6 syntax if you want to argue about classes and whatnot

opal plank
#

even assigning string to number type

fluid basin
#

since there is no "classes" before es6

opal plank
#

i fucking despise ts sometimes

wheat mesa
#
client.on('message', function(message) {
let bots = new Set
bots.add("747954087236206623")
  if(message.mentions.has(bots))
  {
return message.reply('test working!')

}


})
``` I'm trying to get my bot to respond with a message when I mention it, how can I do that?
tight cargo
#

๐Ÿ˜‚

opal plank
#

doesnt exist btw

faint prism
#

I strongly discourage the use of dynamic in C# though.
Since it was mostly added for compatibility with other languages iirc

fluid basin
#

@wheat mesa why do you need a set for the mentions

opal plank
#

i might have to rename it to indes.d.ts

wheat mesa
#

I was just trying something out since my attempt at grabbing the mentions wasn't working

tight cargo
#

guys anyone need help im probot creator if anyone need help you can mention me

opal plank
#

i crashed vsc

earnest phoenix
#

anyone got cool libs, making a list

fluid basin
#

also message.mentions is a MessageMention, it is not a collection/map

restive furnace
#

auto is good keyword :+1:, even the type is chosen in compile time.

faint prism
#

anyone got cool libs, making a list
@earnest phoenix I can make you a lib. What do you want it to do?

fluid basin
#

you will need either MessageMention#users, MessageMention#members or MessageMention#roles

wheat mesa
#

okay

#

I'll try that out

earnest phoenix
#

make me a lib that sends me your entire bank account

#

obv

leaden lake
#

anyone know why my request doesn't work on python ?

opal plank
#

bruh fucking ts

fluid basin
#

thats prolly why I didn't stick with TS, stuff that is well documented and typed works awesome, otherwise its just errors and warnings

opal plank
#

it even compiles, its just a hiccup somewhere

#

it might be cuz i named it interfaces.ts

#

rather than index.d.ts

#

actually dont mind me

#

im retarded

#

forgot to import my interface

faint prism
#

make me a lib that sends me your entire bank account
@earnest phoenix

public static class GetSomeonesBankBalance
{
  public static string Balance(int accountNumber)
  {
    var rng = new Random(accountNumber);
    return $"{(rng.Next() + rng.NextDouble()):C}";
  }
}
earnest phoenix
#

hey java or c# very cool

opal plank
#

import GetSomeonesBankBalance from bankrobber

earnest phoenix
#

im hungry but dont want to leave my room cause then ide have to interact

#

socially

opal plank
#

isnt it ```c
#import something from somewhere

#

i do vaguely recall some language needing # before

faint prism
#

isn't that a comment for python

#

or bash

opal plank
#

im not sure tbh

faint prism
#

I think it is for bash

still merlin
#

python comment

earnest phoenix
#

const { balance } = require('bankrobber')

#

there

ionic dawn
#

@earnest phoenix just order a pizza 6645_Stonks

earnest phoenix
#

its 9am

fluid basin
#

@opal plank you are probably referring to C++

#include <iostream>
#include "myinterface.hpp"
ionic dawn
#

So?

opal plank
#

yeah its C++

ionic dawn
#

Never is to early for a pizza

earnest phoenix
#

my favorite part of c++ is define

knotty steeple
earnest phoenix
#

emojilang ftw

opal plank
#

i knew it was one of those C's langs

#

@faint prism shame on you for not recognizing your counterpart

earnest phoenix
#

Elo

fluid basin
#

@knotty steeple Math.round(Math.log(218) / Math.log(2))

#

use math

#

wait you want the most significant bit value?

#

its always 1

#

unless its 0

knotty steeple
#

o h o k

fluid basin
#

or unless you have a fixed type (int32, int64, int16 etc)

knotty steeple
#

8bit int lul

fluid basin
#

hm

faint prism
#

@faint prism shame on you for not recognizing your counterpart
@opal plank ah damn i knew that :c

fluid basin
#

2^8 = 256

restive furnace
#

128bit architechture when

fluid basin
#

then its just num & 256

#

if you want the value

#

and not the position

faint prism
knotty steeple
#

dgfg really

fluid basin
#

wait

#

it should be (num & 128) != 0

#

or (num & 128) == 128

#

bitwise operations are much faster

#

compared to string and string again XD

knotty steeple
fluid basin
#

also since nodejs treats 0 as a "falsey" value

#

you can just use num & 128 as the condition

knotty steeple
#

cool

#

@fluid basin so false means the bit is 0

fluid basin
#

yup

knotty steeple
#

dank

#

why am i doing this i slept 3 hours

#

my brain

#

is nonexistent

regal arrow
thick saddle
#

.

pale vessel
#

no

thick saddle
#

Cool

golden condor
#

Can someone explain to me/send the mdn page for bitfield?

wheat mesa
#
const clowns = new Set()                                      //w!clown command
clowns.add("313481150637277197")
client.on('message', function(message) {
    if(message.content.startsWith(`${prefix}clown`)) {
        if(!message.member.hasPermission('ADMINISTRATOR')) return message.reply('cant use this L')
        if(message.mentions.everyone || message.mentions.roles) {return message.reply('Improper mention.')}
        let person = message.mentions.users.first()
          if(person.bot) {return message.reply('You cannot clown bots.')}
          let newClown = message.mentions.users.first()
        if(!newClown) return message.reply('You need to mention the user you want to clown.')
        if(clowns.has(newClown.id)) {
            clowns.delete(newClown.id)
            message.reply('removed clown :(')
        } else {
            clowns.add(newClown.id)
            message.reply('new clown in town!')
        }
    }
})
client.on('message', function(message) {
    if(clowns.has(message.author.id)) {
        message.react('๐Ÿคก')
    } 
})

I'm having a problem with the bot when someone does w!clown @granite pagoda and it says improper mention. Why is that? When I get rid of message.mentions.roles if they do w!clown @role then it stops working.

#

whoops I didn't mean to mention user

#

my bad

pale vessel
#

oh no multiple events for a command

wheat mesa
#

this is the 3rd day I've been doing this I'm not great at it lol

pale vessel
#

please don't do this```js
client.on('message', function(message) {
// command
});

client.on('message', function(message) {
// command
});

client.on('message', function(message) {
// command
});```

do this instead```js
client.on('message', function(message) {
if (message.content == "a") {
// command a
}

if (message.content == "b") {
    // command b
}

});```

quartz kindle
#

message.mentions.roles is a collection, so even if its empty, it exists, because its an empty collection. so that IF works anyway

wild inlet
#

how do you make the bot come to your server

pale vessel
#

invite it

faint prism
#

how do you make the bot come to your server
@wild inlet invite it

wild inlet
#

k

quartz kindle
#

you need to check if message.mentions.roles is empty instead of if it exists:
message.mentions.roles.size

wheat mesa
#

oh

#

thank you

#

๐Ÿ™‚

sand skiff
#
client.user.setActivity(`-help`, {
    type: 'PLAYING'
  });

@fringe axle tyyy

slender thistle
#

What's defined as "team" in this context? The team on Discord Developers portal?

If yes, then wouldn't I be required to use OAuth2 to access the team_user flag?

pale vessel
#

If yes, then wouldn't I be required to use OAuth2 to access the team_user flag?
@slender thistle yeah

slender thistle
#

Got it, thanks

leaden lake
#

@slender thistle it says "responses [418]" please help me, this error is an easter egg ๐Ÿ˜ญ๐Ÿ˜‚

slender thistle
#

It's not an error lol

#

You are just sending a request to the base URL so it's an easter egg

pale vessel
leaden lake
#

okay so all is fine ?

#

The request is good ?

west current
#

Discord really added Easter eggs to its API?

slender thistle
west current
#

Ohh

slender thistle
#

but yeah the request is fine, JeSuis

west current
#

Really makes you forget that discord logs every single message ever sent huh

slender thistle
#

@pale vessel I don't speak bitfields but thanks in any case

pale vessel
#

1024 is team user

leaden lake
#

okay thx, I believed it was another error ๐Ÿ˜‚

pale vessel
slender thistle
#

Oh, I see

pale vessel
#

basically the user (team) that owns the application

slender thistle
#

yeet

#

thanks

crimson fjord
#

hi

leaden lake
#

where do I must to send the request ? it give me the error 403 @slender thistle

slender thistle
#

Where are you trying to send a request?

leaden lake
#

in the cog

slender thistle
#

Show your code

leaden lake
#
import discord
from discord.ext import commands, tasks
import asyncio
import logging
import requests


class TopGG(commands.Cog):
    """Handles interactions with the top.gg API"""
    import requests

    url = 'https://top.gg/api'
    headers = {'Authorization':'eyJ.........lLg8'}

    res = requests.get(url, headers=headers)

    print (res)


    def __init__(self, client):
        self.bot = client
        self.token = 'eyJh........JslLg8'
        self.dblpy = dbl.DBLClient(self.bot, self.token)
        self.update_stats.start()

    @commands.Cog.listener()
    async def on_ready(self):
        print("Cog charge !")

    @tasks.loop(minutes=3.0)
    async def update_stats(self):
        """This function runs every 30 minutes to automatically update your server count"""
        logger.info('Attempting to post server count')
        try:
            await self.dblpy.post_guild_count()
            logger.info('Posted server count ({})'.format(self.dblpy.guild_count()))
        except Exception as e:
            logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))

def setup(client):
    global logger
    logger = logging.getLogger('bot')
    client.add_cog(TopGG(client))```
#

I put it in the class TopGG ๐Ÿคท

slender thistle
#

Remove the manual request stuff

#

update_stats should be updating the server count automatically

delicate shore
#
const client = new Discord.Client({ ws: { intents: 8191 } })```
#

is this how i use intents?

pale vessel
#

yes

delicate shore
#

ok thnx

leaden lake
#
         ^
IndentationError: expected an indented block``` @slender thistle
#

at the end line

sudden geyser
#

Python cares about your whitespace.

#

It expects that statement be indented.

leaden lake
#

in my main file I put client = commands.Bot(command_prefix = '+')

#

okay I fixed this error, thx @sudden geyser

#

but I got ANOTHER error (for change) ๐Ÿ˜‚

sudden geyser
#

good job
what is new error

leaden lake
#
    self.update_stats.start()
AttributeError: 'TopGG' object has no attribute 'update_stats'```
#

here is my code ```class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
import requests

url = 'https://top.gg/api'
headers = {'Authorization':'eyJ.........slLg8'}

res = requests.get(url, headers=headers)

print (res)


def __init__(self, client):
    self.bot = client
    self.token = 'eyJh.........JslLg8'
    self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)
    self.update_stats.start()

def setup(client):
client.add_cog(TopGG(client))```

sonic lodge
#

the TopGG class has no update_stats method

leaden lake
#

so how to use it ? how to start the program ?

sonic lodge
#

are you making an api wrapper for an api wrapper

spare flicker
#

@every-one

leaden lake
#

are you making an api wrapper for an api wrapper
@sonic lodge I just want to have the server count ๐Ÿ˜ญ

slender thistle
#

Where did the update_stats thing go

leaden lake
#

in the init... nah ?

earnest phoenix
#

who is bot plz

sonic lodge
#

you previously had async def update_stats somewhere, but not anymore in this snippet

quiet topaz
sonic lodge
#

what in the world is going on

urban olive
#

is there a way to get your bot to dm specific users mentioned within a command?

quiet topaz
#

no, it is writen to react with the two emotes (but thats not the error

lusty zinc
#

Hi, I have a problem with my bot, it's using discord.js, shard 1 is basically getting destroyed every x amount of time, it gets reconnected after a few hours automatically. I turned on extra logs and I'm getting the following 'errors': https://hastebin.com/yijosumomu.js

Feel free to mention me if you have an idea.

valid frigate
#

your syntax is incorrect bruv

sonic lodge
#

new Discord.Client; should be new Discord.Client();

valid frigate
#

have a look at line 10

quiet topaz
#

but why does it output at line 1

urban olive
#

how would you even get a bot to dm a specific user?

valid frigate
#

wait wtf nvm

#

im high thats correct

sonic lodge
#

you haven't saved your file

quiet topaz
#

i have

sonic lodge
quiet topaz
sonic lodge
#

the token you provided is invalid read the error wrong

pale vessel
#

is that a zws

restive furnace
#

learn js please

leaden lake
#
Forbidden: Forbidden (status code: 403)
Traceback (most recent call last):
  File "C:\Users\Shaal0wFR\Desktop\Bot Discord\cogs\topgg.py", line 36, in update_stats
    await self.dblpy.post_guild_count()
  File "C:\Users\Shaal0wFR\AppData\Local\Programs\Python\Python37\lib\dbl\client.py", line 142, in post_guild_count
    await self.http.post_guild_count(self.bot_id, self.guild_count(), shard_count, shard_no)
  File "C:\Users\Shaal0wFR\AppData\Local\Programs\Python\Python37\lib\dbl\http.py", line 169, in post_guild_count
    await self.request('POST', '/bots/{}/stats'.format(bot_id), json=payload)
  File "C:\Users\Shaal0wFR\AppData\Local\Programs\Python\Python37\lib\dbl\http.py", line 143, in request
    raise errors.Forbidden(resp, data)
dbl.errors.Forbidden: Forbidden (status code: 403)``` @sonic lodge
pale vessel
#

maybe before c in const?

quiet topaz
#

i have the token, but in the picture not, cuz users could steal it

urban olive
#

what property would make bot dm a specific user?

restive furnace
#

you sure it is inside ""

pale vessel
#

how would an invisible space be there anyway

#

it's on line 1

restive furnace
#

and as i said before, learn js. please.

sonic lodge
#

@urban olive what library

urban olive
#

discord js 12

quiet topaz
#

btw i created the file in cmd with echo //react >> index.js

sonic lodge
#

if you have a user object, user.send('whatever');

quiet topaz
#

bruh, fixed... dont use files created with cmd echo command

sonic lodge
#

why would you do that

quiet topaz
#

i was lazy

#

i was in cmd and was lazy

sonic lodge
#

too lazy to click a maximum of 2-3 times to make a new file

quiet topaz
#

yes

sonic lodge
#

๐Ÿ‘Œ

urban olive
#

how would i define user though?

sonic lodge
#

problem indeed

#

do you have their id?

urban olive
#

i did user = 388665219963944960;

#

wait

#

i forgot to create user

leaden lake
#

It says to me error 403. Forbidden. Why ? ๐Ÿ˜ญ```class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
import requests

url = 'https://top.gg/api'
headers = {'Authorization':'ey..........Lg8'}

res = requests.get(url, headers=headers)

print (res)

@commands.Cog.listener()
async def on_ready(self):
    print("Cog pret !")


def __init__(self, client):
    self.bot = client
    self.token = 'ey........Lg8'
    self.dblpy = dbl.DBLClient(self.bot, self.token)
    self.update_stats.start()

@tasks.loop(minutes=3.0)
async def update_stats(self):
    """This function runs every 30 minutes to automatically update your server count"""
    logger.info('Attempting to post server count')
    try:
        await self.dblpy.post_guild_count()
        logger.info('Posted server count ({})'.format(self.dblpy.guild_count()))
    except Exception as e:
        logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))

def setup(client):
global logger
logger = logging.getLogger('bot')
client.add_cog(TopGG(client))```

restive furnace
#

i actually just can create new file by Super key, type cmd, then go to right folder with cd cli command, and then type code . and then just click the "+" button.

#

easy

sonic lodge
#

also when dealing with ids in js they should be strings

#

that is why

topaz saddle
#

the errors are given at the bottom, but im not sure what its asking me to input

restive furnace
#

umless you use bigints, and your library supports it

sonic lodge
#

why js

#

w h y

topaz saddle
#

idk first day every site ive been to uses js xd

#

what is the preffered language?

restive furnace
#

else if without if

#

execuse me

topaz saddle
#

ty

pale vessel
#

@sonic lodge should be fine if you're comparing but it's still a good practice to use strings

topaz saddle
#

now there are more problems with the code :(

urban olive
#

TypeError: user.send is not a function

sonic lodge
#

how is user defined

urban olive
#

like this user = "388665219963944960";

#

right above user.send('OK');

sonic lodge
#

you need to convert that id to a user object

urban olive
#

do i do message.user.send('OK');?

earnest phoenix
#

think about that for a moment

urban olive
#

oh ok

earnest phoenix
#

you're telling it that user is a string, then you attempt to call send() on a string

#

and that doesn't make sense, does it?

pale vessel
#

and "stop making up your own methods and properties and read the docs"

urban olive
#

where are docs

#

pls

earnest phoenix
topaz saddle
#

or whatever it was lol

calm junco
#

does anyone know how to keep ur bot online, like mee6 is always online. everytime i close visual code it goes offline?

earnest phoenix
#

get a cheap vps

#

see pins for some good providers

leaden lake
#

When I post this code, ```url = 'https://top.gg/api'
headers = {'Authorization':'ey.......Lg8'}

res = requests.get(url, headers=headers)

print (res)

class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""

@commands.Cog.listener()
async def on_ready(self):
    print("Cog pret !")


def __init__(self, client):
    self.bot = client
    self.token = 'ey.......Lg8'
    self.dblpy = dbl.DBLClient(self.bot, self.token)
    self.update_stats.start()

@tasks.loop(minutes=3.0)
async def update_stats(self):
    """This function runs every 30 minutes to automatically update your server count"""
    logger.info('Attempting to post server count')
    try:
        await self.dblpy.post_guild_count()
        logger.info('Posted server count ({})'.format(self.dblpy.guild_count()))
    except Exception as e:
        logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))

def setup(client):
global logger
logger = logging.getLogger('bot')
client.add_cog(TopGG(client)) I got this errorFailed to post server count
Forbidden: Forbidden (status code: 403)
Traceback (most recent call last):
File "C:\Users\Shaal0wFR\Desktop\Bot Discord\cogs\topgg.py", line 36, in update_stats
await self.dblpy.post_guild_count()
File "C:\Users\Shaal0wFR\AppData\Local\Programs\Python\Python37\lib\dbl\client.py", line 142, in post_guild_count
await self.http.post_guild_count(self.bot_id, self.guild_count(), shard_count, shard_no)
File "C:\Users\Shaal0wFR\AppData\Local\Programs\Python\Python37\lib\dbl\http.py", line 169, in post_guild_count
await self.request('POST', '/bots/{}/stats'.format(bot_id), json=payload)
File "C:\Users\Shaal0wFR\AppData\Local\Programs\Python\Python37\lib\dbl\http.py", line 143, in request
raise errors.Forbidden(resp, data)
dbl.errors.Forbidden: Forbidden (status code: 403)```

shy turret
#
args[1] == "ADMINISTRATOR" || args[1] == "CREATE_INSTANT_INVITE" || args[1] == "KICK_MEMBERS" || args[1] == "BAN_MEMBERS" || args[1] == "MANAGE_CHANNELS" || args[1] == "MANAGE_GUILD" || args[1] == "ADD_REACTIONS" || args[1] == "VIEW_AUDIT_LOG" || args[1] == "PRIORITY_SPEAKER" || args[1] == "STREAM" || args[1] == "VIEW_CHANNEL" || args[1] == "SEND_MESSAGES" || args[1] == "SEND_TTS_MESSAGES" || args[1] == "MANAGE_MESSAGES" || args[1] == "EMBED_LINKS" || args[1] == "ATTACH_FILES" || args[1] == "READ_MESSAGE_HISTORY" || args[1] == "MENTION_EVERYONE" || args[1] == "USE_EXTERNAL_EMOJIS" || args[1] == "VIEW_GUILD_INSIGHTS" || args[1] == "CONNECT" || args[1] == "SPEAK" || args[1] == "MUTE_MEMBERS" || args[1] == "DEAFEN_MEMBERS" || args[1] == "MOVE_MEMBERS" || args[1] == "USE_VAD" || args[1] == "CHANGE_NICKNAME" || args[1] == "MANAGE_NICKNAMES" || args[1] == "MANAGE_ROLES" || args[1] == "MANAGE_WEBHOOKS" || args[1] == "MANAGE_EMOJIS"

I seriously do not want to do this. Is there a simpler way to do this

urban olive
#

woa

#

hastebin exists

earnest phoenix
#

what the fuck

leaden lake
#

does anyone know how to keep ur bot online, like mee6 is always online. everytime i close visual code it goes offline?
@calm junco heroku

earnest phoenix
#

avoid heroku

shy turret
#

or buy a vps

earnest phoenix
#

avoid glitch

urban olive
shy turret
#

buy a vps

sonic lodge
#

array.includes

pale vessel
#

I seriously do not want to do this. Is there a simpler way to do this
@shy turret something like ["SPEAK", "MANAGE_NICKNAMES"].includes(args[1]), depends on what you're trying to do

shy turret
#

bruh'

#

i want to check if it is a valid permission node

leaden lake
shy turret
#

so i guess that works

leaden lake
#

but nothing helps me lmao

urban olive
#

wait

earnest phoenix
#

you'll get an array of valid permissions

shy turret
#

["ADMINISTRATOR","CREATE_INSTANT_INVITE","KICK_MEMBERS","BAN_MEMBERS","MANAGE_CHANNELS","MANAGE_GUILD","ADD_REACTIONS","VIEW_AUDIT_LOG","PRIORITY_SPEAKER","STREAM","VIEW_CHANNEL","SEND_MESSAGES","SEND_TTS_MESSAGES","MANAGE_MESSAGES","EMBED_LINKS","ATTACH_FILES","READ_MESSAGE_HISTORY","MENTION_EVERYONE","USE_EXTERNAL_EMOJIS","VIEW_GUILD_INSIGHTS","CONNECT","SPEAK","MUTE_MEMBERS","DEAFEN_MEMBERS","MOVE_MEMBERS","USE_VAD","CHANGE_NICKNAME","MANAGE_NICKNAMES","MANAGE_ROLES","MANAGE_WEBHOOKS","MANAGE_EMOJIS"]

pale vessel
#

@shy turret you can use if (require("discord.js").Permissions.FLAGS[m.args[1]])

shy turret
#

BRUH i just typed that all out

pale vessel
#

please don't do that

earnest phoenix
#

that too

#

i keep forgetting that js objects are just fancy dictionaries and that you can index them

shy turret
#

lol

#

why is it "m.args[1]"

pale vessel
#

that was me testing

#

yours is just args

shy turret
#

ok

#

thanks

opal plank
#

imagine writing useless code that your lib does for you

shy turret
#

ikr me

opal plank
#

bruh you stupid ngl

shy turret
#

ikr

opal plank
#

like really stupid

#

imagine doing something your lib handles for you

shy turret
#

im scared that i actually understand that now

#

(that code)

opal plank
#

||if you didnt get the joke, i made my own bitwise converted||

urban olive
#

does it matter how i define the object holding the id of the user i want the bot to DM?

opal plank
#

||which dj.hs with .Permissions()||

shy turret
#

i actually very scared i can read that now

opal plank
#

||that code up there is mine and completely reduntant cuz d.js has it, it was a joke, laugh ffs||

shy turret
#

........ if that was djs code and i understood it...

opal plank
#

thats js code

shy turret
#

discord.js lib*

opal plank
#

d.js has its own way of checking it with a method that flaze said. It does the conversion for you. That code you see me doing up there is mine, not discord.js's, since why i jokingly said ' are you stupid for doing something so redundant?', cuz i did it too. T'was a joke, now i had to explain it, now it lost all its funny'ness

shy turret
#

im also scared i wrote my own scripting lang and didnt understand that

leaden lake
shy turret
#
Failed to post server count
Forbidden: Forbidden (status code: 403)
leaden lake
#

same error as you @shy turret

shy turret
#

you forgot ur api key i think

leaden lake
#

nope, her is in my code

shy turret
#

@leaden lake i just pasted what ur hastebin said

leaden lake
#

ah okay

#

but my API key is good when I do a request

shy turret
#

url = 'https://top.gg/api' doesn't seem right

shadow spoke
#

yeah

leaden lake
#

yes it is shivaco said

shy turret
#

post to /bots/YOUR BOT ID/stats

leaden lake
#

where is it ?

shy turret
#

server_count

#

Change it to url = 'https://top.gg/api/bots/YOUR BOT ID/stats'

#

and change YOUR BOT ID to your bot id

leaden lake
#

oh okay

shy turret
#

res = requests.get(url, headers=headers)

#

shouldnt it be res = requests.post(url, headers=headers)

#

(i dont code python btw)

stoic hull
#

Can i ask questions about web dev in here?

shy turret
#

headers = {'Authorization':'ey........Lg8'} also

#

you need to add {'server_count':number} somewhere

#

@stoic hull a top.gg website developer or any developer you knows how to make websites?

stoic hull
#

Well.

#

I keep getting this error and cant find a fix online.

#

HTTP Error 404. The requested resource is not found.

faint prism
#

bad url

shy turret
stoic hull
#

bad url
@faint prism Hm i pointed the domain name to my servers ip on the good port with port forwarding.

faint prism
#

I'm going to need more context about your issue

#

@stoic hull You can keep it in this channel in-case anyone else has a similar issue

stoic hull
#

So i bought a domain name, pointed the domain to the website servers ip address, which is hosted with apache2. And i just get the 404 not found error.

faint prism
#

So i bought a domain name, pointed the domain to the website servers ip address, which is hosted with apache2. And i just get the 404 not found error.
@stoic hull We can keep the discussion in #development

stoic hull
#

Alright.

faint prism
stoic hull
#

Jup

faint prism
#

Are you testing with the public IP, not local?

stoic hull
#

Public ip, yes.

faint prism
#

So it doesn't start with 192.168... right?

stoic hull
#

Nope, i know the difference between a public and local ip.

faint prism
#

That's when you get the 404?

stoic hull
#

HTTP Error 404. The requested resource is not found.

faint prism
#

ah

#

so the DNS does resolve?

stoic hull
#

Nope i don't.

faint prism
#

Oh sweet

#

Then your domain is correctly serving the webservice

#

however, you aren't serving anything on the root route /

#

like an index.html

stoic hull
#

Uh let me test something.

#

My index.html is in /var/www/html/index.html

#

and when i used a free dns service (dynu) it would work great.

faint prism
#

really? hm

stoic hull
#

Yup, and i can't find any articles on the specific problem.

faint prism
#

sounds like the domain provider may have some config that's messing up the routing

stoic hull
#

Hm, maybe the root apache2 folder?

waxen siren
#

someone can give me invite bot?

#

invite manager offline

stoic hull
#

The provider is bnamed

faint prism
#

I mean you said the index page was being served with a different domain provider

modest smelt
#

anyone

stoic hull
#

Yup, maybe i can find a tutorial on how to use bnamed

modest smelt
#

can anyone suggest me a hosting service for free

stoic hull
#

I'll come back to it, yeah?

faint prism
modest smelt
#

oh

#

i used heroku

ancient falcon
#

it literally says it 404

#

that url you're trying to access does not exist

modest smelt
#

but then i can't access json files

faint prism
#

it literally says it 404
@ancient falcon So 404 means the service is responding, but nothing is at that domain.com/someresource url

ancient falcon
#

yeah

faint prism
#

So when you access it directly, it doesn't 404, right?

#

If so, your domain provider must be messing up

ancient falcon
#

domain or subdomain is not found

#

the browser was able to communicate with a given server, but the server could not find what was requested
from wikipedia

faint prism
#

yeah, ik what the status code means

ancient falcon
#

actually 404 might be a 403

#

but hidden

stoic hull
ancient falcon
#

404 doesn't have to do with client side

#

the server sends you a 404 code, so you were connected to the server at some point

stoic hull
#

yeah, true but it doesnt send the custom 404 i set.

faint prism
#

4xx is a client error

ancient falcon
#

yeah but 404 is an error in the request

faint prism
#

yes

ancient falcon
#

the error is in what was requested

faint prism
#

So we are in agreement

ancient falcon
#

@stoic hull that means exactly what it says

faint prism
stoic hull
#

i get that.

lean lintel
#

im trying to make so when the bot creates the channel it generates a random number 1-1000 like ticket #1045

stoic hull
#

but i just cant find a fix

#

and it for sure used to work

ancient falcon
#

im trying to make so when the bot creates the channel it generates a random number 1-1000 like ticket #1045
@lean lintel just use a random int module?

lean lintel
#

k

#

ii tried and it just gives me ticket undefiend

quartz kindle
#

tickets should definitely not be random lol

lean lintel
#

so lol

#

bruh i dont

#

know

#

lmao

stoic hull
#

they should count up

faint prism
#

ticket #0001
ticket #0002
..

quartz kindle
#

did someone just call me bald

#

wat

faint prism
#

lma0

lean lintel
#

lmao

#

auger how to make that

stoic hull
#

@lean lintel did

lean lintel
#

couldnt be me

faint prism
#

just add 1 to the previous ticket?

lean lintel
#

yeah but like lmao

#

you dont get me

faint prism
#

I don't know any more information ๐Ÿคทโ€โ™‚๏ธ

ancient falcon
#

no, we can't read your mind unfortunately

lean lintel
#

somone does .ticket and it creates ticket #1

#

and if somone does it again

#

it creates ticekt #1 again

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

client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
});

client.on('message', msg => {
  if (msg.content === '-ping') {
    msg.reply('Pong!');
  } else if (msg.content === '-help') {
    msg.reply('\n__**COMMANDS**__ \n-help   : shows you this \n-ping   : checks if bot is alive and running! \n-invite   : Gets you invite link for bot and support server. \n-support   : Sends a link to the support server. \n-beep   : Random fun command, kind of like the -ping command. \n \n**More commands will be added soon.**')
  } else if (msg.content === '-invite') {
    msg.reply('\n**OMG! Please invite me to your server(s) because I can help you alot! \n**Bot Invite**: i aint showing \n**Support Server Invite**: i aint showing')
  } else if (msg.content === '-beep') {
      msg.reply('Boop.');
  } else if (msg.content === '-support') {
    msg.reply('Here is the link to our support server: i aint showing')
  }
});

client.user.setActivity('-help', {
    type: 'PLAYING'
});

client.login('i aint showing');
lean lintel
#

thats not what im trying to do

sand skiff
#

why wont it work

faint prism
#

why wont it work
@sand skiff idk, what's the error?

sand skiff
#

when i try to run it

#
/Users/SiaYT/Desktop/MAY/index.js:22
client.user.setActivity('-help', {
            ^

TypeError: Cannot read property 'setActivity' of null
    at Object.<anonymous> (/Users/SiaYT/Desktop/MAY/index.js:22:13)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47
Susantas-iMac:MAY SiaYT$ ```
earnest phoenix
#

if you want tickets you'll most likely need a database, otherwise there can be user interference and your system will do a big oopsie

lean lintel
#

my simple ticket system is fine hehe

misty sigil
#

it needs to be in client.on ready

lean lintel
#

just need to do that

sand skiff
#

can someone fix it for me?

ancient falcon
#

no

earnest phoenix
#

if you pay me

#

don't spoonfeed code

misty sigil
#

arGH

stoic hull
#

i give up

#

just put it in ready event

sand skiff
#

huh

ancient falcon
#

imagine wanting to be spoonfed

stoic hull
#

client.user.setActivity('-help', {
type: 'PLAYING'
});

#

needs to be in ready event

sand skiff
#

oh

dawn plaza
#

[ERR_INVALID_CALLBACK]: Callback must be a function.
Can someone help me with that?

stoic hull
#

Callback isnt a function lol

ancient falcon
#

@dawn plaza show full context

sand skiff
#
client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
} client.user.setActivity('-help', {
    type: 'PLAYING'
});``` @stoic hull like this?
stoic hull
#

yes

misty sigil
#

no that isnt right

stoic hull
#

make it one line tho

sand skiff
#

ok

dawn plaza
sand skiff
#

huh

misty sigil
#

its not inside it

stoic hull
#

just

sand skiff
#

oh

quartz kindle
#

@dawn plaza show code for insult.js

sand skiff
#

afk

ancient falcon
#
client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
} client.user.setActivity('-help', {
    type: 'PLAYING'
});``` @stoic hull like this?

@sand skiff Javascript uses brackets to declare function body

stoic hull
#

client.user.setActivity('-help', { type: "PLAYING" })

ancient falcon
#
client.on('ready', () => { // Opening of the function
  console.log(`Logged in as ${client.user.tag}!`);
}); // Ending of the function
faint prism
#

JS is whitecase insensitive iirc

quartz kindle
#

missed a )

ancient falcon
#

and yeah

dawn plaza
#
module.exports = {
  name: 'insult',
  description: ".",
  execute(message, args){

    if(message.member.roles.cache.some(r => r.name === "Creator")){
          message.channel.send("");
          setTimeout(message.channel.send("1"),2000);
          setTimeout(message.channel.send("2"),6000);
          setTimeout(message.channel.send("3"),8000);
          setTimeout(message.channel.send("4"),10000);
          setTimeout(message.channel.send("5"),12000);
    } else {
          message.channel.send('No permissions');
    }
  }
}
#

@quartz kindle

calm junco
#

@calm junco heroku
@leaden lake what that

quartz kindle
#

setTimeout expects a function

ancient falcon
#

setTimeout uses a callback function

quartz kindle
#

message.channel.send() returns a promise

ancient falcon
#

yeah

dawn plaza
#

So how should I write it?

quartz kindle
#

setTimeout(() => message.channel.send(), 2000)

dawn plaza
#

Ohh, thank you!

ancient falcon
#

shouldn't it be message.channel.send without parenthesis or am I too python

quartz kindle
#

before or after?

misty sigil
#

its parenthesis after because send is a function

quartz kindle
#

isnt it the same in python?

#

.send(content="bla")

ancient falcon
#

if you put parenthesis in python it'll pass the result of the function as an argument

quartz kindle
#

yeah its the same in js

stoic hull
#

Thanks kyando and auger ๐Ÿ™‚

quartz kindle
#

thats why we give a lambda function to setTimeout

sand skiff
#

client.user.setActivity('-help', { type: "PLAYING" }
@stoic hull still not workign

misty sigil
#

is it in

#

the ready event

sand skiff
#
client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
} client.user.setActivity('-help', { type: "PLAYING" }
});```
stoic hull
#

@stoic hull still not workign
@sand skiff is it in the ready event

misty sigil
#

no it isnt

stoic hull
#

still outside

sand skiff
#

oh

misty sigil
#

if i have to do this

#

so be it

stoic hull
#

remove the bracket at the beginning of the client.user.setActivity

misty sigil
#
client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
  client.user.setActivity('-help', { type: "PLAYING" })
});
ancient falcon
#

^

pale vessel
#

close the setActivity

misty sigil
#

wait oh ye

quartz kindle
#

still missing a )

#

lmao

misty sigil
#

fuCK im tired ok

stoic hull
#

fuCK im tired ok
@misty sigil relatable

ancient falcon
#

wait () => is how you do lambdas in js

quartz kindle
#

one of the ways yes

misty sigil
#

i dont think so

ancient falcon
#

I just realized that

misty sigil
#

ok thanks tim

sand skiff
#
client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
  client.user.setActivity('-help', { type: "PLAYING" })
});```
#

this?

faint prism
#

(() => )

quartz kindle
#

you can also do function() {}

sand skiff
#

bc its still not working

misty sigil
#

yes

pale vessel
sand skiff
#

bc its still not working
@sand skiff

#

ITS

#

NOT

#

WORKING

ancient falcon
#

dang I'm too used to python sugar code

misty sigil
#

i was gonna send that falzepe

sand skiff
#

Susantas-iMac:MAY SiaYT$ node index.js
/Users/SiaYT/Desktop/MAY/index.js:23
client.user.setActivity('-help', {
^

TypeError: Cannot read property 'setActivity' of null
at Object.<anonymous> (/Users/SiaYT/Desktop/MAY/index.js:23:13)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
Susantas-iMac:MAY SiaYT$

misty sigil
#

@sand skiff did you remember to save

sand skiff
#

yes

#

command s

misty sigil
#

DID

faint prism
#

lmao

misty sigil
#

YOU

sand skiff
#

YES

faint prism
#

I dont think you did

sand skiff
#

I SAVED IT

pale vessel
#

client.user is null because it's their old code?

faint prism
#

.user.setActivity('-help', { looks like your old code

misty sigil
#

yea it does

opal plank
#
Susantas-iMac:MAY SiaYT$ node index.js
/Users/SiaYT/Desktop/MAY/index.js:22
client.user.setActivity('-help', {
            ^

TypeError: Cannot read property 'setActivity' of null
    at Object.<anonymous> (/Users/SiaYT/Desktop/MAY/index.js:22:13)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47
Susantas-iMac:MAY SiaYT$ 

new err

Susantas-iMac:MAY SiaYT$ node index.js
/Users/SiaYT/Desktop/MAY/index.js:23
client.user.setActivity('-help', {
            ^

TypeError: Cannot read property 'setActivity' of null
    at Object.<anonymous> (/Users/SiaYT/Desktop/MAY/index.js:23:13)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47
Susantas-iMac:MAY SiaYT$```
quartz kindle
#
someFuncThatExpectsALambda(() => console.log("bla"))
someFuncThatExpectsALambdaWithParams(a => console.log(a))
someFuncThatExpectsALambdaWithMultipleParams((a,b,c) => console.log(a,b,c))
someFuncThatExpectsALambdaWithParamsWithRegularFunctions(function(a) { console.log(a) })
#

Lol

opal plank
#

1 line below

sand skiff
#
client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
  client.user.setActivity('-help', { type: "PLAYING" })
});```
#

how

opal plank
#

look at index

sand skiff
#

do i fix

#

it

#

๐Ÿ˜ญ

dawn plaza
#

How quickly can you make a bot send messages before it breaks?

misty sigil
#

dont try and push it that far

faint prism
#

How quickly can you make a bot send messages before it breaks?
@dawn plaza Sounds like API abuse

misty sigil
#

ratelimits bad

opal plank
#

how quickly can u get ratelimtied before you hit 30 messages?

quartz kindle
#

discord allows 5 messages per 5 seconds per channel

sand skiff
#

k

#

k

dawn plaza
#

Okay, thanks

sand skiff
#

k

#

k

#

k

#

k

misty sigil
#

bruh what

faint prism
#

@slender thistle y u spam
||maybe I was too quick to @ sorry <3||

sand skiff
#

nope

#

more

opal plank
#

can we not spam pls?

sand skiff
#

sorry

#

so

dawn plaza
#

@faint prism Mine sends a message longer than 2000 characters and I didn't want other's messages to break the line

sand skiff
#

help pls anyone?

#
client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
  client.user.setActivity('-help', { type: "PLAYING" })
});```
misty sigil
#

try saving it

sand skiff
#

it wont work

#

i tried

misty sigil
#

show us proof that its saved

sand skiff
#

ill try again

opal plank
#

i mean jeremy, it is one line lower than the previous error

sand skiff
#

client.on('ready', () => {
console.log(Logged in as ${client.user.tag}!);
client.user.setActivity('-help', { type: "PLAYING" })
});

#

oops

sand skiff
opal plank
#

client doesnt have user

sand skiff
#

see

misty sigil
#

the error messages are the same

#

just not the stack traces

opal plank
#

indeed

sand skiff
#

then whast WRONG with IT

misty sigil
#

client.user doesn't exist

faint prism
#

The IT industry has a lot of issues rn

solemn leaf
#

client is the bot

#

if you

misty sigil
#

its defined as client

solemn leaf
#

console.log(JSON.stringify(client))

misty sigil
#

nO

sand skiff
#

its defined as client
@misty sigil so uh

solemn leaf
#

no?

misty sigil
#

dont need to json stringify in console.logs iirc

sand skiff
#

client.setactivity?

misty sigil
#

no

solemn leaf
#

can you not do that iwth client?

opal plank
faint prism
#

client.setactivity?
@sand skiff that's a question for d.js docs

sand skiff
#

no i mean like

#

how do i fix it

misty sigil
opal plank
#

^^

#

too slow

misty sigil
#

slow as

opal plank
#

its unfair to keep it open before hand predicting they'll ask for it

#

cheater

misty sigil
#

nah

#

i just have a djs command

opal plank
misty sigil
#

infact luca needs a djs command

leaden lake
#

@leaden lake what that
@calm junco a host

sand skiff
#
// Set the client user's activity
client.user.setActivity('discord.js', { type: 'WATCHING' })
  .then(presence => console.log(`Activity set to ${presence.activities[0].name}`))
  .catch(console.error);```
#

thats from d.js

misty sigil
#

in the ready event

sand skiff
#

ok

opal plank
#

it is on ready event though

#
client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
  client.user.setActivity('-help', { type: "PLAYING" })
});```
sand skiff
#
client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
  client.user.setActivity('discord.js', { type: 'WATCHING' })
  .then(presence => console.log(`Activity set to ${presence.activities[0].name}`))
  .catch(console.error);
});
opal plank
#

i dont see typos either

sand skiff
#

like this?

misty sigil
#

yes

sand skiff
#

ok

opal plank
#

i'll liekly error cuz i dont think thats whats wrong

#

but try

sand skiff
#

let e save and run

opal plank
#

why my shit not functioning?

faint prism
#

sEnD eRrOr

shy turret
#

^

opal plank
#

no not that

shy turret
opal plank
#

i just pushed an update to the host and specifically that command no work

#

wtf

misty sigil
#

lmao

loud rivet
#

I wonder if there are discord bots with afk command?

opal plank
sand skiff
#
Susantas-iMac:~ SiaYT$ cd /Users/SiaYT/Desktop/MAY 
Susantas-iMac:MAY SiaYT$ node index.js
/Users/SiaYT/Desktop/MAY/index.js:25
client.user.setActivity('-help', {
            ^

TypeError: Cannot read property 'setActivity' of null
    at Object.<anonymous> (/Users/SiaYT/Desktop/MAY/index.js:25:13)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47
Susantas-iMac:MAY SiaYT$ 

#

UGH

#

IT WONT

#

WORK

stoic hull
#

lol

misty sigil
#

BRUH

faint prism
#

make the api call directly then

misty sigil
#

^ do that

opal plank
#

whatever you define your client shouldnt matter

misty sigil
#

yes it doesnt

opal plank
misty sigil
#

not at fucking all

opal plank
#

both bots on the same acc

#

replies to all commands except this, whcih only my local replies to

#

both are cloned from git

#

say what now?

#

no errors either

faint prism
#

git pull ?

opal plank
#

i did

sand skiff
#

what

#

can someone send the code

#

fixed

#

please

misty sigil
faint prism
#

spoonfeed no

opal plank
faint prism
#

learn the JS language

opal plank
#

ยฏ_(ใƒ„)_/ยฏ

faint prism
#

If you actually learned the beginner stuff for Javascript language, you'd actually be able to solve most the syntax issues you run into @sand skiff

opal plank
#

@faint prism no u, fix code

stoic hull
#

you can always google it lol

opal plank
#

wait a second

#

you dont think this is doing it, do ya?

#

it should only return '' on that ${} bit

#

not set the whole message as ''

earnest phoenix
#

smh i have to wait again 3 weeks

misty sigil
#

why

opal plank
#

i should prob add a getter method to channels cache tbh

earnest phoenix
#

@misty sigil just submitted new bot

#

omg 4 weeks

#

i am done

#

im done

opal plank
#

'custom bots for nitro'

#

selling your soul for $3 is quite the price, eh?

misty sigil
#

aye

solemn leaf
#

@opal plank might be that your running it twice

opal plank
#

IM SO CONFUSED