Beispiel #1
0
    def __init__(self,
                 room_name,
                 username,
                 email=None,
                 password=None,
                 proxy=None):
        """
        Initialize the ezcapechat protocol class.

        :param room_name: The room name.
        :type room_name: str
        :param username: A user name.
        :type username: str
        :param email: Login email.
        :type email: str
        :param password: Login password.
        :type password: str
        :param proxy: Use a proxy.
        :type proxy: str
        """
        self.room_name = u'' + room_name
        self.email = email
        self.password = password
        self.proxy = proxy

        self.connection = None
        self.is_connected = False

        self.users = user.Users()
        self.users.add_client(username)

        self._pub_n_key = None
        self._room_id = 0
        self._msg_counter = 1
Beispiel #2
0
    def __init__(self,
                 room,
                 nickname="",
                 account=None,
                 password=None,
                 solve_captchas=False):
        self.room_name = room
        self.nickname = nickname
        self.account = account
        self.password = password
        self.client_id = 0
        self.is_client_mod = False
        self.is_client_owner = False
        self._init_time = time.time()

        self.handler = handler.Handler()
        self.is_green_room = False
        self.is_connected = False
        self.active_user = None
        self.users = user.Users()
        # JSON string from tinychat.get_connect_info(), contains room token and ws address
        self.connect_info = {}
        self._ws = None
        self._req = 1
        self.is_published = False
        self.solve_captchas = solve_captchas
        self.ice_servers = None
        if solve_captchas:
            if len(CONFIG.API_KEY) > 0:
                self.captcha = captcha.AntiCaptcha(CONFIG.API_KEY)
            else:
                self.solve_captchas = False
Beispiel #3
0
def readUsers(userDirectory, userFile):
    global allUsers
    uf = open(userDirectory + "/" + userFile,"r")
    i = False
    for line in uf:
         if not i:
             i = True
             allUsers = user.Users(line.split(), userDirectory, userFile)
         else:
             allUsers.add_user(line.split())
    uf.close()
    return i
Beispiel #4
0
    def __init__(self, room, nickname='', account=None, password=None):
        self.room_name = room
        self.nickname = nickname
        self.account = account
        self.password = password
        self.client_id = 0
        self.is_client_mod = False
        self.is_client_owner = False
        self._init_time = time.time()

        self.is_green_room = False
        self.is_connected = False
        self.users = user.Users()
        self.active_user = None
        self._ws = None
        self._req = 1
###################################
# Global variables
###################################
HELP = ""
HELP += "\n다누시스투표봇사용방법\n\n"
HELP += "'투표하기' : 투표하기\n"
HELP += "'관리자' : 관리자 명령어 확인\n"

ADMINHELP = ""
ADMINHELP += "\n다누시스투표봇 관리자 명령어\n\n"
ADMINHELP += "'관리자' : 관리자 명령어 확인\n"
ADMINHELP += "'투표결과' : 투표 결과 확인\n"
ADMINHELP += "'투표결과삭제진짜진짜123' : 투표 결과 제거, 사용시 주의\n"
ADMINHELP += "'사용자제거' : 이름을 잘못 등록했거나 할때 사용자 제거\n"

USERS = user.Users()
USERS.loadfromdata()

ARTICLES = {}
ARTICLENAMES = []
for articlename in glob.glob('___*'):
    articlename = articlename.replace('___', '')
    ARTICLENAMES += [articlename]

    article = voting.VotingArticle(articlename)
    ARTICLES[articlename] = article

PASSWORD = ''
with open('__Password.txt', 'r', encoding='utf-8-sig') as f:
    for line in f.readlines():
        line = line.replace('\n', '')
Beispiel #6
0
import user
import admin
import privileges

user1 = user.Users("иван", "иванов")
user2 = user.Users("петр", "петров")
user3 = admin.Admin("евгений", "евгеньевич")
user1.describe_user()
user1.greet_user()
user2.describe_user()
user2.greet_user()

user3.describe_user()
user3.greet_user()
user3.show_privileges()