mirror of
https://github.com/hemna/aprsd-telegram-plugin.git
synced 2024-11-23 08:28:40 -05:00
Force python-telegram-library to < version 20
the python telegram library has completely broken their API in version 20 and > due to rewriting the library requiring the use of asyncio, which is entirely incompatible with threading.
This commit is contained in:
parent
a4dfb1393d
commit
646f99b9fe
@ -5,6 +5,7 @@ import time
|
|||||||
|
|
||||||
from aprsd import conf # noqa
|
from aprsd import conf # noqa
|
||||||
from aprsd import packets, plugin, threads
|
from aprsd import packets, plugin, threads
|
||||||
|
from aprsd.threads import tx
|
||||||
from aprsd.utils import objectstore
|
from aprsd.utils import objectstore
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from telegram.ext import Filters, MessageHandler, Updater
|
from telegram.ext import Filters, MessageHandler, Updater
|
||||||
@ -132,8 +133,8 @@ class TelegramChatPlugin(plugin.APRSDRegexCommandPluginBase):
|
|||||||
# LOG.info(f"Text {update.message.text}")
|
# LOG.info(f"Text {update.message.text}")
|
||||||
# LOG.info(f"Chat {update.message.chat}")
|
# LOG.info(f"Chat {update.message.chat}")
|
||||||
# LOG.info(f"From {update.message.from.username} : ")
|
# LOG.info(f"From {update.message.from.username} : ")
|
||||||
fromcall = self.config.get("aprs.login")
|
fromcall = CONF.aprs_network.login
|
||||||
tocall = CONF.callsign
|
tocall = CONF.aprsd_telegram_plugin.callsign
|
||||||
|
|
||||||
if update.message.chat.type == "private":
|
if update.message.chat.type == "private":
|
||||||
LOG.info(f"Username {update.message.chat.username} - ID {update.message.chat.id}")
|
LOG.info(f"Username {update.message.chat.username} - ID {update.message.chat.id}")
|
||||||
@ -149,7 +150,7 @@ class TelegramChatPlugin(plugin.APRSDRegexCommandPluginBase):
|
|||||||
to_call=tocall,
|
to_call=tocall,
|
||||||
message_text=message,
|
message_text=message,
|
||||||
)
|
)
|
||||||
pkt.send()
|
tx.send(pkt)
|
||||||
elif update.message.chat.type == "group":
|
elif update.message.chat.type == "group":
|
||||||
group_name = "noidea"
|
group_name = "noidea"
|
||||||
message = "TelegramGroup({}): {}".format(
|
message = "TelegramGroup({}): {}".format(
|
||||||
@ -161,7 +162,7 @@ class TelegramChatPlugin(plugin.APRSDRegexCommandPluginBase):
|
|||||||
to_call=tocall,
|
to_call=tocall,
|
||||||
message_text=message,
|
message_text=message,
|
||||||
)
|
)
|
||||||
pkt.send()
|
tx.send(pkt)
|
||||||
|
|
||||||
def create_threads(self):
|
def create_threads(self):
|
||||||
if self.enabled:
|
if self.enabled:
|
||||||
@ -178,7 +179,7 @@ class TelegramChatPlugin(plugin.APRSDRegexCommandPluginBase):
|
|||||||
if self.enabled:
|
if self.enabled:
|
||||||
# Now we can process
|
# Now we can process
|
||||||
# Only allow aprsd owner to use this.
|
# Only allow aprsd owner to use this.
|
||||||
mycall = self.config["ham"]["callsign"]
|
mycall = CONF.aprsd_telegram_plugin.callsign
|
||||||
|
|
||||||
# Only allow the owner of aprsd to send a tweet
|
# Only allow the owner of aprsd to send a tweet
|
||||||
if not from_callsign.startswith(mycall):
|
if not from_callsign.startswith(mycall):
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
pbr
|
pbr
|
||||||
aprsd>=3.0.0
|
aprsd>=3.0.0
|
||||||
python-telegram-bot
|
python-telegram-bot<20.0
|
||||||
oslo.config
|
oslo.config
|
||||||
|
Loading…
Reference in New Issue
Block a user