cordejs / corde Goto Github PK
View Code? Open in Web Editor NEW๐ค A simple e2e library for testing Discord Bots ๐
Home Page: https://cordejs.org
License: MIT License
๐ค A simple e2e library for testing Discord Bots ๐
Home Page: https://cordejs.org
License: MIT License
This must be done due to Discord.js accept only node v12 or newer
Create a folder types
for all project types in lib folder
Start to use the extensions: *.js, *.ts, and files like corde only, without extension
Dependabot encountered the following error when parsing your .dependabot/config.yml
:
The property '#/update_configs/1/package_manager' value "daily" did not match one of the following values: javascript, ruby:bundler, php:composer, java:maven, elixir:hex, rust:cargo, java:gradle, dotnet:nuget, go:dep, go:modules, docker, elm, submodules, github_actions, python, terraform
Please update the config file to conform with Dependabot's specification using our docs and online validator.
Strucure
mustSetAFKChannel(channel: ChannelResolvable)
When a internal error appear in tests executions while bots are loged. this happens i.e:
Client bot is ready for tests!
TypeError: test is not a function
at Object.<anonymous> (E:\Git\concord\tests\simple-messages\testWait1.js:3:1)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:643:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Module.require (internal/modules/cjs/loader.js:683:19)
at require (internal/modules/cjs/helpers.js:16:16)
at E:\Git\concord\lib\shell.js:12:13
at Array.forEach (<anonymous>)
at Object.runTest (E:\Git\concord\lib\shell.js:10:13)
(node:2444) [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.
Error [ERR_UNHANDLED_ERROR]: Unhandled error. (ErrorEvent {
target: WebSocket {
_events: [Object: null prototype] {
message: [Function],
open: [Function],
error: [Function],
close: [Function]
},
_eventsCount: 4,
_maxListeners: undefined,
readyState: 2,
protocol: '',
_binaryType: 'nodebuffer',
_closeFrameReceived: false,
_closeFrameSent: false,
_closeMessage: '',
_closeTimer: null,
_closeCode: 1006,
_extensions: {},
_receiver: null,
_sender: null,
_socket: null,
_isServer: false,
_redirects: 0,
url: 'wss://gateway.discord.gg/?v=6&encoding=json',
_req: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 4,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: true,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [TLSSocket],
connection: [TLSSocket],
_header: 'GET /?v=6&encoding=json HTTP/1.1\r\n' +
'Sec-WebSocket-Version: 13\r\n' +
'Sec-WebSocket-Key: sLuzCsPoJKiWzJ+iZ5irTQ==\r\n' +
'Connection: Upgrade\r\n' +
'Upgrade: websocket\r\n' +
'Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits\r\n' +
'Host: gateway.discord.gg\r\n' +
'\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: undefined,
socketPath: undefined,
method: 'GET',
path: '/?v=6&encoding=json',
_ended: false,
res: null,
aborted: true,
timeoutCb: null,
upgradeOrConnect: false,
parser: [HTTPParser],
maxHeadersCount: null,
[Symbol(isCorked)]: false,
[Symbol(outHeadersKey)]: [Object: null prototype]
}
},
type: 'error',
message: 'WebSocket was closed before the connection was established',
error: Error: WebSocket was closed before the connection was established
at WebSocket.close (E:\Git\concord\node_modules\ws\lib\websocket.js:217:14)
at WebSocketConnection.destroy (E:\Git\concord\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:276:8)
at WebSocketManager.destroy (E:\Git\concord\node_modules\discord.js\src\client\websocket\WebSocketManager.js:52:28)
at ClientManager.destroy (E:\Git\concord\node_modules\discord.js\src\client\ClientManager.js:60:20)
at Client.destroy (E:\Git\concord\node_modules\discord.js\src\client\Client.js:292:25)
at Object.<anonymous> (E:\Git\concord\lib\bot.js:92:33)
at Generator.next (<anonymous>)
at fulfilled (E:\Git\concord\lib\bot.js:4:58)
at processTicksAndRejections (internal/process/task_queues.js:85:5)
})
at Client.emit (events.js:192:17)
at WebSocketConnection.onError (E:\Git\concord\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:374:17)
at WebSocket.onError (E:\Git\concord\node_modules\ws\lib\event-target.js:128:16)
at WebSocket.emit (events.js:203:13)
at abortHandshake (E:\Git\concord\node_modules\ws\lib\websocket.js:718:15)
at WebSocket.close (E:\Git\concord\node_modules\ws\lib\websocket.js:217:14)
at WebSocketConnection.destroy (E:\Git\concord\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:276:8)
at WebSocketManager.destroy (E:\Git\concord\node_modules\discord.js\src\client\websocket\WebSocketManager.js:52:28)
at ClientManager.destroy (E:\Git\concord\node_modules\discord.js\src\client\ClientManager.js:60:20)
at Client.destroy (E:\Git\concord\node_modules\discord.js\src\client\Client.js:292:25) {
context: ErrorEvent {
target: WebSocket {
_events: [Object: null prototype],
_eventsCount: 4,
_maxListeners: undefined,
readyState: 3,
protocol: '',
_binaryType: 'nodebuffer',
_closeFrameReceived: false,
_closeFrameSent: false,
_closeMessage: '',
_closeTimer: null,
_closeCode: 1006,
_extensions: {},
_receiver: null,
_sender: null,
_socket: null,
_isServer: false,
_redirects: 0,
url: 'wss://gateway.discord.gg/?v=6&encoding=json',
_req: [ClientRequest]
at processTicksAndRejections (internal/process/task_queues.js:85:5)
}
}
Now discord only search for files in a specific folder. Ignoring others.
/**
* Declare a bunch of code that will be executed **after each** test.
*
* More than one declaration of this code results in a list
* of functions to run, following a sequence of files
* reads and the positions of each `afterEach` call.
*
* @param fn code that will be executed **after each** tests finish
*/
export function afterEach(fn: () => void)
Dependabot encountered the following error when parsing your .dependabot/config.yml
:
The property '#/update_configs/0' did not contain a required property of 'directory'
Please update the config file to conform with Dependabot's specification using our docs and online validator.
Make user do not require to call "require" or "import" to use testing methods
This is in cases of questionaries in a command.
Ex:
command("create").mustReturn("What is your RPG name ?")
.then("Ice Frog").mustReturn("What is your class")
.then("Magician").mustReturn("Wellcome Lucas")
make
command("hello").not.shouldReturn("hello!!")
Instead of:
command("hello").shouldNotReturn("hello!!")
Dependabot couldn't parse the package-lock.json found at /package-lock.json
.
The error Dependabot encountered was:
Dependabot::DependencyFileNotParseable
๐จ You privatised your repo. ๐จ
Hello!
You have set your repository to private. From now on Greenkeeper is no longer free. We have disabled your repo for now.
Please enter your payment information at account.greenkeeper.io.
For pricing information, please visit https://greenkeeper.io/#pricing.
With this command, user can delete the last message sent by the bot(default) but can also delete the message by id or by order.
It also has some options
interface DeleteOption {
/**
* How many messages to delete
*/
amount?: number;
/**
* Defines its positions.
* @example
*
* // Supose that we have these messages:
*
* "Hi",
* "Hello",
* "Good morning"
*
* // If is passaed 0, 2
* // Messages "Good morning" and "Hi" will be deleted
*/
positions?: number | number[];
/**
* Deletes messages by its content
*/
content?: string | string[];
}
export function mustDeleteMessage(...content: string[]): void;
export function mustDeleteMessage(content: string | string[] | number | DeleteOption): void;
I.E:
command("delete").mustDeleteMessage() // Deletes last bot message sent
command("delete").mustDeleteMessage(1) // Deletes last bot message sent also
command("delete").mustDeleteMessage(2) // Deletes last 2 bot messages sent
command("delete").mustDeleteMessage({ amount: 10}) // Deletes last 10 bot messages sent
command("delete").mustDeleteMessage({ positions: [0, 2]}) // Deletes last and thirt message sent
command("delete").mustDeleteMessage({ content: ["Hi", "Hello" ]}) // Deletes Messages Hi and Hello
Structure
export function mustDeleteChannel(id: string)
Reply a message using the corde bot name
Structure:
export function mustReply(message: number | string)
It's totally confuse and complex to add new features. The project structure must be rewrite
This command allow user to create a config file with default values and with the desired extension
js, ts or json
the method "shouldReturn" must be "mustReturn"
This function run a code before each test
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.