2022-07-07 07:18:21 +00:00
|
|
|
## Custom Status and RPC
|
|
|
|
|
2022-07-09 12:47:00 +00:00
|
|
|
<strong>Custom Status</strong>
|
2022-07-07 07:18:21 +00:00
|
|
|
|
|
|
|
```js
|
|
|
|
const r = new Discord.CustomStatus()
|
|
|
|
.setState('Discord')
|
|
|
|
.setEmoji('💬')
|
|
|
|
client.user.setActivity(r.toJSON());
|
|
|
|
```
|
|
|
|
|
|
|
|
<img src='https://cdn.discordapp.com/attachments/820557032016969751/994318117243203758/unknown.png'>
|
|
|
|
|
|
|
|
Rich Presence [Custom]
|
|
|
|
```js
|
|
|
|
const r = new Discord.RichPresence()
|
|
|
|
.setApplicationId('817229550684471297')
|
|
|
|
.setType('STREAMING')
|
|
|
|
.setURL('https://youtube.com/watch?v=dQw4w9WgXcQ')
|
|
|
|
.setState('State')
|
|
|
|
.setName('Name')
|
|
|
|
.setDetails('Details')
|
|
|
|
.setParty({
|
|
|
|
max: 9,
|
|
|
|
current: 1,
|
|
|
|
id: Discord.getUUID(),
|
|
|
|
})
|
|
|
|
.setStartTimestamp(Date.now())
|
|
|
|
.setAssetsLargeImage('929325841350000660')
|
|
|
|
.setAssetsLargeText('Youtube')
|
|
|
|
.setAssetsSmallImage('895316294222635008')
|
|
|
|
.setAssetsSmallText('Bot')
|
|
|
|
.addButton('name', 'https://link.com/')
|
|
|
|
client.user.setActivity(r.toJSON());
|
|
|
|
```
|
|
|
|
<img src='https://cdn.discordapp.com/attachments/820557032016969751/994300662378676264/unknown.png'>
|
|
|
|
|
|
|
|
Rich Presence with Spotify
|
|
|
|
```js
|
|
|
|
const r = new Discord.SpotifyRPC(client)
|
|
|
|
.setAssetsLargeImage("spotify:ab67616d00001e02768629f8bc5b39b68797d1bb") // Image ID
|
2022-07-07 07:59:59 +00:00
|
|
|
.setAssetsSmallImage("spotify:ab6761610000f178049d8aeae802c96c8208f3b7") // Image ID
|
|
|
|
.setAssetsLargeText('未来茶屋 (vol.1)') // Album Name
|
|
|
|
.setState('Yunomi; Kizuna AI') // Author
|
|
|
|
.setDetails('ロボットハート') // Song name
|
2022-07-07 07:18:21 +00:00
|
|
|
.setStartTimestamp(Date.now())
|
|
|
|
.setEndTimestamp(Date.now() + 1_000 * (2 * 60 + 56)) // Song length = 2m56s
|
|
|
|
.setSongId('667eE4CFfNtJloC6Lvmgrx'); // Song ID
|
|
|
|
client.user.setActivity(r.toJSON());
|
|
|
|
```
|
2022-07-07 07:59:59 +00:00
|
|
|
<img src='https://cdn.discordapp.com/attachments/820557032016969751/994512257914515456/unknown.png'>
|
|
|
|
<img src='https://cdn.discordapp.com/attachments/820557032016969751/994512258128420944/unknown.png'>
|
2022-07-07 07:18:21 +00:00
|
|
|
|
|
|
|
|
2022-07-09 12:47:00 +00:00
|
|
|
<strong>You can now add custom images for RPC !</strong>
|
2022-07-07 07:18:21 +00:00
|
|
|
|
|
|
|
> Tutorial:
|
|
|
|
|
2022-07-16 08:29:30 +00:00
|
|
|
## Method 1:
|
|
|
|
|
2022-07-09 12:47:00 +00:00
|
|
|
+ Step 1: Send image to Discord
|
2022-07-07 07:18:21 +00:00
|
|
|
|
2022-07-09 12:47:00 +00:00
|
|
|
<img src='https://cdn.discordapp.com/attachments/820557032016969751/995297572732284968/unknown.png'>
|
|
|
|
|
|
|
|
+ Step 2: Get Image URL
|
|
|
|
|
|
|
|
<img src='https://cdn.discordapp.com/attachments/820557032016969751/995298082474426418/unknown.png'>
|
|
|
|
|
|
|
|
```sh
|
|
|
|
Demo URL: https://cdn.discordapp.com/attachments/820557032016969751/991172011483218010/unknown.png
|
2022-07-07 07:18:21 +00:00
|
|
|
```
|
|
|
|
|
2022-07-09 12:47:00 +00:00
|
|
|
+ Step 3: Replace `https://cdn.discordapp.com/` or `https://media.discordapp.net/` with `mp:`
|
|
|
|
|
|
|
|
```diff
|
|
|
|
- https://cdn.discordapp.com/attachments/820557032016969751/991172011483218010/unknown.png
|
|
|
|
|
|
|
|
- https://media.discordapp.net/attachments/820557032016969751/991172011483218010/unknown.png
|
|
|
|
|
|
|
|
+ mp:attachments/820557032016969751/991172011483218010/unknown.png
|
|
|
|
|
2022-07-07 07:18:21 +00:00
|
|
|
```
|
2022-07-09 12:47:00 +00:00
|
|
|
|
|
|
|
+ Step 4:
|
2022-07-07 07:18:21 +00:00
|
|
|
|
|
|
|
```js
|
|
|
|
const r = new Discord.RichPresence()
|
|
|
|
.setApplicationId('817229550684471297')
|
2022-07-09 12:47:00 +00:00
|
|
|
.setType('PLAYING')
|
2022-07-07 07:18:21 +00:00
|
|
|
.setURL('https://youtube.com/watch?v=dQw4w9WgXcQ')
|
|
|
|
.setState('State')
|
|
|
|
.setName('Name')
|
|
|
|
.setDetails('Details')
|
|
|
|
.setParty({
|
|
|
|
max: 9,
|
|
|
|
current: 1,
|
|
|
|
id: Discord.getUUID(),
|
|
|
|
})
|
|
|
|
.setStartTimestamp(Date.now())
|
2022-07-09 12:47:00 +00:00
|
|
|
.setAssetsLargeImage('mp:attachments/820557032016969751/991172011483218010/unknown.png')
|
2022-07-07 07:18:21 +00:00
|
|
|
.setAssetsLargeText('Youtube')
|
|
|
|
.setAssetsSmallImage('895316294222635008')
|
|
|
|
.setAssetsSmallText('Bot')
|
|
|
|
.addButton('name', 'https://link.com/')
|
2022-07-09 18:17:09 +00:00
|
|
|
client.user.setActivity(r.toJSON());
|
2022-07-07 07:18:21 +00:00
|
|
|
```
|
|
|
|
|
2022-07-16 08:29:30 +00:00
|
|
|
## Method 2: (Discord URL, 2.3.78+)
|
|
|
|
|
|
|
|
```js
|
|
|
|
const r = new Discord.RichPresence()
|
|
|
|
.setApplicationId('817229550684471297')
|
|
|
|
.setType('PLAYING')
|
|
|
|
.setURL('https://youtube.com/watch?v=dQw4w9WgXcQ')
|
|
|
|
.setState('State')
|
|
|
|
.setName('Name')
|
|
|
|
.setDetails('Details')
|
|
|
|
.setParty({
|
|
|
|
max: 9,
|
|
|
|
current: 1,
|
|
|
|
id: Discord.getUUID(),
|
|
|
|
})
|
|
|
|
.setStartTimestamp(Date.now())
|
|
|
|
.setAssetsLargeImage('https://cdn.discordapp.com/attachments/820557032016969751/991172011483218010/unknown.png')
|
|
|
|
.setAssetsLargeText('Youtube')
|
|
|
|
.setAssetsSmallImage('895316294222635008')
|
|
|
|
.setAssetsSmallText('Bot')
|
|
|
|
.addButton('name', 'https://link.com/')
|
|
|
|
client.user.setActivity(r.toJSON());
|
|
|
|
```
|
|
|
|
|
2022-07-09 12:47:00 +00:00
|
|
|
<img src='https://cdn.discordapp.com/attachments/820557032016969751/995301015257616414/unknown.png'>
|
|
|
|
|
2022-07-16 08:29:30 +00:00
|
|
|
## Method 3 (Custom URL, 2.3.78+)
|
|
|
|
|
|
|
|
```js
|
2022-07-16 08:43:11 +00:00
|
|
|
const rpc = new Discord.RichPresence();
|
2022-07-16 08:29:30 +00:00
|
|
|
const imageSet = await rpc.getExternal(client, '820344593357996092', 'https://musedash.moe/covers/papipupipupipa_cover.hash.93ae31d41.png', 'https://musedash.moe/covers/lights_of_muse_cover.hash.1c18e1e22.png')
|
2022-07-16 08:43:11 +00:00
|
|
|
rpc
|
2022-07-16 08:29:30 +00:00
|
|
|
.setApplicationId('820344593357996092')
|
|
|
|
.setType('PLAYING')
|
|
|
|
.setState('pa pi pu pi pu pi pa - ころねぽち With 立秋')
|
|
|
|
.setName('Muse Dash')
|
|
|
|
.setDetails('Hard - Lvl.8')
|
|
|
|
.setAssetsLargeImage(imageSet[0].external_asset_path)
|
|
|
|
.setAssetsSmallImage(imageSet[1].external_asset_path)
|
2022-07-16 08:43:11 +00:00
|
|
|
client.user.setActivity(rpc.toJSON());
|
2022-07-16 08:29:30 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
<img src='https://cdn.discordapp.com/attachments/820557032016969751/997781209998434355/unknown.png'>
|
|
|
|
|
2022-07-09 12:47:00 +00:00
|
|
|
<strong>How to get the Assets ID and Name of the bot (application) ?</strong>
|
|
|
|
|
|
|
|
- Bot:
|
|
|
|
```js
|
|
|
|
const bot = await client.users.fetch('BotId');
|
|
|
|
const asset = await bot.application.fetchAssets();
|
|
|
|
// asset: Array<ApplicationAsset>
|
|
|
|
// Document: https://discordjs-self-v13.netlify.app/#/docs/docs/main/typedef/ApplicationAsset
|
|
|
|
```
|
|
|
|
<img src='https://cdn.discordapp.com/attachments/820557032016969751/995307830028550204/unknown.png'>
|
|
|
|
|
|
|
|
- Application
|
|
|
|
> Using Browser (Chrome) with URL: `https://discord.com/api/v9/oauth2/applications/{applicationId}/assets`
|
|
|
|
<img src='https://cdn.discordapp.com/attachments/820557032016969751/995307606115618926/unknown.png'>
|
|
|
|
|
|
|
|
- More:
|
2022-07-09 18:17:09 +00:00
|
|
|
- You can change the status 5 times every 20 seconds!
|