Merge branch 'main' into slash

This commit is contained in:
DjDeveloper 2021-01-21 18:43:47 +05:30 committed by GitHub
commit 06997a1c18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 514 additions and 55 deletions

4
mod.ts
View file

@ -30,7 +30,6 @@ export { ChannelsManager } from './src/managers/channels.ts'
export { EmojisManager } from './src/managers/emojis.ts'
export { GatewayCache } from './src/managers/gatewayCache.ts'
export { GuildChannelsManager } from './src/managers/guildChannels.ts'
export type { GuildChannel } from './src/managers/guildChannels.ts'
export { GuildManager } from './src/managers/guilds.ts'
export * from './src/structures/slash.ts'
export * from './src/types/slash.ts'
@ -104,7 +103,8 @@ export type {
GuildBanPayload,
GuildFeatures,
GuildIntegrationPayload,
GuildPayload
GuildPayload,
GuildChannels
} from './src/types/guild.ts'
export type { InvitePayload, PartialInvitePayload } from './src/types/invite.ts'
export { PermissionFlags } from './src/types/permissionFlags.ts'

View file

@ -12,7 +12,7 @@ export const guildMemberRemove: GatewayEventHandler = async (
if (guild === undefined) return
const member = await guild.members.get(d.user.id)
await guild.members.delete(d.user.id)
await guild.members._delete(d.user.id)
if (member !== undefined) gateway.client.emit('guildMemberRemove', member)
else {

View file

@ -25,7 +25,7 @@ export const messageDeleteBulk: GatewayEventHandler = async (
if (message === undefined) uncached.add(id)
else {
messages.set(id, message)
await channel.messages.delete(id)
await channel.messages._delete(id)
}
}

View file

@ -31,7 +31,7 @@ export const messageReactionRemove: GatewayEventHandler = async (
const reaction = await message.reactions.get(emojiID)
if (reaction === undefined) return
reaction.users.delete(d.user_id)
reaction.users._delete(d.user_id)
gateway.client.emit('messageReactionRemove', reaction, user)
}

View file

@ -24,7 +24,7 @@ export const voiceStateUpdate: GatewayEventHandler = async (
return gateway.client.emit('voiceStateRemoveUncached', { guild, member })
}
// No longer in the channel, so delete
await guild.voiceStates.delete(d.user_id)
await guild.voiceStates._delete(d.user_id)
gateway.client.emit(
'voiceStateRemove',
(voiceState as unknown) as VoiceState

View file

@ -41,11 +41,6 @@ export class BaseManager<T, T2> {
return this.client.cache.delete(this.cacheName, key)
}
/** Alias to _delete (cache) for compatibility purposes */
async delete(key: string): Promise<boolean> {
return await this._delete(key)
}
/** Gets an Array of values from Cache */
async array(): Promise<T2[]> {
let arr = await (this.client.cache.array(this.cacheName) as T[])

View file

@ -2,26 +2,16 @@ import { Client } from '../models/client.ts'
import { Channel } from '../structures/channel.ts'
import { Guild } from '../structures/guild.ts'
import { CategoryChannel } from '../structures/guildCategoryChannel.ts'
import { GuildTextChannel } from '../structures/textChannel.ts'
import { VoiceChannel } from '../structures/guildVoiceChannel.ts'
import {
ChannelTypes,
GuildCategoryChannelPayload,
GuildChannelPayload,
GuildTextChannelPayload,
GuildVoiceChannelPayload,
Overwrite
} from '../types/channel.ts'
import { GuildChannels, GuildChannelPayloads } from '../types/guild.ts'
import { CHANNEL, GUILD_CHANNELS } from '../types/endpoint.ts'
import { BaseChildManager } from './baseChild.ts'
import { ChannelsManager } from './channels.ts'
export type GuildChannelPayloads =
| GuildTextChannelPayload
| GuildVoiceChannelPayload
| GuildCategoryChannelPayload
export type GuildChannel = GuildTextChannel | VoiceChannel | CategoryChannel
export interface CreateChannelOptions {
name: string
type?: ChannelTypes
@ -37,7 +27,7 @@ export interface CreateChannelOptions {
export class GuildChannelsManager extends BaseChildManager<
GuildChannelPayloads,
GuildChannel
GuildChannels
> {
guild: Guild
@ -46,7 +36,7 @@ export class GuildChannelsManager extends BaseChildManager<
this.guild = guild
}
async get(id: string): Promise<GuildChannel | undefined> {
async get(id: string): Promise<GuildChannels | undefined> {
const res = await this.parent.get(id)
if (res !== undefined && res.guild.id === this.guild.id) return res
else return undefined
@ -57,7 +47,7 @@ export class GuildChannelsManager extends BaseChildManager<
return this.client.rest.delete(CHANNEL(id))
}
async array(): Promise<GuildChannel[]> {
async array(): Promise<GuildChannels[]> {
const arr = (await this.parent.array()) as Channel[]
return arr.filter(
(c: any) => c.guild !== undefined && c.guild.id === this.guild.id
@ -67,13 +57,13 @@ export class GuildChannelsManager extends BaseChildManager<
async flush(): Promise<boolean> {
const arr = await this.array()
for (const elem of arr) {
this.parent.delete(elem.id)
this.parent._delete(elem.id)
}
return true
}
/** Create a new Guild Channel */
async create(options: CreateChannelOptions): Promise<GuildChannel> {
async create(options: CreateChannelOptions): Promise<GuildChannels> {
if (options.name === undefined)
throw new Error('name is required for GuildChannelsManager#create')
const res = ((await this.client.rest.post(GUILD_CHANNELS(this.guild.id)),
@ -97,7 +87,7 @@ export class GuildChannelsManager extends BaseChildManager<
await this.set(res.id, res)
const channel = await this.get(res.id)
return (channel as unknown) as GuildChannel
return (channel as unknown) as GuildChannels
}
/** Modify the positions of a set of channel positions for the guild. */

View file

@ -88,7 +88,7 @@ export class GuildEmojisManager extends BaseChildManager<EmojiPayload, Emoji> {
const arr = await this.array()
for (const elem of arr) {
const emojiID = elem.id !== null ? elem.id : elem.name
this.parent.delete(emojiID as string)
this.parent._delete(emojiID as string)
}
return true
}

View file

@ -2,10 +2,24 @@ import { fetchAuto } from '../../deps.ts'
import { Client } from '../models/client.ts'
import { Guild } from '../structures/guild.ts'
import { Template } from '../structures/template.ts'
import { GUILD } from '../types/endpoint.ts'
import { GuildPayload, MemberPayload } from '../types/guild.ts'
import { Role } from '../structures/role.ts'
import { GUILD, GUILDS, GUILD_PREVIEW } from '../types/endpoint.ts'
import {
GuildPayload,
MemberPayload,
GuildCreateRolePayload,
GuildCreatePayload,
GuildCreateChannelPayload,
GuildPreview,
GuildPreviewPayload,
GuildModifyOptions,
GuildModifyPayload,
GuildCreateOptions
} from '../types/guild.ts'
import { BaseManager } from './base.ts'
import { MembersManager } from './members.ts'
import { fetchAuto } from '../../deps.ts'
import { Emoji } from '../structures/emoji.ts'
export class GuildManager extends BaseManager<GuildPayload, Guild> {
constructor(client: Client) {
@ -46,5 +60,183 @@ export class GuildManager extends BaseManager<GuildPayload, Guild> {
typeof template === 'object' ? template.code : template
].post({ name, icon })
return new Guild(this.client, guild)
/**
* Creates a guild. Returns Guild. Fires guildCreate event.
* @param options Options for creating a guild
*/
async create(options: GuildCreateOptions): Promise<Guild> {
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
if (options.icon !== undefined && !options.icon.startsWith('data:')) {
options.icon = await fetchAuto(options.icon)
}
const body: GuildCreatePayload = {
name: options.name,
region: options.region,
icon: options.icon,
verification_level: options.verificationLevel,
roles:
options.roles !== undefined
? options.roles.map((obj) => {
let result: GuildCreateRolePayload
if (obj instanceof Role) {
result = {
id: obj.id,
name: obj.name,
color: obj.color,
hoist: obj.hoist,
position: obj.position,
permissions: obj.permissions.bitfield.toString(),
managed: obj.managed,
mentionable: obj.mentionable
}
} else {
result = obj
}
return result
})
: undefined,
channels:
options.channels !== undefined
? options.channels.map(
(obj): GuildCreateChannelPayload => ({
id: obj.id,
name: obj.name,
type: obj.type,
parent_id: obj.parentID
})
)
: undefined,
afk_channel_id: options.afkChannelID,
afk_timeout: options.afkTimeout,
system_channel_id: options.systemChannelID
}
const result: GuildPayload = await this.client.rest.post(GUILDS(), body)
const guild = new Guild(this.client, result)
return guild
}
/**
* Gets a preview of a guild. Returns GuildPreview.
* @param guildID Guild id
*/
async preview(guildID: string): Promise<GuildPreview> {
const resp: GuildPreviewPayload = await this.client.rest.get(
GUILD_PREVIEW(guildID)
)
const result: GuildPreview = {
id: resp.id,
name: resp.name,
icon: resp.icon,
splash: resp.splash,
discoverySplash: resp.discovery_splash,
emojis: resp.emojis.map((emoji) => new Emoji(this.client, emoji)),
features: resp.features,
approximateMemberCount: resp.approximate_member_count,
approximatePresenceCount: resp.approximate_presence_count,
description: resp.description
}
return result
}
/**
* Edits a guild. Returns edited guild.
* @param guild Guild or guild id
* @param options Guild edit options
* @param asRaw true for get raw data, false for get guild(defaults to false)
*/
async edit(
guild: Guild | string,
options: GuildModifyOptions,
asRaw: false
): Promise<Guild>
async edit(
guild: Guild | string,
options: GuildModifyOptions,
asRaw: true
): Promise<GuildPayload>
async edit(
guild: Guild | string,
options: GuildModifyOptions,
asRaw: boolean = false
): Promise<Guild | GuildPayload> {
if (
options.icon !== undefined &&
options.icon !== null &&
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
!options.icon.startsWith('data:')
) {
options.icon = await fetchAuto(options.icon)
}
if (
options.splash !== undefined &&
options.splash !== null &&
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
!options.splash.startsWith('data:')
) {
options.splash = await fetchAuto(options.splash)
}
if (
options.banner !== undefined &&
options.banner !== null &&
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
!options.banner.startsWith('data:')
) {
options.banner = await fetchAuto(options.banner)
}
if (guild instanceof Guild) {
guild = guild.id
}
const body: GuildModifyPayload = {
name: options.name,
region: options.region,
verification_level: options.verificationLevel,
default_message_notifications: options.defaultMessageNotifications,
explicit_content_filter: options.explicitContentFilter,
afk_channel_id: options.afkChannelID,
afk_timeout: options.afkTimeout,
owner_id: options.ownerID,
icon: options.icon,
splash: options.splash,
banner: options.banner,
system_channel_id: options.systemChannelID,
rules_channel_id: options.rulesChannelID,
public_updates_channel_id: options.publicUpdatesChannelID,
preferred_locale: options.preferredLocale
}
const result: GuildPayload = await this.client.rest.patch(
GUILD(guild),
body
)
if (asRaw) {
const guild = new Guild(this.client, result)
return guild
} else {
return result
}
}
/**
* Deletes a guild. Returns deleted guild.
* @param guild Guild or guild id
*/
async delete(guild: Guild | string): Promise<Guild | undefined> {
if (guild instanceof Guild) {
guild = guild.id
}
const oldGuild = await this.get(guild)
await this.client.rest.delete(GUILD(guild))
return oldGuild
}
}

View file

@ -42,7 +42,7 @@ export class MemberRolesManager extends BaseChildManager<RolePayload, Role> {
async flush(): Promise<boolean> {
const arr = await this.array()
for (const elem of arr) {
this.parent.delete(elem.id)
this.parent._delete(elem.id)
}
return true
}

View file

@ -3,7 +3,7 @@ import { Client } from '../models/client.ts'
import { Guild } from '../structures/guild.ts'
import { Role } from '../structures/role.ts'
import { GUILD_ROLE, GUILD_ROLES } from '../types/endpoint.ts'
import { RolePayload } from '../types/role.ts'
import { RoleModifyPayload, RolePayload } from '../types/role.ts'
import { BaseManager } from './base.ts'
export interface CreateGuildRoleOptions {
@ -35,6 +35,12 @@ export class RolesManager extends BaseManager<RolePayload, Role> {
})
}
async get(key: string): Promise<Role | undefined> {
const raw = await this._get(key)
if (raw === undefined) return
return new Role(this.client, raw, this.guild)
}
async fromPayload(roles: RolePayload[]): Promise<boolean> {
for (const role of roles) {
await this.set(role.id, role)
@ -74,11 +80,26 @@ export class RolesManager extends BaseManager<RolePayload, Role> {
}
/** Delete a Guild Role */
async delete(role: Role | string): Promise<boolean> {
async delete(role: Role | string): Promise<Role | undefined> {
const oldRole = await this.get(typeof role === 'object' ? role.id : role)
await this.client.rest.delete(
GUILD_ROLE(this.guild.id, typeof role === 'object' ? role.id : role)
)
return true
return oldRole
}
async edit(role: Role | string, options: RoleModifyPayload): Promise<Role> {
if (role instanceof Role) {
role = role.id
}
const resp: RolePayload = await this.client.rest.patch(
GUILD_ROLE(this.guild.id, role),
options
)
return new Role(this.client, resp, this.guild)
}
/** Modify the positions of a set of role positions for the guild. */

View file

@ -6,14 +6,22 @@ import {
GuildPayload,
GuildWidgetPayload,
IntegrationAccountPayload,
IntegrationExpireBehavior
IntegrationExpireBehavior,
Verification,
GuildChannels,
GuildPreview,
MessageNotification,
ContentFilter,
GuildModifyOptions,
GuildGetPruneCountPayload,
GuildPruneCountPayload,
GuildBeginPrunePayload
} from '../types/guild.ts'
import { Base } from './base.ts'
import { CreateGuildRoleOptions, RolesManager } from '../managers/roles.ts'
import { InviteManager } from '../managers/invites.ts'
import {
CreateChannelOptions,
GuildChannel,
GuildChannelsManager
} from '../managers/guildChannels.ts'
import { MembersManager } from '../managers/members.ts'
@ -22,7 +30,12 @@ import { GuildEmojisManager } from '../managers/guildEmojis.ts'
import { Member } from './member.ts'
import { User } from './user.ts'
import { Application } from './application.ts'
import { GUILD_BAN, GUILD_BANS, GUILD_INTEGRATIONS } from '../types/endpoint.ts'
import {
GUILD_BAN,
GUILD_BANS,
GUILD_INTEGRATIONS,
GUILD_PRUNE
} from '../types/endpoint.ts'
import { GuildVoiceStatesManager } from '../managers/guildVoiceStates.ts'
import { RequestMembersOptions } from '../gateway/index.ts'
import { GuildPresencesManager } from '../managers/presences.ts'
@ -134,9 +147,9 @@ export class Guild extends Base {
afkTimeout?: number
widgetEnabled?: boolean
widgetChannelID?: string
verificationLevel?: string
defaultMessageNotifications?: string
explicitContentFilter?: string
verificationLevel?: Verification
defaultMessageNotifications?: MessageNotification
explicitContentFilter?: ContentFilter
roles: RolesManager
emojis: GuildEmojisManager
invites: InviteManager
@ -267,7 +280,7 @@ export class Guild extends Base {
}
/** Create a new Guild Channel */
async createChannel(options: CreateChannelOptions): Promise<GuildChannel> {
async createChannel(options: CreateChannelOptions): Promise<GuildChannels> {
return this.channels.create(options)
}
@ -447,6 +460,82 @@ export class Guild extends Base {
async deleteTemplate(code: string): Promise<Guild> {
await this.client.rest.api.guilds[this.id].templates[code].delete()
return this
/** Gets a preview of the guild. Returns GuildPreview. */
async preview(): Promise<GuildPreview> {
return this.client.guilds.preview(this.id)
}
/**
* Edits the guild.
* @param options Guild edit options
*/
async edit(options: GuildModifyOptions): Promise<Guild> {
const result = await this.client.guilds.edit(this.id, options, true)
this.readFromData(result)
return new Guild(this.client, result)
}
/** Deletes the guild. */
async delete(): Promise<Guild> {
const result = await this.client.guilds.delete(this.id)
return result === undefined ? this : result
}
async getPruneCount(options?: {
days?: number
includeRoles?: Array<Role | string>
}): Promise<number> {
const query: GuildGetPruneCountPayload = {
days: options?.days,
include_roles: options?.includeRoles
?.map((role) => (role instanceof Role ? role.id : role))
.join(',')
}
const result: GuildPruneCountPayload = await this.client.rest.get(
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
GUILD_PRUNE(this.id) +
'?' +
Object.entries(query)
.map(([key, value]) => `${key}=${value}`)
.join('&')
)
return result.pruned as number
}
async prune(options?: {
days?: number
computePruneCount: true | undefined
includeRoles?: Array<Role | string>
}): Promise<number>
async prune(options?: {
days?: number
computePruneCount: false
includeRoles?: Array<Role | string>
}): Promise<null>
async prune(options?: {
days?: number
computePruneCount?: boolean | undefined
includeRoles?: Array<Role | string>
}): Promise<number | null> {
const body: GuildBeginPrunePayload = {
days: options?.days,
compute_prune_count: options?.computePruneCount,
include_roles: options?.includeRoles?.map((role) =>
role instanceof Role ? role.id : role
)
}
const result: GuildPruneCountPayload = await this.client.rest.post(
GUILD_PRUNE(this.id),
body
)
return result.pruned
}
}

View file

@ -151,10 +151,19 @@ export class Message extends Base {
return this.client.rest.delete(CHANNEL_MESSAGE(this.channelID, this.id))
}
/**
* Adds a reaction to the message.
* @param emoji Emoji in string or object
*/
async addReaction(emoji: string | Emoji): Promise<void> {
return this.channel.addReaction(this, emoji)
}
/**
* Removes a reaction to the message.
* @param emoji Emoji in string or object
* @param user User or Member or user id
*/
async removeReaction(
emoji: string | Emoji,
user?: User | Member | string

View file

@ -1,10 +1,12 @@
import { Client } from '../models/client.ts'
import { Base } from './base.ts'
import { RolePayload } from '../types/role.ts'
import { RoleModifyPayload, RolePayload } from '../types/role.ts'
import { Permissions } from '../utils/permissions.ts'
import { Guild } from './guild.ts'
export class Role extends Base {
id: string
guild: Guild
name: string
color: number
hoist: boolean
@ -14,9 +16,10 @@ export class Role extends Base {
mentionable: boolean
tags?: RoleTags
constructor(client: Client, data: RolePayload) {
constructor(client: Client, data: RolePayload, guild: Guild) {
super(client, data)
this.id = data.id
this.guild = guild
this.name = data.name
this.color = data.color
this.hoist = data.hoist
@ -46,6 +49,14 @@ export class Role extends Base {
this.managed = data.managed ?? this.managed
this.mentionable = data.mentionable ?? this.mentionable
}
async delete(): Promise<Role | undefined> {
return this.guild.roles.delete(this)
}
async edit(options: RoleModifyPayload): Promise<Role> {
return this.guild.roles.edit(this, options)
}
}
export interface RoleTags {

View file

@ -4,7 +4,7 @@ import {
Intents,
CommandContext,
Extension,
GuildChannel
GuildChannels
} from '../../mod.ts'
import { Invite } from '../structures/invite.ts'
import { TOKEN } from './config.ts'
@ -80,7 +80,7 @@ client.on('inviteDeleteUncached', (invite: Invite) => {
client.on('commandError', console.error)
class ChannelLog extends Extension {
onChannelCreate(ext: Extension, channel: GuildChannel): void {
onChannelCreate(ext: Extension, channel: GuildChannels): void {
console.log(`Channel Created: ${channel.name}`)
}
@ -111,8 +111,8 @@ client.on('messageDeleteBulk', (channel, messages, uncached) => {
client.on('channelUpdate', (before, after) => {
console.log(
`Channel Update: ${(before as GuildChannel).name}, ${
(after as GuildChannel).name
`Channel Update: ${(before as GuildChannels).name}, ${
(after as GuildChannels).name
}`
)
})

View file

@ -4,7 +4,7 @@ import {
Message,
Member,
Role,
GuildChannel,
GuildChannels,
Embed,
Guild,
EveryChannelTypes,
@ -88,7 +88,7 @@ client.on('messageCreate', async (msg: Message) => {
} else if (msg.content === '!channels') {
const col = await msg.guild?.channels.array()
const data = col
?.map((c: GuildChannel, i: number) => {
?.map((c: GuildChannels, i: number) => {
return `${i + 1}. ${c.name}`
})
.join('\n') as string

View file

@ -1,5 +1,16 @@
import { Emoji } from '../structures/emoji.ts'
import { CategoryChannel } from '../structures/guildCategoryChannel.ts'
import { VoiceChannel } from '../structures/guildVoiceChannel.ts'
import { Role } from '../structures/role.ts'
import { GuildTextChannel } from '../structures/textChannel.ts'
import { ApplicationPayload } from './application.ts'
import { ChannelPayload } from './channel.ts'
import {
ChannelPayload,
ChannelTypes,
GuildCategoryChannelPayload,
GuildTextChannelPayload,
GuildVoiceChannelPayload
} from './channel.ts'
import { EmojiPayload } from './emoji.ts'
import { PresenceUpdatePayload } from './gateway.ts'
import { RolePayload } from './role.ts'
@ -21,9 +32,9 @@ export interface GuildPayload {
afk_timeout: number
widget_enabled?: boolean
widget_channel_id?: string
verification_level: string
default_message_notifications: string
explicit_content_filter: string
verification_level: Verification
default_message_notifications: MessageNotification
explicit_content_filter: ContentFilter
roles: RolePayload[]
emojis: EmojiPayload[]
features: GuildFeatures[]
@ -73,7 +84,7 @@ export enum MessageNotification {
export enum ContentFilter {
DISABLED = 0,
MEMBERS_WITHOUT_ROLES = 1,
ALL_MEMBERS = 3
ALL_MEMBERS = 2
}
export enum MFA {
@ -158,4 +169,137 @@ export interface GuildWidgetPayload {
channels: Array<{ id: string; name: string; position: number }>
members: MemberPayload[]
presence_count: number
export type GuildChannelPayloads =
| GuildTextChannelPayload
| GuildVoiceChannelPayload
| GuildCategoryChannelPayload
export type GuildChannels = GuildTextChannel | VoiceChannel | CategoryChannel
export interface GuildCreatePayload {
name: string
region?: string
icon?: string
verification_level?: number
default_message_notifications?: number
explicit_content_filter?: number
roles?: GuildCreateRolePayload[]
channels?: GuildCreateChannelPayload[]
afk_channel_id?: string
afk_timeout?: number
system_channel_id?: string
}
export interface GuildCreateRolePayload {
id?: string
name: string
color?: number
hoist?: boolean
position?: number
permissions?: string
managed?: boolean
mentionable?: boolean
}
export interface GuildCreateChannelPayload {
id?: string
name: string
type: ChannelTypes
parent_id?: string
}
export interface GuildCreateChannelOptions {
id?: string
name: string
type: ChannelTypes
parentID?: string
}
export interface GuildCreateOptions {
name: string
region?: string
icon?: string
verificationLevel?: Verification
roles?: Array<Role | GuildCreateRolePayload>
channels?: Array<GuildChannels | GuildCreateChannelOptions>
afkChannelID?: string
afkTimeout?: number
systemChannelID?: string
}
export interface GuildPreviewPayload {
id: string
name: string
icon: string | null
splash: string | null
discovery_splash: string | null
emojis: EmojiPayload[]
features: GuildFeatures[]
approximate_member_count: number
approximate_presence_count: number
description: string | null
}
export interface GuildPreview {
id: string
name: string
icon: string | null
splash: string | null
discoverySplash: string | null
emojis: Emoji[]
features: GuildFeatures[]
approximateMemberCount: number
approximatePresenceCount: number
description: string | null
}
export interface GuildModifyPayload {
name?: string
region?: string | null
verification_level?: Verification | null
default_message_notifications?: MessageNotification | null
explicit_content_filter?: ContentFilter | null
afk_channel_id?: string | null
afk_timeout?: number
icon?: string | null
owner_id?: string
splash?: string | null
banner?: string | null
system_channel_id?: string | null
rules_channel_id?: string | null
public_updates_channel_id?: string | null
preferred_locale?: string | null
}
export interface GuildModifyOptions {
name?: string
region?: string | null
verificationLevel?: Verification | null
defaultMessageNotifications?: MessageNotification | null
explicitContentFilter?: ContentFilter | null
afkChannelID?: string | null
afkTimeout?: number
icon?: string | null
ownerID?: string
splash?: string | null
banner?: string | null
systemChannelID?: string | null
rulesChannelID?: string | null
publicUpdatesChannelID?: string | null
preferredLocale?: string | null
}
export interface GuildPruneCountPayload {
pruned: number | null
}
export interface GuildGetPruneCountPayload {
days?: number
include_roles?: string
}
export interface GuildBeginPrunePayload {
days?: number
compute_prune_count?: boolean
include_roles?: string[]
}

View file

@ -18,3 +18,11 @@ export interface RoleTagsPayload {
/** The id of the integration this role belongs to */
integration_id?: string
}
export interface RoleModifyPayload {
name?: string | null
permissions?: string | null
color?: number | null
hoist?: boolean | null
mentionable?: boolean | null
}