The Diary Game 10/07/2022 :: Pause For Two Days

in CCS2 years ago

ВОЛШЕБНЫЙ СУНДУЧОК (4).png

Hey everyone!

Six days and I will get to the club5050 again!

Most likely I will take a break for two days in the publication of TheDiaryGame, I will pay more attention to physical activity.

Today, until one in the morning, I cut pears for Father Theophilus and his small farm. And this is great!

I made a little feast for myself today. I ate in a cafe, and you can see in the photo the dishes that I bought myself and ate with great pleasure.

Perhaps for some it is a standard set of food, but for me it is a whole feast. In the evening I ate chickpea cutlets wrapped in dough (falafel) and ice cream. And at 22:00, when it was already necessary to go to bed, I felt a surge of cheerfulness.

photo_2022-10-07_11-51-44.jpg

Therefore, I told Father Theophilus that I wanted to do something useful, and he offered me to cut the pears for peeling. This I began to do, and did for three hours. I liked it very much.

Tomorrow I will continue to do various interesting useful actions.

In October I will focus on the TheWordGame project.

photo_2022-10-08_02-14-34.jpg

Developing:

Modern programming is sometimes like building a constructor out of existing blocks.

https://cloud.google.com/translate/docs/basic/translating-text#translate_translate_text-nodejs
https://cloud.google.com/translate/docs/reference/libraries/v2/nodejs

However, I will leave the translation for the future to finish. Now I'm busy outputting the text of the post to the telegram bot. And it's almost ready.

Thank you for your attention!
Have a nice day!

photo_2022-10-08_02-14-15.jpg

P.S. Files of NodeJs Scripts:

add.js

const steem = require('steem');
spisok = 0;
var settings = require('./config.js');

let body3R = '';
let num_day = settings.num_day;
let bd_name = settings.bd_name;
let hive_name = settings.hive_name;
let url_post = settings.url_post;
let password_mysql = settings.password_mysql;
let user_mysql = settings.user_mysql;

config = {
  host: "localhost",
  user: user_mysql,
  database: bd_name,
  password: password_mysql
}

    var d = new Date(); // Today!
    d.setDate(d.getDate()-num_day); // Yesterday!
    d = d.toJSON().split("T")[0];
    d = d.replace(/-/gi, '');
    console.log(d);   

let mytable_p = 'p'+d;
let mytable_c = 'c'+d;
let mytable = 'a'+d;

const mysql = require("mysql2");

const connection = mysql.createConnection(config);

const sql = `SELECT * FROM twg_spisok`;

connection.query(sql,  function(err, results) { 
    if(err) console.log(err);
    console.log(results);   

    spisok = results;
    console.log(spisok);

    len = spisok.length;
    for (yyy = 0; yyy < len; yyy++) 

    {
        steem.api.getDiscussionsByAuthorBeforeDate(spisok[yyy]['author'],null, new Date().toISOString().split('.')[0],20 , function(err, result) {
         if (result)
         {      

        var i, len = result.length;
        for (i = 0; i < len; i++) 
        {
            var raw = result[i];

            let upvote = raw.active_votes.length-1;
            console.log(raw.active_votes.length-1);
            
            let input = raw.created;
            var d = new Date(); // Today!

            d.setDate(d.getDate() - num_day); // Yesterday!
            d = d.toJSON().split("T")[0];
            let title = raw.title;

            title = title.replace(/[^a-zа-яё0-9\s]/gi, ' ');
            url_ok = raw.url;
            url_ok = url_ok.split("/")
            url_ok = url_ok[3];

            //if (input.indexOf(d) !== -1)
            {
                body3R =  `| `+raw.author + `| <a href="`+raw.url+`">` + title + `</a>| `+ upvote + `| ` +  `????`  + `| ` + raw.children+`| ` + raw.body_length+ ' | \n';
                console.log(body3R);

                const mysql = require("mysql2");

                const connection = mysql.createConnection(config);

                connection.on('error', function() {});

                let sql44 =  `create table if not exists ${mytable_p}( id int primary key auto_increment, author varchar(255) not null, title varchar(255) not null, created varchar(255) not null, length int not null, url varchar(255) UNIQUE KEY, text varchar(255), comments int not null, upvotes int not null, points float not null, percent float not null)`;

                connection.query(sql44, function(err, results) {
                if(err) console.log(err);
                console.log(results);
                });     

                const sql = `INSERT INTO ${mytable_p}(author, title, created, length, url, text, comments, upvotes, points,percent) VALUES('${raw.author}','${title}', '${raw.created}', '${raw.body_length}', '${url_ok}', '', '${raw.children}', '${upvote}','0','999')`;

                connection.query(sql, function(err, results) {
                if(err) console.log(err);
                console.log(results);
                });     

                connection.end();

                console.log(raw.created);

            }
}
}


});

}

});


connection.end();

comments.js

//1
const mysql = require("mysql2");
const steem = require('steem');
const fs = require("fs");    
var settings = require('./config.js');

let body3R = '';
let num_day = settings.num_day;
let bd_name = settings.bd_name;
let hive_name = settings.hive_name;
let url_post = settings.url_post;
let url_ok = settings.url_ok;
let password_mysql = settings.password_mysql;
let user_mysql = settings.user_mysql;
let title_name = settings.title_name;
let image_list = settings.image_list;
let moderators_list = settings.moderators_list;
let wifkey = settings.wifkey;
let votey = settings.votey;

config = {
  host: "localhost",
  user: user_mysql,
  database: bd_name,
  password: password_mysql
}

var d = new Date(); // Today!
d.setDate(d.getDate()-num_day); // Yesterday!
d = d.toJSON().split("T")[0];
d = d.replace(/-/gi, '');
        
const connection = mysql.createConnection(config);

    let sql = `SELECT * FROM twg_number`   ;
    connection.query(sql,  function(err, results) 
    {
        if(err) console.log(err);
        const users2 = results;

        let twg_number = users2[0].number;

        var d = new Date(); // Today!
        d.setDate(d.getDate()-num_day); // Yesterday!
        d = d.toJSON().split("T")[0];
        d = d.replace(/-/gi, '');
                        
        let mytable_p = 'p'+d;

        const sql = `SELECT * FROM ${mytable_p} ORDER BY length DESC`;

        connection.query(sql,  function(err, results) 
        {
            if(err) console.log(err);

            users = results;
            if ((users[twg_number])&&(users[twg_number].length>50)&&(users[twg_number].percent===999))
            {
                console.log(results[twg_number].url);

                const dsteem = require('dsteem');
                const client = new dsteem.Client('https://api.steemit.com');

                client.database.call('get_content', [results[twg_number].author, results[twg_number].url]).then(result => {
                    console.log(result.body);
                });     

            }
            else
            {}
        });
    
   });
   
                    


Sort:  

Upvoted! Thank you for supporting witness @jswit.

Coin Marketplace

STEEM 0.20
TRX 0.13
JST 0.030
BTC 67144.34
ETH 3517.40
USDT 1.00
SBD 2.69