Skip to content

Commit

Permalink
fixed labOnly middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
GhomKrosmonaute committed Jul 3, 2024
1 parent 83f8898 commit 970d80c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/namespaces/middlewares.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,21 @@ export function isNotInUse(

export function labOnly(): command.Middleware<"guild"> {
return async function labOnly(message, data) {
const config = await tools.getGuild(message.guild)

if (!config)
return {
result: "This command can only be used in a lab.",
data,
}

const lab = await labs.query
.where("guild_id", message.guild.id)
.where("guild_id", config._id)
.andWhere("ignored", false)
.first()

return {
result: !!lab || "This command can only be used in a lab channel.",
result: !!lab || "This command can only be used in a lab.",
data,
}
}
Expand Down

0 comments on commit 970d80c

Please sign in to comment.