chore: examples
This commit is contained in:
parent
1304cf1c04
commit
7a8198841f
File diff suppressed because one or more lines are too long
26
examples/JoinGuild.js
Normal file
26
examples/JoinGuild.js
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const Captcha = require('2captcha');
|
||||||
|
const Discord = require('../src/index');
|
||||||
|
|
||||||
|
const solver = new Captcha.Solver('<2captcha key>');
|
||||||
|
|
||||||
|
const client = new Discord.Client({
|
||||||
|
captchaSolver: function (captcha, UA) {
|
||||||
|
return solver
|
||||||
|
.hcaptcha(captcha.captcha_sitekey, 'discord.com', {
|
||||||
|
invisible: 1,
|
||||||
|
userAgent: UA,
|
||||||
|
data: captcha.captcha_rqdata,
|
||||||
|
})
|
||||||
|
.then(res => res.data);
|
||||||
|
},
|
||||||
|
captchaRetryLimit: 3,
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on('ready', async () => {
|
||||||
|
console.log('Ready!', client.user.tag);
|
||||||
|
await client.acceptInvite('mdmc');
|
||||||
|
});
|
||||||
|
|
||||||
|
client.login('token');
|
21
examples/Proxy.js
Normal file
21
examples/Proxy.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const Discord = require('../src/index');
|
||||||
|
const { ProxyAgent } = require('proxy-agent');
|
||||||
|
|
||||||
|
const proxy = new ProxyAgent('<proxy>');
|
||||||
|
|
||||||
|
const client = new Discord.Client({
|
||||||
|
ws: {
|
||||||
|
agent: proxy, // WebSocket Proxy
|
||||||
|
},
|
||||||
|
http: {
|
||||||
|
agent: proxy, // REST Proxy
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on('ready', async () => {
|
||||||
|
console.log('Ready!', client.user.tag);
|
||||||
|
});
|
||||||
|
|
||||||
|
client.login('token');
|
@ -42,7 +42,7 @@ const Sweepers = require('../util/Sweepers');
|
|||||||
*/
|
*/
|
||||||
class Client extends BaseClient {
|
class Client extends BaseClient {
|
||||||
/**
|
/**
|
||||||
* @param {ClientOptions} options Options for the client
|
* @param {ClientOptions} [options] Options for the client
|
||||||
*/
|
*/
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
super(options);
|
super(options);
|
||||||
|
Loading…
Reference in New Issue
Block a user