Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions backup20230627/userListWithEpic-1.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions backup20230627/userListWithEpic.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion channelName.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"id":"C02G2SXKX","name":"general"},{"id":"C03RAK46BEC","name":"web3-da0"},{"id":"C046EJH4P2B","name":"da0-global-comms"},{"id":"C046T7HT05U","name":"da0-hack-and-show"},{"id":"C046ZFGTWQK","name":"da0-shoutout"},{"id":"C047A5734FK","name":"da0-arm0ry"},{"id":"C049L7M5X9S","name":"da0-learning"},{"id":"C04FRRV17GF","name":"da0-coordinate"},{"id":"C04UZ3JNH9A","name":"da0-desci"},{"id":"C051REPUTSS","name":"da0-dml"},{"id":"C051U8RSTHV","name":"da0-g0v-ars-electronica"},{"id":"C0525SELHFY","name":"da0-zkp"}]
[{"id":"C02G2SXKX","name":"general"},{"id":"C0385B90D","name":"jothon"},{"id":"CGU1SLHNH","name":"rand0m"},{"id":"C03RAK46BEC","name":"web3-da0"},{"id":"C046EJH4P2B","name":"da0-global-comms"},{"id":"C046T7HT05U","name":"da0-hack-and-show"},{"id":"C046ZFGTWQK","name":"da0-shoutout"},{"id":"C047A5734FK","name":"da0-arm0ry"},{"id":"C049L7M5X9S","name":"da0-learning"},{"id":"C04FRRV17GF","name":"da0-coordinate"},{"id":"C04UZ3JNH9A","name":"da0-desci"},{"id":"C051REPUTSS","name":"da0-dml"},{"id":"C051U8RSTHV","name":"da0-g0v-ars-electronica"},{"id":"C0525SELHFY","name":"da0-zkp"},{"id":"C059A63M16J","name":"da0-shoutout-test"},{"id":"C05DXC8CNGP","name":"thaubing-esg"}]
3 changes: 2 additions & 1 deletion src/selectConversation.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const app = new App({
signingSecret: process.env.SLACK_SIGNING_SECRET,
});


// All the room in the world for your code
// Require the Node Slack SDK package (github.com/slackapi/node-slack-sdk)
const { WebClient, LogLevel } = require("@slack/web-api");
Expand All @@ -48,7 +49,7 @@ var emojiFilter = [];

const retrieveingTime = new Date();
const retrieveingTimeStamp = retrieveingTime.getTime()/1000;
const retrieveingTimeStampStartDay = retrieveingTimeStamp - 7776000;
const retrieveingTimeStampStartDay = retrieveingTimeStamp - 604800;

// conversation selected was record by ts in this array
// let tsSelected = [];
Expand Down
69 changes: 69 additions & 0 deletions src/transfer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
const redis = require('redis');
var Promise = require('bluebird'); // add this
require('dotenv').config();

// 建立連接至來源及目標資料庫
const sourceClient = redis.createClient({
host: 'localhost',
port: 6379
});

const targetClient = redis.createClient({
url: process.env.REDISCLOUD_URL
});

// promisify redis client
Promise.promisifyAll(sourceClient);

sourceClient.on('connect', function() {
console.log('connected to sourceClient');
});

sourceClient.connect();

// promisify redis client
Promise.promisifyAll(targetClient);

targetClient.on('connect', function() {
console.log('connected to targetClient');
});

targetClient.connect();

let cursor = '0';

function scanAndCopyKeys() {
sourceClient.scan(cursor, 'MATCH', '*', 'COUNT', '100', function(err, reply) {
if (err) throw err;
console.log("done");

// reply is an array where reply[0] is the new cursor and reply[1] is the array of keys
cursor = reply[0];
const keys = reply[1];

keys.forEach(key => {
sourceClient.dump(key, (err, value) => {
if (err) throw err;

targetClient.del(key, (err, delResult) => {
if (err) throw err;

targetClient.restore(key, 0, value, (err, restoreResult) => {
if (err) throw err;
});
});
});
});

// if cursor == '0', it means the scan is complete
if (cursor !== '0') {
scanAndCopyKeys();
} else {
// You may want to close the connection here.
console.log('Finished!');
}
});
}

scanAndCopyKeys();

2 changes: 1 addition & 1 deletion tsSelectedJson.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion userList.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion userListWithEpic.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion userListWithRawEpic.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion userSelectedConversationObject002.json

Large diffs are not rendered by default.