def add_fa(self, newfa): try: self.fa = self.fa + ',' + convertep(newfa) db.execute('update words set fa="%s" ,mode="True" where num=%i' % (convertpe(self.fa), self.num)) sql.commit() self.fa = convertep(self.fa) return True except: return False
def send_message (data0): data = {'to':data0['to'] , 'type' : 'TEXT' , 'body' : convertep(data0.get('body','')) } if data0.get ('keyboard') == '/None': pass else : data ['keyboard'] = data0.get ('keyboard',[]) print ('\n' + convertep(gname(data0['to'])) + ' :') print ( rsend (data['body']) ) signrun() bot1.send_message ( data )
def send_message(data0): data = { 'to': data0['to'], 'type': 'TEXT', 'body': convertep(data0.get('body', '')), 'keyboard': data0.get('keyboard', []) } print('\n' + convertep(gname(data0['to'])) + ' :') print(rsend(data['body'])) signrun() bot1.send_message(data)
def send_message (data0): data = {'to':data0['to'] , 'type' : 'TEXT' , 'body' : convertep(data0.get('body','')) , 'keyboard':data0.get ('keyboard',[]) } print ('(send) %s: %s '% (user.get_id(data['to']) ,data['body']) ) bot1.send_message ( data )
def words(): db.execute('select num ,en ,fa ,mode from words') for q in db.fetchall(): wdic[q[0]] = word(q[1], convertep(q[2]), q[0], q[3]) return wdic
def add_fa(self, newfa): try: self.fa = self.fa + ',' + convertep(newfa) eeee = '' for q in self.fa.split(','): eeee += ',%s' % q.strip() self.fa = eeee[1:] db.execute('update words set fa="%s" ,mode="True" where num=%i' % (convertpe(self.fa), self.num)) sql.commit() self.fa = convertep(self.fa) return True except: return False
def edit(self, newfa): try: self.fa = convertep(newfa) eeee = '' for q in self.fa.split(','): eeee += "%s," % q.strip() self.fa = eeee[:-1] db.execute('update words set fa="%s" ,mode="True" where num=%i' % (convertpe(newfa), self.num)) sql.commit() return True except: return False