#development

1 messages · Page 1283 of 1

quartz kindle
#

xd

opal plank
#

working gets u minimum wage

#

beat that

ancient nova
#

I see

#

welp Imma check them out

solemn latch
#

amazon has some pretty cool stuff too that id like to checkout

#

like wtf is elastic block storage

#

amazon lex? chatbots? pog

#

amazon IoT 250k messages 🤔 some good arduino stuff probably

stark abyss
#

how to send a dm to someone frmo their id (not message.author.send)

#

djs

opal plank
#

@stark abyss get the user from cache(or fetch) then .send()

stark abyss
#

okay

#

thx

#

client.users.cache.get("id")

#

is this the right way

#

is this the way

solemn latch
#

should be

stark abyss
#

do you know da wae

#

Lmao I just remembered an old meme

solemn latch
#

it wasnt me mods i swer

opal plank
#

@stark abyss hence why i put (fetch) in parenthesis

#

if the user is not cached, fetch it

stark abyss
#

what I haven't tried anything yet

solemn latch
#

if the user is in cache is fetch slower?

#

🤔

stark abyss
#

but, but do you know da wae

solemn latch
#

like, if your function is async already is there really any reason not to use await fetch()

#

assuming you need the user either way

opal plank
#

but do you know da #general ? @stark abyss

stark abyss
#

that was the end of it you didn't need to point it out I am well aware what this channel is for and yes I understand I will refrain from it cries

opal plank
#

jokes every now and then are fine

#

neither am i strict about it

#

what gets me is cringe

stark abyss
#

Sorry

faint prism
solemn latch
#

trying to find fetch and get in the github to see what one is slower 🤔 cant find either

#

am i dumb

#

get is part of map isnt it

#

yeah, get is a tiny microscopic amount faster as far as i can tell, if the user is already in cache.

thick gull
#

gee i wonder what’s faster

#

fetching a user (not in cache)

#

or getting a user from the cache (in cache)

#

despair we may never know

#

hold on let’s get Erwin to create a function that’s faster than both

#

they’re a genius

solemn latch
#

my point was is there any point to use get when you need the user

thick gull
#

fetch checks if user is in cache

solemn latch
#

yeah

#

so why use get if you need the user 🤔

thick gull
#

i would use fetch regardless for the slight chance the user might not be in cache

frigid spruce
#

How does a hugely popular bot get past the rate limits that are set?

solemn latch
#

huge bots get special ratelimit perms iirc

frigid spruce
#

Or are they on a per server, per channel, etc sorta basis?

solemn latch
#

mostly per channel iirc, but the hard limits still exist

frigid spruce
#

That's interesting. Trying to find more info about that. High hopes ya know. Also intrigued.

solemn latch
#

the request limits are dynamic so its hard to know tbh

earnest phoenix
#

can anyone tell me why it run?

thick gull
#

uuh

#

js?

sonic lodge
thick gull
#

py? idk

sonic lodge
#

looks like it's python

#

if you put a comma at the end it turns everything into a tuplet

thick gull
#

to me, an idiot doing JS, it looks like JS but fucked up

#

so im not sure

chilly bison
#

spoonfeeding bad

thick gull
#

yes, we know

#

next

fast trench
#

@earnest phoenix That's very very wrong

#

to me, an idiot doing JS, it looks like JS but fucked up
@thick gull right! I think it's js but he is new maybe?

thick gull
#

yeah

zenith terrace
#

its python cause of the set_author

thick gull
#

that's why i asked for lang

fast trench
#

sooo @earnest phoenix did you want help or not?

zenith terrace
#

I think its cause the comma is there KEKW

earnest phoenix
#

yes

#

@fast trench

zenith terrace
#

@earnest phoenix try removing the comma

earnest phoenix
#

I did everything ok

sonic lodge
#

it is because the comma is there

zenith terrace
sonic lodge
earnest phoenix
#

you generally who write or who suggest me to start writing

#

?

sonic lodge
#

remove the comma

earnest phoenix
#

fix bro

sonic lodge
#

that's the fix; remove the comma

earnest phoenix
#

ty

fast trench
#

🤦‍♂️

graceful dock
earnest phoenix
#

you generally who write or who suggest me to start writing?

solemn latch
#

everyone would suggest you start writing here

haughty bough
#

Hello. I'm new to this programming world and I wanted to know what way you use to search videos on youtube and make the bot play on a channel. I currently use the YouTube API, but it has a quota limit per week and this limits the bot a lot. Is there a library that ends this?

umbral zealot
#

there is no way to bypass the quotas from youtube without breaking their terms of service, no.

#

Any library would be subject to these same quotas.

haughty bough
#

Ah understood. So I must keep trying to increase the limit. Thank you!

earnest phoenix
#

are you guys talking about the Youtube.Data.v2 api?

solemn latch
#

any api has ratelimits 🤔

earnest phoenix
#

yeah but i dont think the data api has a qouta limit per week

#

its used to search yt mainly

#

so i dont think they would put a limit on that

earnest phoenix
#

can anyone tell me why it run?

solemn latch
#

your ide probably says why

#

in the list of problems

thick gull
#

why its red ** (?)

earnest phoenix
#

Hello how do i fix my custom text status it's not showing up the words that i put on my mobile

#

@solemn latch

slender thistle
#

@earnest phoenix commands.Bot, not discord.Client

slate oyster
#

Rewriting Discord bots is really hard
Because you have to live up to the expectation of the previous version of the bot and then some
And when the previous version took a month or two to write...

opal plank
#

@thick gull there might be better ways to get lin count

thick gull
#

no i dont

#

need it

hollow sedge
#

what are the benefits of using AWS as opposed to Heroku? People say that Heroku is bad, but why?

thick gull
#

there are over 20K spaces

#

the array is joined by space

opal plank
#

jesus fucking chirst]

slender thistle
#

It's intended to be used for web apps, not Discord bots or generally anything else

thick gull
#

@opal plank it crashed when i tried formatting it into a proper array

hollow sedge
#

i mean yeah but how is that bad

thick gull
#

i put a single ']'

#

at the end

hollow sedge
#

does it affect performance?

opal plank
#

even tokenization fails for me some times

#

cant even imagine that big ass one

#

now require() that and send it as message in discord with {split:true}

slender thistle
#

I mean, Heroku has an ephemeral filesystem, which already renders you unable to use local-file databases

#

I think I had a tag somewhere, hold on

opal plank
#

dont i have a tag?

#

i think i have a 'who no heroku' tag

thick gull
#

now require() that and send it as message in discord with {split:true}
@opal plank i dont want to

#

pelase

hollow sedge
#

thats a good point but im using mongodb atlas anyways..i guess once that fills out I would need to use a local-file database

thick gull
#

no its in pins i think

slender thistle
hollow sedge
#

im already using AWS i just wanted to know why

thick gull
#

erwin if i do it

opal plank
#

aparently not

thick gull
#

chances that i get rate limited

#

?

opal plank
#

probbably very slow

#

d.js handles ratelimits for you[

thick gull
#

this is not a good idea whatsoever

#

but that’s what I like !

opal plank
#

already doing bad shit, what is one more stupid idea ontop?

thick gull
#

bet

opal plank
#

my cache better be calling itself now

hollow sedge
#

AWS is amazing powerful though, I was surprised that it gave me so much for free

#

(I know it's only for one year but it's still pretty cheap afterwards)

thick gull
opal plank
#

LUL

mint hamlet
#
module.exports = {
  name: "slowmode",
  category: "utility",
  description: "Set the slowmode for the channel!",
  run: async (bot, message, args) => {
    if (!args[0])
      return message.channel.send(
        `You did not specify the time in seconds you wish to set this channel's slow mode too!`
      );
    if (isNaN(args[0])) return message.channel.send(`That is not a number!`);
    let reason = message.content.slice(
      bot.prefix.length + 9 + args[0].length + 1
    );
    if (!reason) {
      reason == "No reason provided!";
    }
    message.channel.setRateLimitPerUser(args[0], reason);
    message.channel.send(
      `Set the slowmode of this channel too **${args[0]}** with the reason: **${reason}**`
    );
  },
};```

Why am I getting error again and again? Is there any problem in the code?
sudden geyser
#

@mint hamlet what's the error?

#

Maybe it's because of this line:

message.channel.setRateLimitPerUser(args[0], reason);

.setRateLimitPerUser takes a number as its first argument, but args[0] would return a string most likely.

mint hamlet
#

ok lemme try.

#

Error : ```(node:7911) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'length' of undefined

sonic lodge
#

bot.prefix is undefined

mint hamlet
#

ok

sonic lodge
#

did you set it anywhere

mint hamlet
#

yea in the starting

#

const { prefix } = require('./config.json')

sonic lodge
#

bot and prefix are two different things

#

you never actually attached prefix to bot

#

somewhere after that require you need to have bot.prefix = prefix; in order for your command to work

mint hamlet
#

OMG i realised now thanks

karmic compass
#

in d.js is there a way to get a message content from it's ID and/or link

#

or is it just client.messages.cache.get?

sudden geyser
#

You could manually fetch the message with <TextChannel>.messages.fetch

#

And give it the ID of the message

karmic compass
#

hmm

sudden geyser
#

If you want to fetch a message by the URL, parse it for the ID at the end (https://canary.discordapp.com/channels/guild-id/channel-id/message-id)

karmic compass
#

could i use regex for that part?

sudden geyser
#

Yeah you could, but if you want to be straightforward you could just split by / and get the last element

opal plank
#

just check for digits

#

fetching 'BobTheBuilder' cuz some idiot didnt read the documents/how to use command is quite stupid

#

never trust your users input

vital lark
#

/[0-9]/

opal plank
#

\d+

vital lark
#

heck you

opal plank
#

begone scrib

karmic compass
#

uh

#
    if(command === "quotebook") {
        const channel = client.channels.cache.get("760707104851361822")
        if(!channel) return message.reply("Quotebook not found!")
        let url = args[0]
        if(!url || !url.startsWith("https://discordapp.com/channels/")) return message.reply("Invalid URL!")
        let properties = url.split("/")
        let msgID = properties[6]
        let quoteChannel = client.channels.cache.get(properties[5])
        let quoteMessage = quoteChannel.fetch(msgID)
        if(!msgID) return message.reply("Invalid URL!")
        const quoteBookEmbed = new Discord.MessageEmbed()
         .setColor("34b4eb")
         .setTitle(`Quote From ${quoteMessage.author.username}`)
         .setDescription(`${quoteMessage.content}`)
        channel.send(quoteBookEmbed)
    }
``` so this doesn't work, says "username" is undefined
#

how can i manage to make this somehow work?

#

i'm clueless on this part

#

it also says that the message cobntebt is undefined...... bRRRRRRRRRRRR

vital lark
#

quoteMessage can be null

#

user can be null

karmic compass
#

how can i fix this so?

vital lark
#

condition

#

if (user !== null)

karmic compass
#

no i just think that it isn't a message at all

opal plank
#

await your promises

#

@karmic compass

karmic compass
#

excuse me whjat

#

wait

#

where?

#

wait no

opal plank
#

fetch()

#

is a promise

#

let it finish first

#

either chain it with a then or await it in async

karmic compass
#
(node:17540) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'username' of undefined
    at Client.<anonymous> (C:\Users\email\Desktop\coding\KrossBot\index.js:96:54)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:17540) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:17540) [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.
opal plank
#

again

#

listen to what i said

#

and fix it

karmic compass
#

i did

opal plank
#

now log that to make sure you are properly getting a quoteMessage

#

cuz it can return null

karmic compass
#

i have a check for that aswell

opal plank
#

where is that?

#

post the new code

karmic compass
#
if(command === "quotebook") {
        const channel = client.channels.cache.get("760707104851361822")
        if(!channel) return message.reply("Quotebook not found!")
        let url = args[0]
        if(!url || !url.startsWith("https://discordapp.com/channels/")) return message.reply("Invalid URL!")
        let properties = url.split("/")
        let msgID = properties[6]
        let quoteChannel = client.channels.cache.get(properties[5])
        let quoteMessage = await quoteChannel.fetch(msgID)
        if(!msgID) return message.reply("Invalid URL!")
        if(quoteChannel === null || quoteMessage === null) return
        const quoteBookEmbed = new Discord.MessageEmbed()
         .setColor("34b4eb")
         .setTitle(`Quote From ${quoteMessage.author.username}`)
         .setDescription(`${quoteMessage.content}`)
        channel.send(quoteBookEmbed)
    }
opal plank
#

dont do null

#

use falsey

karmic compass
#

falsey?

opal plank
#

yes

#

if(!thing)

karmic compass
#

what's that?

#

ah

#

so it's a thing

#
(node:13928) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'username' of undefined
    at Client.<anonymous> (C:\Users\email\Desktop\coding\KrossBot\index.js:96:54)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:13928) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:13928) [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.

#

same error

opal plank
#

again, log it

#

before the embed

karmic compass
#

probably not

#

checking now

opal plank
#

k

karmic compass
#

woah

#

wiat

#

it's over 2000 characters but

#

ITS NOT UnDEFINED

opal plank
#

i said log it

karmic compass
#

yeah

opal plank
#

dont throw it in channel

karmic compass
#

i did

opal plank
#

console.log()

karmic compass
#

okay so we getting a textchannel

#

wait

#

wait okay

#

that's returning a channel then

opal plank
#

oh

karmic compass
#

is quoteChannel.fetch incorrect?

opal plank
#

i see the issue

#

<channel>.messages.fetch()

#

my bad, shouldv'e seen it

karmic compass
#

I

#

STG

opal plank
#

check for channel right after you get it for cache

#

if you try undefined.messages it'll error

karmic compass
#

WOW IT SUDDENYL WORKS THANKS INTELLISENSE FOR MAKING ME DOUBT MYSELF

#

lmao

#

i need to stop trusting intellisense so much

opal plank
#

you need to start using debugger

#

thats what you should do

karmic compass
#

wait

#

in .setAuthor what does dynamic mean?

#

like it updates?

opal plank
#

extension iirc

#

for gifs

karmic compass
#

ah

opal plank
#

actually i dont remember

#

lemme check

#

hmm

#

i have no clue tbh

#

the soul who made the the types for d.js did not make a SINGLE comment

#

imagine making me go to the Documents to get info about stuff

karmic compass
#

uh also

#
(node:14028) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
embed.author.url: Not a well formed URL.
    at RequestHandler.execute (C:\Users\email\Desktop\coding\KrossBot\node_modules\discord.js\src\rest\RequestHandler.js:170:25)  
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:14028) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:14028) [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.
opal plank
#

3.1k lines, yeah, no thanks, not about to commit to documenting everything in this messy code

karmic compass
#
.setAuthor(`${quoteMessage.author.tag}`, quoteMessage.author.displayAvatarURL(), true)
#

not sure what i'm doing wrong there

opal plank
#

there are no options in it

#

though i think they are optional

karmic compass
#

oop

#

, true

#

made it dumb

opal plank
#

there you have it

ionic shard
#

do u need BAN_MEMBERS to unban people?

vital lark
#

yes

ionic shard
#

okay thanks

earnest phoenix
#

What is the difference between name , property and type attributes of <meta> tag in HTML

#

uh also
@karmic compass URL is wrong

vital lark
#

type is the actual type you want to set

rocky hearth
#

the <Connection>.dispatcher.end(), optionally takes a callback function. Is that callback function is same as the one which triggers the finish event??

earnest phoenix
#

still can't figure out how to install MySQLi on repl.it

#

@🍰wtf why can i ping birthday cake role

#

<@&330168063729074177>

#

what have you done...

#

LOL

#

we're getting off topic

#

k

pale vessel
#

still can't figure out how to install MySQLi on repl.it
@earnest phoenix please for god's sake use pdo

earnest phoenix
#

what is pdo?

pale vessel
#

an interface for accessing databases

earnest phoenix
pale vessel
#

mysql is supported

earnest phoenix
#

ok

pale vessel
#

it's better than mysqli so

#

supports more than mysql

alpine loom
#

Guys

#

Can you change mee6 command type

#

Like how to change its ! to +

pale vessel
#

ask in their support server

#

and yes, you can

#

but this isn't the place to talk about that

alpine loom
#

Where is that?

pale vessel
compact oriole
#

use your brain once to find stuff

earnest phoenix
#

it's better than mysqli so
@pale vessel bruh i'll need to edit 1k PHP files just to move to PDO because I'm just
temporarily hosting my PHP web server on repl.it

pale vessel
#

it's just a bunch of statements 4Head

opal plank
#

not ONE fucking comment*

#

Erwin would like to know your location and have a talk to whoever the fuck made the type declarations for d,js

earnest phoenix
#

not ONE fucking comment*
@opal plank not ONE Erwin*

opal plank
#

imagine having examples

#

might even go bother Tim to get his lib with type declarations tbh

#

make a pr to ship with the proper declaration types

earnest phoenix
#

wait you can click properties to view typescript descriptions for em

opal plank
#

thats tooling for you

#

providing wiki inside your IDE

#

rather than having me go like an idiot fetch the docs at discord.js.org or whatever

#

it already provides types which is great

#

but having the examples like in the wiki and some extra info about what methods do what would be fucking gvreat, ngl

earnest phoenix
#

@opal plank how do you add the "tooling" thing inside TahpScrept so you can hover over stuff to view things about em

opal plank
#

bruh, lemme show you

#

its so simple

#

everything im adding has tooling in it

earnest phoenix
#

i don't use tahpscrept that's why i dunno
but repl.it has tahpscrept stuff inside normal JS files smh

opal plank
#

look at this

earnest phoenix
#

it's so similar to JSDoc syntax

opal plank
#

when you hover over the method i added it adds the example/description that i set for that

earnest phoenix
#

but can you do that stuff in vanilla JS

#

or is it only restricted to type script

opal plank
#

fairly certain its Ts only

#

do correct me if im wrong

#

but im 90% sure

slender thistle
#

Isn't that type of tooling supported in all languages with proper IDEs

earnest phoenix
#

but how is my IDE able to show me those stuff inside normal JS environments

opal plank
#

im not sure tbh shiv

slender thistle
#

I use it in Python

opal plank
#

im applying that inside my Ts declaration module, so im assuming its in there

cinder patio
#

It also works in JS but not very well. It just guesses most stuff.

opal plank
#

d.js does not have a single tooling inside

cinder patio
#

for example, if Command is a class, and you do const cmd = new Command(), the IDE is going to know the properties and methods of the class regardless if it's TS or JS

opal plank
#

it tells me the types, which is great

#

but ffs

#

every now and then im stuck having to go on the docs

slender thistle
#
        """
        :param role_involved: A boolean switch, True if punishment involves roles (mute), False if not (bans, kicks,
        warn).
        :type role_involved: bool
        :param guild: A guild to get role from.
        :type guild: discord.Guild
        :param now: A datetime.datetime instance, time of executing the function
        :type now: datetime.datetime
        :return: A tuple consisting of the mute role (if role_involved is True), formatted date and time,
        and the mod-log channel. ([mute_role], date, time, channel)
        :rtype: tuple
        """
opal plank
#

thats the whole point of having tooling in your IDE

#

ship your declarations with it

#

and get it over with

#

.ts files wont be caught on vanilla js, just ship it with that inside and you good to go

#

im amazed no one has made a pr for it yet

earnest phoenix
#

for example, if Command is a class, and you do const cmd = new Command(), the IDE is going to know the properties and methods of the class regardless if it's TS or JS
@cinder patio but it only shows the prototype of the class because JS and TS both have prototypes but TS has those extra description stuff iirc

opal plank
#

i might commit to it to get contributor

#

imma ask Tim when he gets on tomorrow if he wants me to ship declarations in a ts file

earnest phoenix
#

i might commit to it to get contributor
@opal plank I added four extra links to discordjs.guide please merge my pull request if you get write access mmLol

earnest cloak
opal plank
#

im not gonna do stuff one someones behalf, im just committing to do a PR with type declarations and IDE support for em'

#

cuz this shit is hella whack

#

should take a day or two if im drunk enough to spend all day

cinder patio
#

Why not just create an issue

earnest phoenix
#

wait if you can't use MySQLi directly on repl.it can you connect to a external MySQLi database without the instruction

opal plank
#

cuz its support

#

its not an issue in it self

#

its more of a PR to request tooling for TS

cinder patio
#

Well issues don't have to be "issues", they're just called issues

earnest phoenix
cinder patio
#

They also accept suggestions

opal plank
#

though tbf d.js ships @types

#

i might try committing to d.js and djs-light tbf

#

imma ask Tim tomrrow

earnest phoenix
#

Well issues don't have to be "issues", they're just called issues
@cinder patio 99% of our suggestions come from issues in programs so

#

wait if you can't use MySQLi directly on repl.it can you connect to a external MySQLi database without the instruction
imma use PHP mah edmin

pale vessel
#

what would pma do in this case

topaz sleet
#

what wrong

opal plank
#

@earnest phoenix just went and asked, they dont have much support for ts. Some of the things i heard was
if you write a bot in TS, you most likely know what you're doing and don't need obvious examples which should probably be what Tim tells me tbf. Welp, goes down the drain a good idea to help Ts users pepe_sad

slender thistle
#

eh

opal plank
#

imagine having @types/discord-js but not having PROPER IDE tooling in it

slender thistle
#

Few examples for a memory refreshment would be cool tho

opal plank
#

imagine having to go to the discord;js docs everything you try to get something new

#

when theres tooling inside Ts

slender thistle
opal plank
#

they dont want it tbh shiv, im not gonna push it

#

i'll ask Tim if he wants to provide his lib with that little grain of extra spice

#

but d.js clearly doesnt want it

#

i know when to take a hard 'no' as answer

#

nor am i salty about it

#

not like im looking for jobs rn to show off im 'contributor' in a somewhat popular lib

earnest phoenix
#

not like im looking for jobs rn to show off im 'contributor' in a somewhat popular lib
@opal plank i am

opal plank
#

i am looking for jobs but not anything related to that, i got stuff in the background to show off for. Anyway, not related to DBL nor #development

fluid basin
#

make your own library tbh and hope it gets popular

opal plank
#

Lerwin's Shit Lib™️

slender thistle
#

LSL

opal plank
#

not too bad, im on par with that

#

Twitch Erwin's Cache Lib when?

slender thistle
#

kek

fluid basin
#

interesting, discord is closing my connection to websocket with close code 1000

earnest phoenix
#

pls

#

pls

silent berry
#

How can I add size of a guild pulled from the api into this string of command/code

he!eval helium.guilds.cache.forEach((guild) => {
        message.channel.send(" - " + guild.name + " | " + guild.id)
    })

Discord js v12.2

earnest phoenix
#

[WARN] [RateLimiter]: Encountered 429 on route /channels/756124716733038695

fluid basin
#

don't aboose api

earnest phoenix
#

means

#

[WARN] [RateLimiter]: Encountered 429 on route /channels/756124716733038695

#

"Ratelimiter"

#

Tell me what i should do

#

server adding

#

I set up webhook

#

What do I fill in?

#

@slender thistle

slender thistle
#

ba da boom

#

anything you want to be your password

earnest phoenix
#

OO

#

random characters?

slender thistle
#

sure, just anything unique that you can use to confirm that requests are coming from top.gg to you

earnest phoenix
#

K

#

after

#

I click test webhook

#

should any msg come to that channel?

slender thistle
#

depends. you got a webhook running?

earnest phoenix
#

I created one

#

and typed it above

slender thistle
#

well as the message says

earnest phoenix
slender thistle
#

You need to host a webhook (webserver) yourself and use it as the middleman to post messages

earnest phoenix
#

how do I do that?

slender thistle
#

What's your bot's library?

earnest phoenix
#

its not a bot

#

its a server

slender thistle
#

eh in any case

#

Search a webserver package for your programming language

earnest phoenix
#

I dont have any programing language for my discord server

slender thistle
#

any programming language you are familiar with?

earnest phoenix
#

js

slender thistle
#

Try out express

earnest phoenix
#

too much

#

I am not doing it

#

XD

#

I just wanted a msg from the bot

#

@pliant gorge

#

when someone votes

slender thistle
#

DSL bot doesn't send messages when someone votes

earnest phoenix
#

sad

viral veldt
slender thistle
#

just handle your promises

#

ez

viral veldt
#

i created event named unhandledRejection n uncaughtException
i can't find the stack errors

#

i can't find the stack errors cat_huh

#

is this error related to sharding?

opal plank
#

@viral veldt you alreayd have an event called that

#

process emits both those events

west agate
#

can anyone suggest any good videos/articles on how to make a corona virus status command?

opal plank
#

i wouldnt know any, though if you want JS or D.JS documentation, i can provide those

#

its simply hooking onto an api, which requires some dcent JS knownledge @west agate

west agate
#

im new

opal plank
#

you need 3 things basically

west agate
#

okay

opal plank
#

How to work with your library, how to work with HTTP libraries(to request the data to an api) and how to handle API(usually JSON) responses

tight plinth
west agate
#

im using node-fetch

opal plank
#

users does a command => you send request to api saying 'i want corona stats for this country' => api returns your response, which then you display to your users

#

those are the steps required

west agate
#

like this API?

tight plinth
#

do you know what your code is even doing

west agate
#

no 😦

opal plank
#

for that you'1ll need 1)
optional => embeds to make the response pretty
required => a command handler of sorts to detect when the user puts a command

some http library
my reocmmendation is AXIOS, though you can very well use node-fetch
https://www.npmjs.com/package/node-fetch

when you sent that URL(website) a proper request, it returns you a response

on that response, you need to display the user
most api uses JSON as format, so you need to work with js objects
https://www.w3schools.com/js/js_objects.asp
then display it for the user @west agate

west agate
#

oh..

#

thanks

opal plank
#

for a general knownledge of JavaScript

west agate
#

thanks

opal plank
#

yw

tight heath
#

i suggest using mdn ( https://developer.mozilla.org/en-US/docs/Web/JavaScript ) over w3schools because it's community-sourced

#

also

#

@west agate since you're trying to use my api

#

consider using the node wrapper instead of making the requests yourself

west agate
#

i figured it out

tight heath
#

aight

west agate
#

@west agate since you're trying to use my api
@tight heath ur API?

tight heath
west agate
#

thanksfor the help

tight heath
#

well so I pay the bills lol

#

it's a joint effort of 4 people

#

elite (originally created it), ethan (main contrib), julian (main contrib), me (infra + domain)

#

btw I have an open source covid command

#

it's not the cleanest though

west agate
#

thanks

opal plank
#

@tight heath the reason i recommend w3 over MDN is the fact that its easier to comprehend for beggingers, both in syntax and snippets. MDN is 100% better when it comes to proper documentation, though w3 has quite a few perks in my book when it comes to new people to js/ts

tight heath
#

icy

#

i just dislike w3 for multiple reasons heh

opal plank
#

i do agree mdn is better, but the interactive snippets and simple grammar helps a lot new people

clever lynx
#

@opal plank need help

opal plank
#

@clever lynx with?

clever lynx
#

Server guild

#

I am adding my bot

opal plank
clever lynx
#

It wants the servers guild id

#

Plz help

opal plank
#

it should only need oauth

west agate
#

How do I make it look like a normal number? Instead of 1000 how do i make it say 1,000

opal plank
#

where you stuck at?

west agate
#

what?

clever lynx
#

I am giving three server ids

#

But still not happening

opal plank
#

these?

clever lynx
#

Ye

opal plank
#

are the 3 server s in the list?

clever lynx
#

No

#

😅

#

Then

#

I cant add

#

Nah ?

opal plank
#

thats optional

west agate
#

@opal plank

opal plank
#

leave it blank if you dont have a server thats in there

#

@west agate yes?

opal plank
#

hmmm

#

splitting every 3

west agate
#

wdym?

opal plank
#

you'd probably want to split every 3 numbers and add a comma

#

1000 => 1,000

#

or 120000 => 120,000

#

right?

#

actually

#

lemme check something

plush magnet
#

also make sure you add the commas in reverse

#

if youre going to do it that way

west agate
#

Why is it giving me undefined? it should be defined

opal plank
#

i guess you could regex

plush magnet
#

data is undefined

#

probably

#

use a debugger

opal plank
#

small tips

#

then uses a function

#

(param) => {do stuff}

#

always wrap your parameters in parenthesiss

west agate
#

okay

opal plank
#

also you can declare multiple variables with commas

plush magnet
#

why even declare variables

opal plank
#
let a = 1, b = 2, c= 3;
//rather than
let a = 1;
let b = 2;
let c = 3;

plush magnet
#

youre not using them for other things so just place them straight into the embed

opal plank
#

^^

#

that too

slender thistle
#
>>> def separ(s: str):
...     string = ""
...     for i in range(len(s)):
...             if i % 3 == 0:
...                     string += f"{s[i]},"
...             else:
...                     string += s[i]
...     return string
...
>>> separ(s)
'1,200,000,0'
``` 🤔
clever lynx
#

@opal plank how can my bot be approved ???

opal plank
#

or discord verification?

clever lynx
#

Ye

#

Top

#

.gg

opal plank
#

top gg just wait, make sure your bot is compliant with the rules

slender thistle
#

Wait for it to be reviewed by a website moderator if you submitted it

clever lynx
#

Can my bot be approved ??

#

😭😭🙄

slender thistle
#

Wait for it to be reviewed by a website moderator if you submitted it

opal plank
#

^^

#

usually takes 5+ weeks

slender thistle
#

yeah that snippet doesn't make much sense with the output, Supernal was right

#

should do it from right to left

opal plank
#

hmmm

#

let me see if i can come up with some non regex method

slender thistle
#

I'm just going with string indexes and a for loop

#

with an if i % 3 == 0

plush magnet
#
SUDO CODE

Split time

  Get length

   count backwards and add ,

complete
#

thats one way to do it

slender thistle
#
>>> separ("12000")
'1,200,0'
``` ffs
opal plank
#

screw it, im using regex lmao

plush magnet
#

but I told you how to do it without regex lol

opal plank
#

im trying CharAt and split with join

#

tried replace too but thats faulty

#

also thats not js

#

regex makes it a whole lot easier

#

time to pass out

cobalt spruce
#

(node:7872) UnhandledPromiseRejectionWarning: TypeError: Function.prototype.apply was called on 376064908317425677, which is a string and not a function

#

i was trying to AwaitMessage

#

module.exports = {
    name: 'test',
    description: 'test',
    execute(message, args) {
        const filter = message.author.id
        message.reply("Set a title you have 10 Seconds").then(r => r.delete(10000));
        message.channel.awaitMessages(filter, {max: 1, time: 10000}).then(collected =>{
            let Title = args[1]
            
            message.channel.send(`here is ${Title}`)

        })
    }}``` FULL CODE
earnest phoenix
#

(node:7872) UnhandledPromiseRejectionWarning: TypeError: Function.prototype.apply was called on 376064908317425677, which is a string and not a function
@cobalt spruce Why are you trying to do Function.prototype.apply on a snowflake

cobalt spruce
#

i dont

earnest phoenix
#

you are

cobalt spruce
earnest phoenix
#

const filter = message.author.id wrong

cobalt spruce
#

hmmm

earnest phoenix
#

it should be a function

cobalt spruce
#

can u explane more?

#

am dum

earnest phoenix
#

@cobalt spruce the filter should be a function that does stuff

#

not message.author.id

cobalt spruce
#

want it to filter by ID

earnest phoenix
#

then it should be a function that returns true if the id matches

#

m => { /* do stuff to 'm' */}

cobalt spruce
#

like

pale vessel
#

yes

earnest phoenix
#

can you use if statement inside template strings?
like:

`Do you have permissions to run this command? ${if (message.member.hasPermission("KICK_MEMBERS")) {true} else {false}}`

or even ternary operator:

`Do you have permissions to run this command? ${message.member.hasPermission("KICK_MEMBERS")? true: false}`
#

||@pale vessel||

pale vessel
#

yes, ternary

#

for example```js
You have ${message.member.hasPermission("KICK_MEMBERS") ? "no" : "the"} permission to kick members.

north bobcat
#

Kurdi lea

earnest phoenix
#

why ain't the embed appearing

pale vessel
#

i love browserling so much

#

seems cool

tight plinth
#

wats dat

pale vessel
#

i used browserling just in case you had a crypto miner or something

#

virtual web browser

earnest phoenix
#

bruh

pale vessel
#

like a vps for free

tight plinth
#

but you gotta use a web browser to use it

#

interesting

misty sigil
#

bruh
@earnest phoenix don’t say bruh

earnest phoenix
#

like a vps for free
@pale vessel *vpb

pale vessel
#

not really a vps when you can only use the browser

misty sigil
#

you are literally known

pale vessel
#

virtual private browser yes

misty sigil
#

for having a crypto mining site

earnest phoenix
#

which i took down

#

because it totally sucked

unique nimbus
#

you still had it

earnest phoenix
#

why does repl.it use my gravatar pfp i didn't notice that until today gtg change it to a gapple

peak osprey
#
else if (command === 'purge') {
    const purgeAmount = args.slice(1).join(' '); 
    if (!purgeAmount) {
        message.reply('You haven\'t given an amount of messages which should be deleted!'); 
    }
    else if (isNaN(purgeAmount)) {
         message.reply('The amount parameter isn`t a number!'); 
    }
    else if (purgeAmount > 100 || purgeAmount < 1) {
         message.reply('You can`t delete more than 100 messages or less than 1 message at once!'); 
    }
    else if (purgeAmount < 1) { 
        message.reply('You have to delete at least 1 message!'); 
    } else {
        async function a() {
    await message.channel.messages.fetch({ limit: amount }).then(messages => { 
        message.channel.bulkDelete(messages 
    )});
        }}
    }```
earnest phoenix
#

@peak osprey what is args

pale vessel
#

debug

earnest phoenix
#

can you send the line of code where you defined args?

misty sigil
#

Console log ur variables

#

so fucking handy

earnest phoenix
#

objects will display as [object Object] in some trash IDEs so JSON.stringify() them before logging in console

peak osprey
#

i got it

#

it was with me not setting up my slice correct

pale vessel
#

usually that happens when you use console.log(`${object}`)

#

it just .toString()'s it

misty sigil
#

if you console.log(object) tho

#

it should return the full object

#

if it doesn’t it’s a shite application

earnest phoenix
#

if it doesn’t it’s a shite application
@misty sigil shite

earnest phoenix
#

can you use variables or things inside CSS?
i wanna set background-size to the size of the div element

ornate copper
#

anyone know a way to use discord.js in a web page?

graceful dock
earnest phoenix
#

wait

#

WITH 2 SECONDS LEFT

pale vessel
#

just keep the tab open

#

why star

ornate copper
#

thanks

pale vessel
#

it has limited support though

#

so no voice related stuff and no sharding

#

the only reason someone would do this is probably to test tbh

ornate copper
#

thats alr im using it for web dashboard kinda

pale vessel
#

how

#

oh well

#

good luck i guess

ornate copper
#

how
@pale vessel when i click check mark its supposed to send a msg

#

and some database shit

pale vessel
#

wouldn't your token be visible in the source?

ornate copper
#

thats the only issue

#

ill try to find a way to hide it

earnest phoenix
pale vessel
#

idk but exploit speedrun any% when

earnest phoenix
#

aa

#

record: 1 min left lol

#

i made a website to exploit the browserling

#

Browserling Teamviewer Install any%

#

oh nice it froze at UAC

faint prism
#

<script src="index.js"></script>

strange mango
#

hi, chrome is blocking my iframe with the following error (works fine on firefox):
Refused to frame 'https://deltabot.me/' because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self' https://top.gg/bot/534632914445664267".

the line for iframe in my nginx config:
add_header X-Frame-Options "ALLOW-FROM https://top.gg";

#

I also tried adding add_header Content-Security-Policy: "frame-ancestors top.gg"; but it didnt change anything

unique patio
#

Sounds like a CORS issue

strange mango
#

how can I fix it?

unique patio
#

Understand the iframe and policy?

tight plinth
#

so i'm trying to make a bot with classes, everything works fine, except that i get this error and i cannot explain why. Can anyone help me?

#

oh wait

#

nvm im just dumb

unique patio
#

lol

tight plinth
#

im mispelling constructor

strange mango
#

Understand the iframe and policy?
@unique patio kinda

thick gull
#

@opal plank index of 4 is pretty close to 12M results, i am still having fun with this one thing

bleak crypt
#

How can I post tweets on my discord server from twitter?

#

Not my own twitter account

sage bobcat
#

One message removed from a suspended account.

bleak crypt
#

Its a twitter account for league of legends

pale vessel
#

weebhook

bleak crypt
#

IFTTT webhook?

#

I can only post tweets from my own twitter account with that?

#

I wanna autopost the tweets from a different twitter account (not my own account)

strange mango
#

ifttt doesnt work well for me

bleak crypt
#

So how can I do it?

unique patio
#

Fetch the URL, if it's private pre-authenticate it and take the results and send it on through.

#

HTTPRequests

#

🧐

solemn merlin
#
var request = new XMLHttpRequest();
      request.open("POST", "my webhook link");
     request.setRequestHeader('Content-type', 'application/json');
      var params = {
        username: "test",
        avatar_url: "",
        content: "test"
      }
      request.send(JSON.stringify(params));

can someone tell me what I've done wrong in this code ? (no error but the message doesn't appear)

strange mango
unique patio
#

You have no on success handle to that?

solemn merlin
#

You speak to who ? Cosomosit

unique patio
#

You

solemn merlin
#

oh x)

unique patio
#

Your Request can go out but there's no on handler emitting your response.

solemn merlin
#

I'm a noob in node but I need to count the vote, Idk how to see the response of my request

#

How can I get the response ?

faint prism
#

What's up with the random indentations

solemn merlin
#

Just because I've copy and paste badly

unique patio
#
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
       // Typical action to be performed when the document is ready:
       document.getElementById("demo").innerHTML = xhttp.responseText;
    }
};
xhttp.open("GET", "filename", true);
xhttp.send();

W3 copied and pasted; go back to basics.

solemn merlin
#

That doesn't tell me what goes wrong with my request

unique patio
#

Ready-state is to be monitored for its status.

#

Your request sends fine

solemn merlin
#

I've some print that told me I received the top.gg call

unique patio
#

You want response and there's no ready state to actuate the response

solemn merlin
#

I have one before and one after the request

unique patio
#

Then it should be in responseText

still merlin
#

How do I convert milliseconds into something like this '8d 7h 15m 1s'? with MS

unique patio
#

Your request will return a responseText if any, if it's status 200

#

1000 = 1 second

solemn merlin
#

Okay, so barely : var res = request.send(); ?

unique patio
#

60,000 = 60 seconds

#

work up 🙂

faint prism
#

How do I convert milliseconds into something like this '8d 7h 15m 1s'? with MS
@still merlin do it with a simple calculation lol?

strange mango
solemn merlin
#

undefined x)

faint prism
#

CORS like that one guy said probably

unique patio
#

Follow the basics @solemn merlin

xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
       // xhttp should be your request that was initiated/sent; this will return true when the message is in fact ready!!!!!!!
       document.getElementById("demo").innerHTML = xhttp.responseText;
    }
};
strange mango
#

CORS like that one guy said probably
@faint prism but whats CORS

unique patio
#

copied/pasted; understand there's an await that occurs behind the scenes with the request.

#

iFrame locked you out

#

Plain and simple.

faint prism
#

@faint prism but whats CORS
@strange mango why would you bother asking me that instead of googling it?

unique patio
#

Your credentials were not good for the service, either they blocked you or your creds bad or you authed wrong.

faint prism
#

It's a security policy revolving around cross origins for resources

solemn merlin
#

const http = require('http');
var xhttp = require("xmlhttprequest");
function sendMessage(data) {
    
     var request = new xhttp.XMLHttpRequest();
     request.open("POST", "my webhook");
     request.setRequestHeader('Content-type', 'application/json');
      var params = {
        username: "api",
        avatar_url: "",
        content: "test"
      }
      var res = request.send(JSON.stringify(params));
     
}
xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
       connsole.log(xhttp.responseText);
    }
};
unique patio
#

iFrame however is very controlled. You can't really do much with them other than the API that comes with them if any; support is up to host to allow.

solemn merlin
#

I didn't get the print of onreadystatechange

unique patio
#

Put log("test12344242424424");

#

If that pops up; then you good output xhttp i nstead

#

and see what that all contains 🙂

solemn merlin
#

In or out the if ?

unique patio
#

connsole.log(xhttp.responseText);
connsole.log(xhttp);

#

^^^

restive furnace
#

console*

unique patio
#

But you can try a dummy log like connsole.log("WOW IT WORKED");

#

oh wow console.log*

#

I put two n's

restive furnace
#

yes

unique patio
#

wow, that really slips past my eyes

#

without a linter

solemn merlin
#

Already patched

#

But changes nothing

unique patio
#

So you don't get a ready-state of 200?

#

There's not even a dummy hey it worked?

solemn merlin
#
    console.log(xhttp.status);
    console.log("test");
    if (this.readyState == 4 && this.status == 200) {
       console.log(xhttp.responseText);
    }
};
#

no test

strange mango
#

ok, so I tried to add

        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Credentials' 'true';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; ```
but it didnt change anything too
solemn merlin
#

Maybe this is because my server is http and not xhttp ?

unique patio
#

Welll My WebHook is not really a location

solemn merlin
#

const server = http.createServer((req, res) => {
  let data=""
  req.on('data', chunk => {
  data+=chunk.toString();
  })
  req.on('end', () => {
      if(req.headers['authorization']==="mypassword"){
          console.log("*=Top.gg Call=*");
          res.writeHead(200, {'Content-Type': 'text/html','connected':true});
          sendMessage(data);
          res.end("<p>Done</p>");
    }
    else{
        console.log("!Unknown call!")
        res.writeHead(401, {'Content-Type': 'text/html','connected':false});
        res.end("<p>Vous n'êtes pas autorisé à entrer</p>")    ;
    }
      
     
      
  })
  }).listen(2943);
#

I know

#

I change it in my code

unique patio
#

request.open("POST", "my webhook");

solemn merlin
#

But i'll not give it to you x)

#

Considere there is a normal link

unique patio
#

You may not be authenticating right

solemn merlin
unique patio
#

CR

solemn merlin
#

The second is the token

#

I've cut the number

#

Just the first letter

unique patio
#

I've not tried the gateway with discord through request

solemn merlin
#

When I click on the link I go to a page that told me the token etc

unique patio
#
var xhttp = require("xmlhttprequest");
function sendMessage(data) {
    var request = new XMLHttpRequest();
    request.open("POST", "my webhook");
    request.setRequestHeader('Content-type', 'application/json');
    var params = {
        username: "api",
        avatar_url: "",
        content: "test"
    }
    request.send(JSON.stringify(params));
}
request.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
        console.log(xhttp.responseText);
    }
};
#

oh fix the console

#

but maybe your variable calling was wrong

#

looked iffy to me

faint prism
#

You fixed the indentation at least 😉

unique patio
#

okay!

#

LMFAO

#

jk I'll fix

faint prism
#

It looked fine how you had it

solemn merlin
#

Look like he can't open the link

unique patio
#

As long as you can see that ready state

#

You can monitor the status

#

and see, if it's not 200 or 4

#

Something messed up

#

URL/AUTH or plain lock-out

solemn merlin
#

Error code 400

#

My requestis bad

unique patio
#

Server is there

#

but precieves client error

#

Possibly bad authentication! 😮

earnest phoenix
#

Hey

unique patio
#

That stuff I can't help with, it tends to be stages of bs

solemn merlin
#

I mean, this is a discord webhook link

#

It seems to be authorized when I click it

#

Because it told me info on it

unique patio
#

Your browser w ill send headers differently

#

Try to match those of what you got out of browser

#

Go into developer mode and go to the network tab

solemn merlin
#

From postman ?

#

ok

unique patio
#

and record the event

solemn merlin
unique patio
#

now

solemn merlin
unique patio
#

Right click it and copy the 200

#

as a fetch

solemn merlin
#

gave me the same

#

oh

#

ok

#

I got it

unique patio
#

yeah?

solemn merlin
#

await fetch("https://discordapp.com/api/webhooks/7/E1", {
"credentials": "include",
"headers": {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8",
"Accept-Language": "fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3",
"Upgrade-Insecure-Requests": "1"
},
"method": "GET",
"mode": "cors"
});

unique patio
#

yup

solemn merlin
#

i've modifed the url

#

What can i do with this ?

unique patio
#

You can send that back in javascript

#

var test = await fetch....

#

then console.log(test)

#

Ccan't say what all you gotta do cause I've yet to explore that but that's how you get your headers and sometimes it goes a step further with two servers involved

#

and joining of sessions/cookies it gets weird outside browser to hijack these things.

solemn merlin
#
    "credentials": "include",
    "headers": {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0",
        "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "Accept-Language": "fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3",
        "Upgrade-Insecure-Requests": "1"
    },
    "method": "GET",
    "mode": "cors"
});
    console.log(test);```
unique patio
#

Yeah see if you get a response

#

with a replicated header

solemn merlin
#

SyntaxError: await is only valid in async function

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

solemn merlin
#

yeye x)

unique patio
#

Yeah derp

#

Best to await these as they get status

solemn merlin
#

Is fetch pre downloaded in node ?

sage bobcat
#

One message removed from a suspended account.

unique patio
#

Uhhhh

#

nope

solemn merlin
#

So i need to add it to dependencies

unique patio
#

perhaps or convert it over to XML

#

XMLHTTP

solemn merlin
#

Which version of fetch is yet the higher stable ?

unique patio
#

Believe they the same thing really in ways

#

Uhhhh can't be sure tbh

solemn merlin
#

1.1.0

#
    "credentials": "include",
    "headers": {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0",
        "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
        "Accept-Language": "fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3",
        "Upgrade-Insecure-Requests": "1"
    },
    "method": "GET",
    "mode": "cors"
});```
#

Fetch isn't a function

unique patio
#

include it

solemn merlin
#

fetch() doesn't working either

#

const fetch = require("fetch");

#

already added

unique patio
#

Try { fetch } = require("fetch");

#

I think

#

Think that calls the function inside the require to be used.

solemn merlin
#

node:25) UnhandledPromiseRejectionWarning: TypeError: fetch is not a function

#

is yet node trolling me ? x)

unique patio
#

Lol it'd appear

solemn merlin
#

Even postman got a 200 error

#

How tf can my website didn't get it ?

unique patio
#

200 is not error?

#

That's success

solemn merlin
#

Ye x)

#

Everything get 200

#

but not my website

#

Maybe because this part isn't in https ?

unique patio
#

uhhh usually has to do with cors policy

#

and authentification

#

if url to gateway/etc is right

#

but you need to install node right

#

I mean fetch

solemn merlin
#

Already in

#

BRUH

#

{"_misc": ["Expected \"Content-Type\" header to be one of {'application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'}."]}

#

I got this

unique patio
#

getting close

solemn merlin
#

It's because I've Content-type

#

and not Content-Type

unique patio
#

different error

solemn merlin
#

......

unique patio
#

Yeah watch your language 😉

solemn merlin
#

That's working now '-'''''''''''''''''''''''''''''''

unique patio
#

you got it?

#

Does it post

solemn merlin
#

Yep

leaden rover
#

How do I make it so if my bot is the only user in a VC that its in, it would leave in discord.py?

restive furnace
still merlin
#

10/10

autumn aspen
#
user.ban(reason)
  .catch(err => {
    if(err) return user.send(`:no_entry_sign: **You weren\'t banned from the server "**${message.guild.name}**"!** :no_entry_sign:`)
    if(err) return message.channel.send(':no_entry_sign: **Something went wrong!** :no_entry_sign:')
  }) 

So I want this err to send it to the channel and user but dont know how to do?

#

Anyone help?

#

like at the same time

#

when it catch the err

sudden geyser
#

it's fine

restive furnace
#

@restive furnace 10/10 where u learned it
well, like 5 people helped on me it, but i did most of it tho. so basically: ask people nicely, and use your brain 👍

autumn aspen
#

Now its only sends it to the first I put below the err functiom

sudden geyser
#

Like it's send message, add reaction, listen for reactions, if X and user sent it delete

autumn aspen
#

well, like 5 people helped on me it, but i did most of it tho. so basically: ask people nicely, and use your brain 👍
@restive furnace but if a random decent role guy deletes it in ur server and u want to read it what do u do?

#

@sudden geyser pls help me read my code

restive furnace
#

@restive furnace but if a random decent role guy deletes it in ur server and u want to read it what do u do?
it works only for the command issuer

autumn aspen
#

oh as I thought

sudden geyser
#

You didn't add err to the actual message content

ripe wyvern
#

what is the unmute command mate

autumn aspen
#

hm that command is cool I want to learn it to

#

p

#

o

#

"

ripe wyvern
#

in python

#

i need the unmute command

sudden geyser
#

For example: js message.channel.send(`<...> Error: ${err}`)

autumn aspen
#

what is the unmute command mate
@ripe wyvern hehe no spoon feed

ripe wyvern
#

you're spoon feed

sudden geyser
#

Why do people think most commands are pre-made just to be given out

autumn aspen
#

your spoon feed
@ripe wyvern tf

restive furnace
#

hm that command is cool I want to learn it to
well, i did that i add a issuer field for the message:

#

and the issuer is the author's id @autumn aspen ^^

ripe wyvern
#
@commands.has_permissions(kick_members=True)
async def mute(ctx,member : discord.Member):
    muted_role = ctx.guild.get_role(758788354061500456)

    await member.add_roles(muted_role)

    await ctx.send(member.mention +" has been muted")```
sudden geyser
#

What is client defined as?

ripe wyvern
#

what

sudden geyser
#

actually nvm I see

ripe wyvern
#

im gonna cry

#

i have to manually unmute ppl by taking their role

#

:(

sudden geyser
#

The logic behind it is to use member.remove_roles(...) to remove the role.

#

It takes a snowflake, which would be a role ID in your case.

crimson vapor
#

is there anyway in html to include another file in it, so every request it would grab that file and import it

slender wagon
#

would heroku clear my db if i use mongodb?

quartz kindle
#

if you use atlas, no

sly dawn
#

help me

#

my bot's status keep dissapearing after many hours

misty sigil
#

if you somehow use mongodb on heroku

#

then yes

#

but even then, HOW

sly dawn
#

send help lol

#

my bot's playing status keep dissapearing after many hours

#

ayone

#

anyone

sonic lodge
#

what library

thick gull
#

but even then, HOW
@misty sigil atlas

misty sigil
#

did

quartz kindle
#

@sly dawn statuses disappear if your bot disconnects and reconnects

misty sigil
#

did you not read the fucking messages above

quartz kindle
#

you need to set the status again, or set it in the client options instead so the library does it for you

thick gull
#

did you not read the fucking messages above
@misty sigil no

earnest phoenix
#

How can I combine all strings?
ex: /test h e l lo w o r l d
return: /test helloworld

hazy sparrow
#

you could remove the spaces

earnest phoenix
#

how 😄

#

replace?

hazy sparrow
#

.replace() works for me iirc

sly dawn
#

@quartz kindle Then it means heroku restarts everytime?

#

this is my code ```
bot.on('ready', () => {

console.log(${bot.user.username} is online on ${bot.guilds.cache.size} servers!);
bot.user.setActivity(my status, { type: 'WATCHING'}).catch(console.error);
})```

quartz kindle
#

put the activity in the client options

sudden geyser
#

@earnest phoenix if you have an array of arguments, just call .join("") on it

#

If you don't trim the spaces at the end, you'll also want to map each string while calling .trim(), then join it

quartz kindle
#
bot = new Discord.Client({
  presence:{
    activity:{
      name:"my status",
      type: "WATCHING"
    }
  }
})
#

@sly dawn