0.0.3-beta.292 • Published 4 years ago

@smartcloudai/discord v0.0.3-beta.292

Weekly downloads
-
License
GNU GPLv3
Repository
gitlab
Last release
4 years ago

Discord

npm.io

{% hint style="success" %}

I already use Discord Bot Maker, and want to switch!

As discord bot maker was built using a similar method of JSON structuring, we decided to build a direct conversion tool for users who already use DBM. Once you have installed SCAA, simply head over to our tutorial on how to convert! {% endhint %}

This "framework" (term used lightly) is developed to make creating discord bots extremely easy for end users and developers. Built on the Typescript coding platform, it features tools for ts, js and json creation of commands and events.

Even though this could be used as an framework for back-end developers, we have built it with the intention of front end editing and production. Everything you can create and make from the back-end can also be created using the SCAA web portal, WordPress plugin or API.

Please see the SCAA Core project for information regarding initial setup and installation of Smart Cloud Artificial Assistant if you intend to use all the features of this software.

JSON driven, what the *?

Yeah we know, that term is slightly confusing for most users. We are claiming this title under the understanding that Discord Bot Maker is an application and not a framework as it is limited on the ability to extend and has reduced functionality.

We have built this framework to be as simple to use while maintaining functionality for the end users. We have introduced unprecedented customisation into a system with extremely minimal effort to actually use. To prove how simple our system actually is, we have developed a command using JSON to build new JSON commands!

Obviously there is more to this than meets the eye, there is still a lot of Javascript involved, so we have build a handy selection of guides to get you started!

{% page-ref page="guides/" %}

Why use over other Discord.js Frameworks?

We don't expect everyone to just drop frameworks which already exist, that would seriously scare our team as we really ain't anywhere near ready for that level of responsibility. What we do want to do is make an impact, be seen as a serious tool for discord bots.

But JSON isn't capable of the customisation which others can using JavaScript....

This was one of the most scary things for us to hear from the community during the development of this framework, people doubting that customisation would be sufficient for complex discord bots. We really wanted to prove these doubters wrong.

So we created custom handlers with such depth, you can access any option using JSON without even having to think about the JavaScript behind it. Imagine the following command:

{
  "name": "demo",
  "alias": [],
  "version": "0.0.2",
  "description": "demo command",
  "helpInformation": "",
  "permissions": "none",
  "usage": "<action>",

  "args": true,
  "minargs": 0,
  "localargs": {
    "name": "smartcloud#0001",
    "local": 1
  },
  "guildOnly": true,
  "execute": [
      {"action": "demo", "options": {"vars": {"names": "*m0*&&*c1*||*m1*", "mentions": "*m1*", "returned": "+[savevar.3.var]+", "local": "[name]", "server": "<server>", "global": "{global}"}}, "typing": {"active": true, "mode": "channel"} },
      "pong"
  ]
}

The execute of this command is an array[] which is cycled through.

regexOptionAction
option&&optionCreate array of options
option||optionReturn option1 or option2
*option*↓↓↓Find argument
a<number>Find arg
m<number>Find Mentioned user
c<number>Find Mentioned Channel
r<number>Find Mentioned role
[option]optionFind local variable
<option>optionFind server variable
{option}optionFind global variable
+action.inst.var+↓↓↓Find returned value
actionFind the named action
instFind action instance
varWhich returned variable

{% hint style="info" %} && is always passed before ||

This therefore means an option of "*m0*&&*c1*||*m1*&&<option>" would always return:

[ MentionedUser0 , (Channel1 or MentionedUser1) , ServerOption ] {% endhint %}

Module Installation

This module can be run as either part of Smartcloud Artificial Assistant, or as standalone framework for discord bots. Using our auto installer, it comes completely operational with default commands, events and actions.

From within the @smartcloud/cli user can choose to install, create and upload their own modules with actions, events and commands to our repository much like npm does, allowing for continuous grouth of the applications abilities without the hassle which is often involved when building customised applications.

Using our auto installer for SCAA operation

Running our auto installer is super easy and guides you through all the steps.

Simply install our command line interface using:

npm i -g @smartcloud/cli

Once installed, run the command

smartcloud install

You can read more about our installation options here:

{% page-ref page="installation.md" %}

Framework information

Key
Tested & Deployed
xNot supported
PIn Planning Phase
DIn Development Phase
TIn Testing Phase
RRejected Proposal
<x>Please see note x below

General

General details about the frameworks, such as versions.

0.0.0
Discord.js^11.5.1
Node.js^12.9.1
Typings✓ †1
Dependencies1 †2
Documentation
VS Code ExtensionR

†1 Written in typescript
†2 Without optional dependencies, functionality may be reduced

Command Parsing

Command parsing is how frameworks parse messages into commands.

Definition0.0.0
Command aliasesCall the command something else
Mention as prefixMention the bot to trigger commands
Multiple prefixesHave multiple prefixes trigger the bot
Per-guild prefix customisationUse different prefixes for each guildD
Regular expression triggerUse regular expression triggers to start a command
Stores original inputStore the original input somewhere accessible

Command Handling

Command handling refers to the behaviour of command execution and restrictions. It also includes the monitoring of and the inhibition of messages and commands. Subcommands are commands that are individual commands with the same base name.

Definition0.0.0
CooldownsBlock the command for x length of time
Monitoring messagesMonitor messages for commands
Blocking messagesBlock & delete messages based on filtersD
Channel restrictionsBlock commands based on channel type
Permissions restrictionsBlock commands based on permissionsD
Command CreationCreate files from file editing
Command editsEdit commands from file editing
Command CreationCreate files from frontend interfaceP
Command editsEdit commands from frontend interfaceP
SubcommandsHave commands use same base nameD
Run from codeRun the command from code
Run from JSONRun the command from JSON file
Typing modeTurn on / off bot typing modeP
Help informationShow help information when required

Argument Parsing

Arguments are the data acquired and parsed from user input. This section compares how frameworks can match and parse input.

Definition0.0.0
Ordered argumentsArguments called in specific order
Unordered argumentsArguments not called in specific orderD
Optional argumentsArguments optional
User and member matchingFind user and membersP
Role matchingFind rolesP
Channel matchingFind channelsP

Prompting

Prompting is the ability to collect messages from the user without invoking a command directly.

Definition0.0.0
From argument parsingPrompt from arg parse issueP
Prompt from codePrompt from codeP
Prompt time limitPrompt using timersP
Prompt retry limitPrompt using attempt countsP
Prompt cancellationPrompt when action is cancelledP
Infinite promptsPrompt continuouslyP
Custom text prompt systemPrompt with user defined textP
Custom prompt messagesCustom create prompt messagesP
Stores prompts and repliesStore prompt responses accessiblyP
Reaction prompt systemListens for reactionsP

Module System

The module system of a framework is how the framework structures its modules. This includes how new modules (e.g. commands) are created and loaded.

Definition0.0.0
Find modulesFind modules from multiple locations
Require ModulesRequire found modules
TypeScript module supportUse .ts files and modules
Recursive loadingLoad modules recursively
Loading and unloadingLoad modules & Unload on demand
Reloading modulesReload modules on demand
Module categoriesCategories for modules in help
Custom module typesDefine Module types (e.g. fun)
Plugins supportSupport requiring pluginsP

Events System

Events that are useful for a framework

Definition0.0.0
Modular event listenersCreate event listeners from modules
On invalid commandsBroadcast event on invalid commands
On command blockedBroadcast event on blocked commands
On command startBroadcast event on command started
On command endBroadcast event on command finished
On command errorBroadcast event on command error
On database changesBroadcast event when database updatesP
On module changesBroadcast event when detects module changesP
Custom eventsBroadcast user defined events

Database System

Database support is listed here, alongside settings that can be changed for Discord.

Definition0.0.0
FireStoreP †1
Leveldb
MongoDBP †1
MSSQLP †1
MySQLP †1
NeDB
Neo4J
PostgreSQLP †1
RethinkDB
SequelizeD †1
SQLiteP †1
Custom providersP
Disabled commandsDisable commands through databaseP
BlacklistBlacklist users through databaseP
PrefixesChange prefix through databaseD
LocalisationChange language through databasex
Custom settingsStore custom settings in databaseP

†1 This is handled by requiring either separate module (read guide) or @smartcloud/core

Integrations

Database support is listed here, alongside settings that can be changed for Discord.

Definition0.0.0
FacebookLogin usersP †1
GoogleLogin usersP †1
TwitterLogin UsersP †1
Other Login ProvidersLogin UsersP †1
TwitchLogin Users & Run ActionsP †2
YoutubeLogin Users & Run ActionsP †2

†1 This is handled by requiring either separate module (read guide) or @smartcloud/core