Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ export class WickrIOAddon extends EventEmitter {
bor?: string,
messageMetaData?: string,
deleteWhenSent?: boolean,
isLowPriority?: boolean
isLowPriority?: boolean,
messageID?: string
): Promise<string>;

// ---------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wickrio_addon",
"version": "7.2.1",
"version": "7.2.2",
"description": "WickrIO's Javascript bot API's",
"main": "src/wickrio_addon.js",
"types": "./index.d.ts",
Expand Down
5 changes: 4 additions & 1 deletion src/wickrio_addon.js
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ class WickrIOAddon extends EventEmitter {
return 'Failure';
}

async cmdSend1to1Attachment(users, attachment, displayName, ttl, bor, messageMetaData, deleteWhenSent, isLowPriority) {
async cmdSend1to1Attachment(users, attachment, displayName, ttl, bor, messageMetaData, deleteWhenSent, isLowPriority, messageID) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Word, I didnt even see that spec, will follow-up on that

if (this.debug) console.log('in cmdSend1to1Attachment')

if (! Array.isArray(users)) {
Expand Down Expand Up @@ -713,6 +713,9 @@ class WickrIOAddon extends EventEmitter {
if (deleteWhenSent) {
commandObj.deletewhensent = true
}
if (messageID?.length > 0) {
commandObj.message_id = messageID
}

const command = JSON.stringify(commandObj);

Expand Down
30 changes: 30 additions & 0 deletions test/spec/test-definitions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,36 @@ tests:
args: [['user1'], null, null, null, null, null]
throws: message must be set

cmdSend1to1Attachment:
- case: basic file attachment with single user
args: [['user1'], "/tmp/file.dat"]
expect:
action: send_message
attachment: { filename: "/tmp/file.dat" }
users: [{ name: user1 }]
expectNotPresent: ['message_id', 'low_priority', 'ttl', 'bor']

- case: complete attachment with all parameters
args: [['user1'], "/tmp/file.dat", "file.dat", "3600", "7200", '{"priority": "high"}', true, true, "msg123"]
expect:
action: send_message
attachment: { filename: "/tmp/file.dat", displayname: "file.dat" }
users: [{ name: user1 }]
ttl: 3600
bor: 7200
messagemeta: { priority: high }
deletewhensent: true
low_priority: true
message_id: msg123

- case: url attachment without display name should throw error
args: [['user1'], "https://example.com/image.png"]
throws: display name must be set for url attachments

- case: missing attachment should throw error
args: [['user1']]
throws: attachment must be set

cmdSendRoomMessage:
- case: basic room message
args: ["Sabc123", "Hello room", null, null, null, null]
Expand Down
Loading