Skip to content

Extremely simple example of a PHP parser for the Discord API

Notifications You must be signed in to change notification settings

idddev/discord-php-api-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

discord-php-api-parser

Extremely simple example of a PHP parser for the Discord API

This was made for testing purposes. Feel free to use it for getting inspired. Check out the Discord API Reference for more information about API endpoints.

There's two examples:

Check if a user exists in a guild

This will search for users with the given pattern.

$findUser = _discordCheckIfUserExists($guildId, $nickname, $token);
if (!$findUser) {
   echo 'Users with given pattern not found.';
} else {
   echo 'Users found.';
   print_r($findUser);
}

Where $guildId is the Id of the Guild, $nickname is the search pattern, and $token is your Bot token.

Change user roles of a member

This will change a user roles.

$changeUserRoles = _discordSetUserRole($guildId, $userId, $roles, $token);
if (!$changeUserRoles) {
    echo 'Error while changing user roles.';
} else {
    echo 'Roles has been updated successfully.';
}

Where $guildId is the Id of the Guild, $userId is the user Id, $roles is an array of roles Ids, and $token is your Bot token.

About

Extremely simple example of a PHP parser for the Discord API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages