mirror of
https://github.com/thaldrin/thaldrin.git
synced 2024-08-14 23:57:21 +00:00
test string replacing with Lingua
This commit is contained in:
parent
1292e4598b
commit
59ecdf2cff
4 changed files with 18 additions and 8 deletions
|
@ -6,7 +6,8 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"start": "node build/index.js",
|
"start": "node build/index.js",
|
||||||
"dev": "rm -r build && npm run build && npm run start"
|
"dev": "rm -r build && npm run build && npm run start",
|
||||||
|
"update:subs": "git submodule update --remote"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { Server, Usage } from "../utils/types";
|
||||||
import config from "../../config";
|
import config from "../../config";
|
||||||
import { Commands, Shortlink, SourceFinder } from "../utils/wrapper.features";
|
import { Commands, Shortlink, SourceFinder } from "../utils/wrapper.features";
|
||||||
import lingua from "../utils/lingua";
|
import lingua from "../utils/lingua";
|
||||||
|
import replace from "../utils/replace";
|
||||||
|
|
||||||
export = {
|
export = {
|
||||||
name: "message",
|
name: "message",
|
||||||
|
@ -57,7 +58,6 @@ export = {
|
||||||
const command = args.shift()?.toLowerCase()
|
const command = args.shift()?.toLowerCase()
|
||||||
|
|
||||||
const cmd = client.commands.find((c) => (c.name as string).toLowerCase() == command || (c.aliases && c.aliases.includes(command)))
|
const cmd = client.commands.find((c) => (c.name as string).toLowerCase() == command || (c.aliases && c.aliases.includes(command)))
|
||||||
console.log(cmd)
|
|
||||||
if (!cmd) return;
|
if (!cmd) return;
|
||||||
|
|
||||||
if (!client.cooldowns.has(cmd.name)) {
|
if (!client.cooldowns.has(cmd.name)) {
|
||||||
|
@ -65,15 +65,24 @@ export = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const ctx = {
|
const ctx = {
|
||||||
client, guild: message.guild, message, channel: message.channel, supabase, config, isDeveloper: config.developers.includes(message.author.id)
|
client,
|
||||||
|
guild: message.guild,
|
||||||
|
message, channel: message.channel,
|
||||||
|
author: message.author,
|
||||||
|
member: message.member,
|
||||||
|
supabase,
|
||||||
|
config,
|
||||||
|
isDeveloper: config.developers.find(dev => dev.id === message.author.id)
|
||||||
}
|
}
|
||||||
|
// ! Override Command Restrictions if Message Author is on list of Developers
|
||||||
|
// if (ctx.isDeveloper) cmd.AuthorPermissions = "NONE"
|
||||||
|
|
||||||
if (ctx.isDeveloper) cmd.AuthorPermissions = "NONE"
|
// ! If Command is NSFW and channel is not marked as such, return
|
||||||
|
|
||||||
console.log(ctx.isDeveloper)
|
|
||||||
if (cmd.nsfw && !ctx.channel.nsfw) return ctx.channel.send(
|
if (cmd.nsfw && !ctx.channel.nsfw) return ctx.channel.send(
|
||||||
lingua["en_US"].CHANNEL_NOT_NSFW
|
lingua["en_US"].CHANNEL_NOT_NSFW
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (cmd.AuthorPermissions !== "NONE" && ctx.member?.permissions.has(cmd.AuthorPermissions)) return ctx.channel.send(replace(/PERMISSIONS/gm, cmd.AuthorPermissions.join(", "), lingua["en_US"].INSUFFICIENT_PERMISSIONS))
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,7 +8,7 @@ export = class Info extends Command {
|
||||||
aliases: ["about"],
|
aliases: ["about"],
|
||||||
// module: "General",
|
// module: "General",
|
||||||
cooldown: 0,
|
cooldown: 0,
|
||||||
guildOnly: false,
|
AuthorPermissions: ["MANAGE_GUILD"],
|
||||||
dev: false
|
dev: false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 135a6a484f9dfff34f034f10474162cf9b51fea7
|
Subproject commit 227b46726a7d2071dc6b73019aaffbe4fbfa2d21
|
Loading…
Reference in a new issue