Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

restcord Guild Icon outputs 404.

# First of all you have to go to the /vendor/restcord file and 
# then you have to rewrite the following files...

                      ###########################
                      # File: src/Constants.php #
                      ###########################
namespace RestCord;

/**
 * @author Aaron Scherer <aequasi@gmail.com>
 *
 * Constants Class
 */
class Constants
{
    const CDN_URL    = 'https://cdn.discordapp.com/';

    const AVATAR_URL = self::CDN_URL.'avatars/';
    const ICON_URL = self::CDN_URL.'icons/';
}

                      ##################################
                      # File: src/Traits/IconTrait.php #
                      ##################################
namespace RestCordTraits;

use RestCordConstants;

/**
 * @author Aaron Scherer <aequasi@gmail.com>
 *
 * IconTrait Class
 */
trait IconTrait
{
    public function getIcon($format = 'webp', $size = null)
    {
        $url = Constants::ICON_URL.$this->id.'/'.$this->icon.'.'.$format;
        if ($size !== null) {
            $url .= '?size='.$size;
        }

        return $url;
    }
}
 
PREVIOUS NEXT
Tagged: #restcord #Guild #Icon #outputs
ADD COMMENT
Topic
Name
2+2 =