init
This commit is contained in:
		
						commit
						6669b3fb8f
					
				
							
								
								
									
										34
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,34 @@ | |||||||
|  | # dependencies (bun install) | ||||||
|  | node_modules | ||||||
|  | 
 | ||||||
|  | # output | ||||||
|  | out | ||||||
|  | dist | ||||||
|  | *.tgz | ||||||
|  | 
 | ||||||
|  | # code coverage | ||||||
|  | coverage | ||||||
|  | *.lcov | ||||||
|  | 
 | ||||||
|  | # logs | ||||||
|  | logs | ||||||
|  | _.log | ||||||
|  | report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json | ||||||
|  | 
 | ||||||
|  | # dotenv environment variable files | ||||||
|  | .env | ||||||
|  | .env.development.local | ||||||
|  | .env.test.local | ||||||
|  | .env.production.local | ||||||
|  | .env.local | ||||||
|  | 
 | ||||||
|  | # caches | ||||||
|  | .eslintcache | ||||||
|  | .cache | ||||||
|  | *.tsbuildinfo | ||||||
|  | 
 | ||||||
|  | # IntelliJ based IDEs | ||||||
|  | .idea | ||||||
|  | 
 | ||||||
|  | # Finder (MacOS) folder config | ||||||
|  | .DS_Store | ||||||
							
								
								
									
										15
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,15 @@ | |||||||
|  | # fantastic_spoon_dc | ||||||
|  | 
 | ||||||
|  | To install dependencies: | ||||||
|  | 
 | ||||||
|  | ```bash | ||||||
|  | bun install | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | To run: | ||||||
|  | 
 | ||||||
|  | ```bash | ||||||
|  | bun run index.ts | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | This project was created using `bun init` in bun v1.2.10. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime. | ||||||
							
								
								
									
										30
									
								
								bun.lock
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								bun.lock
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,30 @@ | |||||||
|  | { | ||||||
|  |   "lockfileVersion": 1, | ||||||
|  |   "workspaces": { | ||||||
|  |     "": { | ||||||
|  |       "name": "fantastic_spoon_dc", | ||||||
|  |       "dependencies": { | ||||||
|  |         "seyfert": "^3.0.0", | ||||||
|  |       }, | ||||||
|  |       "devDependencies": { | ||||||
|  |         "@types/bun": "latest", | ||||||
|  |       }, | ||||||
|  |       "peerDependencies": { | ||||||
|  |         "typescript": "^5", | ||||||
|  |       }, | ||||||
|  |     }, | ||||||
|  |   }, | ||||||
|  |   "packages": { | ||||||
|  |     "@types/bun": ["@types/bun@1.2.10", "", { "dependencies": { "bun-types": "1.2.10" } }, "sha512-eilv6WFM3M0c9ztJt7/g80BDusK98z/FrFwseZgT4bXCq2vPhXD4z8R3oddmAn+R/Nmz9vBn4kweJKmGTZj+lg=="], | ||||||
|  | 
 | ||||||
|  |     "@types/node": ["@types/node@22.15.2", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-uKXqKN9beGoMdBfcaTY1ecwz6ctxuJAcUlwE55938g0ZJ8lRxwAZqRz2AJ4pzpt5dHdTPMB863UZ0ESiFUcP7A=="], | ||||||
|  | 
 | ||||||
|  |     "bun-types": ["bun-types@1.2.10", "", { "dependencies": { "@types/node": "*" } }, "sha512-b5ITZMnVdf3m1gMvJHG+gIfeJHiQPJak0f7925Hxu6ZN5VKA8AGy4GZ4lM+Xkn6jtWxg5S3ldWvfmXdvnkp3GQ=="], | ||||||
|  | 
 | ||||||
|  |     "seyfert": ["seyfert@3.0.0", "", {}, "sha512-Gs8e3gBqNgo6KCsCHND1k6I+rtKIeI/aUfA+AC4YQrgV9oiPwrWSCr9F4+Vu6S9IaTEyW9Tl7pkWfTXsukjbwA=="], | ||||||
|  | 
 | ||||||
|  |     "typescript": ["typescript@5.8.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ=="], | ||||||
|  | 
 | ||||||
|  |     "undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="], | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										1
									
								
								commands.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								commands.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | |||||||
|  | [{"name":"mcs","type":1,"nsfw":false,"description":"Qeury a Minecraft server","contexts":[0,1,2],"integration_types":[0],"options":[{"name":"ip","description":"Server IP","type":3,"name_localizations":{},"description_localizations":{},"autocomplete":false}]},{"name":"ping","type":1,"nsfw":false,"description":"Show latency with Discord","contexts":[0,1,2],"integration_types":[0],"options":[]}] | ||||||
							
								
								
									
										18
									
								
								package.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								package.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,18 @@ | |||||||
|  | { | ||||||
|  |   "name": "fantastic_spoon_dc", | ||||||
|  |   "module": "index.ts", | ||||||
|  |   "type": "module", | ||||||
|  |   "private": true, | ||||||
|  |   "devDependencies": { | ||||||
|  |     "@types/bun": "latest" | ||||||
|  |   }, | ||||||
|  |   "scripts": { | ||||||
|  |     "dev": "bun --env-file=.env --watch src/index.ts" | ||||||
|  |   }, | ||||||
|  |   "peerDependencies": { | ||||||
|  |     "typescript": "^5" | ||||||
|  |   }, | ||||||
|  |   "dependencies": { | ||||||
|  |     "seyfert": "^3.0.0" | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										14
									
								
								seyfert.config.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								seyfert.config.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,14 @@ | |||||||
|  | import { config } from "seyfert"; | ||||||
|  |   | ||||||
|  | export default config.bot({ | ||||||
|  |     token: process.env.DC_TOKEN ?? "", | ||||||
|  |     locations: { | ||||||
|  |         base: "src", // replace with "src" if using bun
 | ||||||
|  |         commands: "commands" | ||||||
|  |     }, | ||||||
|  |     intents: ["Guilds"], | ||||||
|  |     // This configuration is optional, in case you want to receive interactions via HTTP
 | ||||||
|  |     // This allows you to use both the gateway and the HTTP webhook
 | ||||||
|  |     publicKey: process.env.PUBLIC_KEY ?? "", // replace with your public key
 | ||||||
|  |     port: 3275, // replace with your application's port 
 | ||||||
|  | }); | ||||||
							
								
								
									
										30
									
								
								src/commands/mcs.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								src/commands/mcs.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,30 @@ | |||||||
|  | import { | ||||||
|  |   Command, | ||||||
|  |   Declare, | ||||||
|  |   Options, | ||||||
|  |   createStringOption, | ||||||
|  |   type CommandContext | ||||||
|  | } from 'seyfert'; | ||||||
|  |   | ||||||
|  | const options = { | ||||||
|  |   ip: createStringOption({ | ||||||
|  |     description: "Server IP", | ||||||
|  |   }), | ||||||
|  | }; | ||||||
|  |   | ||||||
|  | @Declare({ | ||||||
|  |   name: 'mcs', | ||||||
|  |   description: 'Qeury a Minecraft server', | ||||||
|  | }) | ||||||
|  | @Options(options) | ||||||
|  | export default class McsCommand extends Command { | ||||||
|  |   | ||||||
|  |   async run(ctx: CommandContext<typeof options>) { | ||||||
|  |     const ip = ctx.options.ip || 'hypixel.net'; | ||||||
|  |     const port = 25565; | ||||||
|  |   | ||||||
|  |     await ctx.write({ | ||||||
|  |       content: `${ip}:${port}`, | ||||||
|  |     }); | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										16
									
								
								src/commands/ping.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								src/commands/ping.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,16 @@ | |||||||
|  | import { Declare, Command, type CommandContext } from 'seyfert'; | ||||||
|  |   | ||||||
|  | @Declare({ | ||||||
|  |   name: 'ping', | ||||||
|  |   description: 'Show latency with Discord' | ||||||
|  | }) | ||||||
|  | export default class PingCommand extends Command { | ||||||
|  |   async run(ctx: CommandContext) { | ||||||
|  |     // Average latency between existing connections
 | ||||||
|  |     const ping = ctx.client.gateway.latency; | ||||||
|  |   | ||||||
|  |     await ctx.write({ | ||||||
|  |       content: `The latency is \`${ping}\`` | ||||||
|  |     }); | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										13
									
								
								src/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								src/index.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,13 @@ | |||||||
|  | import { Client } from "seyfert"; | ||||||
|  |   | ||||||
|  | import type { ParseClient } from "seyfert"; | ||||||
|  | 
 | ||||||
|  | declare module 'seyfert' { | ||||||
|  |     interface UsingClient extends ParseClient<Client<true>> { } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const client = new Client(); | ||||||
|  |   | ||||||
|  | // This will start the connection with the Discord gateway and load commands, events, components, and language (i18n)
 | ||||||
|  | client.start() | ||||||
|  |   .then(() => client.uploadCommands({ cachePath: './commands.json' })); | ||||||
							
								
								
									
										28
									
								
								tsconfig.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								tsconfig.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,28 @@ | |||||||
|  | { | ||||||
|  |   "compilerOptions": { | ||||||
|  |     // Environment setup & latest features | ||||||
|  |     "lib": ["ESNext"], | ||||||
|  |     "target": "ESNext", | ||||||
|  |     "module": "ESNext", | ||||||
|  |     "moduleDetection": "force", | ||||||
|  |     "jsx": "react-jsx", | ||||||
|  |     "allowJs": true, | ||||||
|  | 
 | ||||||
|  |     // Bundler mode | ||||||
|  |     "moduleResolution": "bundler", | ||||||
|  |     "allowImportingTsExtensions": true, | ||||||
|  |     "verbatimModuleSyntax": true, | ||||||
|  |     "noEmit": true, | ||||||
|  | 
 | ||||||
|  |     // Best practices | ||||||
|  |     "strict": true, | ||||||
|  |     "skipLibCheck": true, | ||||||
|  |     "noFallthroughCasesInSwitch": true, | ||||||
|  |     "noUncheckedIndexedAccess": true, | ||||||
|  | 
 | ||||||
|  |     // Some stricter flags (disabled by default) | ||||||
|  |     "noUnusedLocals": false, | ||||||
|  |     "noUnusedParameters": false, | ||||||
|  |     "noPropertyAccessFromIndexSignature": false | ||||||
|  |   } | ||||||
|  | } | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user