@satorijs/adapter-discord 3.6.1 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/message.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Dict, h, Messenger, Schema } from '@satorijs/satori';
1
+ import { Dict, h, MessageEncoder, Schema } from '@satorijs/satori';
2
2
  import { DiscordBot } from './bot';
3
- export declare class DiscordMessenger extends Messenger<DiscordBot> {
3
+ export declare class DiscordMessageEncoder extends MessageEncoder<DiscordBot> {
4
4
  private stack;
5
5
  private buffer;
6
6
  private addition;
@@ -13,7 +13,7 @@ export declare class DiscordMessenger extends Messenger<DiscordBot> {
13
13
  flush(): Promise<void>;
14
14
  visit(element: h): Promise<void>;
15
15
  }
16
- export declare namespace DiscordMessenger {
16
+ export declare namespace DiscordMessageEncoder {
17
17
  type HandleExternalAsset = 'auto' | 'download' | 'direct';
18
18
  type HandleMixedContent = 'auto' | 'separate' | 'attach';
19
19
  interface Config {
@@ -32,5 +32,5 @@ export declare namespace DiscordMessenger {
32
32
  */
33
33
  handleMixedContent?: HandleMixedContent;
34
34
  }
35
- const Config: Schema<DiscordMessenger.Config>;
35
+ const Config: Schema<DiscordMessageEncoder.Config>;
36
36
  }
@@ -1,4 +1,4 @@
1
- import { Emoji, GuildMember, integer, snowflake } from '.';
1
+ import { Emoji, GuildMember, integer, snowflake, User } from '.';
2
2
  /** https://discord.com/developers/docs/resources/channel#reaction-object-reaction-structure */
3
3
  export interface Reaction {
4
4
  /** times this emoji has been used to react */
@@ -99,7 +99,7 @@ declare module './internal' {
99
99
  * Get a list of users that reacted with this emoji. Returns an array of user objects on success. The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji. To use custom emoji, you must encode it in the format name:id with the emoji name and emoji id.
100
100
  * @see https://discord.com/developers/docs/resources/channel#get-reactions
101
101
  */
102
- getReactions(channel_id: snowflake, message_id: snowflake, emoji: string, params?: Reaction.GetParams): Promise<Reaction[]>;
102
+ getReactions(channel_id: snowflake, message_id: snowflake, emoji: string, params?: Reaction.GetParams): Promise<User[]>;
103
103
  /**
104
104
  * Deletes all reactions on a message. This endpoint requires the 'MANAGE_MESSAGES' permission to be present on the current user. Fires a Message Reaction Remove All Gateway event.
105
105
  * @see https://discord.com/developers/docs/resources/channel#delete-all-reactions
@@ -112,19 +112,19 @@ export declare namespace Role {
112
112
  /** https://discord.com/developers/docs/resources/guild#create-guild-role-json-params */
113
113
  interface Create {
114
114
  /** name of the role */
115
- name: string;
115
+ name?: string;
116
116
  /** bitwise value of the enabled/disabled permissions */
117
- permissions: string;
117
+ permissions?: string;
118
118
  /** RGB color value */
119
- color: integer;
119
+ color?: integer;
120
120
  /** whether the role should be displayed separately in the sidebar */
121
- hoist: boolean;
121
+ hoist?: boolean;
122
122
  /** the role's icon image (if the guild has the ROLE_ICONS feature) */
123
- icon: string;
123
+ icon?: string;
124
124
  /** the role's unicode emoji as a standard emoji (if the guild has the ROLE_ICONS feature) */
125
- unicode_emoji: string;
125
+ unicode_emoji?: string;
126
126
  /** whether the role should be mentionable */
127
- mentionable: boolean;
127
+ mentionable?: boolean;
128
128
  }
129
129
  /** https://discord.com/developers/docs/resources/guild#modify-guild-role-positions-json-params */
130
130
  interface ModifyPositions {
@@ -136,19 +136,19 @@ export declare namespace Role {
136
136
  /** https://discord.com/developers/docs/resources/guild#modify-guild-role-json-params */
137
137
  interface Modify {
138
138
  /** name of the role */
139
- name: string;
139
+ name?: string;
140
140
  /** bitwise value of the enabled/disabled permissions */
141
- permissions: string;
141
+ permissions?: string;
142
142
  /** RGB color value */
143
- color: integer;
143
+ color?: integer;
144
144
  /** whether the role should be displayed separately in the sidebar */
145
- hoist: boolean;
145
+ hoist?: boolean;
146
146
  /** the role's icon image (if the guild has the ROLE_ICONS feature) */
147
- icon: string;
147
+ icon?: string;
148
148
  /** the role's unicode emoji as a standard emoji (if the guild has the ROLE_ICONS feature) */
149
- unicode_emoji: string;
149
+ unicode_emoji?: string;
150
150
  /** whether the role should be mentionable */
151
- mentionable: boolean;
151
+ mentionable?: boolean;
152
152
  }
153
153
  }
154
154
  }
package/lib/utils.d.ts CHANGED
@@ -6,6 +6,8 @@ export declare const adaptUser: (user: Discord.User) => Universal.User;
6
6
  export declare const adaptGuild: (data: Discord.Guild) => Universal.Guild;
7
7
  export declare const adaptChannel: (data: Discord.Channel) => Universal.Channel;
8
8
  export declare const adaptAuthor: (author: Discord.User) => Universal.Author;
9
+ export declare const decodeRole: (role: Discord.Role) => Universal.Role;
10
+ export declare const encodeRole: (role: Partial<Universal.Role>) => Partial<Discord.Role>;
9
11
  export declare function adaptMessage(bot: DiscordBot, meta: Discord.Message, session?: Partial<Session>): Promise<Universal.Message>;
10
12
  export declare function prepareMessage(session: Partial<Session>, data: Partial<Discord.Message>): void;
11
13
  export declare function adaptSession(bot: DiscordBot, input: Discord.GatewayPayload): Promise<Session>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@satorijs/adapter-discord",
3
3
  "description": "Discord Adapter for Satorijs",
4
- "version": "3.6.1",
4
+ "version": "3.7.0",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
@@ -29,7 +29,7 @@
29
29
  "satori"
30
30
  ],
31
31
  "peerDependencies": {
32
- "@satorijs/satori": "^2.3.5"
32
+ "@satorijs/satori": "^2.4.0"
33
33
  },
34
34
  "dependencies": {
35
35
  "form-data": "^4.0.0"