From 3e98baddda31fe9cc03ad0ae359784a0753980f4 Mon Sep 17 00:00:00 2001 From: phixxy Date: Tue, 18 Jun 2024 11:10:38 -0700 Subject: [PATCH] start of meshtastic code --- cogs/meshtastic.py | 26 ++++++++++++++++++++++++++ requirements.txt | 3 ++- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 cogs/meshtastic.py diff --git a/cogs/meshtastic.py b/cogs/meshtastic.py new file mode 100644 index 0000000..36f08e9 --- /dev/null +++ b/cogs/meshtastic.py @@ -0,0 +1,26 @@ +import logging +import discord +from discord.ext import commands +import meshtastic +import meshtastic.serial_interface + +class Meshtastic(commands.Cog): + + def __init__(self, bot): + self.bot = bot + self.logger = logging.getLogger("bot") + self.interface = meshtastic.serial_interface.SerialInterface() + + @commands.command( + description="Meshtastic", + help="Ask the magic ball a question.", + brief="Ask the magic ball a question.", + aliases=["mesh"] + ) + async def mesh(self, ctx, *args): + message = " ".join(args) + self.interface.sendText(message) + self.logger.info(f"Meshtastic command called by {ctx.author.name}") + +async def setup(bot): + await bot.add_cog(Meshtastic(bot)) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index c94a3fc..173a812 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,4 +9,5 @@ psutil aiofiles inky wakeonlan -beautifulsoup4 \ No newline at end of file +beautifulsoup4 +meshtastic \ No newline at end of file