Merge remote-tracking branch 'origin/main' into slash
This commit is contained in:
commit
aa5075451b
|
@ -319,9 +319,7 @@ export class RESTManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const form = new FormData()
|
const form = new FormData()
|
||||||
for (const file of files) {
|
files.forEach((file, index) => form.append(`file${index + 1}`, file.blob, file.name))
|
||||||
form.append(file.name, file.blob, file.name)
|
|
||||||
}
|
|
||||||
const json = JSON.stringify(body)
|
const json = JSON.stringify(body)
|
||||||
form.append('payload_json', json)
|
form.append('payload_json', json)
|
||||||
if (body === undefined) body = {}
|
if (body === undefined) body = {}
|
||||||
|
|
|
@ -18,7 +18,7 @@ export interface MemberData {
|
||||||
export class Member extends SnowflakeBase {
|
export class Member extends SnowflakeBase {
|
||||||
id: string
|
id: string
|
||||||
user: User
|
user: User
|
||||||
nick?: string
|
nick: string | null
|
||||||
roles: MemberRolesManager
|
roles: MemberRolesManager
|
||||||
joinedAt: string
|
joinedAt: string
|
||||||
premiumSince?: string
|
premiumSince?: string
|
||||||
|
@ -49,7 +49,7 @@ export class Member extends SnowflakeBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
get displayName(): string {
|
get displayName(): string {
|
||||||
return this.nick !== undefined ? this.nick : this.user.username
|
return this.nick !== null ? this.nick : this.user.username
|
||||||
}
|
}
|
||||||
|
|
||||||
toString(): string {
|
toString(): string {
|
||||||
|
@ -95,7 +95,7 @@ export class Member extends SnowflakeBase {
|
||||||
)
|
)
|
||||||
if (res.ok === true) {
|
if (res.ok === true) {
|
||||||
if (data.nick !== undefined)
|
if (data.nick !== undefined)
|
||||||
this.nick = data.nick === null ? undefined : data.nick
|
this.nick = data.nick === null ? null : data.nick
|
||||||
if (data.deaf !== undefined) this.deaf = data.deaf
|
if (data.deaf !== undefined) this.deaf = data.deaf
|
||||||
if (data.mute !== undefined) this.mute = data.mute
|
if (data.mute !== undefined) this.mute = data.mute
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import {
|
||||||
} from '../../mod.ts'
|
} from '../../mod.ts'
|
||||||
import { Collector } from '../models/collectors.ts'
|
import { Collector } from '../models/collectors.ts'
|
||||||
import { MessageAttachment } from '../structures/message.ts'
|
import { MessageAttachment } from '../structures/message.ts'
|
||||||
|
import { Permissions } from '../utils/permissions.ts'
|
||||||
import { TOKEN } from './config.ts'
|
import { TOKEN } from './config.ts'
|
||||||
|
|
||||||
const client = new Client({
|
const client = new Client({
|
||||||
|
@ -179,6 +180,37 @@ client.on('messageCreate', async (msg: Message) => {
|
||||||
const vs = await msg.guild?.voiceStates.get(msg.member.id)
|
const vs = await msg.guild?.voiceStates.get(msg.member.id)
|
||||||
if (typeof vs !== 'object') return
|
if (typeof vs !== 'object') return
|
||||||
vs.channel?.join()
|
vs.channel?.join()
|
||||||
|
} else if (msg.content === '!getOverwrites') {
|
||||||
|
if (msg.channel.type !== ChannelTypes.GUILD_TEXT) {
|
||||||
|
return msg.channel.send("This isn't a guild text channel!")
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
||||||
|
const overwrites = await (msg.channel as GuildTextChannel).overwritesFor(
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
||||||
|
msg.member as Member
|
||||||
|
)
|
||||||
|
msg.channel.send(
|
||||||
|
`Your permission overwrites:\n${overwrites
|
||||||
|
.map(
|
||||||
|
(over) =>
|
||||||
|
`ID: ${over.id}\nAllowed:\n${new Permissions(over.allow)
|
||||||
|
.toArray()
|
||||||
|
.join('\n')}\nDenied:\n${new Permissions(over.deny)
|
||||||
|
.toArray()
|
||||||
|
.join('\n')}`
|
||||||
|
)
|
||||||
|
.join('\n\n')}`
|
||||||
|
)
|
||||||
|
} else if (msg.content === '!getPermissions') {
|
||||||
|
if (msg.channel.type !== ChannelTypes.GUILD_TEXT) {
|
||||||
|
return msg.channel.send("This isn't a guild text channel!")
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
||||||
|
const permissions = await (msg.channel as GuildTextChannel).permissionsFor(
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
||||||
|
msg.member as Member
|
||||||
|
)
|
||||||
|
msg.channel.send(`Your permissions:\n${permissions.toArray().join('\n')}`)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -212,7 +212,7 @@ export interface GuildMemberUpdatePayload {
|
||||||
guild_id: string
|
guild_id: string
|
||||||
roles: string[]
|
roles: string[]
|
||||||
user: UserPayload
|
user: UserPayload
|
||||||
nick?: string | undefined
|
nick: string | null
|
||||||
joined_at: string
|
joined_at: string
|
||||||
premium_since?: string | undefined
|
premium_since?: string | undefined
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ export interface GuildPayload {
|
||||||
|
|
||||||
export interface MemberPayload {
|
export interface MemberPayload {
|
||||||
user: UserPayload
|
user: UserPayload
|
||||||
nick?: string
|
nick: string | null
|
||||||
roles: string[]
|
roles: string[]
|
||||||
joined_at: string
|
joined_at: string
|
||||||
premium_since?: string
|
premium_since?: string
|
||||||
|
|
Loading…
Reference in New Issue