If you want to publish a presence to the store and load it via the extension, you should create the metadata.json
file in your dist
folder.
An example of that file can be found below.
{
"$schema": "https://schemas.premid.app/metadata/1.7",
"author": {
"name": "USER",
"id": "ID"
},
"contributors": [{
"name": "USER",
"id": "ID"
}],
"service": "SERVICE",
"altnames": ["SERVICE"],
"description": {
"en": "DESCRIPTION"
},
"url": "URL",
"regExp": "REGEXP",
"iFrameRegExp": "REGEXP",
"version": "VERSION",
"logo": "URL",
"thumbnail": "URL",
"color": "#45A8FC",
"category": "CATEGORY",
"tags": ["TAG1", "TAG2"],
"iframe": false,
"settings": [
{
"id": "ID",
"title": "DISPLAY TITLE",
"icon": "FONTAWESOME ICON",
"value": true
},
{
"id": "ID",
"if": {
"ID": true
},
"title": "DISPLAY TITLE",
"icon": "FONTAWESOME ICON",
"value": "\"%song%\" by %artist%",
"placeholder": "use %song% or %artist%"
},
{
"id": "ID",
"title": "DISPLAY TITLE",
"icon": "FONTAWESOME ICON",
"value": 0,
"values": ["1", "2", "etc."]
}
]
}
That example looks really strange, huh? Don't worry, its not that hard to understand what each variable is for.
Variable | Description | Type | Optional |
---|---|---|---|
author | Should contain an Object with the name and id of the presence developer. name is your Discord username without the identifier(#0000). User id can be copied from Discord by enabling developer
mode and right-clicking on your profile. |
Object |
No |
contributors | Should contain an Object with the name and id of the contributor. name is your Discord username without the identifier(#0000). User id can be copied from Discord by enabling developer
mode and right-clicking on your profile. |
Array<Object> |
Yes |
service | The title of the service that this presence supports. | String |
No |
altnames | Be able to search the presence using an alternative name. Meant to be used for presences that have different names in different languages (e.g. Pokémon and 포켓몬스터). You can also use it for presences that have special characters so you don't have to type those (e.g. Pokémon and Pokemon). |
Array<String> |
Yes |
description | Description of the service NOT the presence. Your description must have key pair values which indicate the language, and the description in that specific language. Make descriptions with the languages that you know, our translators will make changes to your metadata file. View the category for presence languages for a list. | Object |
No |
url | URL of the service. Example: vk.com This url must match the url of the website as it will be used to detect wherever or not this is the website to inject the script to. This may only be used as an array when there are more than one urls. |
String, Array<String> |
No |
regExp | A regular expression string used to match urls. | String |
Yes |
version | Version of your presence. | String |
No |
logo | Link to service's logotype. | String |
No |
thumbnail | Link to your presence thumbnail. | String |
No |
color | #HEX value. We recommend to use a primary color of the service
that your presence supports. |
String |
No |
category | A string used to represent the category the presence falls under. | String |
No |
tags | Array with tags, they will help users to search your presence on the website. | String, Array<String> |
No |
iframe | Defines whether iFrames are used |
Boolean |
Yes |
iFrameRegExp | A regular expression selector that selects iframes to inject into. | String |
Yes |
readLogs | Defines whether the extension should be reading logs. | Boolean |
Yes |
settings | An array of settings the user can change | Array<Object> |
Yes |
If you want to learn regular expressions, here are a few websites.
• Quick Starter Video
• RegexOne
• Regular Expressions Info
PreMiD is a polyglot service, meaning that there are multiple languages available to connect users around the globe. A full list of languages can be found with this API endpoint. To customize your presence even more, you can allow users to select their presence display language. See multiLanguage
for more.
Setup interactive settings so users can customize the presence!
"settings": [
{
"id": "ID",
"multiLanguage": true //See https://docs.premid.app/dev/presence/metadata#multilanguage
},
{
"id": "ID",
"title": "DISPLAY TITLE",
"icon": "FONTAWESOME ICON", //Example "fas fa-info"
"value": true //Boolean value will make it an on/off switch with the value as the default value
},
{
"id": "ID",
"if": {
"ID": true //If another setting equals this value (true/false/0/1/etc.) then show this button
},
"title": "DISPLAY TITLE",
"icon": "FONTAWESOME ICON",
"value": "\"%song%\" by %artist%", //Putting in a string will make the setting an input one, where you can use a custom input.
"placeholder": "use %song% or %artist%" //When input is empty it will show this grayed out
},
{
"id": "ID",
"title": "DISPLAY TITLE",
"icon": "FONTAWESOME ICON",
"value": 0, //Default value of the selector
"values": ["1", "2", "etc."] //Will make the setting a selector where you select which one you want
}
]
multiLanguage
The multiLanguage
setting is used to allow users to manually select the language they want to presence to be shown in.
This requires you to use strings from our API, for information on how to add strings click here.
The multiLanguage
setting is a special case, it doesn't require a title
nor icon
nor value
or values
like other settings but it does require you some more things to setup!
The multiLanguage
key can be set to the following:
true
: use this if you are only going to use strings of the general.json
file and the <service>.json
file of the Localization Repository.
string
: name of the file excluding the extension (.json) inside the Localization Repository (excluding the general
file, since it's always loaded). Only common languages of both the general
and inputted file will be listed.
Array<String>
: if you are using more than one file inside the Localization Repository you can specify all the values in an array (excluding the general
file, since it's always loaded). Only common languages of all the files will be listed.
Note: Adding custom strings for a presence is only allowed if it has more than 1000 users.
git clone https://github.com/PreMiD/Localization
.src
folder.Presence
folder.<service>.json
. (Service is the name (not an URL) in lowercase of the service you want to support.)Each string
is an Object
where from the name starts with the service name and then the so called stringName with a dot in between them.
The stringName is a 1 word identifier of the message.
The Object
has 2 properties; message
and description
.
message
is the text that needs to be translated.
description
is a description of the message to help our translators understand what they are translating.
Note: Do not add any duplicate strings. (This includes strings out of the general.json
file but not the other files.)
Visualization of the file:
{
"<service>.<stringName>": {
"message": "Text that needs to be translated.",
"description": "This explains what the message above is."
},
"<service>.<stringName>": {
"message": "Text that needs to be translated.",
"description": "This explains what the message above is."
}
}
After you have fully made the file with strings you can create a Pull Request on the Localization Repository, in the description you must include a link to your Pull Request of the presence updated using these new strings from the Presence Repository.
The keys you didn't have to set are automatically set to the following:
title
: "Language" Note: This is translated into their default language (browser language).
icon
: "fas fa-language" (Preview)
value
: Set to their browser language if it is available (100% translated), otherwise English.
values
: Set to the available languages (languages that have it 100% translated).
Note: These are in no way changeable.
Use the following methods to get settings info in your presence files:
getSetting(String)
Returns value of setting.
const setting = await presence.getSetting("pdexID"); //Replace pdexID with the id of the setting
console.log(setting); // This will log the value of the setting
hideSetting(String)
Hides given setting.
presence.hideSetting("pdexID"); //Replace pdexID with the id of the setting
showSetting(String)
Shows given setting (Only works if the setting was already hidden).
presence.showSetting("pdexID"); //Replace pdexID with the id of the setting
When making your presence, you must specify a category which the presence falls under. This is a compiled list of the categories that you can use.
Category | Name | Description |
---|---|---|
anime | Anime | Anything related to anime, from forums to video streaming platforms. |
games | Games | Any website that has game related content, such as Kahoot or Skribbl.io |
music | Music | These are websites that offer music related content, whether that be streaming or downloading. |
socials | Socials | Websites that are used for the purpose of creating and sharing content or for participating in other forms of social networking. |
videos | Videos & Streams | Websites that serve the purpose of providing videos and streams. |
other | Other | Anything that does not fall under a specific category listed above. |