Exemplo n.º 1
0
def c**t(bot, update):
    if not isNewCommand(update): return
    if not checkAccess(update): return 

    message = [1]

    if len(update.message.text.split(" ", 1)) > 1:
        message = update.message.text.split(" ", 1)[1].strip()
    else:
        message = randomCunt()
    send(bot, message)

    count = 5
    while count:
        send(bot, "{}".format(count))
        time.sleep(1)
        count -= 1

    send(bot, "PLAY!")

    config = loadConfig()
    if config['isPlaying'] == True: return

    # also call /new
    if config['lastRoll'] is not None:
        newAlbumSetPosition(bot, config['lastRoll'])

        # newAlbumSetPosition updates config, need to reload it from disk
        config = loadConfig() 
        config['lastRoll'] = None 
        saveConfig(config)
Exemplo n.º 2
0
def c**t(bot, update):
    if not isNewCommand(update):
        return
    if checkAccess(update):
        message = [1]

        if len(update.message.text.split(" ", 1)) > 1:
            message = update.message.text.split(" ", 1)[1].strip()
        else:
            message = randomCunt()
        send(bot, message.encode('utf-8'))

        count = 5
        while count:
            send(bot, "{}".format(count))
            time.sleep(1)
            count -= 1

        send(bot, "PLAY!")

        # also call /new
        config = loadConfig()
        if config['lastRoll'] is not None:
            newAlbumSetPosition(bot, config['lastRoll'])
            config['lastRoll'] = None
            saveConfig(config)
Exemplo n.º 3
0
def archive(bot, update):
    if not isNewCommand(update):
        return
    if not checkAccess(update):
        return
    position = int(update.message.text.split(" ")[1])
    archiveDo(bot, position)
    send(bot, "Suggestion moved to the archive.")
Exemplo n.º 4
0
def sticker(bot, update):
    if not isNewCommand(update):
        return
    if not checkAccess(update):
        return
    if isNewSeeds(update):
        return
    message = update.message.text.split(" ", 1)[1].strip()
    bot.sendSticker(newseeds, message)
Exemplo n.º 5
0
def say(bot, update):
    if not isNewCommand(update):
        return
    if not checkAccess(update):
        return
    if isNewSeeds(update):
        return
    message = update.message.text.split(" ", 1)[1].strip()
    send(bot, message.encode('utf-8'), parse_mode="HTML")
Exemplo n.º 6
0
def over(bot, update):
    if not checkAccess(update):
        return
    config = loadConfig()
    if config['isPlaying'] == True:
        if isNewCommand(update):
            send(bot, "#musictheatre it's OVER.")
        endSession()
    else:
        reply(update, "You betcha it is.")
Exemplo n.º 7
0
def help(bot, update):
    if not isNewCommand(update):
        return
    if not checkAccess(update):
        return
    reply(
        update,
        "Here's the list of commands:\n<b>/sheet</b> gives you the link to our spreadsheet\n<b>/tagme</b> to subscribe to session notifications [private message only]\n<b>/suggest</b> will ask if anyone wants to start a session\n<b>/admins</b> for the list of people who have admin access\n\nUse these while in session:\n<b>/song</b> or <b>/album</b> to find out what's playing"
        .encode('utf-8'),
        parse_mode="HTML")
Exemplo n.º 8
0
def newAlbum(bot, update):
    if not isNewCommand(update): return
    if not checkAccess(update): return

    message = update.message.text.split(" ", 1)[1].strip()

    # new artist - album
    if " - " in message:
        artistName = message.split(" - ", 1)[0].strip()
        albumName = message.split(" - ", 1)[1].strip()
        newAlbumSet(bot, config, artistName, albumName, None, None)
    # new {number}
    else:
        newAlbumSetPosition(bot, message)
Exemplo n.º 9
0
def nextSong(bot, update):
    if not isNewCommand(update): return
    if not checkAccess(update): return

    config = loadConfig()
    if config['isPlaying'] == True:
        trackName = update.message.text.split(" ", 1)[1].strip()
        if len(trackName) > 0 and len(
                config['artist']) > 0 and trackName != config['track']:
            config['track'] = trackName
            text = "#musictheatre {0} - {1}".format(config['artist'],
                                                    config['track'])
            send(bot, text)
            saveConfig(config)
    else:
        send(bot, "What album was that again?")
Exemplo n.º 10
0
def roll(bot, update):
    if not isNewCommand(update):
        return
    if not checkAccess(update):
        return
    config = loadConfig()

    if config['isPlaying'] == False:
        wks = auth()
        suggestionNames = filter(fNonEmpty, map(fValue, wks.range('B4:B100')))
        illegalNames = map(fLower,
                           filter(fNonEmpty, map(fValue, wks.range('G4:G9'))))
        suggestionsCount = len(suggestionNames)

        if suggestionsCount > 0:
            for _ in range(5):

                # get random (favor older suggestions)
                result = getRandom(suggestionsCount - 1)

                spreadsheetNumber = result + 4
                rolled = map(
                    fValue,
                    wks.range('A' + str(spreadsheetNumber) + ':E' +
                              str(spreadsheetNumber)))
                if not rolled[1].lower() in illegalNames:
                    config['lastRoll'] = spreadsheetNumber
                    saveConfig(config)

                    send(bot,
                         "<b>Rolled {}</b>\n{} - {} ({})\nSuggested by: {}".
                         format(spreadsheetNumber, rolled[2].encode('utf-8'),
                                rolled[4].encode('utf-8'),
                                rolled[3].encode('utf-8'),
                                rolled[1].encode('utf-8')),
                         parse_mode="HTML")
                    return
                else:
                    send(
                        bot, "Rolled {}. {} - illegal.".format(
                            spreadsheetNumber, rolled[1].encode('utf-8')))
        else:
            reply(update, "No suggestions found.")
    else:
        reply(update,
              "Another session is still on. I'm afraid I can't do that.")
Exemplo n.º 11
0
def abort(bot, update):
    if not checkAccess(update):
        return
    config = loadConfig()
    if config['isPlaying'] == True:
        endSession()

        if isNewCommand(update):
            send(bot, "#musictheatre it's ABORTED.")

            # add 'aborted'
            wks = auth()
            archiveCells = wks.range('F4:L4')
            if archiveCells[4].value.encode('utf-8') == config['album']:
                archiveCells[6].value = "aborted"
                wks.update_cells(archiveCells)
    else:
        reply(update, "I'll abort you, you f*****g bitch.")
Exemplo n.º 12
0
def roll(bot, update):
    if not isNewCommand(update): return
    if not checkAccess(update): return

    config = loadConfig()
    if config['isPlaying'] == True:
        reply(update, "Another session is still on. I'm afraid I can't do that.")
        return

    wks = auth()
    suggestionNames = list(filter(fNonEmpty, map(fValue, wks.range('B4:B100'))))
    illegalNames = list(map(fLower, list(filter(fNonEmpty, map(fValue, wks.range('G4:G9'))))))

    values = []
    for i in range(len(suggestionNames)):
        name = suggestionNames[i].lower()
        if name not in illegalNames:
            values.append({"number": i+4, "name": name })       

    validSuggestionsCount = len(values)

    if validSuggestionsCount == 0:
        reply(update, "No suggestions found.")
        return

    # get random (favor older suggestions)
    rolled_from_valid = getRandom(validSuggestionsCount-1)
    result = values[rolled_from_valid]["number"]

    spreadsheetNumber = result
    rolled = list(map(fValue, wks.range('A'+str(spreadsheetNumber) +':E'+ str(spreadsheetNumber))))
    
    config['lastRoll'] = spreadsheetNumber
    saveConfig(config)

    send(bot,
        "<b>Rolled {}</b>\n{} - {} ({})\nSuggested by: {}" .format(
            spreadsheetNumber, rolled[2], 
            rolled[4], rolled[3], 
            rolled[1]), parse_mode="HTML")
Exemplo n.º 13
0
def tagPeople(bot, update):
    if not isNewCommand(update):
        return
    if not checkAccess(update):
        return
    if not isNewCommand(update):
        return
    config = loadConfig()
    if 'tagList' in config and len(config['tagList']) > 0:
        send(
            bot, "Notifying {} people... (/taginfo to learn).".format(
                len(config['tagList'])))
        send(bot,
             "<b>Anyone in for a </b>#musictheatre<b> session?</b>",
             parse_mode="HTML")
        for id in config['tagList']:
            if id != update.effective_user.id:
                try:
                    bot.sendMessage(id, "#musictheatre How about some music?")
                except:
                    print("{} blocked the bot.".format(id))
    else:
        send(bot, "No one is subscribed for /tag updates.")
Exemplo n.º 14
0
def archive(bot, update):
    if not isNewCommand(update): return
    if not checkAccess(update): return
    
    position = int(update.message.text.split(" ")[1])
    archiveDo(bot, position)