whatsapp-pi 1.0.25 → 1.0.26

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whatsapp-pi",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "type": "module",
5
5
  "description": "WhatsApp integration extension for Pi",
6
6
  "main": "whatsapp-pi.ts",
@@ -17,19 +17,22 @@ export class MenuHandler {
17
17
  const registered = await this.sessionManager.isRegistered();
18
18
  const options: string[] = [];
19
19
 
20
+ options.push('Recents');
21
+
20
22
  if (status === 'connected') {
23
+ options.push('Allowed Numbers');
24
+ options.push('Blocked Numbers');
21
25
  options.push('Disconnect WhatsApp');
22
26
  } else {
23
27
  options.push('Connect / Reconnect WhatsApp');
28
+ options.push('Allowed Numbers');
29
+ options.push('Blocked Numbers');
24
30
  }
25
31
 
26
32
  if (registered) {
27
33
  options.push('Logoff (Delete Session)');
28
34
  }
29
35
 
30
- options.push('Allowed Numbers');
31
- options.push('Blocked Numbers');
32
- options.push('Recents');
33
36
  options.push('Back');
34
37
 
35
38
  const choice = await ctx.ui.select(`WhatsApp (Status: ${status})`, options);
@@ -332,21 +335,22 @@ export class MenuHandler {
332
335
  private async sendMessageToAllowedNumber(ctx: ExtensionCommandContext, contact: Contact) {
333
336
  const displayName = contact.name ? `${contact.name} (${contact.number})` : contact.number;
334
337
  for (let attempt = 0; attempt < 2; attempt++) {
335
- const text = await ctx.ui.input(`Send a message to ${displayName}:`);
336
- const trimmed = text?.trim() || '';
338
+ const inputText = (await ctx.ui.input(`Send a message to ${displayName}:`))?.trim() || '';
337
339
 
338
- if (!trimmed) {
340
+ if (!inputText) {
339
341
  ctx.ui.notify('Please enter a message before sending.', 'error');
340
342
  continue;
341
343
  }
342
344
 
343
- const result = await this.whatsappService.sendMenuMessage(this.toJid(contact.number), trimmed);
345
+ const inputTextWithPiSuffix = inputText + ' π';
346
+
347
+ const result = await this.whatsappService.sendMenuMessage(this.toJid(contact.number), inputTextWithPiSuffix);
344
348
  if (result.success) {
345
349
  await this.recentsService.recordMessage({
346
350
  messageId: result.messageId ?? `${Date.now()}`,
347
351
  senderNumber: contact.number,
348
352
  senderName: contact.name,
349
- text: trimmed,
353
+ text: inputTextWithPiSuffix,
350
354
  direction: 'outgoing',
351
355
  timestamp: Date.now()
352
356
  });