Skip to content
Closed
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ca2ea37
feat: create method ChannelWebhook.sendMessage
Taureon Mar 14, 2026
33154b2
fix: handle group/DM as voice channel
insertish Oct 8, 2025
895be07
chore: remove triage workflows
insertish Oct 10, 2025
89fc034
chore: fill optional argument for `unreact`
insertish Oct 10, 2025
2ba30ff
chore: increase ack rate
insertish Oct 16, 2025
76ff191
fix: ensure `lastMessageId` is updated on incoming messages
insertish Oct 16, 2025
c45732e
refactor: revolt.js -> stoat.js (publish 7.3.0)
insertish Oct 16, 2025
5c64973
chore: bump stoat-api to 0.8.9-3
insertish Oct 16, 2025
db4b491
chore: switch to bigint handling for permissions
insertish Oct 22, 2025
1fcfc69
chore: add Video and Listen to default permission set
insertish Oct 22, 2025
1dbf2bf
feat: add VoiceParticipant and voice state management
insertish Oct 22, 2025
8321f5e
feat: add Channel#joinCall
insertish Oct 22, 2025
e84fafa
fix: incorrect signature for Channel#joinCall
insertish Oct 22, 2025
987a33c
fix: increase typing timeout to 4s (#119)
Aeledfyr Oct 22, 2025
b34b1de
feat: add call_started system message (#120)
Zomatree Oct 22, 2025
8bb64f7
fix: don't include recipients array if not necessary
insertish Oct 23, 2025
6698c9d
fix: consider DMs as voice channels
insertish Oct 23, 2025
1e7aa53
fix: create user object when creating bot
insertish Nov 16, 2025
96d704d
feat: add nix shell (#121)
amycatgirl Jan 1, 2026
fcb26af
fix: missing undefined check on policy_changes (#122)
amycatgirl Jan 1, 2026
e2ffcca
fix: make ReadyData partial to match event documentation (#123)
amycatgirl Jan 16, 2026
dc34ea2
chore: bump version to 7.3.6
insertish Jan 16, 2026
a266663
chore: aggressively optimise large servers by just not loading many m…
insertish Feb 12, 2026
db38882
fix: lint issues (#133)
chrishultin Feb 28, 2026
b1e0cbf
feat: Enable asynchronous configuration loading and configuration sig…
Dadadah Feb 28, 2026
da5ea06
feat: Add the ability to parse markdown and replace tags asynchronous…
Dadadah Mar 2, 2026
8d0aa67
fix: correct event name in example (#130)
z-nexx Mar 2, 2026
020acc8
fix: markdownToTextFetch will now return results even if fetches fail…
Dadadah Mar 3, 2026
e88c8e0
feat: Add emoji parsing to sync markdownToText (#136)
Dadadah Mar 3, 2026
9657673
fix: linter fix to make pr checks pass (#137)
Dadadah Mar 3, 2026
30f8b9e
Fix/server deletion lockup (#134)
mihaicm93 Mar 3, 2026
2ddca12
Merge branch 'main' into channelwebhook-sendmessage
Taureon Mar 14, 2026
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
40 changes: 39 additions & 1 deletion src/classes/ChannelWebhook.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { DataEditWebhook } from "stoat-api";
import { DataEditWebhook, DataMessageSend } from "stoat-api";

import type { ChannelWebhookCollection } from "../collections/ChannelWebhookCollection.js";
import { hydrate } from "../hydration/index.js";

import type { Channel } from "./Channel.js";
import type { File } from "./File.js";
import { Message } from "./Message.js";
import { ulid } from "ulid";

/**
* Channel Webhook Class
Expand Down Expand Up @@ -101,4 +103,40 @@ export class ChannelWebhook {

this.#collection.delete(this.id);
}

/**
* Send a message through this webhook
* @param data Either the message as a string or message sending route data
* @returns Sent message
*/
async sendMessage(
data: string | DataMessageSend,
idempotencyKey: string = ulid(),
): Promise<Message> {
const msg: DataMessageSend =
typeof data === "string" ? { content: data } : data;

// Mark as silent message
if (msg.content?.startsWith("@silent ")) {
msg.content = msg.content.substring(8);
msg.flags ||= 1;
msg.flags |= 1;
}

const message = await this.#collection.client.api.post(
`/webhooks/${this.id as ""}/${this.token as ""}`,
msg,
{
headers: {
"Idempotency-Key": idempotencyKey,
},
},
);

return this.#collection.client.messages.getOrCreate(
message._id,
message,
true,
);
}
}