Skip to content

Otaku17/discord_psdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord Integration (Rich Presence & Webhook)

Discord integration for Ruby / Pokémon SDK projects
Rich Presence (IPC) + Webhook (HTTP) with a clean DSL


Installation / Update

  1. Download Discord.psdkplug

  2. Place the plugin in your project/scripts:

    Discord.psdkplug
    
  3. Run this command at the root of your project:

    .\psdk --util=plugin load
  4. Configure Discord settings (Data/configs/discord_config.json).

Here’s an example of a typical Rich Presence activity setup:

setup_rich_presence.mp4

Start Rich Presence

Discord::RichPresence.start
Field Required Description
client_id Discord Application ID

Update Activity

Discord::RichPresence.update(
  details: "In battle",
  state: "Arena",
  assets: {
    large_image: "arena",
    small_image: "player"
  }
)

Activity Object (Official)

Field Required Type Notes
details String Max 128 chars
state String Max 128 chars
timestamps.start Integer Unix timestamp
assets.large_image String Asset key
assets.large_text String Hover text
assets.small_image String Asset key
assets.small_text String Hover text

Only provided fields are sent. nil removes the field.

Pause / Resume

Discord::RichPresence.pause
Discord::RichPresence.resume
Method Effect
pause Clears activity
resume Restores last activity

Stop Rich Presence

Discord::RichPresence.stop
  • Closes IPC socket
  • Stops background thread

DISCORD WEBHOOK API

Based on official Discord Webhook & Embed API.

Send Message

Discord::Webhook.send(content: "Server online")
Field Required Type
webhook_url String
content String
username String
avatar_url String
embeds Array

Embed Builder DSL

embed = Discord::Webhook.embed
  .title("Status")
  .description("Server running")
  .color("#5865F2")
  .timestamp

Send it:

Discord::Webhook.send(
  embeds: [embed.to_h]
)

Embed Object (Official Discord API)

Field Required Type Limits
title String 256 chars
description String 4096 chars
url String Valid URL
timestamp ISO8601
color String HEX

Author Object

Field Required Type
name String
url String
icon_url String

Footer Object

Field Required Type
text String
icon_url String

Image / Thumbnail

Field Required Type
url String

Fields Array

Field Required Type Limits
name String 256 chars
value String 1024 chars
inline Boolean

Limits (Discord Enforced)

  • Max embeds per message: 10
  • Max fields per embed: 25
  • Total embed size: 6000 chars

Content + Embed

Discord::Webhook.send(
  content: "Game update",
  embeds: [embed.to_h]
)

Security

Mention Protection

  • Removes all @ characters
  • Prevents:
    • @everyone
    • @here
    • Role mentions
    • User mentions

Enabled by default on:

  • content
  • username
  • embed text

Configuration Reference

The embed section allows you to have a default structure, so you do not need to build embeds manually for each message.

{
  "client_id": "DISCORD_APP_ID",
  "details": "Default details",
  "state": "Default state",
  "large_image": "large",
  "small_image": "small",
  "large_text": "Large hover",
  "small_text": "Small hover",

  "webhook_url": "WEBHOOK_URL",

  "color": "#5865F2",
  "title": "Default title",
  "url": null,
  "author_name": "Author",
  "author_icon": null,
  "author_url": null,
  "thumbnail": null,
  "description": "Default description",
  "image": null,
  "footer_text": "Footer",
  "footer_icon": null
}

All fields are optional, except those marked as required by Discord. If you do not want them, set them to null. The default embed structure ensures you have a working format out-of-the-box without needing to manually define every field each time.


License

Free to use, modify and distribute.

Credits

Made with ❤️ for Pokémon SDK & Ruby projects. Inspired by Discord IPC & Webhook official APIs.

About

Ruby plugin for integrating Discord into your Pokémon Studio projects: adds Rich Presence and Webhook support to show player activity and send messages directly to Discord.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages