A Mastodon bot for pinging
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

README.md 3.6KB

před 2 roky
před 2 roky
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # Pingbot
  2. Pingbot monitors a Mastodon account, and will ping one or more other accounts any time
  3. that account gets a notification. This is useful for monitoring an admin account that
  4. may not be logged in all the time, or for checking in on an old account after you've
  5. made a new one.
  6. **You cannot monitor an account you can't log into. This is deliberate and will not be changed.**
  7. ## Setup
  8. Pingbot requires the `ananas` package. You can install it with pip:
  9. `pip3 install ananas`
  10. Note that the version of ananas that's currently available on pip (as of 4/28/22) is
  11. *not* compatible with Python 3.10. There's already a PR in to fix that so we just
  12. have to wait for PyPI to catch up.
  13. You can either download `pingbot.py` and `sample-config.cfg` directly, or you can go to
  14. the command line on the server you want to run Pingbot on and run
  15. `git clone https://git.noelle.codes/noelle/Pingbot.git`
  16. This will create a new directory called `Pingbot` that contains the repository's files.
  17. You'll run `ananas` (see below) from there.
  18. **In the Mastodon web interface on the account you want to monitor**, open Preferences,
  19. then Development, and click the New Application button at the upper right.
  20. You'll need to give your application a name; this can be pretty much anything you want.
  21. Leave "Application website" blank, and leave "Redirect URI" alone.
  22. You can leave Scopes alone; all Pingbot does is check your notifications and send you
  23. DMs. However, if you want to limit Pingbot's access for security, it **must** have
  24. `read:notifications` and `write:statuses` in order to do its job.
  25. Click the Submit button at the bottom, and you'll see "Application successfully created",
  26. as well as your new application in the list below. Click the name you chose (it should be
  27. blue), and this will bring up a screen that shows you the **client key**, **client secret**,
  28. and **access token**.
  29. In Pingbot's directory, copy `sample-config.cfg` to `config.cfg`, and then open it for
  30. editing. You'll need a separate header in the config file, enclosed by [brackets], for
  31. each bot you want to run in the same directory. The sample configuration file includes
  32. a [pingbot] header for you, as well as a [DEFAULT] header for settings that apply to
  33. every bot in the directory. You should place most of your information under the
  34. [pingbot] header; the configuration file includes instructions on how to do this.
  35. (Note that what the Mastodon web interface calls a "Client key", the config file
  36. calls a `client_id`.)
  37. In the configuration file, every username you include should *not* have an @ before it
  38. (e.g. `noelle@elekk.xyz`, not `@noelle@elekk.xyz`).
  39. Once all your information is in the configuration file, save it, and then run
  40. `ananas config.cfg`
  41. in a terminal window and your bot will start up and begin listening! In Linux, you can
  42. run your bot in the background by adding an & to the end:
  43. `ananas config.cfg &`
  44. Or you can use a window manager like `tmux` or `screen`, which will let you keep the
  45. bot running on a server without you havnig to be logged in.
  46. ## Making configuration changes
  47. If you want to change Pingbot's settings, you'll need to stop and restart the bot.
  48. Make sure you stop the bot *before* you make changes; Pingbot saves its configuration
  49. when it shuts down, and might overwrite your changes.
  50. ## I need help!
  51. You can contact me at [my Mastodon account](https://chat.noelle.codes/@noelle) and
  52. I'll do my best to help you out. :)
  53. ## TODO
  54. * On startup, make Pingbot get permission from all accounts it wants to notify (and store that permission so it doesn't ask multiple times)
  55. * Make Pingbot optionally not respond to replies from accounts in its notify list
  56. * Internationalization