• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

btittelbach/MastodonBoostBot: simple Mastodon Bot to boost all mentions of a cer ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

btittelbach/MastodonBoostBot

开源软件地址(OpenSource Url):

https://github.com/btittelbach/MastodonBoostBot

开源编程语言(OpenSource Language):

Go 100.0%

开源软件介绍(OpenSource Introduction):

Simple Mastodon Bot to boost all mentions of a certain hashtag of the people it's following

Idea

The original usecase is to collect all the toots mentioning one of a set of hashtags by a group of people and re-toot/boost their stati in a single account. The single account can be displayed on a kiosk screen and be the public face of a organisation/group/hackerspace. You can use MastodonBoostBot to emulate groups in Mastodon. Users can post as an organisation account without requiring login credentials and without loosing the information about the original poster.

Administer your group (people whose tagged posts will be boosted) in Mastodon by following/unfollowing users.

Alternatively, you can disable the follower-filter and just boost/reblog every post containing one of your hashtags.

Features

  • mostly 12-factor app
    • configuration with environment variables
    • but no package control until go1.12 is more widespread
  • easily containerized static golang executable
  • fail-fast, restart-fast
  • configure once and forget (administrate trusted followers in mastodon, not bot configuration)

Todo

  • cc videos to Twitter
  • cc multiple images to Twitter
  • split longer toots into multiple tweets

Example Information Flow

see also slides of lightningtalks which can be found here

similar software

  • tootgroup

    • only needs to run periodically from cron while MastodonBoostBot needs to run constantly as a well defined service, otherwise it will miss a post
    • hiding the original poster, by extracting content from direct messages, is currently not planned in MastodonBoostBot
  • boost-bot

    • Very similar, but does not filter by followers

Installation

Build

go build

Configure

  1. In your Mastodon account-page, create a new application in the development app
    • with the following permissions: read:accounts read:statuses read:search read:follows write:conversations write:statuses push
  2. copy example.env and fill the copy with the appropriately app-credentials e.g. to mastodonBoostBot_config1.env
  3. configure the hashtags you want to follow (without the leading #)

Carbon Copy to Twitter

  1. You will need an App Consumer Key and App Consumer Secret from a Twitter Developer (or get a Twitter Developer to run MastodonBoostBot for you)
  2. run MBB_CCTWEET_CONSUMER_KEY=___ MBB_CCTWEET_CONSUMER_SECRET=___ ./MastodonBoostBot --starttwitteroauth after replacing ___ with your key and secret.
  3. authorize or let authorize the twitter account you want to use
  4. enter the PIN on the cmdline
  5. copy&paste the resulting settings into your environment file for the service

Test locally

source <(sed '/^\s*#/d;s/\(.\+\)=\(.*\)/export \1="\2"/;' mastodonBoostBot_config1.env)
./MastodonBoostBot --debug=ALL

Deploy

  1. deploy executable and config file to server of your choice
  2. adapt the service file to your paths and needs or otherwise ensure that environment variables are loaded from config-file.
  3. enable and start you can easily run multiple instances with different configurations

Example 1 - as user on a systemd system

  1. copy MastodonBoostBot executable to ~/bin/
  2. copy config to ~/.config/mastodonBoostBot_config1.env
  3. chmod 400 ~/.config/mastodonBoostBot_config1.env
  4. copy user_service/MastodonBoostBot.service to ~/.local/share/systemd/user/
  5. systemctl --user start MastodonBoostBot.service
  6. systemctl --user enable MastodonBoostBot.service

Example 2 - systemwide on a systemd system

  1. mkdir -p /opt/MastodonBoostBot/
  2. adduser mastodonbot
  3. chown mastodonbot -R /opt/MastodonBoostBot/
  4. copy MastodonBoostBot executable to /opt/MastodonBoostBot/
  5. copy config to /opt/MastodonBoostBot/mastodonBoostBot_config1.env
  6. chmod 400 /opt/MastodonBoostBot/mastodonBoostBot_config1.env
  7. copy user_service/MastodonBoostBot.service to /etc/systemd/system
  8. adapt paths and config in MastodonBoostBot.service a. add User=mastodonbot a. ExecStart a. EnvironmentFile a. change WantedBy to multi-user.target or whatever you start your services with a. comment in additional protections. possibly try chrooting the service in /opt/MastodonBoostBot
  9. systemctl start MastodonBoostBot.service
  10. systemctl enable MastodonBoostBot.service

Design

Algorithm

  • follow stream of configured list of hashtags using StreamingAPI

  • for all received status

    • Boost Status if the following optional checks pass
      • is status public (visibility==public)
      • not already reblogged (reblogged==false||reblogged==nil)
      • filter for configured hashtags
      • conversation unblocked? (blocked==false||blocked==nil)
      • original status or already reblogged? (reblog==nil)
      • verify it is a user we follow.
        • get relationship with the posting account (GET /api/v1/accounts/relationships {id:status.account.id})
        • verify we follow this account (following==true && blocking==false && muting==false)
      • considered but not implemented: check against configured list of users (though that would move user-management from website to daemon-configfile)
      • planned but not implemented: filter for addtional content in status-text
  • considered but not implemented: read "private" messages and toot them




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap