#development
1 messages · Page 1283 of 1
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 get the user from cache(or fetch) then .send()
should be
it wasnt me mods i swer
@stark abyss hence why i put (fetch) in parenthesis
if the user is not cached, fetch it
what I haven't tried anything yet
but, but do you know da wae
like, if your function is async already is there really any reason not to use await fetch()
assuming you need the user either way
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 
jokes every now and then are fine
neither am i strict about it
what gets me is cringe
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.
gee i wonder what’s faster
fetching a user (not in cache)
or getting a user from the cache (in cache)
we may never know
hold on let’s get Erwin to create a function that’s faster than both
they’re a genius
my point was is there any point to use get when you need the user
fetch checks if user is in cache
i would use fetch regardless for the slight chance the user might not be in cache
How does a hugely popular bot get past the rate limits that are set?
huge bots get special ratelimit perms iirc
Or are they on a per server, per channel, etc sorta basis?
mostly per channel iirc, but the hard limits still exist
That's interesting. Trying to find more info about that. High hopes ya know. Also intrigued.
the request limits are dynamic so its hard to know tbh
what's that comma doing there
looks like it's python
if you put a comma at the end it turns everything into a tuplet
spoonfeeding bad
@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?
yeah
its python cause of the set_author
that's why i asked for lang
sooo @earnest phoenix did you want help or not?
I think its cause the comma is there 
@earnest phoenix try removing the comma
I did everything ok
it is because the comma is there
remove the comma
fix bro
that's the fix; remove the comma
🤦♂️
http://sc.aymdj.me/ri2aeu1s.png this shit is accurate
you generally who write or who suggest me to start writing?
everyone would suggest you start writing here
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?
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.
Ah understood. So I must keep trying to increase the limit. Thank you!
are you guys talking about the Youtube.Data.v2 api?
any api has ratelimits 🤔
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
why its red ** (?)
Hello how do i fix my custom text status it's not showing up the words that i put on my mobile
@solemn latch
@earnest phoenix commands.Bot, not discord.Client
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...
@thick gull there might be better ways to get lin count
what are the benefits of using AWS as opposed to Heroku? People say that Heroku is bad, but why?
jesus fucking chirst]
It's intended to be used for web apps, not Discord bots or generally anything else
@opal plank it crashed when i tried formatting it into a proper array
i mean yeah but how is that bad
does it affect performance?
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}

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
now require() that and send it as message in discord with {split:true}
@opal plank i dont want to
pelase
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
no its in pins i think
im already using AWS i just wanted to know why
erwin if i do it
aparently not
already doing bad shit, what is one more stupid idea ontop?
bet
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)
@opal plank
LUL
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?
@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.
ok lemme try.
Error : ```(node:7911) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'length' of undefined
bot.prefix is undefined
ok
did you set it anywhere
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
OMG i realised now thanks
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?
You could manually fetch the message with <TextChannel>.messages.fetch
And give it the ID of the message
hmm
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)
could i use regex for that part?
Yeah you could, but if you want to be straightforward you could just split by / and get the last element
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
/[0-9]/
\d+
heck you
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
how can i fix this so?
no i just think that it isn't a message at all
fetch()
is a promise
let it finish first
either chain it with a then or await it in async
(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.
now log that to make sure you are properly getting a quoteMessage
cuz it can return null
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)
}
falsey?
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
k
i said log it
yeah
dont throw it in channel
i did
console.log()
okay so we getting a textchannel
wait
wait okay
that's returning a channel then
oh
is quoteChannel.fetch incorrect?
check for channel right after you get it for cache
if you try undefined.messages it'll error
WOW IT SUDDENYL WORKS THANKS INTELLISENSE FOR MAKING ME DOUBT MYSELF
lmao
i need to stop trusting intellisense so much
ah
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
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.
3.1k lines, yeah, no thanks, not about to commit to documenting everything in this messy code
.setAuthor(`${quoteMessage.author.tag}`, quoteMessage.author.displayAvatarURL(), true)
not sure what i'm doing wrong there
there you have it
do u need BAN_MEMBERS to unban people?
yes
okay thanks
What is the difference between name , property and type attributes of <meta> tag in HTML
uh also
@karmic compass URL is wrong
type is the actual type you want to set
the <Connection>.dispatcher.end(), optionally takes a callback function. Is that callback function is same as the one which triggers the finish event??
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
let's goto #general
k
still can't figure out how to install MySQLi on repl.it
@earnest phoenix please for god's sake use pdo
what is pdo?
an interface for accessing databases
mysql is supported
ok
ask in their support server
and yes, you can
but this isn't the place to talk about that
Where is that?
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
it's just a bunch of statements 
@quartz kindle think d.js would allow me to PR them a contribution for Ts types? like bruh, for real, not a SINGLE tooling /wiki/comment. Posting the other lib as good reference
https://cdn.discordapp.com/attachments/655288842433200129/760750727504723978/grJDp9ZzEO.gif
https://cdn.discordapp.com/attachments/655288842433200129/760750991476916234/LhbntBGNN3.gif
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
not ONE fucking comment*
@opal plank not ONE Erwin*
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
wait you can click properties to view typescript descriptions for em
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
@opal plank how do you add the "tooling" thing inside TahpScrept so you can hover over stuff to view things about em
i don't use tahpscrept that's why i dunno
but repl.it has tahpscrept stuff inside normal JS files smh
it's so similar to JSDoc syntax
when you hover over the method i added it adds the example/description that i set for that
Isn't that type of tooling supported in all languages with proper IDEs
but how is my IDE able to show me those stuff inside normal JS environments
im not sure tbh shiv
I use it in Python
im applying that inside my Ts declaration module, so im assuming its in there
It also works in JS but not very well. It just guesses most stuff.
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
it tells me the types, which is great
but ffs
every now and then im stuck having to go on the docs
"""
: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
"""
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
for example, if
Commandis a class, and you doconst 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
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
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
so whenever i have my mod mail feature in my bot it wont let me run any commands but i dont get any errors in my console that might tell me why. i dont know why anything in the modmail part of the code would cause that. https://gist.github.com/ImPhinton/5bf7723c778e5ad01687d6fee11b1bce
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
Why not just create an issue
wait if you can't use MySQLi directly on repl.it can you connect to a external MySQLi database without the instruction
cuz its support
its not an issue in it self
its more of a PR to request tooling for TS
Well issues don't have to be "issues", they're just called issues
Is this a pointless pull request: https://github.com/discordjs/guide/pull/482
They also accept suggestions
though tbf d.js ships @types
i might try committing to d.js and djs-light tbf
imma ask Tim tomrrow
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
what would pma do in this case
what wrong
@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 
eh
Few examples for a memory refreshment would be cool tho
imagine having to go to the discord;js docs everything you try to get something new
when theres tooling inside Ts


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

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

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
make your own library tbh and hope it gets popular
Lerwin's Shit Lib™️
LSL
kek
interesting, discord is closing my connection to websocket with close code 1000
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
[WARN] [RateLimiter]: Encountered 429 on route /channels/756124716733038695
don't aboose api
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
sure, just anything unique that you can use to confirm that requests are coming from top.gg to you
depends. you got a webhook running?
well as the message says
You need to host a webhook (webserver) yourself and use it as the middleman to post messages
how do I do that?
What's your bot's library?
I dont have any programing language for my discord server
any programming language you are familiar with?
js
Try out express
too much
I am not doing it
XD
I just wanted a msg from the bot
@pliant gorge
when someone votes
DSL bot doesn't send messages when someone votes
sad
nyeh, i hate this
i created event named unhandledRejection n uncaughtException
i can't find the stack errors
i can't find the stack errors 
is this error related to sharding?
can anyone suggest any good videos/articles on how to make a corona virus status command?
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
im new
you need 3 things basically
okay
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
im using node-fetch
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
do you know what your code is even doing
no 😦
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
lastly i'd recommend looking at this https://www.w3schools.com/js/
for a general knownledge of JavaScript
thanks
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
i figured it out
aight
@west agate since you're trying to use my api
@tight heath ur API?
also the url is disease.sh for a couple months now
thanksfor the help
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
thanks
@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
i do agree mdn is better, but the interactive snippets and simple grammar helps a lot new people
@opal plank need help
@clever lynx with?
it should only need oauth
How do I make it look like a normal number? Instead of 1000 how do i make it say 1,000
where you stuck at?
what?
Ye
are the 3 server s in the list?
thats optional
@opal plank
wdym?
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
i guess you could regex
small tips
then uses a function
(param) => {do stuff}
always wrap your parameters in parenthesiss
okay
also you can declare multiple variables with commas
why even declare variables
let a = 1, b = 2, c= 3;
//rather than
let a = 1;
let b = 2;
let c = 3;
youre not using them for other things so just place them straight into the embed
>>> 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'
``` 🤔
@opal plank how can my bot be approved ???
top gg just wait, make sure your bot is compliant with the rules
Wait for it to be reviewed by a website moderator if you submitted it
Wait for it to be reviewed by a website moderator if you submitted it
Also see pins in #support
yeah that snippet doesn't make much sense with the output, Supernal was right
should do it from right to left
SUDO CODE
Split time
Get length
count backwards and add ,
complete
thats one way to do it
>>> separ("12000")
'1,200,0'
``` ffs
screw it, im using regex lmao
but I told you how to do it without regex lol
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

(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
(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 doFunction.prototype.applyon a snowflake
i dont
you are
const filter = message.author.id wrong
hmmm
it should be a function
@cobalt spruce the filter should be a function that does stuff
not message.author.id
want it to filter by ID
then it should be a function that returns true if the id matches
m => { /* do stuff to 'm' */}
yes
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||
yes, ternary
for example```js
You have ${message.member.hasPermission("KICK_MEMBERS") ? "no" : "the"} permission to kick members.
Kurdi lea
What do you guys think of this?
https://rock-paper-scissors.code913.repl.co/
(a work in progress i know it sucks do not kill me)
why ain't the embed appearing
wats dat
i used browserling just in case you had a crypto miner or something
virtual web browser
bruh
like a vps for free
bruh
@earnest phoenix don’t say bruh
like a vps for free
@pale vessel *vpb
not really a vps when you can only use the browser
you are literally known
virtual private browser yes
for having a crypto mining site
you still had it
why does repl.it use my gravatar pfp i didn't notice that until today gtg change it to a gapple
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
)});
}}
}```
@peak osprey what is args
debug
can you send the line of code where you defined args?
objects will display as [object Object] in some trash IDEs so JSON.stringify() them before logging in console
if you console.log(object) tho
it should return the full object
if it doesn’t it’s a shite application
if it doesn’t it’s a shite application
@misty sigil shite
can you use variables or things inside CSS?
i wanna set background-size to the size of the div element
anyone know a way to use discord.js in a web page?

@ornate copper sure https://github.com/discordjs/discord.js/blob/master/docs/topics/web.md
just keep the tab open
and it's a logical question
why star
thanks
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
thats alr im using it for web dashboard kinda
how
@pale vessel when i click check mark its supposed to send a msg
and some database shit
wouldn't your token be visible in the source?
idk but exploit speedrun any% when
aa
record: 1 min left lol
i made a website to exploit the browserling
Browserling Teamviewer Install any%
oh nice it froze at UAC
<script src="index.js"></script>
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
Sounds like a CORS issue
how can I fix it?
Understand the iframe and policy?
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?
heres my Commands.js:
oh wait
nvm im just dumb
lol
im mispelling constructor
Understand the iframe and policy?
@unique patio kinda
@opal plank index of 4 is pretty close to 12M results, i am still having fun with this one thing
One message removed from a suspended account.
Its a twitter account for league of legends
weebhook
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)
ifttt doesnt work well for me
So how can I do it?
Fetch the URL, if it's private pre-authenticate it and take the results and send it on through.
HTTPRequests
🧐
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)
so, can someone help me with #development message
You have no on success handle to that?
You speak to who ? Cosomosit
You
oh x)
Your Request can go out but there's no on handler emitting your response.
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 ?
What's up with the random indentations
Just because I've copy and paste badly
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.
That doesn't tell me what goes wrong with my request
You want response and there's no ready state to actuate the response
I have one before and one after the request
Then it should be in responseText
How do I convert milliseconds into something like this '8d 7h 15m 1s'? with MS
Okay, so barely : var res = request.send(); ?
How do I convert milliseconds into something like this '8d 7h 15m 1s'? with MS
@still merlin do it with a simple calculation lol?
undefined x)
CORS like that one guy said probably
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;
}
};
CORS like that one guy said probably
@faint prism but whats CORS
copied/pasted; understand there's an await that occurs behind the scenes with the request.
iFrame locked you out
Plain and simple.
@faint prism but whats CORS
@strange mango why would you bother asking me that instead of googling it?
Your credentials were not good for the service, either they blocked you or your creds bad or you authed wrong.
It's a security policy revolving around cross origins for resources
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);
}
};
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.
I didn't get the print of onreadystatechange
Put log("test12344242424424");
If that pops up; then you good output xhttp i nstead
and see what that all contains 🙂
In or out the if ?
console*
But you can try a dummy log like connsole.log("WOW IT WORKED");
oh wow console.log*
I put two n's
yes
console.log(xhttp.status);
console.log("test");
if (this.readyState == 4 && this.status == 200) {
console.log(xhttp.responseText);
}
};
no test
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
Maybe this is because my server is http and not xhttp ?
Welll My WebHook is not really a location
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
request.open("POST", "my webhook");
You may not be authenticating right
CR
I've not tried the gateway with discord through request
When I click on the link I go to a page that told me the token etc
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
You fixed the indentation at least 😉
It looked fine how you had it
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
Hey
That stuff I can't help with, it tends to be stages of bs
I mean, this is a discord webhook link
It seems to be authorized when I click it
Because it told me info on it
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
and record the event
now
When I modify the webhoook token
yeah?
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"
});
yup
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.
"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);```
SyntaxError: await is only valid in async function
One message removed from a suspended account.
One message removed from a suspended account.
yeye x)
Is fetch pre downloaded in node ?
One message removed from a suspended account.
So i need to add it to dependencies
Which version of fetch is yet the higher stable ?
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
include it
Try { fetch } = require("fetch");
I think
Think that calls the function inside the require to be used.
node:25) UnhandledPromiseRejectionWarning: TypeError: fetch is not a function
is yet node trolling me ? x)
Lol it'd appear
Ye x)
Everything get 200
but not my website
Maybe because this part isn't in https ?
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
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
getting close
different error
......
Yeah watch your language 😉
That's working now '-'''''''''''''''''''''''''''''''
Yep
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?
rate my command deletion system: https://gyazo.com/da78abea09873ef81f5fa87a3b513b6d
10/10
rate my command deletion system: https://gyazo.com/da78abea09873ef81f5fa87a3b513b6d
@restive furnace 10/10 where u learned it
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
it's fine
@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 👍
Now its only sends it to the first I put below the err functiom
Like it's send message, add reaction, listen for reactions, if X and user sent it delete
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 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
oh as I thought
You didn't add err to the actual message content
what is the unmute command mate
For example: js message.channel.send(`<...> Error: ${err}`)
what is the unmute command mate
@ripe wyvern hehe no spoon feed
you're spoon feed
Why do people think most commands are pre-made just to be given out
your spoon feed
@ripe wyvern tf
hm that command is cool I want to learn it to
well, i did that i add aissuerfield for the message:
and the issuer is the author's id @autumn aspen ^^
@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")```
What is client defined as?
what
actually nvm I see
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.
is there anyway in html to include another file in it, so every request it would grab that file and import it
would heroku clear my db if i use mongodb?
if you use atlas, no
send help lol
my bot's playing status keep dissapearing after many hours
ayone
anyone
what library
but even then, HOW
@misty sigil atlas
did
@sly dawn statuses disappear if your bot disconnects and reconnects
did you not read the fucking messages above
you need to set the status again, or set it in the client options instead so the library does it for you
did you not read the fucking messages above
@misty sigil no
How can I combine all strings?
ex: /test h e l lo w o r l d
return: /test helloworld
you could remove the spaces
.replace() works for me iirc
@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);
})```
put the activity in the client options






