feat: add js and update ts examples for beta version (#7)

This commit is contained in:
Jacob Nguyen
2022-05-31 23:02:29 -05:00
committed by GitHub
parent 64a67103ed
commit 48bac4a321
11 changed files with 86 additions and 2427 deletions

View File

@@ -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

File diff suppressed because it is too large Load Diff

2
templates/javascript/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
cd ../node_modules
/dist

View File

@@ -0,0 +1 @@
# TODO

View 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 🏓' });
},
});

View 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();

View 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"
}
}

View File

@@ -1,3 +1,2 @@
package-lock.json
/node_modules
/dist

View File

@@ -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": {

View File

@@ -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 🏓' });
},
});

View File

@@ -11,6 +11,7 @@ const client = new Client({
Sern.init({
client,
defaultPrefix: '!', // removing defaultPrefix will shut down text commands
commands: 'dist/commands',
});