Esempio n. 1
0
def save_log(message, title):  # todo: move it to some `utils`
    user = message.from_user
    name = f'{user.first_name} {user.last_name}'.strip()
    path = join(conf.logs_path, 'wiktionary_bot', 'messages',
                f'{dtf("Ym/Ymd")}.txt')
    append(path, f'[{message.date}] @{user.username} ({name}) #{user.id}\n'
                 f'{title}\n')
Esempio n. 2
0
def process_desc(dev, desc):
    if not desc:
        desc = input('Input description: ')
    replaces = {
        'b': 'bug-fix',
        'f': 'fix',
        'c': 'comments',
        'd': 'debug',
        'm': 'minor changes',
        'r': 'refactoring',
        't': 'testing',
        'v': 'increase version',
    }
    desc = replaces.get(desc, desc)
    if not desc:
        raise Exception('Description is required')
    d = 'D' if dev else 'P'
    append('logs/changes.txt',
           f'[{dt()}] [{d}] v{ru_noun_version}/{inflection_version}: {desc}')
    return desc
 def data(self, title):
     append('copier_log.txt', title)
     return self.old_storage.get(title)
Esempio n. 4
0
 def add(cls, title):
     append(cls.filename, title)
Esempio n. 5
0
def log(filename, line, path=None):
    if path:
        filename = join(path, filename)
    ensure_parent_dir(filename)
    append(filename, f'{dt()}: {line}')
Esempio n. 6
0
 def process_line(self, value, color):
     append(f'{self.base.slug}.txt', f'{dt()}: {value}')
     line = f'[{dt()}] {value}'
     if color == 'maroon':
         line = f'<b>{line}</b>'
     return f'* <span style="color: {color};">{line}</span>\n'
Esempio n. 7
0
def save_log(message, title):  # todo: move it to some `utils`
    user = message.from_user
    name = f'{user.first_name} {user.last_name}'.strip()
    path = join(ROOT_PATH, 'telegram_bot', 'logs', 'titles.txt')
    append(path, f'[{message.date}] @{user.username} ({name}) #{user.id}\n'
                 f'{title}\n')