diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ec9983b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ + +*.vsix diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..0e191b5 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,17 @@ +// A launch configuration that launches the extension inside a new window +// Use IntelliSense to learn about possible attributes. +// Hover to view descriptions of existing attributes. +// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Extension", + "type": "extensionHost", + "request": "launch", + "args": [ + "--extensionDevelopmentPath=${workspaceFolder}" + ] + } + ] +} \ No newline at end of file diff --git a/.vscodeignore b/.vscodeignore new file mode 100644 index 0000000..f369b5e --- /dev/null +++ b/.vscodeignore @@ -0,0 +1,4 @@ +.vscode/** +.vscode-test/** +.gitignore +vsc-extension-quickstart.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..3b197ea --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,9 @@ +# Change Log + +All notable changes to the "sern-snippets" extension will be documented in this file. + +Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. + +## [Unreleased] + +- Initial release \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a615a03 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 SrIzan10 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 737f307..aef888d 100644 --- a/README.md +++ b/README.md @@ -1 +1,13 @@ -# snippet \ No newline at end of file +Use [sern](https://sern-handler.js.org) as your discord framework please. Thanks! <3 + +## Usage + +you can use `ctxeph`, `ctxopt`, `sernevent` and `serncommand`. + +## Release Notes + +### 1.0.0 + +Initial release of sern snippets. It contains simple commands and events, also ephemeral and empty options as message sending. + +--- diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..4017f68 Binary files /dev/null and b/icon.png differ diff --git a/package.json b/package.json new file mode 100644 index 0000000..a11f750 --- /dev/null +++ b/package.json @@ -0,0 +1,27 @@ +{ + "name": "sern-snippets", + "displayName": "sern Snippets", + "description": "Snippets for the sern discord bot framework", + "version": "1.0.0", + "repository": {"url": "https://github.com/SrIzan10/sern-snippets"}, + "publisher": "SrIzan", + "icon": "icon.png", + "engines": { + "vscode": "^1.49.0" + }, + "categories": [ + "Snippets" + ], + "contributes": { + "snippets": [ + { + "language": "javascript", + "path": "./snippets/snippets.code-snippets" + }, + { + "language": "typescript", + "path": "./snippets/snippets.code-snippets" + } + ] + } +} diff --git a/snippets/snippets.code-snippets b/snippets/snippets.code-snippets new file mode 100644 index 0000000..9bfdce8 --- /dev/null +++ b/snippets/snippets.code-snippets @@ -0,0 +1,47 @@ +{ + // Place your snippets for typescript here. Each snippet is defined under a snippet name and has a prefix, body and + // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: + // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the + // same ids are connected. + // Example: + // "Print to console": { + // "prefix": "log", + // "body": [ + // "console.log('$1');", + // "$2" + // ], + // "description": "Log output to console" + // } + "sern: Send ephemeral message": { + "scope": "js,ts", + "prefix": "ctxeph", + "body": [ + "ctx.reply({content: `$1`, ephemeral: true})", + ], + "description": "Send an ephemeral message with some content." + }, + "sern: Send message with empty array": { + "scope": "js,ts", + "prefix": "ctxopt", + "body": [ + "ctx.reply({$1})", + ], + "description": "Send a message with an empty array." + }, + "sern: Create a simple event": { + "scope": "js,ts", + "prefix": "sernevent", + "body": [ + "const { EventType, eventModule } = require('@sern\/handler');\r\n\r\nexport default eventModule({\r\n type: EventType.${1:Discord},\r\n name : '$2',\r\n execute($3) {\r\n $4\r\n }\r\n })" + ], + "description": "Create a simple event in sern." + }, + "sern: Create a simple command": { + "scope": "js,ts", + "prefix": "serncommand", + "body": [ + "const { commandModule, CommandType } = require('@sern\/handler');\r\n\r\nexport default commandModule({\r\n\ttype: CommandType.$1,\r\n\tplugins: [],\r\n\tdescription: '$2',\r\n\toptions: [],\r\n\texecute: async (ctx, options) => {\r\n\t\t$3\r\n\t},\r\n});" + ], + "description": "Create a simple command in sern." + }, +} \ No newline at end of file diff --git a/vsc-extension-quickstart.md b/vsc-extension-quickstart.md new file mode 100644 index 0000000..2fadf67 --- /dev/null +++ b/vsc-extension-quickstart.md @@ -0,0 +1,23 @@ +# Welcome to your VS Code Extension + +## What's in the folder + +* This folder contains all of the files necessary for your extension. +* `package.json` - this is the manifest file that defines the location of the snippet file and specifies the language of the snippets. +* `snippets/snippets.code-snippets` - the file containing all snippets. + +## Get up and running straight away + +* Press `F5` to open a new window with your extension loaded. +* Create a new file with a file name suffix matching your language. +* Verify that your snippets are proposed on IntelliSense. + +## Make changes + +* You can relaunch the extension from the debug toolbar after making changes to the files listed above. +* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes. + +## Install your extension + +* To start using your extension with Visual Studio Code copy it into the `/.vscode/extensions` folder and restart Code. +* To share your extension with the world, read on https://code.visualstudio.com/docs about publishing an extension.