Jaxel
Well-known member
When I first connect my Discord account, it shows up like this:
Works fine. However, after a few days, the extraneous information, like the avatar, the username and the #discriminator code disappear.
Where is this information stored? And why does it disappear after a few days?
This is my provider data:
Works fine. However, after a few days, the extraneous information, like the avatar, the username and the #discriminator code disappear.
Where is this information stored? And why does it disappear after a few days?
This is my provider data:
Code:
<?php
namespace EWR\Discord\ConnectedAccount\ProviderData;
class Discord extends \XF\ConnectedAccount\ProviderData\AbstractProviderData
{
public function getDefaultEndpoint()
{
return 'users/@me';
}
public function getProviderKey()
{
return $this->requestFromEndpoint('id');
}
public function getUsername()
{
return $this->requestFromEndpoint('username');
}
public function getDiscriminator()
{
return $this->requestFromEndpoint('discriminator');
}
public function getAvatar()
{
return $this->requestFromEndpoint('avatar');
}
public function getEmail()
{
return $this->requestFromEndpoint('email');
}
public function getVerified()
{
return $this->requestFromEndpoint('verified');
}
public function getAvatarUrl()
{
$avatar = $this->getAvatar();
if (empty($avatar))
{
$discriminator = $this->getDiscriminator();
return 'https://cdn.discordapp.com/embed/avatars/'.($discriminator%5).'.png';
}
else
{
$providerKey = $this->getProviderKey();
return 'https://cdn.discordapp.com/avatars/'.$providerKey.'/'.$avatar.'.png';
}
}
}