Commit Graph

5984 Commits

Author SHA1 Message Date
Valentin Lorentz a6aa5530dd Ensure files written with AtomicFile are read in UTF8
With some locale configurations (not that uncommon on CentOS), open() may
default to non-UTF8 encodings (eg. ANSI_X3.4-1968).

This is usually not an issue, because we use open() both for writing and
reading. However, AtomicFile implicitly enforces UTF8; which needs to be
mirrored when reading.
2022-10-06 09:49:42 +02:00
James Lu b1cfb87e71 String: allow multi-character inputs in "ord" and "unicodename"
This allows them to support emoji ZWJ sequences, which render like one character but are actually multiple.
2022-10-06 08:31:22 +02:00
Valentin Lorentz 169824a9d2 Math: make `@icalc` fail early when result is too large
This avoids inconsistent errors between CPython 3.10.7 and older
versions; and the result would not be readable anyway.

Closes GH-1517.
2022-09-18 20:06:34 +02:00
Valentin Lorentz bc3a441888 Poll: Make answers case-insensitive 2022-09-18 19:25:48 +02:00
Valentin Lorentz 200acdfa93 registry: Normalize values before checking they are valid
Otherwise, normalization is useless, and gives a surprising error message,
such as:

```
<user> config plugins.rss.sortfeeditems oldestfirst
<bot> Error: Valid values include 'asInFeed', 'oldestFirst', 'newestFirst', 'outdatedFirst', and 'updatedFirst', not 'oldestFirst'.
```
2022-09-07 12:31:22 +02:00
Valentin Lorentz 86b389618f MessageParser: Ignore chathistory batches
To be consistent with commands and PluginRegexp (snarfers)
2022-08-16 00:23:33 +02:00
Valentin Lorentz fccb4f705b RSS: Log feed URL when feedparser.parse raises exceptions 2022-08-07 19:17:15 +02:00
Valentin Lorentz 4db32e24a5 Ctcp: Fix 'RuntimeError: dictionary changed size during iteration' 2022-08-06 15:09:10 +02:00
Valentin Lorentz 0780624450 Time: Fix typo 2022-08-06 15:08:51 +02:00
Valentin Lorentz b8dce0d7db Time: Skip new assertions on Python 3.6 so testSeconds passes 2022-08-02 13:16:21 +02:00
Valentin Lorentz 8f837a676d Time: Add support for omitting space in @seconds 2022-08-02 13:01:08 +02:00
Valentin Lorentz cd0f9f2628 Polls: Make nick matching case-insensitive
This prevents the same nick from voting twice by changing
the capitalization
2022-07-31 09:04:27 +02:00
Valentin Lorentz 28c52c2818 Poll: Add @poll list command 2022-07-30 21:25:47 +02:00
Valentin Lorentz 2afa3c49a1 Fediverse: run black 2022-07-30 21:23:10 +02:00
Valentin Lorentz 461c091b94 Fediverse: Hide channel actor on PeerTube 2022-07-20 18:15:51 +02:00
Valentin Lorentz 34f8842273 Fediverse: Add support for descriptions with line breaks 2022-07-20 18:10:14 +02:00
Valentin Lorentz 2df2bc28d0 Fediverse: Add support for videos 2022-07-20 17:57:29 +02:00
Valentin Lorentz d67fb2a8b2 Autocomplete, Fediverse, Geography, Poll: Run Black 2022-07-20 17:53:09 +02:00
pratyushd 5d8f59bf80
add conditional to respond acc to kick being true or not (#1512)
Co-authored-by: Pratyush Desai <pratyush.desai@liberta.casa>
2022-07-13 21:02:28 +02:00
Pratyush Desai 964acac058 for #1490 extend usage examples 2022-07-13 08:56:30 +02:00
James Lu 95f6b1698e Aka, Alias: replace obsolete LastFM example 2022-07-09 14:15:57 -07:00
Valentin Lorentz 96b7f51e71 callbacks: Ignore chathistory batches in PluginRegexp
This is consistent with what we already do with commands; and generally
makes sense, as we don't want to re-send titles and others when cycling
on UnrealIRCd (which includes a chathistory batch when joining when
chmode +H is set, despite umode +B)
2022-07-06 22:07:37 +02:00
James Lu d00113e92d PluginDownloader: replace automatic 2to3 step with a simple warning
The previous heuristic runs into false positives when imports are merged in __init__.py

More broadly though, it's unlikely automatic 2to3 is particularly useful in 2022 - plugins that were written ~10 years ago are unlikely to work even if syntax errors are fixed.
2022-06-23 22:31:17 +02:00
James Lu 8ccf2c7175 PluginDownloader: drop legacy Python 2-only repos
Most of these haven't been updated in ~10 years and are unlikely to work out of the box today (obsolete web APIs, etc.)
2022-06-23 22:31:17 +02:00
SamStrongTalks d04e8161d5
Add ability to exclude channel from self censoring (#1508) 2022-06-17 16:44:12 +02:00
Valentin Lorentz 1d4a43ed1b AutoMode: Fix crash on servers without ISUPPORT PREFIX 2022-04-16 12:05:43 +02:00
Valentin Lorentz eb6fc932d9 Web: Fix matching for youtube 2022-04-04 23:29:47 +02:00
Valentin Lorentz 21ea999e3c Time: Add support for UTC offsets as tztime arguments. 2022-04-04 22:07:06 +02:00
Valentin Lorentz 4f3d6fc39f Geograpy: Fix formatting of negative non-integral offsets (and improve others) 2022-04-04 22:06:19 +02:00
Valentin Lorentz 66d986e820 Web: Add overrides to support Youtube and Reddit; remove Twitter from tests. 2022-03-03 22:16:53 +01:00
Valentin Lorentz 76f7eced5d Fediverse: Update tests broken by previous commit 2022-02-19 21:18:24 +01:00
Valentin Lorentz 4e60d8812d Misc: Make @last handle --regexp in a single process for all messages
Spawning one process for each message was a little silly, considering
there can be thousands of messages.

Plus, some instances do reach the timeout after running for a few weeks,
so we really need to fix this.

Ideally, `regexp_wrapper` should also be removed from other plugins
(Todo, Notes, ...) as they have the same issues, but this will do for
now.
2022-02-16 21:27:28 +01:00
Valentin Lorentz 4b892c2b1d all: Update .pot and .po files 2022-02-06 00:14:47 +01:00
Valentin Lorentz 5b7b2bd85b Fix chmods 2022-02-05 23:37:39 +01:00
James Lu 0ed743bb8e Format: allow empty substrings in 'replace'
This allows for easy substring removal without having to use regex.
2022-01-28 17:50:31 -08:00
Valentin Lorentz da549e4fde Geography: Print current UTC offset next to timezones. 2022-01-16 20:45:41 +01:00
Valentin Lorentz 880efbbd27 Merge branch 'geography' into testing 2022-01-16 19:44:22 +01:00
Valentin Lorentz 28b28fe3cf Config: Fix crash happening since the previous commit 2022-01-11 20:38:14 +01:00
Valentin Lorentz dcca9f9637 RSS: Make feed announces actually network-specific
.getSpecific() always returned the  channel-specific but non-network-specific var,
unless the channel-specific and network-specific one was manually set.
2022-01-11 20:13:39 +01:00
Valentin Lorentz 74f86654b1 Remove fallbacks for old Python versions. 2022-01-01 18:11:36 +01:00
Valentin Lorentz 7fade191c3 Google: Update suggestions in the deprecation warning
1. DDG is now built-in
2. GoogleCSE is actually limited to site-specific search
2021-12-23 20:09:49 +01:00
Valentin Lorentz caa5aa3d84 Config: Replace inconsistent terminology 2021-12-19 21:11:26 +01:00
Valentin Lorentz e223b507dd utils.time: Add support for timezones without a slash.
eg. UTC, CET, ...
2021-12-07 23:30:16 +01:00
Valentin Lorentz ed9dffdd7f supybot-plugin-doc: Remove extra space + regenerate all READMEs. 2021-12-04 03:19:12 +01:00
Valentin Lorentz 828fff9cc0 supybot-plugin-doc: Add missing newlines + regenerate all READMEs. 2021-12-04 02:50:28 +01:00
Valentin Lorentz f1824fc7db Config: Fix crash when reseting registry.Pattern 2021-12-03 17:28:05 +01:00
Valentin Lorentz baa8cda814 Fix bypassed cache invalidation checks, causing '@config reload' to be partially ignored
`registry.Value.__call__()` is a wrapper around access to
`registry.Value.value`, that checks if the value was set before the latest
call to `registry.open_registry`; and updates the `value` if needed.

When accessing `registry.Value.value` directly, this cache can't be
invalidated, causing the old value to still be used, until the next call
to `registry.Value.__call__()`.
2021-12-03 16:56:06 +01:00
Valentin Lorentz c0d033ff84 Math: Fix crash in @convert on small/large single-digit numbers
str() converts them to the exponent notation, which makes split('.')[1]
crash, since there is no decimal part in the exponent notation when there
is a single significant digit.
2021-11-28 18:00:58 +01:00
Valentin Lorentz 2d5c80736d MessageParser: Fix crash (and unexpected behavior) when matching backslashes
Closes GH-1497.
2021-11-26 00:55:44 +01:00
Valentin Lorentz 63a97fc147 Owner: Ignore commands when they are in a chathistory batch. 2021-11-18 13:17:39 +01:00
Valentin Lorentz d2091e8f71 Geography: Always prefer IANA timezones over UTC offsets
Even if the UTC offsets are given on a more specific entity,
they are usually worthless to us (eg. DST).
2021-11-11 19:07:36 +01:00
Valentin Lorentz 76b9d6f0ce Geography: Properly handle missing timezones 2021-11-09 23:38:31 +01:00
Valentin Lorentz 93a407a9ac Geography: Add 'localtime' command 2021-11-09 23:10:59 +01:00
Valentin Lorentz 36ade18319 Geography: Add 'timezone' command 2021-11-09 22:41:40 +01:00
Valentin Lorentz 696d82ccfe Geography: Fix crash in nominatim.py when some results are not OSM objects 2021-11-09 22:41:40 +01:00
Valentin Lorentz 162e974aba Geography: Implement search for OSM IDs using Nominatim. 2021-11-09 22:41:40 +01:00
Valentin Lorentz 35c1407779 Geography: Add support for querying Wikidata from an OSM ID. 2021-11-09 22:41:40 +01:00
Valentin Lorentz 1a72a7d6d0 Geography: run Black 2021-11-09 22:41:40 +01:00
Valentin Lorentz 849acb21f4 Geography: Clean up the SPARQL statement. 2021-11-09 22:41:40 +01:00
Valentin Lorentz 3b7379ec0f Geography: Fix typo, preventing exclusion of non-constant offset statements on timezones
eg. it did not exclude the offsets from Q941023 (Eastern Time Zone)
2021-11-09 22:41:40 +01:00
Valentin Lorentz 0a6f598295 Geography: Set a better user-agent to access Wikidata 2021-11-09 22:41:40 +01:00
Valentin Lorentz 27c513135c Geography: Early draft, with buggy implementation of timezone_from_qid. 2021-11-09 22:41:40 +01:00
Valentin Lorentz 5aefd6395f Time: Fix error handling in @tztime. 2021-11-09 22:33:23 +01:00
Valentin Lorentz 8326d6ef7f Fediverse and Poll: Run Black 2021-11-09 22:33:12 +01:00
Valentin Lorentz 8b26b675ba Use stdlib instead of pytz on Python >= 3.9
Python 3.9 introduced the zoneinfo module, which provides the only
feature we used pytz for (getting a datetime.tzinfo object from
an IANA timezone id); so let's use it instead of a third-party
dependency.
2021-11-08 21:46:48 +01:00
Valentin Lorentz ce7e4b754c Replace deprecated unittest function calls. 2021-11-08 21:29:59 +01:00
James Lu 417cd7d66f LogToIrc: add missing import 2021-10-20 17:39:50 -07:00
Valentin Lorentz 63eb6672ea Revert generic 'The Limnoria Contributors' in copyright notices
This commit reverts db7ef3f025
(though it keeps the year updates)

After discussion with several people, it seems better to mention
copyright owners explicitly. eg. https://reuse.software/faq/#vcs-copyright
explains the issue of using VCSs to track copyright.

As db7ef3f025 only replaced mentions
of my name with 'The Limnoria Contributors', this commit only needs
to undo that + add one person who contributed to setup.py.
2021-10-17 09:57:55 +02:00
PeGaSuS f31e5c4b9a LogToIrc: Synchronize README with config.py
Better document the format of the 'target' config var
2021-10-09 22:53:13 +02:00
Valentin Lorentz 3f27c03f77 LogToIrc: better document the format of the 'target' config var 2021-10-09 21:08:48 +02:00
Valentin Lorentz 163e717bf0 Fediverse: increase again to fix failures on the CI... 2021-10-08 01:03:31 +02:00
Valentin Lorentz d844243ce1 Fediverse: increase max heap size to mitigate crashes on pypy 2021-10-08 00:15:45 +02:00
Valentin Lorentz bc0c5bdeed ChannelLogger: Log away messages 2021-10-07 21:34:04 +02:00
Valentin Lorentz 4d974869f9 String: Fix TypeError. 2021-09-21 21:41:25 +02:00
Valentin Lorentz f468557899 Channel: Fix capability check in alertOps, to check the target instead of sender. 2021-09-21 21:21:21 +02:00
Valentin Lorentz c93493901e Fediverse & String: Increase test timeouts, they can be flaky on CIs 2021-09-21 21:19:03 +02:00
Valentin Lorentz dc79ab193a Update capitalization of my Github username 2021-09-14 20:30:47 +02:00
Valentin Lorentz 5b9ec4f716 LogToIrc: Prevent loop when sending to non-existing channels
When the target is a channel it is not in, it would treat it as a user;
which, if userCapabilityRequired is empty, would unconditionally send it
to a channel.
This would usually result in an error, that would be logged,
hence the loop.
2021-09-13 19:07:34 +02:00
Valentin Lorentz 070090ffc5 LogToIrc: Honor the configured log level 2021-09-13 19:05:42 +02:00
Valentin Lorentz e63858659a Fediverse: Better assertionerror messages 2021-08-28 23:48:19 +02:00
Valentin Lorentz 52a5cefd50 Move stripformatting from Format to Filter, for consistency 2021-08-28 23:37:21 +02:00
Valentin Lorentz db05081ff6 commands: fix _checkUrl 2021-08-25 23:28:25 +02:00
Valentin Lorentz be88530fa4 commands: Disallow IRIs from 'url' and 'httpUrl' converters.
urllib doesn't support IRIs, and gives out a cryptic
'UnicodeEncodeError: 'ascii' codec can't encode character ...'
if we don't validate it.
2021-08-25 21:54:55 +02:00
Valentin Lorentz ca624d7ae6 RSS: Fix nondeterministic test failures
Caused by 'rss announce add' triggering headline announces, that would
delay the execution of the 'remove' commands.

Thanks to @mapreri and @Unit193 for help in reproducing the issue
and confirming the patch.
2021-08-22 19:23:05 +02:00
Valentin Lorentz 0c8e455b4e RSS: When deleting a named feed, preserve anonymous feed of the same URL. 2021-08-22 19:21:28 +02:00
Valentin Lorentz db7ef3f025 all: Add generic 'The Limnoria Contributors' to copyright notices.
No need to bother with details (that are all outdated / out of sync
anyway), just look up the git history.
2021-08-01 21:54:49 +02:00
Valentin Lorentz c008d1191c RSS: Fix crashes when the set of channels changed while iterating. 2021-07-31 14:33:34 +02:00
Valentin Lorentz 0af4af16d3 RSS: Fix random test failure
Closes GH-1479
2021-07-04 10:46:51 +02:00
James Lu 64ae28c0b8 Remove references to my old nick 2021-07-03 16:42:13 -07:00
Valentin Lorentz b8aa5aa33e User: Make @register automatically add the account tag
No need for '@nickauth nick add' right after registering anymore.
2021-06-30 21:28:17 +02:00
Valentin Lorentz c23227cdc7 MessageParser: Show error when the action has a syntax error
Instead of being silent
2021-06-28 23:10:36 +02:00
Valentin Lorentz 6b72672a1e Poll: Fix typo in documentation 2021-06-28 23:10:36 +02:00
James Lu a7216d290f Remove Spanish translations as requested by the author 2021-06-24 22:36:04 -07:00
Valentin Lorentz a7c4c9bd78 Poll: Document usage. 2021-06-19 16:56:17 +02:00
Valentin Lorentz 936d7ebfea Poll Disallow 0 as poll id. 2021-06-19 16:48:40 +02:00
Valentin Lorentz d919e2133d Poll: Initial commit with basic features. 2021-06-19 16:44:21 +02:00
Valentin Lorentz 3b25a94b46 Regenerate READMEs. 2021-06-19 16:44:21 +02:00
Valentin Lorentz 2293d1c129 Services: Update to the latest version of the draft/account-registration spec. 2021-06-15 20:35:55 +02:00
Valentin Lorentz 4b82934131 Services: Add @nickserv and @chanserv command, to message services directly
This is because the recommended method ('owner ircquote nickserv register mypassword bot@example.com')
does not work on charybdis, as Limnoria inserts a colon
before the trailing argument and Charybdis' m_alias module
does not parse commands using the IRC syntax, so it
considers the leading colon to be part of the email address.

The alternative would be to change the recommended command to:
'owner ircquote PRIVMSG nickserv :register mypassword bot@example.com'
but it is prone to typos, so I think we should avoid it.
2021-06-14 21:47:36 +02:00
Valentin Lorentz a4758146d8 Factoids: Fix NameErrors in HTTP callback. 2021-06-01 12:16:34 +02:00