Skip to content

Commit

Permalink
print discord message
Browse files Browse the repository at this point in the history
  • Loading branch information
zcpua committed Jul 5, 2023
1 parent 391cdb2 commit ffff725
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 7 additions & 2 deletions example/upscale-ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@ async function main() {
ServerId: <string>process.env.SERVER_ID,
ChannelId: <string>process.env.CHANNEL_ID,
SalaiToken: <string>process.env.SALAI_TOKEN,
Debug: true,
// Debug: true,
Ws: true,
});
await client.Connect();
const Imagine = await client.Imagine("a cool cat, blue ears, yellow hat");
const Imagine = await client.Imagine(
"a cool cat, blue ears, yellow hat --v 4",
(uri: string, progress: string) => {
console.log("loading", uri, "progress", progress);
}
);
console.log(Imagine);
if (!Imagine) {
console.log("no message");
Expand Down
2 changes: 2 additions & 0 deletions src/discord.ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ export class WsMessage {
if (channel_id !== this.config.ChannelId) return;
if (author?.id !== this.config.BotId) return;
if (interaction && interaction.user.id !== this.UserId) return;
this.log('[messageCreate]', JSON.stringify(message));
this.messageCreate(message);
}

Expand All @@ -237,6 +238,7 @@ export class WsMessage {
if (channel_id !== this.config.ChannelId) return;
if (author?.id !== this.config.BotId) return;
if (interaction && interaction.user.id !== this.UserId) return;
this.log('[messageUpdate]', JSON.stringify(message));
this.messageUpdate(message);
}

Expand Down

0 comments on commit ffff725

Please sign in to comment.