Skip to content

Interacting with Discord Developer Portal

Lezalith edited this page Sep 24, 2022 · 6 revisions

What is it and what is it used for?

Discord Developer Portal is a corner on the official Discord website that allows creating applications. These applications are used to interact with Discord's code.

The most common applications are bots. Yes, those bots that are added onto Discord servers to provide all kinds of functionality, from playing music in voice channels to giving users virtual xp for writing in channels. The second most common ones are apps for interacting with Rich Presence - that's what we're here for.

Creating an application

To create a new application, click the New Application blue button in top right. You should create a new app for each of your projects that uses RenPy Discord Presence.

1

You will be asked to input a name, do so and click Create. This name is displayed inside the Presence when the game is being played, so it of course should be the name of your game. Don't worry, you can always change it later.

2

And that's all. The application is now created and you've been brought to its main page.

3

Top of the main page contains a couple of things:

  • Name is what you've chosen when creating the application, shown inside presence when the game is being played.
  • App Icon is shown on the list of applications at the beginning of the Discord Developer Portal. It's pretty.
  • Description is absolutely useless to us, as it's used by bots...
  • ...and so are the Tags.

Finally:

  • Application ID. This is the most important thing of all, you need to copy it over to settings.rpy in the script files, into the application_id variable. Simply put: Your game uses this to communicate with this application, and this application has the ability to change presence in user's profiles. And don't worry about this being in your code, it cannot be used for anything malicious!

After you copy the App ID to the settings.rpy file, you're ready to start using this script.

Preparing images

On the left side, there is a menu with the Rich Presence tab. Clicking it takes you to its sub-tab, Art Assets.

4

This is where you need to upload all the images that you want to show in the presence. Since your game communicates with the application and not the presence, it cannot tell presence what image to show. Instead, your game tells the application which image to show, and the app displays it inside the presence.

To upload an image, click the blue Add Image(s) button, which will prompt you to select one or more files. As the note says, they have to be of .png, .jpg or .jpeg format, and are recommended to be 1024x1024 in size. They don't have to be that big, but they have to be at least 512x512.

After the files are done uploading, they will appear under Rich Presence Assets with editable names. This is the name that you'll be using in your code to refer to them, so be short and descriptive. The name cannot be changed later, but if you do mess up, you can delete the image and re-upload it.

5

Once you've named the image(s), you can click the green Save Changes button to confirm it, and voilà, the image is now prepared to be referred by your code.

6

Visualizer

One more cool feature that I wanted to mention in this doc is the Visualizer sub-tab in the left-side menu. Here, you can see what the user's presence looks like when playing your game. If you're just starting out with RenPy Discord Presence, this can help you, well, visualize, how the presence will look with your code!

7

Below all the fields is the preview in question. Transferring it into game code, here is what it would looks like:

discord.set(state = "Scene 1: Perfect Day",
            large_image = "sophie",
            small_image = "book",
            time = True)

And being the one who tested all this, let me finish by showing you what those properties look like on my own profile.

result

Credits

This documentation page was made with the help of WitchyDev and their project Sophie the Witch. You can check the game out on its itch.io page and I've included a few screenshots below, just because I think the game looks great. Thank you, Witchy!

screen3 screen2 screen1

Clone this wiki locally