- 1
 - 2
 - 3
 
В бота добавлены 2 новые фичи:
- можно писать сообщения без reply, тогда появятся кнопки в какой оффтоп запостить
- бота можно добавлять в группы*, и если кто-то на ваш комментарий отвечает - срабатывает mention
                                    Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
Всего: 4
−5
В бота добавлены 2 новые фичи:
- можно писать сообщения без reply, тогда появятся кнопки в какой оффтоп запостить
- бота можно добавлять в группы*, и если кто-то на ваш комментарий отвечает - срабатывает mention
                                    
            Ссылка на бота - https://t.me/GovnokodBot
А также подписывайтесь на канал Говнокода в телеграме: https://t.me/GovnokodChannel
* в группу 1*1 с ботом можно, на группах больше не тестировал
        
−6
Подписывайтесь на канал Говнокода в телеграме:
https://t.me/GovnokodChannel
                                    
−1
<?php
function is_russian_char($c) {
    return preg_match('/[А-Яа-яЁё]/u', $c);
}
function nemyxify_char($a) {
    $map = [
        "а" => "a",
        "б" => "6",
        "в" => "B",
        "г" => "r",
        "д" => "g",
        "е" => "e",
        "ё" => "e",
        "ж" => "Jk",
        "з" => "3",
        "и" => "u",
        "й" => "u",
        "к" => "k",
        "л" => "JI",
        "м" => "M",
        "н" => "H",
        "о" => "o",
        "п" => "n",
        "р" => "p",
        "с" => "c",
        "т" => "m",
        "у" => "y",
        "ф" => "qp",
        "х" => "x",
        "ц" => "LL",
        "ч" => "4",
        "ш" => "LLI",
        "щ" => "LLL",
        "ь" => "b",
        "ы" => "bI",
        "ъ" => "b",
        "э" => "3",
        "ю" => "I0",
        "я" => "9I",
        "А" => "A",
        "Д" => "D",
        "Е" => "E",
        "Ё" => "E",
        "Ж" => "JK",
        "И" => "U",
        "Й" => "U",
        "К" => "K",
        "О" => "O",
        "Р" => "P",
        "С" => "C",
        "Т" => "T",
        "У" => "Y",
        "Х" => "X",
    ];
    if (isset($map[$a])) {
        return $map[$a];
    }
    return $map[mb_strtolower($a)];
}
function gk_nemyxify($text) {
    $res = '';
    foreach (preg_split( '//u', $text, null, PREG_SPLIT_NO_EMPTY ) as $c) {
        if (is_russian_char($c)) {
            $res .= nemyxify_char($c);
        } else {
            $res .= $c;
        }
    }
    return $res;
}
                                    
−2
# Дамп базы хуза
# Постобработка export-а из MySQL
import pandas as pd
import numpy as np
import csv
comments = pd.read_csv('/wp_comments-2.csv', header=None)
comments.head()
##
comments_clean = pd.DataFrame({
    'comment_id': comments[0],
    'comment_post_id': comments[1],
    'comment_parent': comments[13],
    'name': comments[2],
    'gravatar_hash': comments[3].str.split('@').str[0],
    'gravatar_domain': comments[3].str.split('@').str[1],
    'profile': comments[4],
    'date': comments[6],
    'content': comments[8],
})
##
comments_clean[(comments_clean.gravatar_domain != 'lo.ol') & ~comments_clean.gravatar_domain.isna()]
##
comments_clean = comments_clean[(comments_clean.gravatar_domain == 'lo.ol') | comments_clean.gravatar_domain.isna()]
comments_clean.drop(columns=['gravatar_domain'], inplace=True)
comments_clean.head()
##
posts = pd.read_csv('/wp_posts.csv', header=None)
posts = posts[(posts[20] == 'post') & (posts[7] == 'publish') & (posts[11].str.match('^_'))]
posts.head()
##
posts_clean = pd.DataFrame({
    'post_id': posts[0],
    'date': posts[2],
    'content': posts[4],
    'description': posts[6],
    'original_id': posts[11].str[1:]
})
posts_clean.head()
##
comments_clean.to_csv('~/Downloads/gost/comments.csv', index=False)
posts_clean.to_csv('~/Downloads/gost/posts.csv', index=False)
                                    
            https://govnokod.xyz/dump/wp_gk_legacy_users.csv
../comments.csv
../posts.csv