Skip to content

Commit 0e0d369

Browse files
committed
🔧 update(discord): add checks before sending typing and messages
1 parent 1d7bbdc commit 0e0d369

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

  • plugins

plugins/channel/plugin-channel-discord/src/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ const discordPlugin: ChannelPlugin = {
102102
const userId = `discord:${msg.author.id}`;
103103

104104
try {
105-
await msg.channel.sendTyping();
105+
if ('sendTyping' in msg.channel) {
106+
await msg.channel.sendTyping();
107+
}
106108

107109
const response = await context.enqueue(userId, rawContent);
108110

@@ -112,7 +114,9 @@ const discordPlugin: ChannelPlugin = {
112114
} else {
113115
const chunks = splitIntoChunks(response, 1900);
114116
for (const chunk of chunks) {
115-
await msg.channel.send(chunk);
117+
if ('send' in msg.channel) {
118+
await msg.channel.send(chunk);
119+
}
116120
}
117121
}
118122
} catch (err) {

plugins/provider/plugin-provider-openai/src/pairing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function createOpenAIPairingTools(
3535
'Stores the API key securely, configures the model, enables the plugin, ' +
3636
'and routes complex/reasoning queries to OpenAI. ' +
3737
'After pairing, call tinyclaw_restart to apply the changes. ' +
38-
'To get an API key: go to https://platform.openai.com/api-keys and create one.',,
38+
'To get an API key: go to https://platform.openai.com/api-keys and create one.',
3939
parameters: {
4040
type: 'object',
4141
properties: {

0 commit comments

Comments
 (0)