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
=======
v0.1.3
------
* remove trace
v0.1.2
------

View File

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

View File

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