mirror of
https://github.com/sern-handler/templates
synced 2026-06-06 01:16:58 +00:00
feat: add js and update ts examples for beta version (#7)
This commit is contained in:
42
.github/workflows/codeql-analysis.yml
vendored
42
.github/workflows/codeql-analysis.yml
vendored
@@ -37,29 +37,29 @@ jobs:
|
||||
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # tag=v3
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@dcd71f646680f2efd8db4afa5ad64fdcba30e748 # tag=v3
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
2395
package-lock.json
generated
2395
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
2
templates/javascript/.gitignore
vendored
Normal file
2
templates/javascript/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
cd ../node_modules
|
||||
/dist
|
||||
1
templates/javascript/README.md
Normal file
1
templates/javascript/README.md
Normal file
@@ -0,0 +1 @@
|
||||
# TODO
|
||||
10
templates/javascript/commands/ping.js
Normal file
10
templates/javascript/commands/ping.js
Normal file
@@ -0,0 +1,10 @@
|
||||
const { CommandType, sernModule } = require('@sern/handler');
|
||||
|
||||
exports.default = sernModule([], {
|
||||
type: CommandType.Both,
|
||||
description: 'A ping command',
|
||||
//alias : [],
|
||||
execute: (ctx, args) => {
|
||||
ctx.reply({ content: 'Pong 🏓' });
|
||||
},
|
||||
});
|
||||
18
templates/javascript/index.js
Normal file
18
templates/javascript/index.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, GatewayIntentBits } from 'discord.js';
|
||||
import { Sern } from '@sern/handler';
|
||||
|
||||
const client = new Client({
|
||||
intents: [
|
||||
GatewayIntentBits.Guilds,
|
||||
GatewayIntentBits.GuildMembers,
|
||||
GatewayIntentBits.GuildMessages,
|
||||
],
|
||||
});
|
||||
|
||||
Sern.init({
|
||||
client,
|
||||
defaultPrefix: '!', // removing defaultPrefix will shut down text commands
|
||||
commands: 'commands',
|
||||
});
|
||||
|
||||
client.login();
|
||||
26
templates/javascript/package.json
Normal file
26
templates/javascript/package.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "js-example",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [
|
||||
"javacsript",
|
||||
"sern",
|
||||
"discord.js",
|
||||
"cli"
|
||||
],
|
||||
"author": "EvolutionX",
|
||||
"license": "UNLICENSED",
|
||||
"dependencies": {
|
||||
"@sern/handler": "^1.0.0-beta",
|
||||
"discord.js": "^14.0.0-dev.1650672498-3617093",
|
||||
"package.json": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^17.0.25",
|
||||
"prettier": "^2.6.2"
|
||||
}
|
||||
}
|
||||
1
templates/typescript/.gitignore
vendored
1
templates/typescript/.gitignore
vendored
@@ -1,3 +1,2 @@
|
||||
package-lock.json
|
||||
/node_modules
|
||||
/dist
|
||||
@@ -15,7 +15,7 @@
|
||||
"author": "EvolutionX",
|
||||
"license": "UNLICENSED",
|
||||
"dependencies": {
|
||||
"@sern/handler": "^0.0.1",
|
||||
"@sern/handler": "^1.0.0-beta",
|
||||
"discord.js": "^14.0.0-dev.1650672498-3617093"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import type { Interaction } from 'discord.js';
|
||||
import { apply, sernModule } from '@sern/handler/dist/handler/plugins/plugin';
|
||||
import { CommandType } from '@sern/handler/dist/handler/sern';
|
||||
import type { Context } from '@sern/handler/dist/handler/structures/structxports';
|
||||
import { Args, CommandType, Context, sernModule } from '@sern/handler';
|
||||
|
||||
export const module = sernModule(apply(), {
|
||||
type: CommandType.Text,
|
||||
export default sernModule([], {
|
||||
type: CommandType.Both,
|
||||
description: 'A ping command',
|
||||
alias: [],
|
||||
execute: (ctx: Context, args: unknown) => {
|
||||
ctx.channel?.send('Pong 🏓');
|
||||
//alias : [],
|
||||
execute: (ctx: Context, args: Args) => {
|
||||
ctx.reply({ content: 'Pong 🏓' });
|
||||
},
|
||||
});
|
||||
|
||||
@@ -11,6 +11,7 @@ const client = new Client({
|
||||
|
||||
Sern.init({
|
||||
client,
|
||||
defaultPrefix: '!', // removing defaultPrefix will shut down text commands
|
||||
commands: 'dist/commands',
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user