Ejemplo n.º 1
0
 def __init__(self):
     self.usrdir = usrdir
     self.lingua = lingua
     defal = modArgona.Argo()
     self.database = defal.database
     chatdata = self.database.get('chat')
     chatdata.update({'chatid': auth.id()})
     chatdata.update({'content_type': 'text'})
     self.setti = Setting
     self.veces = 0
     self.keywo = ''
Ejemplo n.º 2
0
    def moSave(self):
        msgCreo = MsgCreo(lingua=self.argo.lingua)
        msgShort = MsgShort(self.argo.lingua)

        primo = self.argo.database.get('mode',{})
        creodata = self.argo.database.get('creo',{})
        temradata = creodata.get('temra',{})

        modDatabase.addRaw(self.argo.usrdir,temradata)
        modDatabase.refesdb(self.argo.usrdir)
        self.mesut.append(msgShort.saved)
        self.mesut.append(msgCreo.savon(temra=temradata))

        null = primo.pop(max(primo.keys()))
        defal = modArgona.Argo()
        creodata = defal.database.get('creo')
        self.argo.database.update({'creo' : creodata})
Ejemplo n.º 3
0
    def open(self, initial_msg, seed):  # Welcome Region
        content_type, chat_type, chat_id = telepot.glance(initial_msg)
        usrdir = 'database/usr/' + str(chat_id)
        lingua = modDatabase.openSetting(usrdir=usrdir).get('lingua', 'enMY')
        defal = modArgona.Argo()
        msgMain = MsgMain(lingua)

        self.argo.usrdir = usrdir
        self.argo.lingua = lingua
        chatdata = self.argo.database.get('chat', {})
        chatdata.update({'chatid': chat_id})
        chatdata.update({'chattype': chat_type})
        chatdata.update({'content_type': content_type})
        self.argo.database.update({'chat': chatdata})
        self.argo.database.update({'mode': {0: ''}})
        self.argo.setti = modDatabase.openSetting(usrdir=usrdir)
        self.argo.veces = 0

        if content_type != 'text':
            self.sending(mesag=[msgMain.error])
            self.close()
            return

        # if "/" in initial_msg['text']:
        if initial_msg['text'][0] == "/":
            resul = Excut(initial_msg['text'], self.argo)

            self.sending(mesag=resul.mesut)
            self.argo = resul.argo
            if resul.cos == 1:
                self.close()

        # elif "/" not in initial_msg["text"]:
        else:
            keywo = initial_msg["text"]
            self.argo.keywo = keywo
            self.sending(mesag=[msgMain.home({'keywo': keywo})])

        return True  # prevent on_message() from being called on the initial message
Ejemplo n.º 4
0
def kenwo(mesag):
    metase = []
    defal = modArgona.Argo()
    temran = defal.temra

    mesalista = mesag.split(' ')
    for kasso in set(defal.temra.keys()):
        for mesol in mesalista:
            # print(kasso+" vs. "+mesol)
            if '#' + kasso in mesol:
                keywo = mesol.replace('#' + kasso, '')
                metase.append(mesol)
                # pprint.pprint(metase)
                temran.update({kasso: keywo})

    for kasso in set(temran.keys()):
        if temran.get(kasso, '') == '':
            null = temran.pop(kasso)

    resut = {
        'ketase': metase,
        'temran': temran,
    }
    return resut
Ejemplo n.º 5
0
import modSearch, modArgona, auth, pprint
from core import modDatabase
usrdir = 'database/usr/' + str(auth.id())
rawdb = modDatabase.opendb(usrdir).get('raw')
defal = modArgona.Argo()
tamta = defal.tamta
ma = input('dynamic(two subject): ')
mam = ma.split(' ')
na = input('static: ')
la = modSearch.exper(usrdir, mam[0] + ' ' + mam[1] + ' ' + na)
a = la['resudi']
ia = la['fikasi']
ba = modSearch.exper(usrdir, mam[0] + ' ' + na)
b = ba['resudi']
bi = ba['fikasi']
ca = modSearch.exper(usrdir, mam[1] + ' ' + na)
c = ca['resudi']
ci = ca['fikasi']
i = ia + '@' + bi + '@' + ci
ni = i.split('@')
ni = list(set(ni))
d = []
d.extend(a)
d.extend(b)
d.extend(c)
d = sorted(list(set(d)))
print('a:' + mam[0] + ' ' + mam[1] + ' ' + na)
print('b:' + mam[0] + ' ' + na)
print('c:' + mam[1] + ' ' + na)
nak = ''
for las in sorted(list(tamta)):
Ejemplo n.º 6
0
 def __init__(self, *args, **kwargs):
     super(User, self).__init__(*args, **kwargs)
     self.argo = modArgona.Argo()
Ejemplo n.º 7
0
    def codCreo(self):
        """Condition of general function"""
        resut = False
        msgShort = MsgShort(self.argo.lingua)
        primo = self.argo.database.get('mode',{ 0 : '' })
        creodata = self.argo.database.get('creo',{})
        recomdata = creodata.get('recom',{})
        temradata = creodata.get('temra',{})

        if max(primo.keys()) == 0:
            if "/expense" in self.text:
                creodata.update({ 'submode' : 'expe' })
                resut = True
            elif "/transfer" in self.text:
                creodata.update({ 'submode' : 'tafe' })
                resut = True
            elif "/income" in self.text:
                creodata.update({ 'submode' : 'inco' })
                resut = True

        elif primo.get(max(primo.keys()),'') == 'creo' :
            if '/recom' in self.text:
                numano = self.text.replace('/recom','')
                metadi = recomdata.get(numano,{})
                for nan in metadi:
                    if nan != 'keywo':
                        if nan == 'desci':
                            if temradata.get('desci','') == '':
                                temradata.update({ 'desci' : metadi.get('desci','') })
                            else:
                                metasi = temradata.get('desci','') + ' ' + metadi.get('desci','')
                                temradata.update({ 'desci' : metasi })
                        else:
                            temradata.update({ nan : metadi.get(nan,'') })
                creodata.update({ 'submode' : 'temra' })

            elif '/' in self.text:
                keywo = self.text[1:6]
                statu = self.text[6:7]
                numano = self.text[7:len(self.text)]
                if keywo in temradata.keys():
                    metadi = recomdata.get(numano,{})
                    stana = False
                    
                    if statu == 'R':
                        if metadi.get(keywo,'') != '':
                            desmi = metadi.get('desci','')
                            temradata.update({ keywo : metadi.get(keywo,'') })
                            stana = True
                    elif statu == 'K':
                        if metadi.get('keywo','') != '':
                            desmi = metadi.get('keywo','')
                            temradata.update({ keywo : metadi.get('keywo','') })
                            stana = True

                    if stana:
                        if temradata.get('desci','') == '':
                            temradata.update({ 'desci' : desmi })
                        else:
                            metasi = temradata.get('desci','') + ' - ' + desmi
                            temradata.update({ 'desci' : metasi })
                        creodata.update({ 'submode' : 'temra' })

                elif self.text[0:6] == "/temra":
                    creodata.update({ 'submode' : 'temra' })
                elif self.text[0:8] == "/discard":
                    null = primo.pop(max(primo.keys()))
                    defal = modArgona.Argo()
                    creodata = defal.database.get('creo')
                    self.argo.database.update({'creo' : creodata})
                    self.mesut.append(msgShort.empting)
                elif self.text[0:5] == "/Save":
                    if '' in temradata.values():
                        self.bos = False
                        creodata.update({ 'submode' : 'temra' })
                        self.mesut.append(msgShort.emptylist)
                    else:
                        creodata.update({ 'submode' : 'saved' })
                else:
                    self.mesut.append(msgShort.wrong)
                    creodata.update({ 'submode' : 'temra' })
            elif '/' not in self.text:
                resut = True

        return resut