Completed
Push — stable ( ce9d65...6568cb )
by Sydney
02:01 queued 01:19
created

onCommand()   A

Complexity

Conditions 4

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 22
Bugs 4 Features 0
Metric Value
c 22
b 4
f 0
dl 0
loc 7
rs 9.2
cc 4
1
#    Copyright 2017 Starbot Discord Project
2
# 
3
#    Licensed under the Apache License, Version 2.0 (the "License");
4
#    you may not use this file except in compliance with the License.
5
#    You may obtain a copy of the License at
6
# 
7
#        http://www.apache.org/licenses/LICENSE-2.0
8
# 
9
#    Unless required by applicable law or agreed to in writing, software
10
#    distributed under the License is distributed on an "AS IS" BASIS,
11
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
#    See the License for the specific language governing permissions and
13
#    limitations under the License.
14
15
from api import command, message, plugin
16
17
def onInit(plugin_in):
18
    gitsrc_command = command.Command(plugin_in, 'source', shortdesc='Get the git repo for the bot!')
19
    docs_command = command.Command(plugin_in, 'docs', shortdesc='Get a link to the bot\'s documentation')
20
    tests_command = command.Command(plugin_in, 'tests', shortdesc='Get a link to the bot\'s tests')
21
    return plugin.Plugin(plugin_in, 'tinyurl', [gitsrc_command, docs_command, tests_command])
22
23
async def onCommand(message_in):
24
    if message_in.command == 'source':
25
        return message.Message(body="https://github.com/StarbotDiscord/Starbot")
26
    if message_in.command == 'docs':
27
        return message.Message(body="http://starbot.readthedocs.io/en/latest/")
28
    if message_in.command == 'tests':
29
        return message.Message(body="https://travis-ci.org/StarbotDiscord/Starbot")