diff --git a/bot.js b/bot.js index f468d00cc1dd55e76ae055f5d8997b44b37e79cc..2642374392669ad729027f2687eb3a68f2d83476 100644 --- a/bot.js +++ b/bot.js @@ -1,7 +1,7 @@ const EventEmitter = require('events'); const MastodonAPI = require('mastodon-api'); -// Todo: Implements block_user and block_domain +// Todo: Implements mute_user and block_domain // Todo: Implements unfollow class Bot extends EventEmitter { @@ -105,12 +105,10 @@ class Bot extends EventEmitter { /** * Follow a user - * @param {string} acct + * @param {int} id */ - follow(acct) { - this.M.post('follows', { - uri: acct - }); + follow(id) { + this.M.post('accounts/' + id + '/follow'); } } diff --git a/index.js b/index.js index 08d72dc616c349a8b696c5e8e1761879c2654ce1..f0b178da00022eff516901a3da0c08e55db33bf2 100644 --- a/index.js +++ b/index.js @@ -17,6 +17,7 @@ client.start().then(() => { client.on('update', (msg) => { const acct = msg.account.acct; + const id = parseInt(msg.account.id); const acct_parts = acct.split('@'); if (acct_parts.length === 1) { @@ -35,7 +36,7 @@ client.on('update', (msg) => { //Todo: Implement #nobot detection following.push(acct); - client.follow(acct); + client.follow(id); console.log("NOW FOLLOWS: " + acct); });