Esempio n. 1
0
@client.event
async def on_message(message):
    #if the message was from bot itself it doesnt activate
    if message.author == client.user:
        return

    if message.content.startswith('$help'):
        await message.channel.send('prefix=$')
        for i in enumerate(commands):
            await message.channel.send(i)

    #if the message is $quote runs fn quote()
    if message.content.startswith('$' + commands[0]):
        quote = get_quote()
        await message.channel.send(quote)

    #if the message is $advice runs fn advice()
    if message.content.startswith('$' + commands[1]):
        advice = get_advice()
        await message.channel.send(advice)

    #if the message is $joke runs fn joke()
    if message.content.startswith('$' + commands[2]):
        joke = get_joke()
        await message.channel.send(joke)


#keeping the bot online
uptime()

client.run(os.getenv('TOKEN'))
Esempio n. 2
0
def do_uptime(obj):
 """
 Shows how long the server has been running for.
 
 Synopsis:
  uptime
  @uptime
 """
 return obj.notify('The server has been up since %s (%s).' % (ctime(server.started), timedelta(seconds = server.uptime())))
Esempio n. 3
0
def test_uptime():
 assert type(server.uptime()) == float