Update for aprsd 2.7.0

This patch removes references to aprsd.messaging as it's been replaced
by aprsd.packets
This commit is contained in:
Hemna 2022-12-20 17:17:17 -05:00
parent 108ea07f60
commit 25e18a55d2
3 changed files with 23 additions and 10 deletions

View File

@ -1,6 +1,11 @@
CHANGES CHANGES
======= =======
v0.1.3
------
* remove trace
v0.1.2 v0.1.2
------ ------

View File

@ -3,7 +3,7 @@ import logging
import threading import threading
import time import time
from aprsd import messaging, objectstore, plugin, threads from aprsd import objectstore, packets, plugin, threads
from telegram.ext import Filters, MessageHandler, Updater from telegram.ext import Filters, MessageHandler, Updater
import aprsd_telegram_plugin import aprsd_telegram_plugin
@ -143,16 +143,24 @@ class TelegramChatPlugin(plugin.APRSDRegexCommandPluginBase):
self.users[update.message.chat.username] = update.message.chat.id self.users[update.message.chat.username] = update.message.chat.id
# LOG.debug(self.users) # LOG.debug(self.users)
# LOG.info(f"{message}") # LOG.info(f"{message}")
msg = messaging.TextMessage(fromcall, tocall, message) pkt = packets.MessagePacket(
msg.send() from_call=fromcall,
to_call=tocall,
message_text=message,
)
pkt.send()
elif update.message.chat.type == "group": elif update.message.chat.type == "group":
group_name = "noidea" group_name = "noidea"
message = "TelegramGroup({}): {}".format( message = "TelegramGroup({}): {}".format(
group_name, group_name,
update.message.text, update.message.text,
) )
msg = messaging.TextMessage(fromcall, tocall, message) pkt = packets.MessagePacket(
msg.send() from_call=fromcall,
to_call=tocall,
message_text=message,
)
pkt.send()
def create_threads(self): def create_threads(self):
if self.enabled: if self.enabled:
@ -163,8 +171,8 @@ class TelegramChatPlugin(plugin.APRSDRegexCommandPluginBase):
"""This is called when a received packet matches self.command_regex.""" """This is called when a received packet matches self.command_regex."""
LOG.info("TelegramChatPlugin Plugin") LOG.info("TelegramChatPlugin Plugin")
from_callsign = packet.get("from") from_callsign = packet.from_call
message = packet.get("message_text", None) message = packet.message_text
if self.enabled: if self.enabled:
# Now we can process # Now we can process
@ -196,10 +204,10 @@ class TelegramChatPlugin(plugin.APRSDRegexCommandPluginBase):
text=msg, text=msg,
) )
return messaging.NULL_MESSAGE return packets.NULL_MESSAGE
else: else:
LOG.warning("TelegramChatPlugin is disabled.") LOG.warning("TelegramChatPlugin is disabled.")
return messaging.NULL_MESSAGE return packets.NULL_MESSAGE
class TelegramThread(threads.APRSDThread): class TelegramThread(threads.APRSDThread):

View File

@ -1,3 +1,3 @@
pbr pbr
aprsd>=2.4.0 aprsd>=2.7.0
python-telegram-bot python-telegram-bot