Commit Graph

49 Commits

Author SHA1 Message Date
Ian Wienand a973d8572b
Update ancient hacking version
This version should work with modern python.  Fix up a few minor
formatting things it picks up.

Change-Id: Ie9bebfa5eacc53aa8cbc857c48c7b71c55141864
2022-11-16 14:36:31 +11:00
Ian Wienand 37fb799a1e
Don't recurse on log() message
Both of these classes have a function called log(), so making the
logger "log" is not what we want ... it leads to a debug log sending
out toots ...

Rename the logger variable

Change-Id: I00007daa4763bd05a8f600369d1c65726f3831a6
2022-11-16 13:08:21 +11:00
Ian Wienand 0263b3abda
Add mastodon support
Add very simple mastodon support.  Basically send a request with a
bearer token.

Change-Id: I345dfa5d68a5cbf4035db85be9883592f143dd93
2022-11-16 08:27:22 +11:00
Zuul 387e31a16c Merge "Handle exception for unprivileged commands" 2022-09-28 14:15:37 +00:00
Ian Wienand 5cc27bd9ee twitter: ensure we have a space after the status icon
Change-Id: Ic0acd0f2f1587b51dc35148dad833ce9608e6553
2022-07-14 10:26:59 +10:00
Ian Wienand a269bac966 twitter: Fix typo on OK tick
fe0 is the "variation selector", 0xf is "VS16" which ensures the
preceeding character is shown as a graphical emoji.  The tick here had
a typo from I2746b291a0bc451f1a8dc3aec46adfddb10bb938.

Change-Id: I6c9146c84712e9bdd888babb23049059bb5f8fc8
2022-06-20 09:42:27 +10:00
Ian Wienand 3563ac69a2 Don't inline code emojis
Use the codepoints directly; also add the VS16 selector where required
which ensures we get the graphical version, which is what we want
here.

Change-Id: I2746b291a0bc451f1a8dc3aec46adfddb10bb938
2022-04-20 11:00:04 +10:00
Ian Wienand 14f3df569f Prefix twitter logs with emoji
- ⚠️ Alert
- 📌 Notice
- 🪵 Log
-  OK

Although self explainitory, we can put this key in the description
page too.

Change-Id: Ieaafc625477e100029c9c7cd86cb4cf8cfa49963
2022-04-20 09:37:21 +10:00
Ian Wienand 0428e0d9cb twitter: send log level messages
We note interesting things we're doing a log level, so sending it to
twitter, where we have about 375 people who were engaged enough to
follow us, seems like a way to increase visibility with what is going
on in the project.

Change-Id: I59189d71fb6a3618b14947033d8cc0bf70d8d0b1
2022-04-08 15:14:19 +10:00
Ian Wienand 8097c54a2e twitter: use better variable for the tweet chain link
Using "last" can also imply "final", "prior" is more helpful

Change-Id: Ie601373ec6441dd90bc4447359a50c20663639df
2022-04-06 11:20:51 +10:00
Ian Wienand 0b290dc863 twitter: catch update exceptions
We don't need to kill the whole bot if tweets fail, just log it.

Change-Id: Id874fd6b46f0ef48b1f6fef707672fa467e1c268
2022-04-06 11:04:53 +10:00
Ian Wienand a2bf4189e7 twitter: switch to tweepy
python-twitter has stopped working after Twitter upstream removed an
endpoint it was querying.  Switch to the better maintained tweepy,
which is basically the same.

tweepy doesn't automatically split tweets, so implement that.  Split
tweets will now be in reply to each other, which is a feature.

Change-Id: Id40af0e314ce8a6cb542f6138f5deaa8a587b260
2022-04-06 10:46:12 +10:00
Ian Wienand 067bc37ec0 Revert "Add use_ssl option"
This broke the OpenDev connection, we should figure out why

This reverts commit 4c31332e23.

Change-Id: I944b1a5e8dcb451374ad07c2f34ba873cc9b11ca
2021-11-12 14:50:16 +11:00
Tristan Cacqueray 52bf62acc6 Handle exception for unprivileged commands
This change prevents the bot from crashing on unprivileged commands.

Change-Id: Ib855550aaccfdaca6b8997611de19603ecff72e2
2021-11-10 19:59:18 +00:00
Tristan Cacqueray 4c31332e23 Add use_ssl option
This change enables using the statusbot with a non ssl server.

Change-Id: I4e79625316ebaa391941743bfd1a2ea29e14df09
2021-11-10 19:59:03 +00:00
Tristan Cacqueray 42e3cc433d Add Etherpad backend
Change-Id: Ia525ed337ac7569bec54b70bf57a6c010c33f801
2021-11-10 19:26:59 +00:00
Tristan Cacqueray 0edde4fccc Introduce a BackendInterface
This change replaces object inheritance with object composition to
enable adding backend other than WikiPage.

Change-Id: Id1a5453a1635f17c67594696d58e1d5c17b9566f
2021-11-10 19:26:37 +00:00
Jeremy Stanley 2ce45fe35d More Py3K fixes, urrlib.quote->urllib.parse.quote
We're running statusbot under Python 3 now, and urllib.quote no
longer exists there. Use urllib.parse.quote instead.

Change-Id: If9b7eced5c65bc3a3e0a078c338da2a609af0fc2
2021-06-25 20:39:40 +00:00
Jeremy Stanley e8f9ee6e45 Switch to Python3
Our servers have, in the two years since we last needed to change
statusbot, switched to installing packages with pip for Python 3.x
instead of 2.7. Instead of figuring out how to unfurl that, just
roll forward and embrace the glorious pastfuture.

Update the simplemediawiki version to pull in a prerelease, since
that's the only way to get a version which supports Py3K.

Change-Id: I24100ad2e9d87e20b7fd9ce90399346846529985
2021-05-30 00:44:35 +00:00
Clark Boylan e13ba0ca77 Add non SASL auth back to statusbot
Some networks don't support SASL and we want to support those networks.
This adds non SASL auth back to this IRC bot.

Note that networks like OFTC don't support identity-msg cap extensions.
For this reason we also remove the cap checking for authenticated nicks
in this bot. Instead we will rely on nick enforcement by nickserv.

Change-Id: I81381398b4c100990c04f454191cee52568dbdfe
2021-05-29 09:40:07 -07:00
Jeremy Stanley 79e285e53a Identify with SASL
Identify through SASL using the convenient ib3 mixins, and
get rid of a bunch of special-case code in the process.

This helps when dealing with channels set to require identified
users, as otherwise channel joins will race NickServ's processing of
the identify message and some channels will end up not serviced by
the bot (an alternative would be to delay joining channels until the
identify success is confirmed, but the implementation for that looks
like it would be at least as complex).

Note this also effectively drops non-SSL IRC support. Given
passwords are sent over this connection, I don't see it as a loss.

Change-Id: I0aa15d81f0158fcf2b74825cdb3968d62356fa1d
Co-Authored-By: Thierry Carrez <thierry@openstack.org>
Depends-On: https://review.openstack.org/599061
2018-08-31 20:07:33 +00:00
Zuul 375ed10dce Merge "Thanks & Success bot provide confirmation site url" 2018-01-25 16:30:23 +00:00
Mike Perez 009093c4ae Thanks & Success bot provide confirmation site url
In confirmation of giving a thanks or success post, this will output the
wiki url so the user knows where it got posted.

Change-Id: I06d637c00dccbee49ad8a60398ac21af4064034e
2018-01-04 08:27:16 -08:00
Thierry Carrez 177fe62586 Fix continuation character under Python 2
Recent Twitter messages show the characters \u2026 at the end of
messages needing continuation, rather than the corresponding
character (…), due to statusbot running under Python 2.

Use u\u2026 instead, si that it works in both Python 2 and Python 3.

Change-Id: I958be50bef1991edf0b3aeaf5aa1a32a48f03ef6
2017-12-12 17:58:07 +01:00
Monty Taylor d01cfd3994
Let the python-twitter library handle message splitting
Twitter auto-converts urls to twitter shortened URLs. This can affect
the math for message splitting. The python-twitter library has this
implemented already, including all of the logic necessary ... so just
use it.

The character '\u2026' is the unicode horizontal ellipsis and is used
to indicate that the message is continued.

Change-Id: I5492a2792f5d11dccbe4a3454396262341449eab
2017-09-18 19:45:47 -05:00
Mike Perez 4316cbfadd Implement #thanks command in statusbot
Add simple unprivileged "#thanks" command that adds thanks snippets to
a celebration wiki page.

NB: this adds a couple of configuration options, but fails gracefully if
they are not present.

Change-Id: I995c3189f0f109df35c56b63b3e19427f60f3750
2017-08-01 16:25:57 -07:00
Andreas Jaeger 57d6ed9ad7 Make example config file consistent
Update the sample config file to use _key as well for the
access_token_key - like all other entries.

Change-Id: I8e561a3827bed72601babcb021d12b0a8ec8cad0
2016-09-20 14:52:55 +02:00
Andreas Jaeger 15b3e12ad4 Fix twitter support
statusbot failed to start with error that access_token did not exist.
The variable is called access_token_key, use it.

Change-Id: Ib45a1021046145ff5a65f5aaa2e276558762a2a9
2016-09-20 14:42:21 +02:00
Jenkins a0d518a16f Merge "Explicitly handle ImportError for pid_file_module" 2016-09-09 20:39:11 +00:00
Jenkins c9796fc86f Merge "Explicitly catch Exception" 2016-09-09 20:28:18 +00:00
Joshua Hesketh d95fe85dc4 Post message to twitter on 'ok' status
Change-Id: I0c92f52eca7670fa86a1803fd3fb4b01f46f9bc4
2016-01-04 03:14:14 +00:00
Monty Taylor b9ea2612f7 Add twitter support to statusbot
Similar to replicating to github for the convenience of our
developer community, sending statuses ALSO to twitter seems
like a potentially low-impact way to communicate status on
an additional channel.

Change-Id: Ib4bdbb335e4bc12d75d5f0ec2a1b95c8a6b2e7d5
2015-12-30 10:38:59 -06:00
Monty Taylor e46fe612e7 Update to pbr-based build
Change-Id: I4f7e669563b537eb40365eb006ee327b10784783
2015-12-30 10:27:05 -06:00
Dolph Mathews 1299a815f5 Explicitly catch Exception
This allows non-Exceptions like KeyboardInterrupt, etc, to be ignored
and raised naturally.

Change-Id: I58b3d46d90d7a98891d0afb481da4df60dd9ce62
2015-10-12 19:26:01 +00:00
Dolph Mathews 6ba0de29a5 Explicitly handle ImportError for pid_file_module
Change-Id: Ide9f386a1819b5111d54a75231ff996179f43ecb
2015-10-12 19:24:17 +00:00
Thierry Carrez d58d5456c7 Implement #success command in statusbot
Add simple unprivileged "#success" command that adds small
success snippets to a celebration wiki page.

NB: this adds a couple of configuration options, but fails
gracefully if they are not present.

Change-Id: Ib113fa2b55e47759003a84850c0c85a2f883814e
2015-09-08 16:19:28 +02:00
Thierry Carrez 5a27f181ac Add abstractions to make room for #success
Abstract common WikiPage functions to a parent class to make room
for SuccessPage operations. Make handle_commands specific to #status
commands.

Change-Id: I887ab9b81326bcf4543ff7d8cc6a03eb31691e34
2015-09-08 15:51:44 +02:00
James E. Blair efe7f1cf1b Send broadcast messages with notice command
If the bot has +v or +o, it bypasses target change rate limits.

Also, it stands out more in most clients.

Change-Id: I1dc7dcb4cbfc8ab6ce70d1e34720a2753cf36a96
2014-04-25 11:33:09 -07:00
James E. Blair e75f59cdb6 Sleep longer
2 seconds is the closest thing to a recommendation I can find.
With 1 second we were hitting errors about changing targets too
often.

Change-Id: Ieb36d3c156bc9e2e36bd8bb85a438cdfed661046
2014-04-15 17:03:24 -07:00
James E. Blair 832d196be7 Sleep 1 second
Apparently 0.5 seconds isn't slow enough to avoid services flood
protection.

Change-Id: I79a05e08dc6c5ca7a44f4e7dd93738732b2bed7d
2014-03-12 10:05:30 -07:00
James E. Blair 9297fe91ba Support SSL
Change-Id: I0d6429bf32dbf565b30b6225fcf2f9b951956e4b
2014-03-10 08:30:28 -07:00
James E. Blair d98505cbb3 Handle lots of channels better
Get rid of threads and make all actions synchronous instead (to
make sure we are measuring our commands to the server so we don't
flood).

Don't explicitly ask for the topics to save.  Instead, notice the
topics when joining and keep updating the local copy (except when
we are updating the topic) to speed up the process of changing
topics.

Move the setting of the topic and the broadcast closer together so
that channels don't wait a long time between the announcement
and the topic change.

Give the user confirmation of what's going on, since their channel
might not be near the beginning or end of the list.

Change-Id: I317062268bc591c5ed9db0cb1bbc6fe0e79bec5e
2014-03-07 10:44:19 -08:00
James E. Blair 34429fa549 Sleep when joining channels
Otherwise there is flooding.

Also, log topic changes at INFO level.

Change-Id: I4f105a9e2cc9ecdfbe67565f32ca6c1389fae282
2014-03-07 10:24:53 -08:00
James E. Blair 5d6e389bd3 Don't crash on invalid UTF8
Apparently this is the correct solution to the problem according
to the library author:

  https://bitbucket.org/jaraco/irc/issue/34/irc-client-should-not-crash-on-failed

Change-Id: Ie3661af84982bd54cebd1456b211cedb5495e2bb
2014-03-06 16:23:24 -08:00
James E. Blair a104892265 Set world-readable permissions on alert file
Change-Id: Iaaea474d064479b2732deddd124fba02670ca4d8
2013-12-11 14:34:20 -08:00
James E. Blair ab953f9fdc Add missing import directives
Change-Id: I72d5e11a84b651225a3cfd7e8b33102ad6bb6d19
2013-12-11 13:37:49 -08:00
James E. Blair 42a2678379 Add an alert file publisher
Write the current alert to a file on the file system.  Later this
can be served by apache and included on other pages.

Change-Id: I71a88df993b16cecad7287c54361f8cd5ff78a05
2013-12-06 13:56:54 -08:00
James E. Blair 336c7d9992 Fix imports/dependencies.
Add kitchen (which is an unlisted dep of simplemediawiki).
Fix the logging.config import statement.

Change-Id: I9b82b64d4da2be5ab0f8d2a2e3b74631915b732f
2013-03-29 15:36:36 -07:00
James E. Blair 7c14dc8209 Initial commit.
Change-Id: I9636b219862579fba20a389541bfdc51d41fe96c
2013-03-28 16:19:02 -07:00