chore: Update docs
This commit is contained in:
15
examples/ActivityMessage.js
Normal file
15
examples/ActivityMessage.js
Normal file
@@ -0,0 +1,15 @@
|
||||
const { Client } = require('../src/index');
|
||||
const client = new Client();
|
||||
|
||||
client.on('ready', async () => {
|
||||
console.log(`${client.user.username} is ready!`);
|
||||
const channel = client.channels.cache.get('id');
|
||||
channel.send({
|
||||
activity: {
|
||||
type: 3, // MessageActivityType.Listen
|
||||
partyId: `spotify:${client.user.id}`,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
client.login('token');
|
14
examples/Basic.js
Normal file
14
examples/Basic.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const { Client } = require('../src/index');
|
||||
const client = new Client();
|
||||
|
||||
client.on('ready', async () => {
|
||||
console.log(`${client.user.username} is ready!`);
|
||||
});
|
||||
|
||||
client.on("messageCreate", message => {
|
||||
if (message.content == 'ping') {
|
||||
message.reply('pong');
|
||||
}
|
||||
});
|
||||
|
||||
client.login('token');
|
41
examples/Embed.js
Normal file
41
examples/Embed.js
Normal file
@@ -0,0 +1,41 @@
|
||||
const { Client, WebEmbed } = require('../src/index');
|
||||
const client = new Client();
|
||||
|
||||
client.on('ready', async () => {
|
||||
console.log(`${client.user.username} is ready!`);
|
||||
});
|
||||
|
||||
client.on('messageCreate', message => {
|
||||
if (message.content == 'embed_hidden_url') {
|
||||
const embed = new WebEmbed()
|
||||
.setAuthor({ name: 'hello', url: 'https://google.com' })
|
||||
.setColor('RED')
|
||||
.setDescription('description uh')
|
||||
.setProvider({ name: 'provider', url: 'https://google.com' })
|
||||
.setTitle('This is Title')
|
||||
.setURL('https://google.com')
|
||||
.setImage('https://i.ytimg.com/vi/iBP8HambzpY/maxresdefault.jpg')
|
||||
.setRedirect('https://www.youtube.com/watch?v=iBP8HambzpY')
|
||||
.setVideo('http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
|
||||
message.channel.send({
|
||||
content: `Hello world ${WebEmbed.hiddenEmbed}${embed}`,
|
||||
});
|
||||
}
|
||||
if (message.content == 'embed') {
|
||||
const embed = new WebEmbed()
|
||||
.setAuthor({ name: 'hello', url: 'https://google.com' })
|
||||
.setColor('RED')
|
||||
.setDescription('description uh')
|
||||
.setProvider({ name: 'provider', url: 'https://google.com' })
|
||||
.setTitle('This is Title')
|
||||
.setURL('https://google.com')
|
||||
.setImage('https://i.ytimg.com/vi/iBP8HambzpY/maxresdefault.jpg')
|
||||
.setRedirect('https://www.youtube.com/watch?v=iBP8HambzpY')
|
||||
.setVideo('http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4');
|
||||
message.channel.send({
|
||||
content: `${embed}`,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
client.login('token');
|
46
examples/RichPresence.js
Normal file
46
examples/RichPresence.js
Normal file
@@ -0,0 +1,46 @@
|
||||
const { Client, RichPresence, CustomStatus, SpotifyRPC } = require('discord.js-selfbot-v13');
|
||||
const client = new Client();
|
||||
|
||||
client.on('ready', async () => {
|
||||
console.log(`${client.user.username} is ready!`);
|
||||
const getExtendURL = await RichPresence.getExternal(
|
||||
client,
|
||||
'367827983903490050',
|
||||
'https://assets.ppy.sh/beatmaps/1550633/covers/list.jpg', // Required if the image you use is not in Discord
|
||||
);
|
||||
const status = new RichPresence()
|
||||
.setApplicationId('367827983903490050')
|
||||
.setType('PLAYING')
|
||||
.setURL('https://www.youtube.com/watch?v=5icFcPkVzMg')
|
||||
.setState('Arcade Game')
|
||||
.setName('osu!')
|
||||
.setDetails('MariannE - Yooh')
|
||||
.setParty({
|
||||
max: 8,
|
||||
current: 1,
|
||||
})
|
||||
.setStartTimestamp(Date.now())
|
||||
.setAssetsLargeImage(getExtendURL[0].external_asset_path) // https://assets.ppy.sh/beatmaps/1550633/covers/list.jpg
|
||||
.setAssetsLargeText('Idle')
|
||||
.setAssetsSmallImage('373370493127884800') // https://discord.com/api/v9/oauth2/applications/367827983903490050/assets
|
||||
.setAssetsSmallText('click the circles')
|
||||
.addButton('Beatmap', 'https://osu.ppy.sh/beatmapsets/1391659#osu/2873429');
|
||||
// Custom Status
|
||||
const custom = new CustomStatus().setEmoji('😋').setState('yum');
|
||||
// Spotify
|
||||
const spotify = new SpotifyRPC(client)
|
||||
.setAssetsLargeImage('spotify:ab67616d00001e02768629f8bc5b39b68797d1bb') // Image ID
|
||||
.setAssetsSmallImage('spotify:ab6761610000f178049d8aeae802c96c8208f3b7') // Image ID
|
||||
.setAssetsLargeText('未来茶屋 (vol.1)') // Album Name
|
||||
.setState('Yunomi; Kizuna AI') // Artists
|
||||
.setDetails('ロボットハート') // Song name
|
||||
.setStartTimestamp(Date.now())
|
||||
.setEndTimestamp(Date.now() + 1_000 * (2 * 60 + 56)) // Song length = 2m56s
|
||||
.setSongId('667eE4CFfNtJloC6Lvmgrx') // Song ID
|
||||
.setAlbumId('6AAmvxoPoDbJAwbatKwMb9') // Album ID
|
||||
.setArtistIds('2j00CVYTPx6q9ANbmB2keb', '2nKGmC5Mc13ct02xAY8ccS'); // Artist IDs
|
||||
|
||||
client.user.setPresence({ activities: [status, custom, spotify] });
|
||||
});
|
||||
|
||||
client.login('token');
|
17
examples/SamsungRPC.js
Normal file
17
examples/SamsungRPC.js
Normal file
@@ -0,0 +1,17 @@
|
||||
const { Client } = require('../src/index');
|
||||
|
||||
const client = new Client();
|
||||
|
||||
client.on('ready', async () => {
|
||||
client.user.setSamsungActivity('com.YostarJP.BlueArchive', 'START');
|
||||
|
||||
setTimeout(() => {
|
||||
client.user.setSamsungActivity('com.miHoYo.bh3oversea', 'UPDATE');
|
||||
}, 30_000);
|
||||
|
||||
setTimeout(() => {
|
||||
client.user.setSamsungActivity('com.miHoYo.GenshinImpact', 'STOP');
|
||||
}, 60_000);
|
||||
});
|
||||
|
||||
client.login('token');
|
91
examples/SlashCommand.md
Normal file
91
examples/SlashCommand.md
Normal file
@@ -0,0 +1,91 @@
|
||||
# Slash command
|
||||
|
||||
```js
|
||||
TextBasedChannel.sendSlash(
|
||||
user: BotId (Snowflake) | User (User.bot === true),
|
||||
commandName: 'command_name [sub_group] [sub]',
|
||||
...args: (string|number|boolean|FileLike|undefined)[],
|
||||
): Promise<Message<true> | Modal>
|
||||
```
|
||||
|
||||
## Basic
|
||||
|
||||
### Demo
|
||||
|
||||

|
||||
|
||||
### Code
|
||||
|
||||
```js
|
||||
await channel.sendSlash('bot_id', 'aiko')
|
||||
```
|
||||
|
||||
## Sub Command / Sub Group
|
||||
|
||||
### Demo
|
||||
|
||||

|
||||
|
||||
### Code test
|
||||
|
||||
```js
|
||||
await channel.sendSlash('450323683840491530', 'animal chat', 'bye')
|
||||
```
|
||||
|
||||
## Attachment
|
||||
|
||||
### Demo
|
||||
|
||||

|
||||
|
||||
### Code test
|
||||
|
||||
```js
|
||||
const { MessageAttachment } = require('discord.js-selfbot-v13')
|
||||
const fs = require('fs')
|
||||
const a = new MessageAttachment(fs.readFileSync('./wallpaper.jpg') , 'test.jpg')
|
||||
await message.channel.sendSlash('718642000898818048', 'sauce', a)
|
||||
```
|
||||
|
||||
### Result
|
||||
|
||||

|
||||
|
||||
## Skip options
|
||||
|
||||
### Demo Command
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
### Code
|
||||
```js
|
||||
const channel = client.channels.cache.get('channel_id');
|
||||
const response = await channel.sendSlash(
|
||||
'bot_id',
|
||||
'image make',
|
||||
'MeinaMix - v11',
|
||||
'Phone (9:16) [576x1024 | 810x1440]',
|
||||
'2', // String choices, not number
|
||||
undefined, // VAE
|
||||
undefined, // sdxl_refiner
|
||||
undefined, // sampling_method,
|
||||
30,
|
||||
);
|
||||
// Submit Modal
|
||||
if (!response.isMessage) { // Modal
|
||||
response.components[0].components[0].setValue(
|
||||
'1girl, brown hair, green eyes, colorful, autumn, cumulonimbus clouds',
|
||||
);
|
||||
response.components[1].components[0].setValue(
|
||||
'(worst quality:1.4), (low quality:1.4), (normal quality:1.4), (ugly:1.4), (bad anatomy:1.4), (extra limbs:1.2), (text, error, signature, watermark:1.2), (bad legs, incomplete legs), (bad feet), (bad arms), (bad hands, too many hands, mutated hands), (zombie, sketch, interlocked fingers, comic, morbid), cropped, long neck, lowres, missing fingers, missing arms, missing legs, extra fingers, extra digit, fewer digits, jpeg artifacts',
|
||||
);
|
||||
await response.reply();
|
||||
}
|
||||
|
||||
```
|
21
examples/VoiceMessage.js
Normal file
21
examples/VoiceMessage.js
Normal file
@@ -0,0 +1,21 @@
|
||||
const { Client, MessageAttachment } = require('../src/index');
|
||||
const client = new Client();
|
||||
|
||||
client.on('ready', async () => {
|
||||
console.log(`${client.user.username} is ready!`);
|
||||
const channel = client.channels.cache.get('channel_id');
|
||||
const attachment = new MessageAttachment(
|
||||
'./test.mp3', // path file
|
||||
'random_file_name.ogg', // must be .ogg
|
||||
{
|
||||
waveform: '=',
|
||||
duration_secs: 1, // any number you want
|
||||
},
|
||||
);
|
||||
channel.send({
|
||||
files: [attachment],
|
||||
flags: 'IS_VOICE_MESSAGE',
|
||||
});
|
||||
});
|
||||
|
||||
client.login('token');
|
Reference in New Issue
Block a user