SessionState
Isolated state for a session
| Property | Type | Description |
|---|
applicationEmojis | Map<string, MockEmoji> | - |
applicationId | string | - |
attachmentStorage | MemoryAttachmentStorage | - |
auditLogs | Map<string, MockAuditLogEntry[]> | - |
autoModRules | Map<string, MockAutoModRule> | - |
bans | Map<string, MockBan> | - |
botUser | MockUser | - |
channels | Map<string, MockChannel> | - |
commandPermissions | Map<string, MockCommandPermission[]> | - |
commands | Map<string, MockApplicationCommand> | - |
currentUser | MockUser | Current "acting" user for Stage UI interactions (separate from botUser) |
dmChannels | Map<string, MockChannel> | - |
emojis | Map<string, MockEmoji> | - |
guildMembers | Map<string, MockGuildMember> | - |
guilds | Map<string, MockGuild> | - |
interactions | Map<string, MockInteraction> | - |
invites | Map<string, MockInvite> | - |
messages | Map<string, MockMessage> | - |
pollVotes | Map<string, Map<string, number[]>> | - |
roles | Map<string, MockRole> | - |
scheduledEvents | Map<string, MockScheduledEvent> | - |
sequence | number | - |
stageInstances | Map<string, MockStageInstance> | - |
stickers | Map<string, MockSticker> | - |
threadMembers | Map<string, Map<string, MockThreadMember>> | - |
users | Map<string, MockUser> | - |
voiceStates | Map<string, MockVoiceState> | - |
webhooks | Map<string, MockWebhook> | - |
addChannel(channel): void
void
addChannelToGuild(guildId, channel): void
void
addForumTag(channelId, tag): undefined | MockForumTag
undefined | MockForumTag
void
addInteraction(interaction): void
void
addMemberRole(
guildId,
userId,
roleId): boolean
| Parameter | Type |
|---|
guildId | string |
userId | string |
roleId | string |
boolean
addPollVote(
messageId,
userId,
answerId): boolean
| Parameter | Type |
|---|
messageId | string |
userId | string |
answerId | number |
boolean
addReaction(
messageId,
userId,
emoji): undefined | MockReaction[]
| Parameter | Type |
|---|
messageId | string |
userId | string |
emoji | { id: null | string; name: string; } |
emoji.id | null | string |
emoji.name | string |
undefined | MockReaction[]
addScheduledEventSubscriber(
guildId,
eventId,
userId): boolean
| Parameter | Type |
|---|
guildId | string |
eventId | string |
userId | string |
boolean
addSticker(sticker): void
| Parameter | Type |
|---|
sticker | MockSticker |
void
addThreadMember(threadId, userId): undefined | MockThreadMember
| Parameter | Type |
|---|
threadId | string |
userId | string |
undefined | MockThreadMember
void
bulkOverwriteCommands(configs, guildId?): null | MockApplicationCommand[]
| Parameter | Type |
|---|
configs | MockApplicationCommandConfig[] |
guildId? | string |
null | MockApplicationCommand[]
checkAutoArchiveThreads(): string[]
string[]
checkPollExpiry(messageId): boolean
| Parameter | Type |
|---|
messageId | string |
boolean
cleanupExpiredInteractions(): void
void
createAuditLogEntry(guildId, config): MockAuditLogEntry
| Parameter | Type |
|---|
guildId | string |
config | MockAuditLogEntryConfig |
MockAuditLogEntry
createAutoModRule(
guildId,
config,
creatorId): null | MockAutoModRule
| Parameter | Type |
|---|
guildId | string |
config | MockAutoModRuleConfig |
creatorId | string |
null | MockAutoModRule
createBan(
guildId,
userId,
config?): null | MockBan
| Parameter | Type |
|---|
guildId | string |
userId | string |
config? | MockBanConfig |
null | MockBan
createCommand(config, guildId?): null | MockApplicationCommand
| Parameter | Type |
|---|
config | MockApplicationCommandConfig |
guildId? | string |
null | MockApplicationCommand
createEveryoneRole(guildId): MockRole
| Parameter | Type |
|---|
guildId | string |
MockRole
createForumChannel(config): MockForumChannel
MockForumChannel
createForumPost(config): {
message: MockMessage;
thread: MockForumThread;
}
{
message: MockMessage;
thread: MockForumThread;
}
createGuildEmoji(
guildId,
config,
uploaderId): null | MockEmoji
| Parameter | Type |
|---|
guildId | string |
config | MockEmojiConfig |
uploaderId | string |
null | MockEmoji
createGuildMember(
guildId,
userId,
config?): null | MockGuildMember
null | MockGuildMember
createGuildRole(guildId, config?): null | MockRole
null | MockRole
createGuildSticker(
guildId,
config,
uploaderId): null | MockSticker
| Parameter | Type |
|---|
guildId | string |
config | MockStickerConfig |
uploaderId | string |
null | MockSticker
createInvite(
guildId,
channelId,
config,
inviterId): null | MockInvite
| Parameter | Type |
|---|
guildId | string |
channelId | string |
config | MockInviteConfig |
inviterId | string |
null | MockInvite
createMessage(config): MockMessage
MockMessage
createScheduledEvent(
guildId,
config,
creatorId): null | MockScheduledEvent
| Parameter | Type |
|---|
guildId | string |
config | MockScheduledEventConfig |
creatorId | string |
null | MockScheduledEvent
createStageInstance(guildId, config): null | MockStageInstance
| Parameter | Type |
|---|
guildId | string |
config | MockStageInstanceConfig |
null | MockStageInstance
createThread(config): MockThread
MockThread
createWebhook(
channelId,
config,
creatorId): null | MockWebhook
null | MockWebhook
deleteAttachment(id): boolean
boolean
deleteAutoModRule(guildId, ruleId): null | MockAutoModRule
| Parameter | Type |
|---|
guildId | string |
ruleId | string |
null | MockAutoModRule
deleteChannelOverwrite(channelId, overwriteId): boolean
| Parameter | Type |
|---|
channelId | string |
overwriteId | string |
boolean
deleteCommand(commandId): boolean
| Parameter | Type |
|---|
commandId | string |
boolean
deleteGuildEmoji(emojiId): boolean
| Parameter | Type |
|---|
emojiId | string |
boolean
deleteGuildRole(
guildId,
roleId,
reason?): boolean
| Parameter | Type |
|---|
guildId | string |
roleId | string |
reason? | string |
boolean
deleteGuildSticker(stickerId): boolean
| Parameter | Type |
|---|
stickerId | string |
boolean
deleteInvite(code): null | MockInvite
null | MockInvite
deleteMessage(id): boolean
boolean
deleteScheduledEvent(guildId, eventId): boolean
| Parameter | Type |
|---|
guildId | string |
eventId | string |
boolean
deleteStageInstance(channelId): null | MockStageInstance
| Parameter | Type |
|---|
channelId | string |
null | MockStageInstance
deleteThread(threadId): boolean
| Parameter | Type |
|---|
threadId | string |
boolean
deleteWebhook(webhookId): boolean
| Parameter | Type |
|---|
webhookId | string |
boolean
expirePoll(messageId): boolean
| Parameter | Type |
|---|
messageId | string |
boolean
findCommandByName(name, guildId?): undefined | MockApplicationCommand
| Parameter | Type |
|---|
name | string |
guildId? | string |
undefined | MockApplicationCommand
getActiveThreadsForGuild(guildId): MockThread[]
| Parameter | Type |
|---|
guildId | string |
MockThread[]
getAttachment(id): undefined | StoredAttachment
undefined | StoredAttachment
getAttachmentsForMessage(messageId): StoredAttachment[]
| Parameter | Type |
|---|
messageId | string |
StoredAttachment[]
getAuditLogEntries(guildId, options?): MockAuditLogEntry[]
| Parameter | Type |
|---|
guildId | string |
options? | { action_type: number; after: string; before: string; limit: number; user_id: string; } |
options.action_type? | number |
options.after? | string |
options.before? | string |
options.limit? | number |
options.user_id? | string |
MockAuditLogEntry[]
getAutoModRule(guildId, ruleId): undefined | MockAutoModRule
| Parameter | Type |
|---|
guildId | string |
ruleId | string |
undefined | MockAutoModRule
getBan(guildId, userId): undefined | MockBan
| Parameter | Type |
|---|
guildId | string |
userId | string |
undefined | MockBan
getChannel(id): undefined | MockChannel
undefined | MockChannel
getChannelInvites(channelId): MockInvite[]
| Parameter | Type |
|---|
channelId | string |
MockInvite[]
getChannelOverwrites(channelId): MockChannelOverwrite[]
| Parameter | Type |
|---|
channelId | string |
MockChannelOverwrite[]
getChannelsForGuild(guildId): MockChannel[]
| Parameter | Type |
|---|
guildId | string |
MockChannel[]
getCommand(commandId): undefined | MockApplicationCommand
| Parameter | Type |
|---|
commandId | string |
undefined | MockApplicationCommand
getDMChannel(recipientId): undefined | MockChannel
| Parameter | Type |
|---|
recipientId | string |
undefined | MockChannel
getEmoji(emojiId): undefined | MockEmoji
| Parameter | Type |
|---|
emojiId | string |
undefined | MockEmoji
getForumChannel(id): undefined | MockForumChannel
undefined | MockForumChannel
getForumChannelsForGuild(guildId): MockForumChannel[]
| Parameter | Type |
|---|
guildId | string |
MockForumChannel[]
getForumPosts(forumChannelId, options?): MockForumThread[]
| Parameter | Type |
|---|
forumChannelId | string |
options? | { archived: boolean; } |
options.archived? | boolean |
MockForumThread[]
getForumThread(id): undefined | MockForumThread
undefined | MockForumThread
getGlobalCommands(): MockApplicationCommand[]
MockApplicationCommand[]
getGuild(id): undefined | MockGuild
undefined | MockGuild
getGuildAutoModRules(guildId): MockAutoModRule[]
| Parameter | Type |
|---|
guildId | string |
MockAutoModRule[]
getGuildBans(guildId): MockBan[]
| Parameter | Type |
|---|
guildId | string |
MockBan[]
getGuildCommands(guildId): MockApplicationCommand[]
| Parameter | Type |
|---|
guildId | string |
MockApplicationCommand[]
getGuildEmojis(guildId): MockEmoji[]
| Parameter | Type |
|---|
guildId | string |
MockEmoji[]
getGuildInvites(guildId): MockInvite[]
| Parameter | Type |
|---|
guildId | string |
MockInvite[]
getGuildMember(guildId, userId): undefined | MockGuildMember
| Parameter | Type |
|---|
guildId | string |
userId | string |
undefined | MockGuildMember
getGuildMembers(guildId): MockGuildMember[]
| Parameter | Type |
|---|
guildId | string |
MockGuildMember[]
getGuildRole(guildId, roleId): undefined | MockRole
| Parameter | Type |
|---|
guildId | string |
roleId | string |
undefined | MockRole
getGuildRoles(guildId): MockRole[]
| Parameter | Type |
|---|
guildId | string |
MockRole[]
getGuildScheduledEvents(guildId): MockScheduledEvent[]
| Parameter | Type |
|---|
guildId | string |
MockScheduledEvent[]
getGuildStageInstances(guildId): MockStageInstance[]
| Parameter | Type |
|---|
guildId | string |
MockStageInstance[]
getGuildStickers(guildId): MockSticker[]
| Parameter | Type |
|---|
guildId | string |
MockSticker[]
getInteraction(id): undefined | MockInteraction
undefined | MockInteraction
getInteractionByToken(token): undefined | MockInteraction
undefined | MockInteraction
getInvite(code): undefined | MockInvite
undefined | MockInvite
getMessage(id): undefined | MockMessage
undefined | MockMessage
getMessagesForChannel(channelId, limit?): MockMessage[]
| Parameter | Type |
|---|
channelId | string |
limit? | number |
MockMessage[]
getOrCreateDMChannel(recipientId): MockChannel
| Parameter | Type |
|---|
recipientId | string |
MockChannel
getOrCreateTestUser(userId?): MockUser
| Parameter | Type |
|---|
userId? | string |
MockUser
getPollVoters(messageId, answerId): string[]
| Parameter | Type |
|---|
messageId | string |
answerId | number |
string[]
getRole(roleId): undefined | MockRole
| Parameter | Type |
|---|
roleId | string |
undefined | MockRole
getScheduledEvent(guildId, eventId): undefined | MockScheduledEvent
| Parameter | Type |
|---|
guildId | string |
eventId | string |
undefined | MockScheduledEvent
getScheduledEventSubscribers(
guildId,
eventId,
options?): {
member: MockGuildMember;
user: MockUser;
}[]
| Parameter | Type |
|---|
guildId | string |
eventId | string |
options? | { after: string; before: string; limit: number; withMember: boolean; } |
options.after? | string |
options.before? | string |
options.limit? | number |
options.withMember? | boolean |
{
member: MockGuildMember;
user: MockUser;
}[]
getStageInstance(channelId): undefined | MockStageInstance
| Parameter | Type |
|---|
channelId | string |
undefined | MockStageInstance
getSticker(stickerId): undefined | MockSticker
| Parameter | Type |
|---|
stickerId | string |
undefined | MockSticker
getThread(id): undefined | MockThread
undefined | MockThread
getThreadMember(threadId, userId): undefined | MockThreadMember
| Parameter | Type |
|---|
threadId | string |
userId | string |
undefined | MockThreadMember
getThreadMembers(threadId): MockThreadMember[]
| Parameter | Type |
|---|
threadId | string |
MockThreadMember[]
getThreadsForChannel(channelId, options?): MockThread[]
| Parameter | Type |
|---|
channelId | string |
options? | { archived: boolean; } |
options.archived? | boolean |
MockThread[]
getUser(id): undefined | MockUser
undefined | MockUser
getUserPollVotes(messageId, userId): number[]
| Parameter | Type |
|---|
messageId | string |
userId | string |
number[]
getWebhook(webhookId): undefined | MockWebhook
| Parameter | Type |
|---|
webhookId | string |
undefined | MockWebhook
getWebhookByToken(token): undefined | MockWebhook
undefined | MockWebhook
getWebhooksForChannel(channelId): MockWebhook[]
| Parameter | Type |
|---|
channelId | string |
MockWebhook[]
getWebhooksForGuild(guildId): MockWebhook[]
| Parameter | Type |
|---|
guildId | string |
MockWebhook[]
incrementThreadMessageCount(threadId): void
| Parameter | Type |
|---|
threadId | string |
void
isBanned(guildId, userId): boolean
| Parameter | Type |
|---|
guildId | string |
userId | string |
boolean
isForumChannel(channelId): boolean
| Parameter | Type |
|---|
channelId | string |
boolean
isForumThread(threadId): boolean
| Parameter | Type |
|---|
threadId | string |
boolean
isThread(channelId): boolean
| Parameter | Type |
|---|
channelId | string |
boolean
number
removeBan(guildId, userId): boolean
| Parameter | Type |
|---|
guildId | string |
userId | string |
boolean
removeChannel(id): boolean
boolean
removeForumTag(channelId, tagId): boolean
| Parameter | Type |
|---|
channelId | string |
tagId | string |
boolean
boolean
removeGuildMember(guildId, userId): boolean
| Parameter | Type |
|---|
guildId | string |
userId | string |
boolean
removeInteraction(id): boolean
boolean
removeMemberRole(
guildId,
userId,
roleId): boolean
| Parameter | Type |
|---|
guildId | string |
userId | string |
roleId | string |
boolean
removePollVote(
messageId,
userId,
answerId): boolean
| Parameter | Type |
|---|
messageId | string |
userId | string |
answerId | number |
boolean
removeReaction(
messageId,
userId,
emoji): undefined | MockReaction[]
| Parameter | Type |
|---|
messageId | string |
userId | string |
emoji | { id: null | string; name: string; } |
emoji.id | null | string |
emoji.name | string |
undefined | MockReaction[]
removeScheduledEventSubscriber(
guildId,
eventId,
userId): boolean
| Parameter | Type |
|---|
guildId | string |
eventId | string |
userId | string |
boolean
removeThreadMember(threadId, userId): boolean
| Parameter | Type |
|---|
threadId | string |
userId | string |
boolean
boolean
void
serialize(): SerializedSessionState
SerializedSessionState
setChannelOverwrite(channelId, overwrite): boolean
boolean
storeAttachment(attachment): void
void
switchCurrentUser(userId): undefined | MockUser
Switch to a different user as the current user
| Parameter | Type |
|---|
userId | string |
undefined | MockUser
updateAutoModRule(
guildId,
ruleId,
updates): null | MockAutoModRule
| Parameter | Type |
|---|
guildId | string |
ruleId | string |
updates | MockAutoModRuleUpdateConfig |
null | MockAutoModRule
updateCommand(commandId, updates): null | MockApplicationCommand
| Parameter | Type |
|---|
commandId | string |
updates | Partial<MockApplicationCommandConfig> |
null | MockApplicationCommand
updateCurrentUser(updates): MockUser
Update the current user's properties without changing their ID
| Parameter | Type |
|---|
updates | Partial<Omit<MockUser, "id">> |
MockUser
updateForumTag(
channelId,
tagId,
updates): undefined | MockForumTag
| Parameter | Type |
|---|
channelId | string |
tagId | string |
updates | Partial<Omit<MockForumTag, "id">> |
undefined | MockForumTag
updateForumThreadTags(threadId, appliedTags): undefined | MockForumThread
| Parameter | Type |
|---|
threadId | string |
appliedTags | string[] |
undefined | MockForumThread
updateGuildEmoji(emojiId, updates): null | MockEmoji
| Parameter | Type |
|---|
emojiId | string |
updates | { name: string; roles: string[]; } |
updates.name? | string |
updates.roles? | string[] |
null | MockEmoji
updateGuildMember(
guildId,
userId,
updates): null | MockGuildMember
null | MockGuildMember
updateGuildRole(
guildId,
roleId,
updates,
reason?): null | MockRole
| Parameter | Type |
|---|
guildId | string |
roleId | string |
updates | Partial<MockRoleConfig> |
reason? | string |
null | MockRole
updateGuildRolePositions(guildId, positions): MockRole[]
| Parameter | Type |
|---|
guildId | string |
positions | { id: string; position: number; }[] |
MockRole[]
updateGuildSticker(stickerId, updates): null | MockSticker
| Parameter | Type |
|---|
stickerId | string |
updates | { description: string; name: string; tags: string; } |
updates.description? | string |
updates.name? | string |
updates.tags? | string |
null | MockSticker
updateMessage(id, updates): undefined | MockMessage
undefined | MockMessage
updatePollResults(messageId): void
| Parameter | Type |
|---|
messageId | string |
void
updateScheduledEvent(
guildId,
eventId,
updates): null | MockScheduledEvent
| Parameter | Type |
|---|
guildId | string |
eventId | string |
updates | MockScheduledEventUpdateConfig |
null | MockScheduledEvent
updateStageInstance(channelId, updates): null | MockStageInstance
| Parameter | Type |
|---|
channelId | string |
updates | { privacy_level: StageInstancePrivacyLevel; topic: string; } |
updates.privacy_level? | StageInstancePrivacyLevel |
updates.topic? | string |
null | MockStageInstance
updateThread(threadId, updates): undefined | MockThread
| Parameter | Type |
|---|
threadId | string |
updates | Partial<{ archived: boolean; auto_archive_duration: 60 | 1440 | 4320 | 10080; invitable: boolean; locked: boolean; name: string; rateLimitPerUser: number; }> |
undefined | MockThread
updateWebhook(webhookId, updates): null | MockWebhook
| Parameter | Type |
|---|
webhookId | string |
updates | { avatar: null | string; channel_id: string; name: string; } |
updates.avatar? | null | string |
updates.channel_id? | string |
updates.name? | string |
null | MockWebhook
boolean