__version__ = importlib.metadata.version(__package__)
+_READ_ONLY: bool = False # suppress any API requests that modify the thread?
+
+
@dataclass
class _Update:
id: str
) -> None:
from strikebot.reddit_api import CorrectionUpdateRequest, DeleteRequest, ReportUpdateRequest, StrikeRequest
+ enforcing = enforcing and not _READ_ONLY
+
buffer_ = []
timeline = []
last_valid: Optional[_Update] = None
if parts:
parts.append(_format_curr_count(last_valid))
- api_pool.enqueue_request(CorrectionUpdateRequest(thread_id, "\n\n".join(parts)))
+ if not _READ_ONLY:
+ api_pool.enqueue_request(CorrectionUpdateRequest(thread_id, "\n\n".join(parts)))
for invalid_tu in newly_invalid:
if not invalid_tu.update.stricken:
api_pool.enqueue_request(StrikeRequest(thread_id, update.name, update.ts))
update.stricken = True
- if update.command is Command.REPORT:
+ if not _READ_ONLY and update.command is Command.REPORT:
api_pool.enqueue_request(ReportUpdateRequest(thread_id, body = _format_curr_count(last_valid)))
with message_rx:
slot.update.stricken = True
if isinstance(slot, _TimelineUpdate) and slot.accepted:
logger.info(f"bad strike of {slot.update.id}")
- body = _format_bad_strike_alert(slot.update, thread_id)
- api_pool.enqueue_request(CorrectionUpdateRequest(thread_id, body))
+ if not _READ_ONLY:
+ body = _format_bad_strike_alert(slot.update, thread_id)
+ api_pool.enqueue_request(CorrectionUpdateRequest(thread_id, body))
else:
pending_strikes.add(msg.data["payload"])