Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #2056 by adding files to app_mention payload #2057

Merged
merged 1 commit into from
Feb 13, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
41 changes: 41 additions & 0 deletions src/types/events/base-events.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { assert } from 'chai';
import { AppMentionEvent } from './base-events';

describe('Events API payload types', () => {
it('should be compatible with app_mention payload', () => {
const payload: AppMentionEvent = {
type: 'app_mention',
text: '<@U066C7XNE6M> hey',
files: [{ id: 'F111' }],
upload: false,
user: 'U03E94MK0',
display_as_bot: false,
ts: '1707806347.397809',
blocks: [
{
type: 'rich_text',
block_id: 't9D3L',
elements: [
{
type: 'rich_text_section',
elements: [
{
type: 'user',
user_id: 'U066C7XNE6M',
},
{
type: 'text',
text: ' hey',
},
],
},
],
},
],
client_msg_id: '883e5317-28e3-4ef8-9385-b88343560de6',
channel: 'CHE2DUW5V',
event_ts: '1707806347.397809',
};
assert.isNotEmpty(payload);
});
});
7 changes: 6 additions & 1 deletion src/types/events/base-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,16 @@ export interface AppMentionEvent {
subtype?: string;
bot_id?: string;
bot_profile?: BotProfile;
username: string;
username?: string;
team?: string;
user?: string;
text: string;
attachments?: MessageAttachment[];
blocks?: (KnownBlock | Block)[];
// TODO: Add more properties once the types library has a file object definition
files?: { id: string }[];
upload?: boolean;
display_as_bot?: boolean;
edited?: {
user: string;
ts: string;
Expand All @@ -203,6 +207,7 @@ export interface AppMentionEvent {
channel: string;
event_ts: string;
thread_ts?: string;
client_msg_id?: string;
}

export interface AppRateLimitedEvent {
Expand Down