overwolf.social.discord

Provides access to the Discord social provider

Methods

performUserLogin()

Version added: 0.115.1

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|

performLogout(callback)

Version added: 0.115.1

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

  • Parameter: callback <function>

    Returns the status of the logout process 

Callback argument:
{status: "success"}

getUserInfo(callback)

Version added: 0.115.1

Return the user’s information (if he’s currently logged in to Discord) 

  • Parameter: callback <function>

    If the user is currently logged into Discord, this will return user information.

    Otherwise, an error is returned:

    {"status":"error","reason":"Disconnected"}
Callback argument:
{
  "status": "success",
  "userInfo": {
    "id": "1111111111111",
    "discriminator": 9999,
    "username": "itay",
    "email": "itay@overwolf.com",
    "avatar": null,
    "verified": true
  }
}

getGuilds(callback)

Version added: 0.115.1

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

  • Parameter: callback <function>

    Returns the guilds that the user is registered to

Callback argument:
{
  "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
    },
    {
      "id": "407984551600717834",
      "name": "Legendary Builds",
      "icon": "https://cdn.discordapp.com/icons/407984551600717834/2fec1c02b5095bd7bce6208c2348e70c.png",
      "owner": false,
      "roles": null
    },
    {
      "id": "418527834936573954",
      "name": "Official PUBG API HQ",
      "icon": "https://cdn.discordapp.com/icons/418527834936573954/372e39d981644b6345dc6d0c9b957f52.png",
      "owner": false,
      "roles": null
    }
  ]
}

getChannels(guildId, callback)

Version added: 0.115.1

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

  • Parameter: guildId <string>

    The guild ID

  • Parameter: callback <function>

    Returns the channels of the given guild Id

share(discordShareParams, callback)

Version added: 0.115.1

If the user is currently logged into Discord, this will perform a media share (image or video).

Type 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)

Events How to use events

onLoginStateChanged

Version added: 0.115.1

Fired when the login state was changed

Types

overwolf.social.discord.DiscordShareParameters

Options

file

<string>

The file to share.

channelId

<string>

The channel ID that the file will be shared to.

message

<string>

The message to include with the shared file.

events

<string>

An array of chronological events that occurred during the capture.Optional parameter.

gameClassId

<int>

The associated game's class ID.Optional parameter.

gameTitle

<string>

The associated game's title.Optional parameter.