Giter VIP home page Giter VIP logo

slappey's Introduction

Slappey

Slap together a Discord Bot project in seconds!

slappey-logo

What is Slappey?

Slappey is a CLI (Command Line Interface) tool that lets you generate a Discord.JS project in a matter of seconds.

Why Slappey?

Do you use a Command/Event Handler? Are you tired of having to copy & paste the same files over and over again, or cloning a repository? Slappey serves as a purpose to eliminate the annoyance of doing that. Instead, with a simple command, Slappey will generate a base structure for your next Discord Bot Project.

It does so by using the most basic command & event handler. Simplicity is key. And since it works well, why change it? Regardless, if you need to try some things out without needing to re-write the same functions all the time, Slappey is great for that.

It also eliminates the abstraction away from users so they need not worry about how commands and events are registered. It will just work out of the box.

What Slappey is NOT

  • Framework
  • Library
  • Discord Bot (It is a Discord Bot Project generator)
  • Replacement for coding

Getting Started

Install slappey by running npm install -g slappey or yarn global add slappey on your terminal or Windows CMD. This will install Slappey globally.

  • To create a project, type slappey, or simply type slappey new <name of project> in your Terminal or Command Prompt.
  • Follow the steps and enter your Bot Token and Prefix.
  • Once done, cd into your project by typing cd <name of project>
  • To run the bot, type npm run dev or yarn dev. This will run the bot using nodemon which is installed locally.

Generating Commands

  • Slappey allows you to generate commands into categories. You can type slappey and select Generate to generate a command, or slappey gen command.
  • It will ask you for a name, and then a category. This will generate all commands in the src/commands folder, in the correct category.
  • You can also generate a command by typing slappey gen command. This will prompt you for a command name and category.

Generating Events

  • You can generate events by running slappey gen event, this will prompt you to select which events you would like to generate.
  • To select event(s), press space bar and use the up and down arrow keys to navigate. Hit enter when you're done and your event files will be generated in the src/events folder.

Will Slappey support TypeScript?

  • Soon

Slappey now supports TypeScript as of 6/1/2020!

You must have TypeScript installed. However, if you don't, during the installation process, if you selected TypeScript, Slappey will ask you if you would like to install TypeScript, ts-node, and setup a basic tsconfig.json file. If you enter n (no), you will have to install these manually.

ts-node is a TypeScript interpreter for Node.JS, the dev script uses it along with nodemon, so be sure you have nodemon installed.

Otherwise, if you have TypeScript installed, you can skip this part and just run npm run build and then npm run start

Will Slappey support Python?

  • Soon

Recipes

Integrating with Sequelize

Implementation Provided Soon

Integrating with Mongoose

Implementation Provided Soon

Integrating with MongoDB

Implementation Provided Soon

Integrating with QuickDB

Implementation Provided Soon

Integrating with Lavalink

Implementation Provided Soon

slappey's People

Contributors

creeperplanet26 avatar dependabot[bot] avatar graphyql avatar harryallen1 avatar stuyy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slappey's Issues

prefix case sensetive

need help with command handler is there any way to make your prefix not case sensitive like r!help people have to type R!help in mobile and r!help in the desktop can someone help me with this

Running Issue

I was trying to install slappey by running 'npm install -g slappey'. The Installation Succeeded but I still get an error: 'env: node\r: No such file or directory'.
(i am on macos and have npm and node)

Subcommands and more

It may be a good idea to add subcommands to the command/commandhandler.
and stuff like AdminOnly / GuildOnly.

the BaseCommand.ts class could be something like this:

export default abstract class BaseCommand {
  constructor(private name: string, private description: string, private category: string, private args: boolean, private guildOnly: boolean, private adminOnly: boolean, private subCommands: [], private aliases: Array<string>) {}

  getName(): string { return this.name; }
  getDescription(): string { return this.description; }
  getCategory(): string { return this.category; }
  getArgs(): boolean { return this.args; }
  getGuildOnly(): boolean { return this.guildOnly; }
  getAdminOnly(): boolean { return this.adminOnly; }
  getSubCommands(): [] { return this.subCommands; }
  getAliases(): Array<string> { return this.aliases; }


  abstract run(client: DiscordClient, message: Message, args: Array<string> | null): Promise<void>;
}

this is just an example and i couldnt get it working. Someone more experianced then me should be able to figure it out quite easily i think.

Prefix

This is yet to be fixed...
Prefix: $
All work:
ahelp
help
!help
qhelp
etc

not a slappey project

when i got to cmd and the type slappy and create a command and then i type command name and category after then i press enter/space it say this Error: Not a slappey project
at Object. (C:\Users\saimp\AppData\Roaming\npm\node_modules\slappey\lib\scaffold.js:107:15)
at Generator.next ()
at fulfilled (C:\Users\saimp\AppData\Roaming\npm\node_modules\slappey\lib\scaffold.js:5:58)

Version selector

I want to install v11 with slappey but I can't select a version in a menu. Is this still a thing or is this removed?

How do i host it

Everything is working fine in my pc but when i try to host it on my hosting provider it gives me an error that cannot find index.js file but i fixed that by just moving the files from src to the root then it gives me error that cannot find slappey.json idk what to do here is the slappey.json error:

Error: Cannot find module '../slappey.json'
Require stack:

  • /home/container/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Module.require (internal/modules/cjs/loader.js:903:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object. (/home/container/index.js:4:16)
    at Module._compile (internal/modules/cjs/loader.js:1015:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
    at Module.load (internal/modules/cjs/loader.js:879:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [ '/home/container/index.js' ]
    }

Issue with commands

Hey,

I've noticed that you are able to use any prefix for a command.

So for example if I set my prefix to "!", I will be able to type !help and also .help, ?help etc...

Type Error: Bot is not a legal HTTP Value

Ever since I started using Slappey I've gotten this error. I've done everything, and I've found out its a Discord.JS error, I made a bot from scratch and there was no Discord.JS error. This has been bothering me for days.

descriptions

using JS: How do I add description to each command to pull into help command?
I already implemented description into BaseCommand like constructor(name, category, aliases, description) and used this.description under this.aliases.

Can anyone help with installing?

Heyyoo!

I've just come accross slappey and tried to use it, and the only thing that is currently working for me is npm i -g slappey
This installs + [email protected] and then when I continue to use the slappey command in the exact same terminal window, it prints back as an unknown command.

I am currently using the Windows Terminal App from the Microsoft Store. Free and made by Microsoft.

If anyone can help that would be awesome!

Thanks again,
~ Jack

my bot keeps repeating commands

my bot keeps repeating the command text 4 to 5 sometimes it just 2 times and it all in one masg but sometimes its delayed by a 1 sec or 2. if anyone knows what causing this please help me

Change in-strings template to a template repository

You may use a template repositoy for the project boilerplate because having all of the code in strings is not very easy to maintain, and so when you create a new project you just clone the repository and then install the deps

Prefix

Prefix: $
$help
ahelp
bhelp
!help
chelp

Those all work doesn't detect prefix correctly.

Generating Events or Commands in a JS project always creates a Typescript file

I've just upgraded from 2.0.0 to 3.0.0 and created a new command in an existing project - the new command was created as Typescript not Javascript.

The same is happening for generated events and appears to be happening in freshly created projects with 3.0.0 and old projects.
I'd hazard a guess that the language in slappey.json is being ignored.

Slappey not creating new events

Exactly as the title says.

Slappey Installed on OS X - won't create new events.
Creating commands work just fine but selecting generate->event and then any event doesn't create a new event. in ./src/events

Not tested on any other platform.

Cannot Gen Event

Hello I'm using the latest version of slappey as of 12/31 its version 3.0 and Whenever i try and generate a event i select one and press enter but then nothing ever generates and when in the terminal it has the check next to Which event(s) would you like to generate.

Slappey generated project Token_invalid and a new token wont work

So i got this error today when creating a new project today with slappey and it says exactly that in the picture everytime i try to launch the bot A new bot token wont work either and i havent touched the .env file either hope this issue somehow can get resolved
image
Edit: i fixed the problem by doing client.login('TOKEN'); in bot.js but .env file doest work

Events not generating

Slappey does not generate the events it's supposed to generate.
in /events are only /message and /ready

cannot find module '../slappey.json'.

version: 3.0.0
lang: typescript
manager: yarn
os: windows 10
reproducing the error:
when i run npm run dev i get the error:

src/index.ts:3:20 - error TS2732: Cannot find module '../slappey.json'. Consider using '--resolveJsonModule' to import module with'.json' extension.

hope the error can be resolved in the near future

guildMemberAdd not firing

I generated the guildMemberAdd event, but when a member joins it doesn't fire.

here is the code:

const BaseEvent = require('../utils/structures/BaseEvent');
const { MessageEmbed } = require('discord.js');

module.exports = class GuildMemberAddEvent extends BaseEvent {
  constructor() {
    super('guildMemberAdd');
  }
  
  async run(client, member) {
    console.log(`${member.user.tag} joined ${member.guild.name}!`);
  }
}

Unable to install Slappey

I tried installing Slappey and it simply gave back an error message. I have ran command prompt in admin and everything.

Log:
2020-12-22T03_36_31_046Z-debug.log

Command Prompt:
npm WARN deprecated @types/[email protected]: This is a stub types definition. log-symbols provides its own type definitions, so you do not need this installed.
npm ERR! Unexpected end of JSON input while parsing near '..."integrity":"sha512-H'

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Steve\AppData\Roaming\npm-cache_logs\2020-12-22T03_38_06_151Z-debug.log

Thank you!

Bot Prefix

When making a new project, the bot will reply as long as any 1 letter prefix is used.

Issue with TypeScript

Hello, I am trying to make a discord bot with slappey and typescript and for some reason i can't use npm run start
Please help!

Files should be named in kebab-case

PascalCase - Should only be used for classes.
camelCase - Should be used for variables, functions, etc.
snake_case/SNAKE_CASE - Capitalized is usually used for constants and non capitalized for database fields.
kebab-case - Used in URLs and files. Super easy to read which makes it so convenient.

One of the reasons why this should be changed is because eslint-plugin-unicorn will throw validation errors in the file and will not allow prettier or eslint to work until the issue is resolved.

Type 'void' is not assignable to type 'Message'

I have a problem creating a new command (with slappey help ofc) and I still get this error when I try to run the bot:

Property 'run' in type 'HelpCommand' is not assignable to the same property in base type 'BaseCommand'. Type '(client: DiscordClient, message: Message, args: string[]) => Promise<void>' is not assignable to type '(client: DiscordClient, message: Message, args: string[]) => Promise<Message>'. Type 'Promise<void>' is not assignable to type 'Promise<Message>'. Type 'void' is not assignable to type 'Message'.

Can someone explain why this happens?

Unable to install

i cant install slappey

it says: " 'npm' is not recognized as an internal or external command,
operable program or batch file."

Error while compiling typescript.

This is the error:

(node:32588) UnhandledPromiseRejectionWarning: TSError: ⨯ Unable to compile TypeScript:
src/utils/structures/BaseCommand.ts:12:12 - error TS1243: 'async' modifier cannot be used with 'abstract' modifier.

12   abstract async run(client: DiscordClient, message: Message, args: Array<string> | null): Promise<void>;

How to fix it: In the part where it says this abstract async run(client: DiscordClient, message: Message, args: Array<string> | null): Promise<void>, You must remove the async there.

Slappey not running

So I have run the install command for slappey on my machine.

npm i -g slappey

and it wont run when i type slappey into the cmd shell.

I get the following error. I am unaware if this is a system or a slappey issue or whether there is a fix to this or not.

Please note that this worked about 3 months ago on a different project and now I have issues.

=== ERROR ===

C:\Users\Orodg\OneDrive\Documents\Discord_Bots\JS bots\V12\Tales of the outer rim>slappey
'slappey' is not recognized as an internal or external command,
operable program or batch file.

slappey is not recognized as an internal or external command

Hello Im Achutaine
I have a issue with slappey I have installed it and tried uninstalling it and reinstalling it, I have installed it globally and I get the following error:
'slappey' is not recognized as an internal or external command, operable program or batch file.

I have even ran npm list -g --depth 0 and it showed the following:
+-- [email protected]

If anyone knows how to fix this error please let me know as others have also been getting the same error and there is not really a type of guide on how to fix this, also please respond only with a answer that would work as I have seen others make this issue and been left on something that dosen't work.

TypeError: Event is not a constructor

When I use Slappey with TypeScript, if I add basically any code, I get the following error:
(node:25992) UnhandledPromiseRejectionWarning: TypeError: Event is not a constructor
at registerEvents (C:\Users........\src\utils\registry.ts:31:21)
(Use node --trace-warnings ... to show where the warning was created)
(node:25992) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:25992) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

It's doesn't break the bot, it just annoying. Is there any way to fix this?

suggestion (if this is the right place) - aliases

basically what I'm thinking of is that when you generate a command you can choose the name and category as normal but after category, you can add aliases separated by spaces
for example, it could look like this:

C:\[insert bot path here]>slappey
√ What would you like to do? » Generate
√ What would you like to generate? » Command
√ Enter the name of the command ...  command
√ Enter the category of the command ...  command category
? Enter one or more aliases separated by spaces...  command_alias_1 command_alias_2

C:\[insert bot path here]>

Aliases

Is there a way to add aliases and description of a command
Or can u tell me which files to edit so that I can do it on my own

Auto-generated message event not working

I'm trying to create a bot and I have followed the docs from Slappey and for some reason the Message Event is not working. I'm trying to call message.channel and message.author and it is saying that they are not a function.
Screen Shot 2020-12-15 at 1 48 05 PM

Code: https://hastebin.com/eyozoqewud.js

The constructor and run event are the same as generated so I have no clue what is going on.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.