@pocketping/sdk-node 1.4.0 → 1.5.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/dist/index.cjs CHANGED
@@ -1241,8 +1241,38 @@ var WebhookHandler = class {
1241
1241
  this.writeOK(res);
1242
1242
  return;
1243
1243
  }
1244
+ if (update.message_reaction) {
1245
+ const reaction = update.message_reaction;
1246
+ const emoji = reaction.new_reaction?.[0]?.emoji;
1247
+ const topicId = reaction.message_thread_id;
1248
+ if (emoji && emoji.includes("\u{1F5D1}") && topicId && this.config.onOperatorMessageDelete) {
1249
+ const deletedAt = reaction.date ? new Date(reaction.date * 1e3).toISOString() : (/* @__PURE__ */ new Date()).toISOString();
1250
+ await this.config.onOperatorMessageDelete(
1251
+ String(topicId),
1252
+ reaction.message_id,
1253
+ "telegram",
1254
+ deletedAt
1255
+ );
1256
+ }
1257
+ this.writeOK(res);
1258
+ return;
1259
+ }
1244
1260
  if (update.message) {
1245
1261
  const msg = update.message;
1262
+ if (msg.text && /^\/delete(@\w+)?(\s|$)/.test(msg.text)) {
1263
+ const topicId2 = msg.message_thread_id;
1264
+ const replyToId = msg.reply_to_message?.message_id;
1265
+ if (topicId2 && replyToId && this.config.onOperatorMessageDelete) {
1266
+ await this.config.onOperatorMessageDelete(
1267
+ String(topicId2),
1268
+ replyToId,
1269
+ "telegram",
1270
+ (/* @__PURE__ */ new Date()).toISOString()
1271
+ );
1272
+ }
1273
+ this.writeOK(res);
1274
+ return;
1275
+ }
1246
1276
  if (msg.text?.startsWith("/")) {
1247
1277
  this.writeOK(res);
1248
1278
  return;
package/dist/index.js CHANGED
@@ -1210,8 +1210,38 @@ var WebhookHandler = class {
1210
1210
  this.writeOK(res);
1211
1211
  return;
1212
1212
  }
1213
+ if (update.message_reaction) {
1214
+ const reaction = update.message_reaction;
1215
+ const emoji = reaction.new_reaction?.[0]?.emoji;
1216
+ const topicId = reaction.message_thread_id;
1217
+ if (emoji && emoji.includes("\u{1F5D1}") && topicId && this.config.onOperatorMessageDelete) {
1218
+ const deletedAt = reaction.date ? new Date(reaction.date * 1e3).toISOString() : (/* @__PURE__ */ new Date()).toISOString();
1219
+ await this.config.onOperatorMessageDelete(
1220
+ String(topicId),
1221
+ reaction.message_id,
1222
+ "telegram",
1223
+ deletedAt
1224
+ );
1225
+ }
1226
+ this.writeOK(res);
1227
+ return;
1228
+ }
1213
1229
  if (update.message) {
1214
1230
  const msg = update.message;
1231
+ if (msg.text && /^\/delete(@\w+)?(\s|$)/.test(msg.text)) {
1232
+ const topicId2 = msg.message_thread_id;
1233
+ const replyToId = msg.reply_to_message?.message_id;
1234
+ if (topicId2 && replyToId && this.config.onOperatorMessageDelete) {
1235
+ await this.config.onOperatorMessageDelete(
1236
+ String(topicId2),
1237
+ replyToId,
1238
+ "telegram",
1239
+ (/* @__PURE__ */ new Date()).toISOString()
1240
+ );
1241
+ }
1242
+ this.writeOK(res);
1243
+ return;
1244
+ }
1215
1245
  if (msg.text?.startsWith("/")) {
1216
1246
  this.writeOK(res);
1217
1247
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pocketping/sdk-node",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "type": "module",
5
5
  "description": "Node.js SDK for implementing PocketPing protocol",
6
6
  "main": "dist/index.cjs",