Skip to content

Commit

Permalink
feat(satori): add guildId as 3rd param for sendPrivateMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Oct 14, 2023
1 parent 49222c6 commit 6ae3b0d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ export abstract class Bot<T = any> implements Login {
return messages.map(message => message.id)
}

async sendPrivateMessage(userId: string, content: Fragment, options?: SendOptions) {
const { id } = await this.createDirectChannel(userId, options?.session?.guildId)
async sendPrivateMessage(userId: string, content: Fragment, guildId?: string, options?: SendOptions) {
const { id } = await this.createDirectChannel(userId, guildId ?? options?.session?.guildId)
return this.sendMessage(id, content, null, options)
}

Expand Down
16 changes: 4 additions & 12 deletions packages/protocol/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export interface List<T> {
export interface Methods {
// message
sendMessage(channelId: string, content: Element.Fragment, guildId?: string, options?: SendOptions): Promise<string[]>
sendPrivateMessage(userId: string, content: Element.Fragment, options?: SendOptions): Promise<string[]>
sendPrivateMessage(userId: string, content: Element.Fragment, guildId?: string, options?: SendOptions): Promise<string[]>
getMessage(channelId: string, messageId: string): Promise<Message>
getMessageList(channelId: string, next?: string): Promise<List<Message>>
getMessageIter(channelId: string): AsyncIterable<Message>
Expand Down Expand Up @@ -228,22 +228,14 @@ export interface Button {

export interface Command {
name: string
aliases: string[]
description: Dict<string>
arguments: Command.Argument[]
options: Command.Option[]
arguments: Command.Declaration[]
options: Command.Declaration[]
children: Command[]
}

export namespace Command {
export interface Argument {
name: string
description: Dict<string>
type: string
required: boolean
}

export interface Option {
export interface Declaration {
name: string
description: Dict<string>
type: string
Expand Down

0 comments on commit 6ae3b0d

Please sign in to comment.