Beispiel #1
0
def unfollow(username, message, privileges):
    if message == "!unfollow":
        user = data.get_element(username, main_users)
        if user is not None:
            user_privileges = int(user[eUser.privileges])
        else:
            user_privileges = 0
        if user_privileges >= privileges:
            if data.has(main_channel_list, "#"+username):
                try:
                    shutil.rmtree(config.PATH+"channel/#"+username)
                    for key in main_channel_list:
                        if key[0] == "#"+username:
                            main_channel_list.remove(key)
                            data.save(config.PATH+"channel/channel.csv", main_channel_list)
                            break
                except OSError:
                    main_whisper.whisper(username, "Something went wrong. Please contact a Bot_Omb developer!")
                for i in range(len(bot_threads)):
                    if "#"+username == bot_threads[i].getName():
                        shutdown(bot_threads[i])
                        break
                main_whisper.whisper(username, "It seems like, it is time to say goodbye!")
            else:
                main_whisper.whisper(username, "First things first. If you want me to unfollow your chat, I have to follow first.")
        else:
            main_whisper.whisper(username, "Your privileges level is not high enough to perform this command! You need at least a level of {0}.".format(privileges))  
Beispiel #2
0
def creeper(stops):

    notmissing = [(stop[LATITUDE], stop[LONGITUDE]) for stop in stops.values()
                  if stop[LATITUDE] is not None and stop[LONGITUDE] is not None
                  and not has('closest', stop[LATITUDE], stop[LONGITUDE])]

    j = 1
    for latitude, longitude in notmissing:

        log("{:.2f}%".format(j / len(notmissing) * 100))
        j += 1

        yield get('closest', latitude, longitude)
def creeper ( stops ) :

    notmissing = [
        ( stop[LATITUDE], stop[LONGITUDE] )
        for stop in stops.values()
        if stop[LATITUDE] is not None
        and stop[LONGITUDE] is not None
        and not has( 'closest' , stop[LATITUDE] , stop[LONGITUDE])
    ]

    j = 1
    for latitude , longitude in notmissing :

        log( "{:.2f}%".format( j / len( notmissing ) * 100 ) )
        j += 1

        yield get( 'closest' , latitude , longitude )
Beispiel #4
0
def follow(username, message, privileges):
    if message == "!follow":
        user = data.get_element(username, main_users)
        if user is not None:
            user_privileges = int(user[eUser.privileges])
        else:
            user_privileges = 0
        if user_privileges >= privileges:
            if not data.has(main_channel_list, "#"+username):
                try:
                    os.mkdir(config.PATH+"channel/"+"#"+username)
                    os.mkdir(config.PATH+"channel/"+"#"+username+"/bank")
                    
                    files = [
                     {"file_name" : "quotes.csv", "file_path" : config.PATH+"channel/#"+username+"/", "file_data" : ""},
                     {"file_name" : "guards.csv", "file_path" : config.PATH+"channel/#"+username+"/bank/", "file_data" : "Karl;20\nMark;50\nLisa;40\n"},
                     {"file_name" : "whitelist.csv", "file_path" : config.PATH+"channel/#"+username+"/", "file_data" : "bot_omb\nnightbot\ntipeeebot\nwizebot\nmikuia\nmoobot\n"},
                     {"file_name" : "commands.csv", "file_path" : config.PATH+"channel/#"+username+"/", "file_data" : ""},
                     {"file_name" : "announcements.csv", "file_path" : config.PATH+"channel/#"+username+"/", "file_data" : ""},
                     {"file_name" : "greetings.csv", "file_path" : config.PATH+"channel/#"+username+"/", "file_data" : ""},
                     {"file_name" : "settings.csv", "file_path" : config.PATH+"channel/#"+username+"/", "file_data" : "language_chat;english\nwarning_url;False\nwarning_caps;False\nwarning_long_text;False\ngreetings;False\ngreetings_interval;60\ncommand_mode;True\nbet_mode;True\nfollow_mode;True\nannounce_mode;True\nsmm_mode;True\npoll_mode;True\nrank_mode;True\nbank_mode;True\nwhitelist_mode;True\nwatchtime_mode;False\nquote_mode;False\nhelp;0\ncoins;0\ncommand_add;99\ncommand_remove;99\ncommand_show;99\nprivileges;99\nsetting;99\nsetting_show;99\nurl;99\nbet;0\nbet_start;99\nbet_stop;99\nbet_reset;99\nfollow;0\nfollow_member;0\nfollow_member_other;99\nunfollow;0\ninfo;0\nannounce_add;99\nannounce_remove;99\nannounce_show;99\nsmm_level_submit;99\nsmm_level_submit_other;99\nsmm_level_show;99\nsmm_level_next;99\npoll_start;99\npoll_vote;99\npoll_result;99\nlanguage;99\nupsince;0\nrank_add;99\nrank_remove;99\nrank_show;99\nrank_show_me;0\nbank_robbery;99\nbank_spy;99\nbank_robbery_flee;99\nbank_guard_add;99\nbank_guard_remove;99\nbank_guard_show;99\nwhitelist_add;99\nwhitelist_remove;99\nwhitelist_show;99\nclam_ask;99\nroulette;99\nwatchtime_me;99\nhug_random;99\nhug_other;99\nquote_add;99\nquote_remove;99\nquote_show;99\n"},
                     {"file_name" : "users.csv", "file_path" : config.PATH+"channel/#"+username+"/", "file_data" : username+";100;100;False;0;0;0\n"},
                     {"file_name" : "ranks.csv", "file_path" : config.PATH+"channel/#"+username+"/", "file_data" : ""}
                    ]
                    
                    data.create(files)
                    
                    main_channel_list.append(["#"+username])
                    data.save(config.PATH+"channel/channel.csv", main_channel_list)
                except OSError:
                    main_whisper.whisper(username, "Something went wrong. Please contact a Bot_Omb developer!")
                new_bot_thread = Bot_Omb(["#"+username])
                new_bot_thread.setName("#"+username)
                new_bot_thread.setDaemon(True)
                bot_threads.append(new_bot_thread)
                new_bot_thread.start()
                main_whisper.whisper(username, "I joined your stream! If you want to use my full power, you just need to make me a Mod. Otherwise the auto moderation function will not work.")
            else:
                main_whisper.whisper(username, "I already joined your Chat!")
        else:
            main_whisper.whisper(username, "Your privileges level is not high enough to perform this command! You need at least a level of {0}.".format(privileges))