Skip to main content

overwolf.social.discord API

Provides access to the Discord social provider.

tip

You can use overwolf.social.getDisabledServices() method to check if the service is available.

Methods Reference

Events Reference

Types Reference

performUserLogin()

Version added: 0.115

Opens the login dialog.

There is no callback for this method and the only way to know if the user signed in is via onLoginStateChanged event.

performLogout(callback)

Version added: 0.115

Performs a "strong" sign out of Discord, so that even if the user performs a login via the Overwolf Settings / Accounts page, he will be considered signed out.

ParameterTypeDescription
callback(Result) => voidA callback function which will be called with the status of the request

getUserInfo(callback)

Version added: 0.115

If the user is currently logged into Discord, this will return user information, Otherwise, an error is returned.

ParameterTypeDescription
callback(Result: GetUserInfoResult) => voidA callback function which will be called with the status of the request

getGuilds(callback)

Version added: 0.115

If the user is currently logged into Discord, this will return the guilds that the user is registered to. Otherwise, an error is returned

ParameterTypeDescription
discordShareParamsDiscordShareParameters ObjectThe share parameters
callbackfunctionWill contain the status of the request

getChannels(guildId, callback)

Version added: 0.115

If the user is currently logged into Discord, this will return the channels of the given guild Id, for which the user has privileges to share images/videos to. Otherwise, an error is returned.

ParameterTypeDescription
callbackfunctionReturns the channels of the given guild

share(DiscordShareParameters, callback)

Version added: 0.115

If the user is currently logged into Discord, this will perform the video share.

ParameterTypeDescription
discordShareParamsDiscordShareParameters ObjectThe share parameters
callback(Result) => voidA callback function which will be called with the status of the request

Types of errors that can occur:

  • Disconnected (user isn't signed in)
  • MissingFile (trying to share a missing file)
  • UnsupportedFile (trying to share an unsupported format)
  • ExceedsMaxSize (the file is too large: > 8 MB for images, > 100 MBfor videos)

Code Example

Note: you should perform login to Discord before calling the share function: overwolf.social.discord.performUserLogin().

let settingsLocalFile=
{
"file":"C:\\Users\\astaroth\\Videos\\Overwolf\\test.mp4", //change the file name to an existing file
"message":"Check out my video! #LeagueofLegends | Captured by #Overwolf",
"events":[
"death"
],
"gameClassId":5426,
"gameTitle":"League of Legends",
"channelId":"544173576018722867", //change the "channelId" right click the discord channel you would like to share to and click "copy id"
"metadata":{
"champion":"Urgot",
"win":"Win"
}
}

overwolf.social.discord.share(settingsLocalFile, console.log)

shareEx(DiscordShareParameters, callback, callback)

Version added: 0.198

If the user is currently logged into Discord, this will perform the video share.

ParameterTypeDescription
discordShareParamsDiscordShareParameters ObjectThe share parameters
resultCallback(SocialShareResult) => voidA callback function which will be called with the resulting status of the request
progressCallback(socialShareProgress) => voidA callback function which will be called whenever share progress is made

Types of errors that can occur:

  • Disconnected (user isn't signed in)
  • MissingFile (trying to share a missing file)
  • UnsupportedFile (trying to share an unsupported format)
  • ExceedsMaxSize (the file is too large: > 8 MB for images, > 100 MBfor videos)

Code Example

Note: you should perform login to Discord before calling the share function: overwolf.social.discord.performUserLogin().

let settingsLocalFile =
{
"file":"C:\\Users\\astaroth\\Videos\\Overwolf\\test.mp4", //change the file name to an existing file
"message":"Check out my video! #LeagueofLegends | Captured by #Overwolf",
"id":"2",
"useOverwolfNotifications":false,
"events":[
"death"
],
"gameClassId":5426,
"gameTitle":"League of Legends",
"channelId":"544173576018722867", //change the "channelId" right click the discord channel you would like to share to and click "copy id"
"metadata":{
"champion":"Urgot",
"win":"Win"
}
}

overwolf.social.discord.share(settingsLocalFile, console.log, console.log)

cancelShare(string, callback)

Version added: 0.198

cancels an ongoing share request with the given id, if valid. Callback will be invoked with success if such a request was found and a cancellation order was executed (may take a while)

ParameterTypeDescription
idstringThe request ID
callback(Result) => voidCalled with the result of the cancellation
overwolf.social.discord.cancelShare("2", console.log)

onLoginStateChanged

Version added: 0.115

Fired when the user’s login state changes, with the following structure: LoginStateChangedEvent Object.

DiscordShareParameters Object

Version added: 0.115

This object defines all parameters that can/should be passed to the Discord Share() and shareEx() methods.

ParameterTypeDescription
file (optional)stringThe file to share. See note
channelIdstringThe channel ID that the file will be shared to
id (Optional)stringThe ID for the current share request. See note
useOverwolfNotificationsbooleanWhether or not overwolf notifications should be used. See note
messagestringThe message to include with the shared file. See note
trimming (Optional)VideoCompositionSegmentAn object containing start time and end time for the desired VideoCompositionSegment
events (optional)stringAn array of chronological events that occurred during the capture
gameClassId (Optional)intThe associated game's class ID
gameTitle (Optional)stringThe associated game's title
metadata (Optional)ObjectExtra information about the game session

file note

Since version 0.153, the "file" param is optional when calling overwolf.social.discord.share() or overwolf.social.discord.shareEx(). Instead, you can use the "message" param to include a URL of a file that you want to share.

id note

When calling overwolf.social.discord.shareEx(), it is required to supply it with a request ID. This ID will also be used in case you wish to cancel this share using overwolf.social.discord.cancelShare().

useOverwolfNotifications note

When calling overwolf.social.discord.share(), this will default to true. When calling overwolf.social.discord.shareEx(), this will default to false.

SocialShareResult Object

Version added: 0.198

Container for the url shared in a successful share.

ParameterTypeDescription
urlstringThe url of the generated result

Example data

{
"url": "https://cdn.discordapp.com/media/310742576380772355/ff2c69e1b4b4d3563fdfbeb6e8a96d37.png"
}

SocialShareProgress Object

Version added: 0.198

The current progress of the share request

ParameterTypeDescription
progressintThe current precentage of upload progress
idstringThe id of the share request
stateShareStateThe current state of the share request

Example data

{
"progress": 56,
"id": "1",
"state": "Uploading"
}

ShareState Enum

Version added: 0.198

The current state of the overwolf.social.discord.shareEx() operation.

OptionsDescription
StartedThe upload has started
UploadingThe upload is in progress
FinishedThe upload has finished

GetGuildsResult Object

Version added: 0.128

Container for get Guilds result.

ParameterTypeDescription
guildsGuild[]

Example data: Success

A callback function which will be called with the status of the request and the guilds that the user is registered to.

{
"status": "success",
"guilds": [
{
"id": "310742576380772355",
"name": "Overwolf",
"icon": "https://cdn.discordapp.com/icons/310742576380772355/ff2c69e1b4b4d3563fdfbeb6e8a96d37.png",
"owner": false,
"roles": null
},
{
"id": "407312977017045002",
"name": "PUBGG",
"icon": "https://cdn.discordapp.com/icons/407312977017045002/032b6941ca08ffcd89bbcb7fb16b2217.png",
"owner": false,
"roles": null
}
]
}

Guild Object

Version added: 0.128

Container for the Guild entity.

ParameterTypeDescription
iconstring
idstring
namestring
owner_idstring
rolesRole[]

Example data

{
"id": "310742576380772355",
"name": "Overwolf",
"icon": "https://cdn.discordapp.com/icons/310742576380772355/ff2c69e1b4b4d3563fdfbeb6e8a96d37.png",
"owner": false,
"roles": null
}

Role Object

Version added: 0.128

Container for the Role entity.

ParameterTypeDescription
idstring
namestring
permissionsnumber