Only announce if they can reasonably type here
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
const {z} = require("zod")
|
const {z} = require("zod")
|
||||||
const {defineEventHandler, useSession, createError, readValidatedBody, setResponseHeader} = require("h3")
|
const {defineEventHandler, useSession, createError, readValidatedBody, setResponseHeader} = require("h3")
|
||||||
const Ty = require("../../types")
|
const Ty = require("../../types")
|
||||||
|
const DiscordTypes = require("discord-api-types/v10")
|
||||||
|
|
||||||
const {discord, db, as, sync, select, from} = require("../../passthrough")
|
const {discord, db, as, sync, select, from} = require("../../passthrough")
|
||||||
/** @type {import("../../d2m/actions/create-space")} */
|
/** @type {import("../../d2m/actions/create-space")} */
|
||||||
@@ -64,10 +65,12 @@ as.router.post("/api/link", defineEventHandler(async event => {
|
|||||||
await createRoom.syncRoom(parsedBody.discord)
|
await createRoom.syncRoom(parsedBody.discord)
|
||||||
|
|
||||||
// Send a notification in the room
|
// Send a notification in the room
|
||||||
|
if (channel.type === DiscordTypes.ChannelType.GuildText) {
|
||||||
await api.sendEvent(parsedBody.matrix, "m.room.message", {
|
await api.sendEvent(parsedBody.matrix, "m.room.message", {
|
||||||
msgtype: "m.notice",
|
msgtype: "m.notice",
|
||||||
body: "👋 This room is now bridged with Discord. Say hi!"
|
body: "👋 This room is now bridged with Discord. Say hi!"
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
setResponseHeader(event, "HX-Refresh", "true")
|
setResponseHeader(event, "HX-Refresh", "true")
|
||||||
return null // 204
|
return null // 204
|
||||||
|
Reference in New Issue
Block a user