mirror of
https://github.com/sern-handler/awesome-plugins
synced 2026-06-21 15:22:21 +00:00
chore: update JavaScript plugins
This commit is contained in:
@@ -52,7 +52,7 @@ export function assertFields(config: {
|
||||
errors.push(
|
||||
input +
|
||||
" failed to pass assertion " +
|
||||
resolvedAssertion.toString()
|
||||
resolvedAssertion.toString(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ export function buttonConfirmation(options?: Partial<ConfirmationOptions>) {
|
||||
await sent.edit({
|
||||
components: [
|
||||
new ActionRowBuilder<ButtonBuilder>().setComponents(
|
||||
buttons
|
||||
buttons,
|
||||
),
|
||||
],
|
||||
});
|
||||
|
||||
@@ -45,7 +45,7 @@ export class ExpiryMap<K, V> extends Map<K, V> {
|
||||
public readonly expiry: number;
|
||||
constructor(
|
||||
expiry: number = Infinity,
|
||||
iterable: [K, V][] | ReadonlyMap<K, V> = []
|
||||
iterable: [K, V][] | ReadonlyMap<K, V> = [],
|
||||
) {
|
||||
super(iterable);
|
||||
this.expiry = expiry;
|
||||
@@ -65,7 +65,7 @@ export const map = new ExpiryMap<string, number>();
|
||||
|
||||
function parseCooldown(
|
||||
location: CooldownLocation,
|
||||
cooldown: CooldownString
|
||||
cooldown: CooldownString,
|
||||
): Cooldown {
|
||||
const [actions, seconds] = cooldown.split("/").map((s) => Number(s));
|
||||
|
||||
@@ -113,7 +113,7 @@ function add(
|
||||
| [CooldownLocation | keyof typeof CooldownLocation, CooldownString]
|
||||
| Cooldown
|
||||
>,
|
||||
message?: CooldownResponse
|
||||
message?: CooldownResponse,
|
||||
) {
|
||||
const raw = items.map((c) => {
|
||||
if (!Array.isArray(c)) return c;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* //your code here
|
||||
* }
|
||||
* })
|
||||
* ```
|
||||
* ```
|
||||
* @end
|
||||
*/
|
||||
import { CommandType, CommandControlPlugin, controller } from "@sern/handler";
|
||||
@@ -30,7 +30,7 @@ export function disable(
|
||||
onFail?:
|
||||
| string
|
||||
| Omit<InteractionReplyOptions, "fetchReply">
|
||||
| ReplyMessageOptions
|
||||
| ReplyMessageOptions,
|
||||
) {
|
||||
return CommandControlPlugin<CommandType.Both>(async (ctx, [args]) => {
|
||||
if (onFail !== undefined) {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* //your code here
|
||||
* }
|
||||
* })
|
||||
* ```
|
||||
* ```
|
||||
* @end
|
||||
*/
|
||||
import { CommandControlPlugin, CommandType, controller } from "@sern/handler";
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,7 @@
|
||||
* //your code here
|
||||
* }
|
||||
* })
|
||||
* ```
|
||||
* ```
|
||||
* @end
|
||||
*/
|
||||
import {
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
} from "discord.js";
|
||||
import { CommandControlPlugin, CommandType, controller } from "@sern/handler";
|
||||
function isGuildText(
|
||||
channel: TextBasedChannel | null
|
||||
channel: TextBasedChannel | null,
|
||||
): channel is GuildTextBasedChannel {
|
||||
return (
|
||||
channel?.type == ChannelType.GuildPublicThread ||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* //your code here
|
||||
* }
|
||||
* })
|
||||
* ```
|
||||
* ```
|
||||
* @end
|
||||
*/
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ export function permCheck(perm: PermissionResolvable, response: string) {
|
||||
if (ctx.guild === null) {
|
||||
await ctx.reply("This command cannot be used here");
|
||||
console.warn(
|
||||
"PermCheck > A command stopped because we couldn't check a users permissions (was used in dms)"
|
||||
"PermCheck > A command stopped because we couldn't check a users permissions (was used in dms)",
|
||||
); //delete this line if you dont want to be notified when a command is used outside of a guild/server
|
||||
return controller.stop();
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* //your code here
|
||||
* }
|
||||
* })
|
||||
* ```
|
||||
* ```
|
||||
* @end
|
||||
*/
|
||||
import {
|
||||
@@ -46,16 +46,16 @@ export function publish<
|
||||
| CommandType.Both
|
||||
| CommandType.Slash
|
||||
| CommandType.CtxMsg
|
||||
| CommandType.CtxUser
|
||||
| CommandType.CtxUser,
|
||||
>(options?: PublishOptions) {
|
||||
return CommandInitPlugin<T>(async ({ module }) => {
|
||||
// Users need to provide their own useContainer function.
|
||||
let client;
|
||||
try {
|
||||
client = (await import('@sern/handler')).Service('@sern/client')
|
||||
client = (await import("@sern/handler")).Service("@sern/client");
|
||||
} catch {
|
||||
const { useContainer } = await import('../index.js')
|
||||
client = useContainer("@sern/client")[0];
|
||||
const { useContainer } = await import("../index.js");
|
||||
client = useContainer("@sern/client")[0];
|
||||
}
|
||||
const defaultOptions = {
|
||||
guildIds: [],
|
||||
@@ -98,7 +98,7 @@ export function publish<
|
||||
description: cmd(module.description, ""),
|
||||
options: cmd(
|
||||
optionsTransformer((module as SlashCommand).options ?? []),
|
||||
[]
|
||||
[],
|
||||
),
|
||||
defaultMemberPermissions,
|
||||
dmPermission,
|
||||
@@ -110,17 +110,17 @@ export function publish<
|
||||
|
||||
if (!guildIds.length) {
|
||||
const cmd = (await client.application!.commands.fetch()).find(
|
||||
(c) => c.name === module.name && c.type === curAppType
|
||||
(c) => c.name === module.name && c.type === curAppType,
|
||||
);
|
||||
if (cmd) {
|
||||
if (!cmd.equals(commandData, true)) {
|
||||
logged(
|
||||
`Found differences in global command ${module.name}`
|
||||
`Found differences in global command ${module.name}`,
|
||||
);
|
||||
cmd.edit(commandData).then(
|
||||
log(
|
||||
`${module.name} updated with new data successfully!`
|
||||
)
|
||||
`${module.name} updated with new data successfully!`,
|
||||
),
|
||||
);
|
||||
}
|
||||
return controller.next();
|
||||
@@ -136,7 +136,7 @@ export function publish<
|
||||
const guild = await client.guilds.fetch(id).catch(c);
|
||||
if (!guild) continue;
|
||||
const guildCmd = (await guild.commands.fetch()).find(
|
||||
(c) => c.name === module.name && c.type === curAppType
|
||||
(c) => c.name === module.name && c.type === curAppType,
|
||||
);
|
||||
if (guildCmd) {
|
||||
if (!guildCmd.equals(commandData, true)) {
|
||||
@@ -145,8 +145,8 @@ export function publish<
|
||||
.edit(commandData)
|
||||
.then(
|
||||
log(
|
||||
`${module.name} updated with new data successfully!`
|
||||
)
|
||||
`${module.name} updated with new data successfully!`,
|
||||
),
|
||||
)
|
||||
.catch(c);
|
||||
continue;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* //your code here
|
||||
* }
|
||||
* })
|
||||
* ```
|
||||
* ```
|
||||
* @end
|
||||
*/
|
||||
|
||||
@@ -35,13 +35,13 @@ function payload(resp?: string) {
|
||||
export function requirePermission(
|
||||
target: "user" | "bot" | "both",
|
||||
perm: PermissionResolvable[],
|
||||
response?: string
|
||||
response?: string,
|
||||
) {
|
||||
return CommandControlPlugin<CommandType.Both>(async (ctx, args) => {
|
||||
if (ctx.guild === null) {
|
||||
ctx.reply(payload("This command cannot be used here"));
|
||||
console.warn(
|
||||
"PermCheck > A command stopped because we couldn't check a users permissions (was used in dms)"
|
||||
"PermCheck > A command stopped because we couldn't check a users permissions (was used in dms)",
|
||||
); //delete this line if you dont want to be notified when a command is used outside of a guild/server
|
||||
return controller.stop();
|
||||
}
|
||||
@@ -55,7 +55,7 @@ export function requirePermission(
|
||||
if (!bot.permissions.has(perm)) {
|
||||
if (!response)
|
||||
response = `I cannot use this command, please give me \`${perm.join(
|
||||
", "
|
||||
", ",
|
||||
)}\` permission(s).`;
|
||||
await ctx.reply(payload(response));
|
||||
return controller.stop();
|
||||
@@ -66,7 +66,7 @@ export function requirePermission(
|
||||
if (!memm.permissions.has(perm)) {
|
||||
if (!response)
|
||||
response = `You cannot use this command because you are missing \`${perm.join(
|
||||
", "
|
||||
", ",
|
||||
)}\` permission(s).`;
|
||||
await ctx.reply(payload(response));
|
||||
return controller.stop();
|
||||
|
||||
@@ -25,7 +25,7 @@ import { CommandType, controller, CommandControlPlugin } from "@sern/handler";
|
||||
|
||||
export function serverOnly(
|
||||
guildId: string[],
|
||||
failMessage = "This command is not available in this guild. \nFor permission to use in your server, please contact my developer."
|
||||
failMessage = "This command is not available in this guild. \nFor permission to use in your server, please contact my developer.",
|
||||
) {
|
||||
return CommandControlPlugin<CommandType.Both>(async (ctx, _) => {
|
||||
if (ctx.guildId == null) {
|
||||
|
||||
Reference in New Issue
Block a user