Table of Contents
Interfaces
- Adapter
- HandlesReactions
- HandlesSlashCommands
- SupportsDeleteMessages
- SupportsEditMessages
Properties
-
$apiUrl
: string
-
$applicationId
: string
-
$botToken
: string
-
$botUserId
: string|null
-
$formatConverter
: DiscordFormatConverter
-
$httpClient
: ClientInterface
-
$psrFactory
: Psr17Factory|null
-
$webhookVerifier
: DiscordWebhookVerifier|null
Methods
-
__construct()
: mixed
-
addReaction()
: void
-
channelIdFromThreadId()
: string
-
createResponse()
: ResponseInterface|null
-
decodeThreadId()
: mixed
-
deleteMessage()
: void
-
disconnect()
: void
-
editMessage()
: SentMessage
-
encodeThreadId()
: string
-
fetchChannelInfo()
: ChannelInfo|null
-
fetchMessages()
: FetchResult
-
fetchThread()
: ThreadInfo
-
getBotUserId()
: string|null
-
getFormatConverter()
: FormatConverter|null
-
getName()
: string
-
getUser()
: UserInfo|null
-
initialize()
: void
-
openDM()
: string|null
-
parseReaction()
: Author, emoji: string, rawEmoji: string, added: bool, threadId: string, messageId: string, userId: string, raw: mixed, originId: ?string}|null
-
parseSlashCommand()
: Author, command: string, text: string, userId: string, isBot: bool, isMe: bool, channelId: string, triggerId: ?string, raw: mixed}|null
-
parseWebhook()
: Message
-
postMessage()
: SentMessage
-
removeReaction()
: void
-
startTyping()
: void
-
stream()
: SentMessage|null
-
verifyWebhook()
: ResponseInterface|null
-
apiCall()
: array<string|int, mixed>
-
buildMessageParams()
: array<string|int, mixed>
-
extractAttachments()
: array<string|int, Attachment>
-
getAttachmentType()
: string
-
getAvatarUrl()
: string|null
-
parseComponentInteraction()
: Message
-
parseGatewayEvent()
: Message
-
postMessageWithFiles()
: SentMessage
$apiUrl
read-only
protected
string
$apiUrl
= 'https://discord.com/api/v10'
$applicationId
read-only
protected
string
$applicationId
$botToken
read-only
protected
string
$botToken
$botUserId
protected
string|null
$botUserId
= null
protected
DiscordFormatConverter
$formatConverter
$httpClient
read-only
protected
ClientInterface
$httpClient
$psrFactory
read-only
protected
Psr17Factory|null
$psrFactory
= null
$webhookVerifier
protected
DiscordWebhookVerifier|null
$webhookVerifier
= null
__construct()
public
__construct(string $botToken, ClientInterface $httpClient, string $publicKey, string $applicationId[, string $apiUrl = 'https://discord.com/api/v10' ][, Psr17Factory|null $psrFactory = null ]) : mixed
Parameters
-
$botToken
: string
-
-
$httpClient
: ClientInterface
-
-
$publicKey
: string
-
-
$applicationId
: string
-
-
$apiUrl
: string
= 'https://discord.com/api/v10'
-
-
$psrFactory
: Psr17Factory|null
= null
-
addReaction()
public
addReaction(string $threadId, string $messageId, string $emoji) : void
Parameters
-
$threadId
: string
-
-
$messageId
: string
-
-
$emoji
: string
-
channelIdFromThreadId()
public
channelIdFromThreadId(string $threadId) : string
Parameters
-
$threadId
: string
-
createResponse()
public
createResponse() : ResponseInterface|null
Return values
ResponseInterface|null
decodeThreadId()
public
decodeThreadId(string $threadId) : mixed
Parameters
-
$threadId
: string
-
deleteMessage()
public
deleteMessage(string $threadId, string $messageId) : void
Parameters
-
$threadId
: string
-
-
$messageId
: string
-
disconnect()
public
disconnect() : void
editMessage()
public
editMessage(string $threadId, string $messageId, PostableMessage $message) : SentMessage
Parameters
-
$threadId
: string
-
-
$messageId
: string
-
-
$message
: PostableMessage
-
encodeThreadId()
public
encodeThreadId(mixed $platformData) : string
Parameters
-
$platformData
: mixed
-
fetchChannelInfo()
public
fetchChannelInfo(string $channelId) : ChannelInfo|null
Parameters
-
$channelId
: string
-
fetchMessages()
public
fetchMessages(string $threadId[, FetchOptions|null $options = null ]) : FetchResult
Parameters
-
$threadId
: string
-
-
$options
: FetchOptions|null
= null
-
fetchThread()
public
fetchThread(string $threadId) : ThreadInfo
Parameters
-
$threadId
: string
-
getBotUserId()
public
getBotUserId() : string|null
Return values
string|null
public
getFormatConverter() : FormatConverter|null
getName()
public
getName() : string
getUser()
public
getUser(string $userId) : UserInfo|null
Parameters
-
$userId
: string
-
initialize()
public
initialize(Chat $chat) : void
Parameters
-
$chat
: Chat
-
openDM()
public
openDM(string $userId) : string|null
Parameters
-
$userId
: string
-
Return values
string|null
parseReaction()
public
parseReaction(ServerRequestInterface $request) : Author, emoji: string, rawEmoji: string, added: bool, threadId: string, messageId: string, userId: string, raw: mixed, originId: ?string}|null
Parameters
-
$request
: ServerRequestInterface
-
Return values
Author, emoji: string, rawEmoji: string, added: bool, threadId: string, messageId: string, userId: string, raw: mixed, originId: ?string}|null
parseSlashCommand()
public
parseSlashCommand(ServerRequestInterface $request) : Author, command: string, text: string, userId: string, isBot: bool, isMe: bool, channelId: string, triggerId: ?string, raw: mixed}|null
Parameters
-
$request
: ServerRequestInterface
-
Return values
Author, command: string, text: string, userId: string, isBot: bool, isMe: bool, channelId: string, triggerId: ?string, raw: mixed}|null
parseWebhook()
public
parseWebhook(ServerRequestInterface $request) : Message
Parameters
-
$request
: ServerRequestInterface
-
postMessage()
public
postMessage(string $threadId, PostableMessage $message) : SentMessage
Parameters
-
$threadId
: string
-
-
$message
: PostableMessage
-
removeReaction()
public
removeReaction(string $threadId, string $messageId, string $emoji) : void
Parameters
-
$threadId
: string
-
-
$messageId
: string
-
-
$emoji
: string
-
startTyping()
public
startTyping(string $threadId) : void
Parameters
-
$threadId
: string
-
stream()
public
stream(string $threadId, iterable<string|int, mixed> $textStream[, array<string|int, mixed> $options = [] ]) : SentMessage|null
Parameters
-
$threadId
: string
-
-
$textStream
: iterable<string|int, mixed>
-
-
$options
: array<string|int, mixed>
= []
-
verifyWebhook()
public
verifyWebhook(ServerRequestInterface $request) : ResponseInterface|null
Parameters
-
$request
: ServerRequestInterface
-
Return values
ResponseInterface|null
apiCall()
protected
apiCall(string $endpoint, array<string|int, mixed> $params[, string $method = 'POST' ]) : array<string|int, mixed>
Parameters
-
$endpoint
: string
-
-
$params
: array<string|int, mixed>
-
-
$method
: string
= 'POST'
-
Return values
array<string|int, mixed>
buildMessageParams()
protected
buildMessageParams(PostableMessage $message) : array<string|int, mixed>
Parameters
-
$message
: PostableMessage
-
Return values
array<string|int, mixed>
protected
extractAttachments(array<string|int, mixed> $attachments) : array<string|int, Attachment>
Parameters
-
$attachments
: array<string|int, mixed>
-
getAttachmentType()
protected
getAttachmentType(string|null $mimeType) : string
Parameters
-
$mimeType
: string|null
-
getAvatarUrl()
protected
getAvatarUrl(string|null $userId, string|null $avatarHash) : string|null
Parameters
-
$userId
: string|null
-
-
$avatarHash
: string|null
-
Return values
string|null
parseComponentInteraction()
protected
parseComponentInteraction(array<string|int, mixed> $interaction, string $rawBody) : Message
Parameters
-
$interaction
: array<string|int, mixed>
-
-
$rawBody
: string
-
parseGatewayEvent()
protected
parseGatewayEvent(array<string|int, mixed> $event, string $rawBody) : Message
Parameters
-
$event
: array<string|int, mixed>
-
-
$rawBody
: string
-
postMessageWithFiles()
protected
postMessageWithFiles(string $channelId, PostableMessage $message) : SentMessage
Parameters
-
$channelId
: string
-
-
$message
: PostableMessage
-