Ejemplo n.º 1
0
 def send_not_coll(self, bot_teacher, lang, lang_class):
     if lang in self.collaborators:
         for coll in self.collaborators[lang]:
             send_message(bot_teacher,
                          coll,
                          lang_class.get_string(lang, "restart"),
                          reply_markup=ReplyKeyboardRemove(selective=False))
Ejemplo n.º 2
0
 def set_lang(self, chat_id, from_id, lang, chat_type):
     user = super().get_bot().getChat(from_id)
     lang_array = self.get_lang_array()
     if len(lang_array) > 0:
         self.singleton.add_time_id(chat_type, self.node.get_lang(), lang,
                                    from_id, chat_id, 4,
                                    self.node.get_topic_name())
         send_message(super().get_bot(),
                      chat_id,
                      tag_group(chat_type, user) +
                      self.node.get_string(lang, "lang"),
                      self.node.get_string(lang, "canc"),
                      self.singleton.check_time_id(
                          chat_type, self.node.get_lang(), lang, from_id,
                          chat_id, self.node.get_topic_name()) != 0,
                      reply_markup=self.node.set_lang_keyboard(lang_array))
     else:
         send_message(super().get_bot(),
                      chat_id,
                      tag_group(chat_type, user) +
                      self.node.get_string(lang, "disable"),
                      self.node.get_string(lang, "canc"),
                      self.singleton.check_time_id(
                          chat_type, self.node.get_lang(), lang, from_id,
                          chat_id, self.node.get_topic_name()) != 0,
                      reply_markup=ReplyKeyboardRemove())
Ejemplo n.º 3
0
 def send_not_teach(self, bot_teacher, lang, lang_class):
     if lang in self.teachers:
         for teach in self.teachers[lang]:
             send_message(bot_teacher,
                          teach,
                          lang_class.get_string(lang, "restart"),
                          reply_markup=ReplyKeyboardRemove(selective=False))
Ejemplo n.º 4
0
 def add_comment(self, chat_id, from_id, txt, lang, chat_type):
     user = super().get_bot().getChat(from_id)
     if txt in self.node.get_json_array(lang):
         self.node.set_qid(chat_id, from_id, txt)
         self.singleton.add_time_id(chat_type, self.node.get_lang(), lang,
                                    from_id, chat_id, 3,
                                    self.node.get_topic_name())
         send_message(super().get_bot(),
                      chat_id,
                      tag_group(chat_type, user) +
                      self.node.get_string(lang, "rv_comment"),
                      self.node.get_string(lang, "canc"),
                      self.singleton.check_time_id(
                          chat_type, self.node.get_lang(), lang, from_id,
                          chat_id, self.node.get_topic_name()) != 0,
                      reply_markup=create_reply_keyboard(
                          [[self.node.get_string(lang, "comment")]]))
     else:
         self.singleton.del_time_id(chat_type, self.node.get_lang(), lang,
                                    from_id, chat_id,
                                    self.node.get_topic_name())
         send_message(
             super().get_bot(), chat_id,
             tag_group(chat_type, user) +
             self.node.get_string(lang, "error_q"),
             self.node.get_string(lang, "canc"),
             self.singleton.check_time_id(chat_type, self.node.get_lang(),
                                          lang, from_id, chat_id,
                                          self.node.get_topic_name()) != 0)
Ejemplo n.º 5
0
 def add_hints(self, chat_id, from_id, topic, lang, chat_type, user):
     self.tree.set_nlp(lang)
     hints = self.tree.get_hint(topic, lang)
     if len(hints) > 0:
         self.singleton_id.add_time_id(chat_type, self.tree.get_lang(),
                                       lang, from_id, chat_id, 6,
                                       "teacher")
         send_message(super().get_bot(),
                      chat_id,
                      tag_group(chat_type, user) +
                      self.tree.get_string(lang, "select_hint"),
                      self.tree.get_string(lang, "canc"),
                      self.singleton_id.check_time_id(
                          chat_type, self.tree.get_lang(), lang,
                          from_id, chat_id, "teacher") != 0,
                      reply_markup=create_reply_keyboard(
                          array_to_matrix(
                              self.tree.get_hint(topic, lang))))
     else:
         self.singleton_id.del_time_id(chat_type, self.tree.get_lang(),
                                       lang, from_id, chat_id,
                                       "teacher")
         send_message(super().get_bot(),
                      chat_id,
                      tag_group(chat_type, user) +
                      self.tree.get_string(lang, "empty"),
                      self.tree.get_string(lang, "canc"),
                      self.singleton_id.check_time_id(
                          chat_type, self.tree.get_lang(), lang,
                          from_id, chat_id, "teacher") != 0,
                      reply_markup=create_reply_keyboard(
                          array_to_matrix(
                              self.tree.get_hint(topic, lang))))
Ejemplo n.º 6
0
 def case1(self, chat_id, from_id, txt, lang, topic, chat_type):
     user = super().get_bot().getChat(from_id)
     res = self.tree.get_response(txt, lang, topic)
     if res != None:
         self.tree.set_qid(chat_id, from_id, txt, topic)
         self.singleton_id.add_time_id(chat_type, self.tree.get_lang(),
                                       lang, from_id, chat_id, 4,
                                       "teacher")
         send_message(
             super().get_bot(), chat_id,
             tag_group(chat_type, user) +
             self.tree.get_string(lang, "answer", xxx=txt),
             self.tree.get_string(lang, "canc"),
             self.singleton_id.check_time_id(
                 chat_type, self.tree.get_lang(), lang, from_id,
                 chat_id, "teacher") != 0)
     else:
         send_message(
             super().get_bot(), chat_id,
             tag_group(chat_type, user) +
             self.tree.get_string(lang, "error"),
             self.tree.get_string(lang, "canc"),
             self.singleton_id.check_time_id(
                 chat_type, self.tree.get_lang(), lang, from_id,
                 chat_id, "teacher") != 0)
Ejemplo n.º 7
0
def propagate_message(msg, rooms, client, client_detail):
    room_name = client_detail["room_name"]
    members = rooms[room_name]["members"]
    for member in members:
        if member == client:
            continue
        send_message(member, msg)
Ejemplo n.º 8
0
 def case4(self, chat_id, from_id, txt, lang, topic, chat_type):
     user = super().get_bot().getChat(from_id)
     question = self.tree.set_res(chat_id, from_id, txt, lang, topic)
     if question == None:
         return
     vett = self.tree.get_ids_array(topic, lang, question)
     self.singleton_id.del_time_id(chat_type, self.tree.get_lang(),
                                   lang, from_id, chat_id, "teacher")
     send_message(
         super().get_bot(), chat_id,
         tag_group(chat_type, user) +
         self.tree.get_string(lang, "answer_q", xxx=question, yyy=txt),
         self.tree.get_string(lang, "canc"),
         self.singleton_id.check_time_id(
             chat_type, self.tree.get_lang(), lang, from_id, chat_id,
             "teacher") != 0)
     for elem in vett:
         send_message(
             self.tree.get_bot_by_topic(topic), elem,
             self.tree.get_string(lang,
                                  "answer_q",
                                  xxx=question,
                                  yyy=txt),
             self.tree.get_string(lang, "canc"),
             self.singleton_id.check_time_id(
                 chat_type, self.tree.get_lang(), lang, from_id,
                 chat_id, "teacher") != 0)
Ejemplo n.º 9
0
 def send_not_stud(self, lang, lang_class):
     if lang in self.students:
         for stud in self.students[lang]:
             send_message(super().get_bot(),
                          stud,
                          lang_class.get_string(lang, "restart"),
                          reply_markup=ReplyKeyboardRemove(selective=False))
Ejemplo n.º 10
0
 def case7(self, chat_id, from_id, txt, lang, topic, chat_type):
     user = super().get_bot().getChat(from_id)
     txt = self.tree.switcherflag(txt)
     if txt == None:
         send_message(
             super().get_bot(), chat_id,
             tag_group(chat_type, user) +
             self.tree.get_string(lang, "error"),
             self.tree.get_string(lang, "canc"),
             self.singleton_id.check_time_id(
                 chat_type, self.tree.get_lang(), lang, from_id,
                 chat_id, "teacher") != 0)
         return
     self.tree.set_super_user_lang(chat_id, topic, txt)
     send_message(
         super().get_bot(), chat_id,
         tag_group(chat_type, user) +
         self.tree.get_string(txt, "setted_lang"),
         self.tree.get_string(lang, "canc"),
         self.singleton_id.check_time_id(
             chat_type, self.tree.get_lang(), lang, from_id, chat_id,
             "teacher") != 0)
     self.singleton_id.start_fun(chat_id, from_id, chat_type, txt,
                                 self.tree.get_lang(), "teacher", topic,
                                 self.keyboard)
Ejemplo n.º 11
0
 def branch_one(self, msg, chat_id, from_id):
     lang = self.prev_lang[chat_id]
     topic = self.topic_name[chat_id]
     if self.tree.check_teach(lang, msg["text"]):
         send_message(super().get_bot(),
                      chat_id,
                      self.tree.get_string(lang, "teacher"),
                      reply_markup=ReplyKeyboardRemove())
         self.tree.add_teachers([chat_id], self.topic_name[chat_id],
                                lang)
         del self.topic_name[chat_id]
         del self.prev_lang[chat_id]
     elif self.tree.check_coll(lang, msg["text"]):
         send_message(super().get_bot(),
                      chat_id,
                      self.tree.get_string(lang, "collaborator"),
                      reply_markup=ReplyKeyboardRemove())
         self.tree.add_collaborators([chat_id],
                                     self.topic_name[chat_id], lang)
         del self.topic_name[chat_id]
         del self.prev_lang[chat_id]
     self.singleton_id.start_fun(chat_id, from_id, "private", lang,
                                 self.tree.get_lang(), "teacher", topic,
                                 self.keyboard)
     self.query_bool[chat_id] = False
     self.lang_bool[chat_id] = False
Ejemplo n.º 12
0
 def final_set(self, chat_id, from_id, txt, lang, chat_type):
     user = super().get_bot().getChat(from_id)
     txt = self.node.get_lang_by_flag(txt)
     if txt == None:
         send_message(
             super().get_bot(), chat_id,
             tag_group(chat_type, user) +
             self.node.get_string(lang, "error"),
             self.node.get_string(lang, "canc"),
             self.singleton.check_time_id(chat_type, self.node.get_lang(),
                                          lang, from_id, chat_id,
                                          self.node.get_topic_name()) != 0)
         return
     self.del_students([chat_id])
     self.add_students(txt, [chat_id])
     send_message(
         super().get_bot(), chat_id,
         tag_group(chat_type, user) +
         self.node.get_string(txt, "setted_lang"),
         self.node.get_string(lang, "canc"),
         self.singleton.check_time_id(chat_type, self.node.get_lang(), lang,
                                      from_id, chat_id,
                                      self.node.get_topic_name()) != 0)
     self.singleton.start_fun(chat_id, from_id, chat_type, txt,
                              self.node.get_lang(),
                              self.node.get_topic_name(),
                              self.node.get_topic_name(), self.keyboard)
Ejemplo n.º 13
0
 def seg_rev(self, chat_id, from_id, txt, lang, chat_type):
     question = self.node.get_qid(chat_id, from_id)
     self.node.del_qid(chat_id, from_id)
     user = super().get_bot().getChat(from_id)
     is_new = self.node.check_lang_str(txt, "comment")
     if is_new:
         send_message(
             super().get_bot(), chat_id,
             tag_group(chat_type, user) +
             self.node.get_string(lang, "revision", xxx=question),
             self.node.get_string(lang, "canc"),
             self.singleton.check_time_id(chat_type, self.node.get_lang(),
                                          lang, from_id, chat_id,
                                          self.node.get_topic_name()) != 0)
         if not self.node.set_rv_comment(question, "", lang):
             return
         self.new_seg_rev(question, lang, user, chat_type, from_id, chat_id)
     else:
         send_message(
             super().get_bot(), chat_id,
             tag_group(chat_type, user) +
             self.node.get_string(lang, "revision", xxx=question) + " (\"" +
             txt + "\")", self.node.get_string(lang, "canc"),
             self.singleton.check_time_id(chat_type, self.node.get_lang(),
                                          lang, from_id, chat_id,
                                          self.node.get_topic_name()) != 0)
         if not self.node.set_rv_comment(question, txt, lang):
             return
         self.old_seg_rev(question, lang, user, chat_type, from_id, chat_id)
Ejemplo n.º 14
0
def propagate_chat_message(msg, rooms, client, client_detail):
    if client_detail["state"] == "wait":
        send_message(client, "MASTER: You must go into the room first!!")
        return

    propagate_message(client_detail["user_name"] + ":" + msg, rooms, client,
                      client_detail)
Ejemplo n.º 15
0
 def delete_old_branchthreeone(self, name, elem, lang_class, user):
     del self.id_times[name][elem]
     if name in self.id_commands and elem in self.id_commands[name]:
         send_message(self.bot_array[name], elem,
                      lang_class.get_string(lang, "timeout"))
         del self.id_commands[name][elem]
         if len(self.id_commands[name]) == 0:
             del self.id_commands[name]
Ejemplo n.º 16
0
 def choose_topic(self,chat_id,text):
     if text in self.tree.get_topic_list():
         self.singleton_id.add_time_id("private",self.tree.get_lang(),"en",chat_id,chat_id,3,"creation")
         send_message(super().get_bot(),chat_id,"Enter the password relating to the topic:","Cancel",self.singleton_id.check_time_id("private",self.tree.get_lang(),"en",chat_id,chat_id,"creation")!=0,reply_markup=create_reply_keyboard([["Forgot password?"]],only_one=False))
         self.unc_del[chat_id]=text
     else :
         self.singleton_id.del_time_id("private",self.tree.get_lang(),"en",chat_id,chat_id,"creation")
         send_message(super().get_bot(),chat_id,"Topic don't found, command aborted","Cancel",self.singleton_id.check_time_id("private",self.tree.get_lang(),"en",chat_id,chat_id,"creation")!=0,reply_markup=ReplyKeyboardRemove())
Ejemplo n.º 17
0
 def match_speech(self, chat_id, from_id, txt, lang, chat_type):
     is_new = self.node.check_lang_str(txt, "new_button")
     if not is_new:
         self.node.set_qid(chat_id, from_id, txt)
     user = super().get_bot().getChat(from_id)
     elem = self.node.get_qid(chat_id, from_id)
     response = None
     if not is_new:
         response = self.node.get_response(elem, lang)
     if response == None:
         self.node.set_question(elem, lang, chat_id)
         send_message(
             super().get_bot(), chat_id,
             tag_group(chat_type, user) +
             self.node.get_string(lang, "q_not_found", xxx=elem),
             self.node.get_string(lang, "canc"),
             self.singleton.check_time_id(chat_type, self.node.get_lang(),
                                          lang, from_id, chat_id,
                                          self.node.get_topic_name()) != 0)
         if lang in self.teachers:
             for teacher_id in self.teachers[lang]:
                 send_message(
                     self.node.get_bot_teacher().get_bot(), teacher_id,
                     self.node.get_string(lang, "new_q", xxx=elem),
                     self.node.get_string(lang, "canc"),
                     self.singleton.check_time_id(
                         chat_type, self.node.get_lang(), lang, from_id,
                         chat_id, self.node.get_topic_name()) != 0)
     elif response == "BANNED":
         send_message(
             super().get_bot(), chat_id,
             tag_group(chat_type, user) +
             self.node.get_string(lang, "banned_q", xxx=elem),
             self.node.get_string(lang, "canc"),
             self.singleton.check_time_id(chat_type, self.node.get_lang(),
                                          lang, from_id, chat_id,
                                          self.node.get_topic_name()) != 0)
     elif response == "":
         send_message(
             super().get_bot(), chat_id,
             tag_group(chat_type, user) +
             self.node.get_string(lang, "wait_q", xxx=elem),
             self.node.get_string(lang, "canc"),
             self.singleton.check_time_id(chat_type, self.node.get_lang(),
                                          lang, from_id, chat_id,
                                          self.node.get_topic_name()) != 0)
     else:
         send_message(
             super().get_bot(), chat_id,
             tag_group(chat_type, user) +
             self.node.get_string(lang, "answer_q", xxx=elem, yyy=response),
             self.node.get_string(lang, "canc"),
             self.singleton.check_time_id(chat_type, self.node.get_lang(),
                                          lang, from_id, chat_id,
                                          self.node.get_topic_name()) != 0)
     self.node.del_qid(chat_id, from_id)
Ejemplo n.º 18
0
 def cond_hash_second_branch(self,chat_id,text):
     self.singleton_id.del_time_id("private",self.tree.get_lang(),"en",chat_id,chat_id,"creation")
     if self.tree.verify_password(self.unc_del[chat_id], text):
         self.singleton_ban.del_ban(chat_id)
         self.tree.delete_bot(self.unc_del[chat_id])
         send_message(super().get_bot(),chat_id,"Topic deleted","Cancel",self.singleton_id.check_time_id("private",self.tree.get_lang(),"en",chat_id,chat_id,"creation")!=0,reply_markup=ReplyKeyboardRemove())
     else :
         self.singleton_ban.add_ban(chat_id)
         send_message(super().get_bot(),chat_id,"Incorrect password. Command aborted.","Cancel",self.singleton_id.check_time_id("private",self.tree.get_lang(),"en",chat_id,chat_id,"creation")!=0,reply_markup=ReplyKeyboardRemove())
     del self.unc_del[chat_id]
Ejemplo n.º 19
0
 def send_del_lang_notification(self, lang):
     for lang_stud in self.students:
         for chat_id in self.students[lang_stud]:
             send_message(super().get_bot(),
                          chat_id,
                          self.node.get_string(lang_stud,
                                               "del_lang",
                                               xxx=self.node.get_string(
                                                   lang_stud, lang)),
                          reply_markup=None)
Ejemplo n.º 20
0
 def branch_two(self, msg, chat_id, from_id, topic):
     if msg["text"] in self.tree.get_flag_list():
         self.prev_lang[chat_id] = self.tree.switcherflag(msg["text"])
         send_message(super().get_bot(),
                      chat_id,
                      self.tree.get_string(self.prev_lang[chat_id],
                                           "roles"),
                      reply_markup=self.tree.get_lang_board(
                          self.prev_lang[chat_id],
                          ["teacher", "collaborator"]))
         self.lang_bool[chat_id] = True
Ejemplo n.º 21
0
def kill_room(msg, rooms, client_details):
    room_name = re.findall("\/kill ([\w]+)", msg)[0]
    room = rooms[room_name]
    for member in room["members"]:
        send_message(member, "Room has been killed")
        client_details[member] = {
            "state": "wait",
            "room_name": '',
            "user_name": ''
        }
    del rooms[room_name]
    print(room_name, "is killed")
Ejemplo n.º 22
0
 def cond_hash_first_branch(self,chat_id,text):
     self.singleton_id.del_time_id("private",self.tree.get_lang(),"en",chat_id,chat_id,"creation")
     if self.tree.verify_password(self.unc_del[chat_id], text):
         self.singleton_ban.del_ban(chat_id)
         pwd=self.rand_string()
         self.send_notify(chat_id,pwd,self.unc_del[chat_id])
         self.tree.change_pwd(self.unc_del[chat_id],self.hash_password(pwd))
         self.teach_board_topic(self.unc_del[chat_id],chat_id)
     else :
         self.singleton_ban.add_ban(chat_id)
         send_message(super().get_bot(),chat_id,"Incorrect password. Command aborted.","Cancel",self.singleton_id.check_time_id("private",self.tree.get_lang(),"en",chat_id,chat_id,"creation")!=0,reply_markup=ReplyKeyboardRemove())
     del self.unc_del[chat_id]
Ejemplo n.º 23
0
 def new_seg_rev(self, question, lang, user, chat_type, from_id, chat_id):
     response = self.node.get_response(question, lang)
     if lang in self.teachers:
         for teacher_id in self.teachers[lang]:
             if response != None and response != "" and lang in self.teachers:
                 send_message(
                     self.node.get_bot_teacher().get_bot(), teacher_id,
                     tag_group(chat_type, user) +
                     self.node.get_string(lang, "revision", xxx=question),
                     self.node.get_string(lang, "canc"),
                     self.singleton.check_time_id(
                         chat_type, self.node.get_lang(), lang, from_id,
                         chat_id, self.node.get_topic_name()) != 0)
Ejemplo n.º 24
0
def handle_participant_left_event(room, rooms, client, client_details):
    client_detail = client_details[client]
    msg = "Client " + client_detail["user_name"] + " has left the room."
    send_message(client, "Left the room")
    propagate_message(msg, rooms, client, client_detail)
    client_details[client] = {
        "state": "wait",
        "room_name": '',
        "user_name": ''
    }
    room["members"] = [
        member for member in room["members"] if member != client
    ]
Ejemplo n.º 25
0
 def cond_hash(self,chat_id,text):
     if text=="Forgot password?":
         user=super().get_bot().getChat(chat_id)
         bot_pwd=self.tree.get_bot_pwd()
         self.singleton_id.del_time_id("private",self.tree.get_lang(),"en",chat_id,chat_id,"creation")
         send_message(bot_pwd,self.admin_pwd,"The user "+user['last_name']+" "+user['first_name']+" (@"+user['username']+") lost password for the topic "+self.unc_del[chat_id],self.singleton_id.check_time_id("private",self.tree.get_lang(),"en",chat_id,chat_id,"creation")!=0)
         send_message(super().get_bot(),chat_id,"A request was sent to the administrator","Cancel",self.singleton_id.check_time_id("private",self.tree.get_lang(),"en",chat_id,chat_id,"creation")!=0,reply_markup=ReplyKeyboardRemove())
         del self.unc_del[chat_id]
         return
     if self.boolvett[chat_id]:
         self.cond_hash_first_branch(chat_id,text)
     else:
         self.cond_hash_second_branch(chat_id,text)
Ejemplo n.º 26
0
def join_room(msg, rooms, client, client_details):
    (room_name, null, user_name) = re.findall("\/join ([\w]+)( ([\w]+))?",
                                              msg)[0]
    if room_name not in rooms:
        send_message(client, "MASTER: no room named " + room_name + "!!!")
        return
    if client_details[client]["state"] == "chat":
        send_message(client, "Cannot join: client is already in a chat room")
        return
    room = rooms[room_name]
    if user_name and does_user_name_exists(user_name, room, client_details):
        send_message(client, "Cannot join: Nickname already exists")
        return
    if not user_name:
        user_name = "Unknown"
    client_details[client] = {
        "state": "chat",
        "room_name": room_name,
        "user_name": user_name
    }
    msg = "Client " + client_details[client][
        "user_name"] + " joined in the room.\r\n"
    msg += "name: " + client_details[client]["user_name"] + "\r\n"
    msg += "addr: " + str(client.getpeername()) + "\r\n"
    propagate_message(msg, rooms, client, client_details[client])
    room["members"].append(client)
    send_message(client, "Room " + room_name + " joined")
    return
Ejemplo n.º 27
0
 def sub_nv(self, new_times, new_ids, count, array, time, lang_class):
     user = bot.getChat(elem1)
     if self.id_times[array[0]][array[1]][array[2]] > time:
         new_times, new_ids = self.add_elem(new_times, new_ids,
                                            array[1], array[2],
                                            array[0])
         count += 1
     elif array[0] in self.id_commands and array[1] in self.id_commands[
             array[0]] and array[2] in self.id_commands[array[0]][
                 array[1]]:
         send_message(
             self.bot_array[array[0]], array[1],
             tag_group(chat_type, user) +
             lang_class.get_string(lang, "timeout"))
     return new_times, new_ids, count
Ejemplo n.º 28
0
 def case6(self, chat_id, from_id, txt, lang, topic, chat_type):
     user = super().get_bot().getChat(from_id)
     splitted = txt[1:-1].split("\" -> \"")
     self.tree.add_question_by_hint(lang, splitted[0], splitted[1],
                                    chat_id, from_id, topic)
     self.singleton_id.del_time_id(chat_type, self.tree.get_lang(),
                                   lang, from_id, chat_id, "teacher")
     send_message(
         super().get_bot(), chat_id,
         tag_group(chat_type, user) + self.tree.get_string(
             lang, "answer_q", xxx=splitted[0], yyy=splitted[1]),
         self.tree.get_string(lang, "canc"),
         self.singleton_id.check_time_id(
             chat_type, self.tree.get_lang(), lang, from_id, chat_id,
             "teacher") != 0)
Ejemplo n.º 29
0
def handle_client_message(msg, rooms, client, client_details):
    client_detail = client_details[client]
    if msg == '/ls':
        send_message(client, get_room_list(rooms))
    elif re.search("\/join ([\w]+)( ([\w]+))?", msg):
        join_room(msg, rooms, client, client_details)
    elif re.search("\/create ([\w]+)( ([\w]+))?", msg):
        create_room(msg, rooms, client, client_details)
    elif re.search("\/whisper ([\w]+) ([\w| ]+)", msg):
        whisper(msg, rooms, client, client_detail)
    elif msg == "/exit":
        run_exit(rooms, client, client_details)
    elif re.search("^\/", msg):
        send_message(client, "Inappropriate Command!!")
    else:
        propagate_chat_message(msg, rooms, client, client_detail)
Ejemplo n.º 30
0
 def start_fun(self, chat_id, from_id, chat_type, lang, lang_class,
               name, topic, keyboard):
     user = self.bot_array[name].getChat(from_id)
     send_message(
         self.bot_array[name], chat_id,
         tag_group(chat_type, user) +
         lang_class.get_string(lang, "start", xxx=topic))
     try:
         self.set_key_id(
             telepot.message_identifier(
                 send_message(self.bot_array[name],
                              chat_id,
                              lang_class.get_string(lang, "command"),
                              reply_markup=keyboard)), name)
     except TypeError:
         pass