Bump minimal Python version to 3.8
This commit is contained in:
parent
fe28b04225
commit
0542113d99
3 changed files with 6 additions and 21 deletions
|
@ -3,8 +3,8 @@ import logging
|
|||
import sys
|
||||
|
||||
# Check that we're not running on an unsupported Python version.
|
||||
if sys.version_info < (3, 5):
|
||||
print("nyx_bot requires Python 3.5 or above.")
|
||||
if sys.version_info < (3, 8):
|
||||
print("nyx_bot requires Python 3.8 or above.")
|
||||
sys.exit(1)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -15,7 +15,7 @@ def run():
|
|||
from . import main
|
||||
|
||||
# Run the main function of the bot
|
||||
asyncio.get_event_loop().run_until_complete(main.main())
|
||||
asyncio.run(main.main())
|
||||
except ImportError as e:
|
||||
print("Unable to import nyx_box.main:", e)
|
||||
except KeyboardInterrupt:
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import asyncio
|
||||
import logging
|
||||
import time
|
||||
|
||||
from nio import AsyncClient, MatrixRoom, RoomMemberEvent, RoomMessageText, UnknownEvent
|
||||
|
||||
|
@ -42,25 +41,14 @@ class Callbacks:
|
|||
|
||||
event: The event defining the message.
|
||||
"""
|
||||
event_replace = get_replaces(event)
|
||||
# Ignore too old messages
|
||||
current_time = int(time.time() * 1000)
|
||||
if current_time - event.server_timestamp > 60000:
|
||||
return
|
||||
|
||||
if event_replace:
|
||||
if event_replace := get_replaces(event):
|
||||
self.replace_map[event_replace] = event.event_id
|
||||
|
||||
# Extract the message text
|
||||
msg = strip_beginning_quote(event.body)
|
||||
|
||||
# Ignore messages from ourselves
|
||||
if event.sender == self.client.user:
|
||||
if not is_bot_event(event):
|
||||
include_text = True
|
||||
if not should_record_message_content(self.room_features, room.room_id):
|
||||
include_text = False
|
||||
MatrixMessage.update_message(room, event, event_replace, include_text)
|
||||
if event.sender == self.client.user and is_bot_event(event):
|
||||
return
|
||||
|
||||
# XXX: Special case for Arch Linux CN
|
||||
|
|
|
@ -7,7 +7,7 @@ name = "nyx-bot"
|
|||
version = "0.0.1"
|
||||
description = "A matrix bot to do amazing things!"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.5"
|
||||
requires-python = ">=3.8"
|
||||
dependencies = [
|
||||
"matrix-nio>=0.10.0",
|
||||
"Markdown>=3.1.1",
|
||||
|
@ -23,9 +23,6 @@ dependencies = [
|
|||
classifiers=[
|
||||
"License :: OSI Approved :: Apache Software License",
|
||||
"Programming Language :: Python :: 3 :: Only",
|
||||
"Programming Language :: Python :: 3.5",
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
|
|
Loading…
Reference in a new issue