-
-
Save rigwild/28f5d9479e3e122070e27db84e104719 to your computer and use it in GitHub Desktop.
// Due to some interest, I created a proper repo. | |
// Check it out! :) | |
// https://github.com/rigwild/discord-self-bot-console |
@KuroRXX good job :)
It may help to also provide an unminified version though
I actually added in those features after messing with your already made function "apiCall", by the time I was editing it I already put the original in a code compressor. Most of this was just me going through the discord API endpoint list and spending hours making functions for them. Mostly copy paste and a little editing.
Hey! I was wondering if it was okay if I used this to make a library but adding more and stuff? Or adding more things to the api.
@micc281 no problem :) don't forget to add rigwild <me@rigwild.dev>
in your license 😁
@rigwild
Will do! Although this may take a while. I am a slow programmer and I have come into my first issue using fetch :/ But none the less I will put you in!!
Edit: I just realized this is not what I thought it was. But thank you anyway for introducing me into the discord api, I will give you credit still.
Ok Hey. So I am micc281 I have a new account for making my discord lib and I had to rewrite your entire fetch code. Well not entirely but most so yeah that my progress.
Cool! my code doesn't work with Other methods but get
To fix Api/V6 error replace this api prefix code; ( Now working. )
apiPrefix = 'https://discord.com/api/v8'
How can we modify this script to send a message every minute? @rigwild
this still works?
Sorry for the late reply!
How can we modify this script to send a message every minute?
loop = true
count = 0
setup = async () => {
while (loop) {
const test2 = await api.sendMessage('channel_id', 'your_message')
console.log(`Sent ${++count} messages`)
await timeout(61000) // 61 seconds
}
}
setup()
When you want to stop it you can simply use
loop = false
this still works?
I just updated the API uri to the new domain (discord.com), it's working.
Please tell me if you think I should open a proper GitHub repository for this as it's getting a lot of attention. Did you get here by googling discord self bot ?
Yes you should start a repository and i have this project id like to discuss with you that i dont know much about cause theres no public info but you seem to understand the discord user api better than me. If youve got the time
@BryanBarrera im goint to format his example a little differently bare in mind but
loop = Infinity
count = 0;
const messages = [
{ channelID: 'the channel id', content: 'hello', afterDelay: 6000/*in ms*/ },
{ channelID: 'the channel id', content: 'world', afterDelay: 3000/*in ms*/},
];
setup = async () => {
for (let i = 0; i < loop; i ++) {
for(let x = 0; x < messages.length; x++){
let { channelID, content, afterDelay } = messages[x];
const test2 = await api.sendMessage(channelID, content);
console.log(`Sent ${++count} messages`)
await timeout(afterDelay);
}
}
}
setup()
only reason you'd want to use for loops instead is when you start working with event handlers the while loop fucks up any event listeners.
@SkellyM386 thanks so much, your update worked as expected. I appreciate this!
How can we send a message like Ping Pong?
User1: ping
We: pong
actually if we can i'd like to message you guys since your interested in client botting cause right now im working on a more nodejs version of a user/client bot thats similar to discord.js except that its a user bot and its got the ability to read all the json data that goes in and out requests and responses it can even using this example automatically get your user token and be able to accomplish more its just im just one person and i dont know the user api like rigwild does. the plan is to make this and then publish it as a package. and im not afraid of discord since their bot detection isn't that good.
I am not interested in doing full client botting right now, sorry. This is only intended to run small script manually from the console.
How can we send a message like Ping Pong?
User1: ping
We: pong
This is using HTTP queries, so there is no WebSocket event listener like in Discord.js. You can use api.getMessages
and search for a message if you want.
Cleaned the thread a bit.
This is using HTTP queries, so there is no WebSocket event listener like in Discord.js. You can use
api.getMessages
and search for a message if you want.
Yeah i want like this api.getMessages
and post message but I don't know how to do it, can you tell me?
ok so @BryanBarrera so apparently im a dummy and the api for users is almost exactly the same as the discord api if not actually the same
It is indeed the same API. In fact, you can use the discord.js package with your user token (v11.3.2 and below though, they deprecated user token support starting v11.4.0).
Hello,
First of all, thanks for this resource.
I wanted to know how to loop through the messages once you call getMessages; any help would be appreciated.
Thanks in advance.
Hello,
First of all, thanks for this resource.
I wanted to know how to loop through the messages once you call getMessages; any help would be appreciated.
Thanks in advance.
I wan't know too. Please help us guys.
I don't understand: send a message. Can you help me
setup = async () => {
// Send a message
const test2 = await api.sendMessage('your-channel-id-here', 'your-message-here')
console.log(test2)
await delay(3000)
}
setup()
edit your-channel-id-here
and your-message-here
and send with console.
is there a way to obtain the authtoken programmatically in javascript ? anyone knows how it's stored ?
also, can this be used on discord's website too ?
is there a way to obtain the authtoken programmatically in javascript ? anyone knows how it's stored ?
also, can this be used on discord's website too ?
Discord don't really want users to automate theirs accounts... More than a year ago the authentication token was just stored in the localStorage
, which means it was pretty easy to get. But due to its success, their found a way to remove the token while the app is open, and even remove the global localStorage
object to make sure it cannot be accessed via the console. Too many users got their tokens stolen with this technique.
Another solution, a bit hacky, maybe be to hook the fetch
(or XMLHTTPRequest
) function to intercept the Authorization
header, but it still require the app to send a request, and it wont work if they keep a local copy of the fetch
function.
I wanted to know how to loop through the messages once you call getMessages; any help would be appreciated.
Functions like sendMessages
and so on here just call the API as defined on the Discord website, e.g. https://discord.com/developers/docs/resources/channel#get-channel-messages. They use a filter mechanism based on a reference id to handle pagination, so you have to get for instance the 50 latest messages, that start again by passing the lowest (oldest) message id as the before
parameter, and so on. But I'm not sure it works indefinitely, and I assume their abuse system is aware about that...
Can I make this script fetch a message like if someone sent ping I replay pong?
a script start when the event new message in a channel occurs gets the message and makes the message.content == "ping"
and if that happened I start the function api.sendMessage('channel_id', 'pong')
@5rbsh518 this does not support the WebSocket events API.
You can try to check the recent messages using api.getMessages
every x seconds and check if a message start with pong.
Wouldn't that get me banned if I requested messages every 1 second or 2 seconds?
I will request a maximum of 5 messages if I'll spam it
I don't know, maybe. I have used this script multiple times in the past to delete 100k+ messages of mine accross private messages and servers and never got banned.
But I can't garantee anything.
Hi, I have no experience with JS and so I am unable to debug it. I tried using the script on console and I am getting an error saying 'delay is not defined'.
I am looking at ways to extract the auth token by a web extension...
Hey everyone! I finally created the repo, any new activity should happen there now. See you there!
https://github.com/rigwild/discord-self-bot-console
@TSedlar @toobeeh @iformas @jablazr @Kyn21kx @ray-adams @pilppilo @Michael-404 @Filiq @xconstarx @NitramO-YT @gettosam @m4p1e @LeviOP @KaniShiel @KaliyaAlkaline @micc281 @dis-chord-dev @DeadLyBro @BryanBarrera @SkellyM386 @Sadlysius @beppe9000 @Minigugus @5rbsh518 @AceN1nja
@KuroRXX good job :)
It may help to also provide an unminified version though