Skip to content

Commit 3f82e78

Browse files
committed
Updated readme + added cmds
1 parent ec66aa0 commit 3f82e78

5 files changed

Lines changed: 64 additions & 3 deletions

File tree

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 Emeric
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,16 @@
11
# Basic
2-
Basic plugin for Skinny bot
2+
3+
|StyleCI|Stable Version|Downloads|License|
4+
|:------:|:------:|:------:|:------:|
5+
|[![StyleCI](https://styleci.io/repos/73423248/shield)](https://styleci.io/repos/73423248)|[![Latest Stable Version](https://img.shields.io/packagist/v/SkinnyBot/Basic.svg?style=flat-square)](https://packagist.org/packages/skinnybot/basic)|[![Total Downloads](https://img.shields.io/packagist/dt/skinnybot/basic.svg?style=flat-square)](https://packagist.org/packages/skinnybot/basic)|[![License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://packagist.org/packages/skinnybot/basic)|
6+
7+
Basic plugin for Skinny bot.
8+
9+
This plugin is primary used to show how to create plugin and for testing purpose.
10+
11+
## Commands
12+
|Commands|Description|
13+
|----|----|
14+
|`!say <text>`|The bot will say the `<text>` in a message.|
15+
|`!info`|Display the GitHub link of the Skinny's repository.|
16+
|`!time`|Display the running time of the bot. Format : ``%a days, %h hours, %i minutes and %s seconds`.|

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "skinnybot/basic",
33
"description": "A simple plugin for Skinny.",
44
"homepage": "https://github.com/SkinnyBot/Basic",
5-
"keywords": ["discord", "bot", "php", "discordphp", "botphp", "skinny", "plugin"],
5+
"keywords": ["discord", "bot", "php", "discordphp", "botphp", "skinny", "plugin", "basic"],
66
"type": "skinny-plugin",
77
"license": "MIT",
88
"support": {

config/commands.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
'say' => [
55
'params' => 1,
66
'syntax' => 'Say [Message]'
7-
]
7+
],
8+
'info' => [
9+
'params' => 0,
10+
'syntax' => 'Info'
11+
],
12+
'time' => [
13+
'params' => 0,
14+
'syntax' => 'Time'
15+
],
816
]
917
];

src/Module/Modules/Basic.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
namespace Basic\Module\Modules;
33

4+
use DateTime;
45
use Skinny\Module\ModuleInterface;
56
use Skinny\Network\Wrapper;
67

@@ -46,6 +47,23 @@ public function onCommandMessage(Wrapper $wrapper, $message)
4647
case 'say':
4748
$wrapper->Channel->sendMessage($message['parts'][1]);
4849

50+
break;
51+
52+
case 'info':
53+
$wrapper->Message->reply(
54+
'I\'m open-source! You can find me on GitHub : https://github.com/SkinnyBot/Skinny .'
55+
);
56+
57+
break;
58+
59+
case 'time':
60+
$seconds = floor(microtime(true) - TIME_START);
61+
$start = new DateTime("@0");
62+
$end = new DateTime("@$seconds");
63+
$wrapper->Message->reply(
64+
'I\'m running since ' . $start->diff($end)->format('%a days, %h hours, %i minutes and %s seconds.')
65+
);
66+
4967
break;
5068
}
5169
}

0 commit comments

Comments
 (0)