simnJS
simnJS
Explore posts from servers
SIASapphire - Imagine a framework
Created by simnJS on 2/3/2025 in #sapphire-support
Precondition doesn't return an error message
Enjoying hard Sapphire
20 replies
SIASapphire - Imagine a framework
Created by simnJS on 2/3/2025 in #sapphire-support
Precondition doesn't return an error message
Have a nice day
20 replies
SIASapphire - Imagine a framework
Created by simnJS on 2/3/2025 in #sapphire-support
Precondition doesn't return an error message
Thank you for your help
20 replies
SIASapphire - Imagine a framework
Created by simnJS on 2/3/2025 in #sapphire-support
Precondition doesn't return an error message
yeah I just seen that sorry
20 replies
SIASapphire - Imagine a framework
Created by simnJS on 2/3/2025 in #sapphire-support
Precondition doesn't return an error message
Fixed, the problem was from my chatInputSubCommandDenied
20 replies
SIASapphire - Imagine a framework
Created by simnJS on 2/3/2025 in #sapphire-support
Precondition doesn't return an error message
Sun ? I didn't understand what you mean sorry
20 replies
SIASapphire - Imagine a framework
Created by simnJS on 2/3/2025 in #sapphire-support
Precondition doesn't return an error message
No description
20 replies
SIASapphire - Imagine a framework
Created by simnJS on 2/3/2025 in #sapphire-support
Precondition doesn't return an error message
export class TicketCommand extends Subcommand {
public constructor(context: Subcommand.LoaderContext) {
super(context, {
name: 'ticket',
description: 'Gérer le ticket actuel',
preconditions: ['IsInTicket','GuildOnly', 'IsInTicket'],
runIn: CommandOptionsRunTypeEnum.GuildAny,
subcommands: [
{
name: 'add',
chatInputRun: 'chatInputAdd',
preconditions: ['IsInTicket',"TicketModerate"]
},
{
name: 'remove',
chatInputRun: 'chatInputRemove',
preconditions: ['IsInTicket',"TicketModerate"]
},
{
name: 'close',
chatInputRun: 'chatInputClose',
preconditions: ['IsInTicket',"TicketModerate"]
},
{
name: 'switchpanel',
chatInputRun: 'chatInputTransfer',
preconditions: ['IsInTicket',"TicketModerate"]
},
{
name: 'rename',
chatInputRun: 'chatInputRename',
preconditions: ['IsInTicket',"TicketModerate"]
},
{
name: 'addrole',
chatInputRun: 'chatInputAddRole',
preconditions: ['IsInTicket','TicketManager']
},
{
name: 'unclaim',
chatInputRun: 'chatInputUnclaim',
preconditions: ['IsInTicket','TicketModerate']
},
{
name: 'autoclose',
chatInputRun: 'chatInputAutoClose',
preconditions: ['IsInTicket','TicketModerate']
},
{
name: 'claim',
chatInputRun: 'chatInputClaim',
preconditions: ['IsInTicket','TicketModerate']
},
{
name: 'closerequest',
chatInputRun: 'chatInputCloseRequest',
preconditions: ['IsInTicket','TicketModerate']
}
]
});
}
export class TicketCommand extends Subcommand {
public constructor(context: Subcommand.LoaderContext) {
super(context, {
name: 'ticket',
description: 'Gérer le ticket actuel',
preconditions: ['IsInTicket','GuildOnly', 'IsInTicket'],
runIn: CommandOptionsRunTypeEnum.GuildAny,
subcommands: [
{
name: 'add',
chatInputRun: 'chatInputAdd',
preconditions: ['IsInTicket',"TicketModerate"]
},
{
name: 'remove',
chatInputRun: 'chatInputRemove',
preconditions: ['IsInTicket',"TicketModerate"]
},
{
name: 'close',
chatInputRun: 'chatInputClose',
preconditions: ['IsInTicket',"TicketModerate"]
},
{
name: 'switchpanel',
chatInputRun: 'chatInputTransfer',
preconditions: ['IsInTicket',"TicketModerate"]
},
{
name: 'rename',
chatInputRun: 'chatInputRename',
preconditions: ['IsInTicket',"TicketModerate"]
},
{
name: 'addrole',
chatInputRun: 'chatInputAddRole',
preconditions: ['IsInTicket','TicketManager']
},
{
name: 'unclaim',
chatInputRun: 'chatInputUnclaim',
preconditions: ['IsInTicket','TicketModerate']
},
{
name: 'autoclose',
chatInputRun: 'chatInputAutoClose',
preconditions: ['IsInTicket','TicketModerate']
},
{
name: 'claim',
chatInputRun: 'chatInputClaim',
preconditions: ['IsInTicket','TicketModerate']
},
{
name: 'closerequest',
chatInputRun: 'chatInputCloseRequest',
preconditions: ['IsInTicket','TicketModerate']
}
]
});
}
20 replies
SIASapphire - Imagine a framework
Created by simnJS on 2/3/2025 in #sapphire-support
Precondition doesn't return an error message
But doesn't work with my ticket subcommands
20 replies
SIASapphire - Imagine a framework
Created by simnJS on 2/3/2025 in #sapphire-support
Precondition doesn't return an error message
import { ApplyOptions } from '@sapphire/decorators';
import { Precondition } from '@sapphire/framework';
import type { PreconditionOptions, PreconditionResult } from '@sapphire/framework';
import type { CommandInteraction, ContextMenuCommandInteraction, GuildMember, Message } from 'discord.js';
import { checkAdministrator } from '../lib/util/functions/permissions';

@ApplyOptions<PreconditionOptions>({
name: 'AdminOnly',
})
export class AdminOnlyPrecondition extends Precondition {
public override chatInputRun(interaction: CommandInteraction): PreconditionResult {
return this.isGuildAdmin(interaction.member as GuildMember);
}

public override contextMenuRun(interaction: ContextMenuCommandInteraction): PreconditionResult {
return this.isGuildAdmin(interaction.member as GuildMember);
}

public override messageRun(message: Message): PreconditionResult {
return this.isGuildAdmin(message.member as GuildMember);
}

private isGuildAdmin(member: GuildMember): PreconditionResult {
return checkAdministrator(member)
? this.ok()
: this.error({ message: "Bien essayé, mais tu n'as pas les permissions nécessaires pour effectuer cette commande." });
}
}

declare module '@sapphire/framework' {
interface Preconditions {
AdminOnly: never;
}
}
import { ApplyOptions } from '@sapphire/decorators';
import { Precondition } from '@sapphire/framework';
import type { PreconditionOptions, PreconditionResult } from '@sapphire/framework';
import type { CommandInteraction, ContextMenuCommandInteraction, GuildMember, Message } from 'discord.js';
import { checkAdministrator } from '../lib/util/functions/permissions';

@ApplyOptions<PreconditionOptions>({
name: 'AdminOnly',
})
export class AdminOnlyPrecondition extends Precondition {
public override chatInputRun(interaction: CommandInteraction): PreconditionResult {
return this.isGuildAdmin(interaction.member as GuildMember);
}

public override contextMenuRun(interaction: ContextMenuCommandInteraction): PreconditionResult {
return this.isGuildAdmin(interaction.member as GuildMember);
}

public override messageRun(message: Message): PreconditionResult {
return this.isGuildAdmin(message.member as GuildMember);
}

private isGuildAdmin(member: GuildMember): PreconditionResult {
return checkAdministrator(member)
? this.ok()
: this.error({ message: "Bien essayé, mais tu n'as pas les permissions nécessaires pour effectuer cette commande." });
}
}

declare module '@sapphire/framework' {
interface Preconditions {
AdminOnly: never;
}
}
20 replies
SIASapphire - Imagine a framework
Created by simnJS on 2/3/2025 in #sapphire-support
Precondition doesn't return an error message
No description
20 replies
SIASapphire - Imagine a framework
Created by simnJS on 2/3/2025 in #sapphire-support
Precondition doesn't return an error message
No description
20 replies
SIASapphire - Imagine a framework
Created by simnJS on 2/3/2025 in #sapphire-support
Precondition doesn't return an error message
No description
20 replies
SIASapphire - Imagine a framework
Created by simnJS on 1/31/2025 in #sapphire-support
Use precondition on subcommands
Perfect thank you that exactly what I'm looking for
5 replies
SIASapphire - Imagine a framework
Created by simnJS on 8/20/2024 in #sapphire-support
Using sapphire paginator is it possible to customize the pages names ?
Toi qui a pas mal utilisé sapphire, niveau performance ca marche bien ?
60 replies
SIASapphire - Imagine a framework
Created by simnJS on 8/20/2024 in #sapphire-support
Using sapphire paginator is it possible to customize the pages names ?
quand même
60 replies
SIASapphire - Imagine a framework
Created by simnJS on 8/20/2024 in #sapphire-support
Using sapphire paginator is it possible to customize the pages names ?
C'est mieux
60 replies
SIASapphire - Imagine a framework
Created by simnJS on 8/20/2024 in #sapphire-support
Using sapphire paginator is it possible to customize the pages names ?
No description
60 replies
SIASapphire - Imagine a framework
Created by simnJS on 8/20/2024 in #sapphire-support
Using sapphire paginator is it possible to customize the pages names ?
merci pour tout
60 replies
SIASapphire - Imagine a framework
Created by simnJS on 8/20/2024 in #sapphire-support
Using sapphire paginator is it possible to customize the pages names ?
Bon bah super
60 replies