Skip to content

Instantly share code, notes, and snippets.

@steve02081504
Last active May 6, 2022 01:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save steve02081504/a3cccec1d7e70bceebcc70ac99e3558a to your computer and use it in GitHub Desktop.
Save steve02081504/a3cccec1d7e70bceebcc70ac99e3558a to your computer and use it in GitHub Desktop.
How to get your ghost to support Discord Rich Presence

步骤1:

前往discord app开发面板新建app
图片

步骤2:

填写app名称
图片 上传Discord Rich Presence所需资源
图片

步骤3:

安装或更新Discord Rich Presence PLUGIN到至少1.1.2.1

步骤4:

让你的ghost对OnDiscordPluginCustom[Notify]OnDiscordPluginCustomEnd[Notify]进行反应
这两个事件是Notify,因为如果它们是GET会打断ghost的启动/终止对话
但是你应当保证你的ghost在OnDiscordPluginCustom发生后用以下方式更新Discord Rich Presence的内容,并且在OnDiscordPluginCustomEnd发生后不再对Discord Rich Presence内容进行更新
你可以通过

OnDiscordPluginCustomAppid
OnDiscordPluginCustomState
OnDiscordPluginCustomDetail
OnDiscordPluginCustomLargeImageKey
OnDiscordPluginCustomLargeImageText
OnDiscordPluginCustomSmallImageKey
OnDiscordPluginCustomSmallImageText
OnDiscordPluginCustomALL

以上任何事件更新Discord Rich Presence的内容,例子如下

\![raiseplugin,Discord Rich Presence,OnDiscordPluginCustomALL,902362898960117830,,,kikka_eye_open,github.com/Taromati2,]\![raiseplugin,Discord Rich Presence,OnDiscordPluginCustomSmallImageKey,"simple_hollow_red_heart"]\![raiseplugin,Discord Rich Presence,OnDiscordPluginCustomSmallImageText,"Developer"]\![raiseplugin,Discord Rich Presence,OnDiscordPluginCustomDetail,"发呆。"]\0\s[0]好的,Discord个人资料已经更新了\n

除了OnDiscordPluginCustomALL,其他任何事件都是只会对第一个参数作出反应的事件
OnDiscordPluginCustomALL接受的参数依次为AppidCustomDetailCustomStateLargeImageKeyLargeImageTextSmallImageKeySmallImageText
除了Appid是定制Discord Rich Presence必须的信息,其他的信息都是可选信息
你可以在ghost运行时的任何时间通过以上的任意事件修改这些信息来调整和修改Discord Rich Presence的具体表现
如果你还需要更多关于这些信息如何影响Discord Rich Presence的资讯,可以访问https://discord.com/developers/applications/<你的Appid>/rich-presence/visualizer
图片

步骤5:

丰富ghost的反应
你可以在任何时间更新你的ghost的Discord Rich Presence,比如最小化时
图片
被抚摸时
图片
有时你还可以在Discord Rich Presence中附加更多信息,比如如果你的ghost有音乐播放功能,你可以在Discord Rich Presence中展现现在正在听的歌曲
图片
或者你的ghost有小游戏功能,你可以在玩游戏时更新Discord Rich Presence中显示的分数
图片
能做的事情很多,而你只需要使用raiseplugin就好

Step 1.

Go to the discord app development panel to create a new app
image

Step 2.

Fill in the app name
image Upload the required resources for Discord Rich Presence
Image

Step 3.

Install or update Discord Rich Presence PLUGIN to at least 1.1.2.1

Step 4.

Get your ghost to react to OnDiscordPluginCustom[Notify] and OnDiscordPluginCustomEnd[Notify]
These two events are Notify, because if they were GET they would interrupt the start/end conversation of ghost
But you should ensure that your ghost updates the contents of the Discord Rich Presence after OnDiscordPluginCustom occurs with the following, and that it does not update the contents of the Discord Rich Presence after OnDiscordPluginCustomEnd occurs
You can update the contents of a Discord Rich Presence with

OnDiscordPluginCustomAppid
OnDiscordPluginCustomState
OnDiscordPluginCustomDetail
OnDiscordPluginCustomLargeImageKey
OnDiscordPluginCustomLargeImageText
OnDiscordPluginCustomSmallImageKey
OnDiscordPluginCustomSmallImageText
OnDiscordPluginCustomALL

Any of the above events update the contents of the Discord Rich Presence, examples are as follows

\![raiseplugin,Discord Rich Presence,OnDiscordPluginCustomALL,902362898960117830,,,kikka_eye_open,github.com/Taromati2,]\![raiseplugin,Discord Rich Presence,OnDiscordPluginCustomSmallImageKey,"simple_hollow_red_heart"]\![raiseplugin,Discord Rich Presence,OnDiscordPluginCustomSmallImageText,"Developer"]\![raiseplugin,Discord Rich Presence,OnDiscordPluginCustomDetail,"Daze."]\0\s[0]Okay.The Discord profile has been updated\n

Any event other than OnDiscordPluginCustomALL is an event that only reacts to the first parameter
and OnDiscordPluginCustomALL accepts the parameters Appid, CustomDetail, CustomState, LargeImageKey, LargeImageText, SmallImageKey, SmallImageText
All informations is optional except for Appid which is required to customize Discord Rich Presence
You can modify this information at any time during the ghost runtime by raise any of the events listed above to adjust and modify the specific presentation of Discord Rich Presence.
If you need more information on how this informations affects Discord Rich Presence, you can visit https://discord.com/developers/applications/<Your Appid>/rich-presence/visualizer
Image

Step 5.

Enriching ghost's response
You can update your ghost's Discord Rich Presence at any time, for example when minimized
image
When being stroked
Image
Sometimes you can also attach more information to the Discord Rich Presence, for example if your ghost has music player function, you can show the listening song in the Discord Rich Presence
image
Or if your ghost has a mini-game function, you can update the score displayed in Discord Rich Presence while playing the game
image
There's a lot you can do, and all you need is use raiseplugin

Thanks to @OmegaV1105 and @Don for proofreading the translation

ステップ1.

Discordのアプリ開発パネルにアクセスし、新規アプリを作成します。 image

ステップ2.

アプリ名を入力します。
image Discord Rich Presenceに必要なリソースをアップロードします。
Image

ステップ3.

Discord Rich Presence PLUGIN を 1.1.2.1 以降をインストールまたはアップデートしてください。

ステップ4.

あなたのゴーストをOnDiscordPluginCustom[Notify]OnDiscordPluginCustomEnd[Notify] に対応させてください。
この2つのイベントはNotifyです。もしGETであれば、ゴーストの開始と終了の会話を中断することになるからです。
ただし、OnDiscordPluginCustomが発生した後にあなたのゴーストがDiscord Rich Presenceの内容を次のように更新し、OnDiscordPluginCustomEndが発生した後にDiscord Rich Presenceの内容を更新しないようにする必要があります。 そしてDiscord Rich Presenceの内容を更新することができます。

OnDiscordPluginCustomAppid
OnDiscordPluginCustomState
OnDiscordPluginCustomDetail
OnDiscordPluginCustomLargeImageKey
OnDiscordPluginCustomLargeImageText
OnDiscordPluginCustomSmallImageKey
OnDiscordPluginCustomSmallImageText
OnDiscordPluginCustomALL

上記のいずれかのイベントが発生すると、Discord Rich Presenceの内容が更新されます。例としては、以下のようなものがあります。

\![raiseplugin,Discord Rich Presence,OnDiscordPluginCustomALL,902362898960117830,,,kikka_eye_open,github.com/Taromati2,]\![raiseplugin,Discord Rich Presence,OnDiscordPluginCustomSmallImageKey,"simple_hollow_red_heart"]\![raiseplugin,Discord Rich Presence,OnDiscordPluginCustomSmallImageText,"Developer"]\![raiseplugin,Discord Rich Presence,OnDiscordPluginCustomDetail,"Daze."]\0\s[0]Okay.The Discord profile has been updated\n

OnDiscordPluginCustomALL 以外のイベントは、最初のパラメーターにのみ反応するイベントです。
OnDiscordPluginCustomALL は、パラメータ AppidCustomDetailCustomStateLargeImageKeyLargeImageTextSmallImageKeyLargeImageTextSmallImageKeySmallImageTextを受け付けます。
Discord リッチプレゼンスのカスタマイズに必要な Appid は必須で、それ以外の情報は任意です。 この情報は、ゴースト実行中にいつでも、上記のイベントのいずれかを変更して、Discord Rich Presenceの特定のプレゼンテーションを調整・変更することができます。 この情報がDiscord Rich Presenceにどのように影響するかについての詳しい情報が必要な場合は、https://discord.com/developers/applications/<あなたのAppid>/rich-presence/visualizerを参照してください。 Image

ステップ5.

ゴーストの反応を豊かにする
ゴーストの Discord Rich Presence は、最小化したときなど、いつでも更新することができます。
image
撫でられる時
Image
例えば、あなたのゴーストが音楽を流している場合、今聴いている曲を Discord Rich Presence に表示することができます。
image
また、ゴーストにミニゲーム機能があれば、ゲームをプレイしながらDiscord Rich Presenceに表示されるスコアを更新することができます。
image
できることはたくさんあり、必要なのはraisepluginを使うことです。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment