@alemonjs/discord 2.1.15 → 2.1.16

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/index.js CHANGED
@@ -88,7 +88,7 @@ const main = () => {
88
88
  .addOpen({ OpenId: UserId })
89
89
  .add({ tag: 'interaction.create' }).value);
90
90
  }
91
- void client.interactionsCallback(event.id, event.token, '正在处理您的请求...');
91
+ void client.interactionsCallbackEphemeral(event.id, event.token, '正在处理您的请求...');
92
92
  });
93
93
  client.on('MESSAGE_UPDATE', event => {
94
94
  if (!event.author) {
package/lib/sdk/api.d.ts CHANGED
@@ -144,10 +144,15 @@ export declare class DCAPI {
144
144
  gateway(): Promise<{
145
145
  url: string;
146
146
  }>;
147
- interactionsCallback(id: string, token: string, content: string): Promise<any>;
147
+ interactionsCallback(id: string, token: string, data: {
148
+ type: number;
149
+ data: any;
150
+ }): Promise<any>;
151
+ interactionsCallbackEphemeral(id: string, token: string, content: string): Promise<any>;
148
152
  interactionsCallbackMessage(id: string, token: string, messageData: any): Promise<any>;
149
153
  interactionsCallbackForm(id: string, token: string, formData: any): Promise<any>;
150
154
  interactionsDeferred(id: string, token: string): Promise<any>;
155
+ interactionsCallbackModal(id: string, token: string, modalData: any): Promise<any>;
151
156
  interactionsFollowup(application_id: string, token: string, messageData: any): Promise<any>;
152
157
  interactionsFollowupForm(application_id: string, token: string, formData: any): Promise<any>;
153
158
  getGlobalApplicationCommands(application_id: string, params?: {
package/lib/sdk/api.js CHANGED
@@ -826,14 +826,21 @@ class DCAPI {
826
826
  url: '/gateway'
827
827
  });
828
828
  }
829
- interactionsCallback(id, token, content) {
829
+ interactionsCallback(id, token, data) {
830
+ return this.request({
831
+ method: 'POST',
832
+ url: `/interactions/${id}/${token}/callback`,
833
+ data
834
+ });
835
+ }
836
+ interactionsCallbackEphemeral(id, token, content) {
830
837
  return this.request({
831
838
  method: 'POST',
832
839
  url: `/interactions/${id}/${token}/callback`,
833
840
  data: {
834
841
  type: 4,
835
842
  data: {
836
- content: content,
843
+ content,
837
844
  flags: 64
838
845
  }
839
846
  }
@@ -868,6 +875,16 @@ class DCAPI {
868
875
  }
869
876
  });
870
877
  }
878
+ interactionsCallbackModal(id, token, modalData) {
879
+ return this.request({
880
+ method: 'POST',
881
+ url: `/interactions/${id}/${token}/callback`,
882
+ data: {
883
+ type: 9,
884
+ data: modalData
885
+ }
886
+ });
887
+ }
871
888
  interactionsFollowup(application_id, token, messageData) {
872
889
  return this.request({
873
890
  method: 'POST',
package/lib/send.js CHANGED
@@ -201,9 +201,7 @@ const sendchannel = async (client, param, val) => {
201
201
  if (embedData) {
202
202
  payload.embeds = embedData;
203
203
  }
204
- const res = components.length > 0 || embedData
205
- ? await client.channelsMessages(channelId, payload)
206
- : await client.channelsMessagesForm(channelId, payload);
204
+ const res = components.length > 0 || embedData ? await client.channelsMessages(channelId, payload) : await client.channelsMessagesForm(channelId, payload);
207
205
  return [createResult(ResultCode.Ok, '完成', res)];
208
206
  }
209
207
  return [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alemonjs/discord",
3
- "version": "2.1.15",
3
+ "version": "2.1.16",
4
4
  "description": "discord platform connection",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",