-
-
Notifications
You must be signed in to change notification settings - Fork 241
Guild
Guilds are part of discord. Guilds are known as 'Discord Servers' in the Discord application.
A Guild is Discord's equivalent of a server. It contains all the Members, Channels, Roles, Bans etc.
Return
- float the timestamp of when the guild was created.
Example
echo $guild->createdTimestamp();
function createRole([array<string|int, mixed> $data = [] ]) : ExtendedPromiseInterface
Creates a role in the guild with a given array of attributes. Returns the created role in a promise.
https://discord.com/developers/docs/resources/guild#create-guild-role
Returns an audit log object for the query.
https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log
Returns the channels invites.
https://discord.com/developers/docs/resources/guild#get-guild-invites
function getInvites() : ExtendedPromiseInterface
Retrieves a list of invites in the guild. Returns a collection of invites in a promise.
function getVoiceRegions() : ExtendedPromiseInterface
Retrieves a list of valid voice regions. Returns a collection of objects describing voice regions in a promise.
Leaves the guild. Alias for $discord->guilds->leave($guild->id)
.
https://discord.com/developers/docs/resources/user#leave-guild
function transferOwnership(Member|int $member) : ExtendedPromiseInterface
Transfers the ownership of the guild to another member. The bot must be the owner of the guild. Returns a promise with no data.
Unbans a member. Alias for $guild->bans->unban($user)
.
https://discord.com/developers/docs/resources/guild#remove-guild-ban
function unban(User|string $user) : ExtendedPromiseInterface
https://discord.com/developers/docs/resources/guild#modify-guild-role-positions
-
BanRepository
$guild->bans
-
ChannelRepository
$guild->channels
-
EmojiRepository
$guild->emojis
-
InviteRepository
$guild->invites
-
MemberRepository
$guild->members
-
RoleRepository
$guild->roles
Requires GUILD
intent
Your BOT must be member of the guild
Change 123123123123123123
below with the Guild ID you want to retrieve
Cached, synchronous:
$guild = $discord->guilds->get('id', '123123123123123123');
// Or using offsetGet
$guild = $discord->guilds['123123123123123123'];
If the code above returns null
(which most likely won't since guilds are always cached), you may need to fetch it first (Promise, asynchronous):
$discord->guilds->fetch('123123123123123123')->done(function (Guild $guild) {
// ...
});
Guild can be also retrieved from related objects:
Note: This wiki is currently Work In Progress. Consider reading the docs instead.
- Application Command (Slash based)
Command Client (Message based)
- Activity
- Application
- Guild
- Private Channel
- User
Components
-
ActionRow
- Buttons
- Option (commands)
- SelectMenu
- TextInput
Builders