-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add templates for
generate
command
- Loading branch information
Showing
8 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ "category": "arguments" } | ||
--- | ||
import { Argument } from "@sapphire/framework"; | ||
|
||
export class UserArgument extends Argument { | ||
constructor(context, options) { | ||
super(context, { | ||
...options | ||
}); | ||
} | ||
|
||
async run(parameter) { | ||
return this.ok(parameter); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ "category": "arguments" } | ||
--- | ||
import { ApplyOptions } from '@sapphire/decorators'; | ||
import { Argument, ArgumentOptions } from "@sapphire/framework"; | ||
|
||
@ApplyOptions<ArgumentOptions>({}) | ||
export class UserArgument extends Argument<string> { | ||
async run(parameter: string) { | ||
return this.ok(parameter); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ "category": "commands" } | ||
--- | ||
const { SubCommandPluginCommand } = require('@sapphire/plugin-subcommands'); | ||
|
||
class UserCommand extends SubCommandPluginCommand { | ||
constructor(context, options) { | ||
super(context, { | ||
...options | ||
}); | ||
} | ||
|
||
async run(message) { | ||
return msg.channel.send('Hello world!'); | ||
} | ||
} | ||
|
||
exports.UserCommand = UserCommand; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ "category": "commands" } | ||
--- | ||
import { ApplyOptions } from '@sapphire/decorators'; | ||
import { SubCommandPluginCommand, SubCommandPluginCommandOptions } from '@sapphire/plugin-subcommands'; | ||
import { Message } from 'discord.js'; | ||
|
||
@ApplyOptions<SubCommandPluginCommandOptions>({ | ||
description: 'A basic command' | ||
}) | ||
export class UserCommand extends SubCommandPluginCommand { | ||
public async run(message: Message) { | ||
return message.channel.send('Hello world!'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ "category": "listeners" } | ||
--- | ||
const { Listener } = require('@sapphire/framework'); | ||
|
||
class UserEvent extends Listener { | ||
constructor(context, options = {}) { | ||
super(context, { | ||
...options | ||
}); | ||
} | ||
|
||
run() {} | ||
} | ||
|
||
exports.UserEvent = UserEvent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ "category": "listeners" } | ||
--- | ||
import { ApplyOptions } from '@sapphire/decorators'; | ||
import { Listener, ListenerOptions } from '@sapphire/framework'; | ||
|
||
@ApplyOptions<ListenerOptions>({}) | ||
export class UserEvent extends Listener { | ||
public run() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ "category": "preconditions" } | ||
--- | ||
const { Precondition } = require('@sapphire/framework'); | ||
|
||
class UserPrecondition extends Precondition { | ||
run(message) { | ||
return this.ok(); | ||
} | ||
} | ||
|
||
module.exports.UserPrecondition = UserPrecondition; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ "category": "preconditions" } | ||
--- | ||
import { Precondition } from '@sapphire/framework'; | ||
import type { Message } from 'discord.js'; | ||
|
||
export class UserPrecondition extends Precondition { | ||
public run(message: Message) { | ||
return this.ok(); | ||
} | ||
} | ||
|
||
declare module '@sapphire/framework' { | ||
interface Preconditions { | ||
{{name}}: never; | ||
} | ||
} |