Markov Chains in Sockbot
-
Hm, is there any way to download a whole thread as text? I'd really like to try and feed a few Markov chains with this one ...
-
The Bad/Evil Ideas Threads are
But, seriously, worst case scenario, I guess you could try scrolling all the way from one end to the other with Infiniscroll (or scroll through chunks), Select-All-ing everything, and then copy/pasting it elsewhere.
-
@accalia, someone wants help writing a bot that interfaces with the DiscoAPI.
-
Hm, is there any way to download a whole thread as text? I'd really like to try and feed a few Markov chains with this one ...
well, yes actually there is.
it's not a thing out of the box that's supported, but no worries i have a solution for that!
Step the first: clone the repository
Step the second:npm install; npm install csv-stringify
Step the third: place this text in$/plugins/saveThreads.js
'use strict'; /** * Example plugin, echos your words back at you. * @module echo * @author Accalia * @license MIT */ const fs = require('fs'), stringify = require('csv-stringify'); let mBrowser; /** * Prepare Plugin prior to login * * @param {*} plugConfig Plugin specific configuration * @param {Config} config Overall Bot Configuration * @param {externals.events.SockEvents} events EventEmitter used for the bot * @param {Browser} browser Web browser for communicating with discourse */ exports.prepare = function (plugConfig, config, events, browser) { mBrowser = browser; }; /** * Start the plugin after login */ exports.start = function () { const threads=[]; //Thread Ids Go Here threads.forEach(thread=>{ const filename = thread+'.csv'; console.log(filename); fs.writeFileSync(filename,''); const stringifier = stringify(); stringifier.on('readable', function () { let data; while (data = stringifier.read()) { fs.appendFileSync(filename, data); } }); stringifier.write(['post_id', 'post_number', 'username', 'created_at', 'like_count', 'raw', 'cooked']); mBrowser.getPosts(thread, (post, next) => { stringifier.write([post.id, post.post_number, post.username, post.created_at, post.like_count, post.raw, post.cooked]); next(); }, () => { console.log('saved!'); }); }); }; /** * Stop the plugin prior to exit or reload */ exports.stop = function () {}; /** * Handle notifications * * @param {external.notifications.Notification} notification Notification recieved * @param {external.topics.Topic} topic Topic trigger post belongs to * @param {external.posts.CleanedPost} post Post that triggered notification */ exports.handler = function handler(notification, topic, post) {};
Step the fourth: Edit Line 29 to have a list of thread Ids to pull
Step the fifth: put this text in$/config.yml
--- core: username: LaoC password: 'LaoC's password is really secure' pollNotifications: false owner: Laoc plugins: './plugins/saveThreads': true
Step the ???th: ???
Step the ???+1th: runnpm start config.yml
the threads you specify will be saved and dumped as CSV files in the current directory
NOTA BENE:
Both SockBot and this advice (Hearafter collectively known as "THE SOFTWARE") are designed for educational and entertainment purposes and is not indended to be used for mischief or evil.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-
-
Markov chains
If you want to fire them right back at Discourse, some crazy person went and wrote a module for doing so:
-
But, seriously, worst case scenario, I guess you could try scrolling all the way from one end to the other with Infiniscroll (or scroll through chunks), Select-All-ing everything, and then copy/pasting it elsewhere.
-
Doctor Zoidberg, soaking in brine.
-
Yes master Sultanatrix of Swypos; @βRaceProUK's queen, I shall appear as summoned.
-
For some reason, whenever I see your mini-avatar my Rorschach engine detects a cute happy face figure above the ankle.
Filed under: Then I click into the Usercard and it's a cute Robot instead.
-
When I once wanted a thread for further analysis (I was actually interested in the content) I simply M'ed @PJH and asked. But I guess sockbot would work too.
-
I simply M'ed @PJH and asked.
Ah, but @sockbot doesn't mind being repeatedly asked over and over again. ;)
-
Yes mistress Anthony Tsaukpaetra of Unimatrix 08, I shall appear as summoned.
-
Um, sir....?
-
@sockbot sometimes gets confused about gender. Our fields on the topic are rather useless for that purpose.
-
You forgot
You acknowledge that you will comply with U.S. Export Administration Regulations. You will not export or re-export this product, directly or indirectly, to: (1) any countries that are subject to U.S. export restrictions; (2) any end user who has been prohibited from participating in U.S. export transactions by any federal agency of the U.S. government; or (3) any end user who you know or have reason to know will utilize them in the design, development or production of nuclear, chemical or biological weapons.
(Imagine if the terrorists got hold of SockBot technology!)
-
@sockbot pls
-
@sockbot plz
[22:30:39] Polling Messages [22:30:40] Polling Messages [22:30:40] executing command: pls [22:31:09] Polling Messages [22:31:40] Polling Messages
it appears that @mentioning @sockbot starting at character 0 on a line triggers it to be treated as an @mention command instead of an @mention
-
@sockbot rm -rf ~
-
Yes master %name%, I shall appear as summoned.
-
-
It would be somewhat less odd if sockbot actually ran that command.
-
@sockbot said:
Yes master %name%, I shall appear as summoned.
Huh.... that's .... odd.
User has no long name
-
Ahhhh, that'd do it.
-
Expected output: "Yes master, I shall appear as summoned".
-
Expected output: "Yes master, I shall appear as summoned".
Pull Requests Accepted.
:-P
-
I should issue a PR consisting of only a failing unit test XD
-
well, yes actually there is.
Sweet, thanks very much! Something to play with on the long winter evenings we don't have here@LaoC said:
Markov chains
If you want to fire them right back at Discourse, some crazy person went and wrote a module for doing so:
Haha, thanks, sounds like there's hardly enough to do for one winter evening now, with everything prepared already!
Actually I'd been playing with a simple pattern-based grammar that forces the Markov chain output not to sound quite as random, so maybe there is. I'll give it a shot!
-
Sweet, thanks very much! Something to play with on the long winter evenings we don't have here
no worries! if you have any trouble with sockbot or want to contribute drop any of us sockdevs a line! We'll be happy to help!