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

PetraOleum/vortaro: Esperanto dictionary Mastodon bot

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

开源软件名称(OpenSource Name):

PetraOleum/vortaro

开源软件地址(OpenSource Url):

https://github.com/PetraOleum/vortaro

开源编程语言(OpenSource Language):

Python 100.0%

开源软件介绍(OpenSource Introduction):

Roboto por esperanta vortaro

("Robot for an Esperanto dictionary")

This is a Mastodon bot that posts entries from a English-Esparanto dictionary. It is hosted @[email protected], and uses the Mastodon.py Python wrapper.

This is my first bot for either Twitter or Mastodon, and my first python program in a long time. It's not perfect, but it works.

Source

The bot takes its wordlist from the utf-8 version of the above-linked dictionary, editing out the section headings and other elements that do not fit the pattern "(English) = (Esperanto).", e.g:

Bed (river) = kuŝujo.

A handful of words I'd rather not have appear are removed, along with the first entry which for posterity reads:

A = indefinite article, not used in Esperanto.

This is a very important feature of the language! It just doesn't fit the formulae I use.

Usage

Obviuosly you're more likely to use this to make your own bot, but supposing you were going to deploy an exact copy this is what you would do:

  1. Make an account on botsin.space, or another Mastodon instance. Mark it as a bot and do all the other profile things.
  2. Under Settings->Development create a new application, give it a name etc, leave the permissions as they are, and submit.
  3. Clone this repository onto whatever computer you want to run the app.
    • If the account you made is not on botsin.space, edit bot.py to change the api_base_url to the URL of your instance.
  4. Using pip, download the Mastodon.py API interface. For example, pip3 install --user Mastodon.py.
  5. Back on the website, find the application you created under Settings->Development->Your Applications, and copy its access token into a file named vortaro.secret in the same directory as bot.py etc.
  6. Run your app with python3 bot.py, or equivalent. If all is successful it will print to stdout as well as tooting.

cron

I run the bot via cron. Remember: if you have a line like

0 * * * * /usr/bin/python3 /home/petra/vortaro/bot.py

in your crontab, it's not going to run the bot in the right directory to find the files it needs; instead it will fail silently. Personally I use a wrapper script that cds into the directory.




鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
err4nt/blabber: QML Kirigami based Mastodon client发布时间:2022-08-17
下一篇:
MagnificentPako/Discodon: A Mastodon->Discord relay/bridge.发布时间:2022-08-17
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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