diff --git a/.idea/dataSources.local.xml b/.idea/dataSources.local.xml index 357d466..38780b0 100644 --- a/.idea/dataSources.local.xml +++ b/.idea/dataSources.local.xml @@ -1,6 +1,6 @@ - + " diff --git a/cogs/events.py b/cogs/events.py index 9f8c023..996181d 100644 --- a/cogs/events.py +++ b/cogs/events.py @@ -365,6 +365,29 @@ class Events(commands.Cog): if not message.guild: return + if message.channel.name == "femboy-hole": + if Path("/tmp/jimmy-bridge").exists(): + payload = { + "author": str(message.user), + "content": message.content, + "attachments": [ + { + "url": a.url, + "filename": a.filename, + "size": a.size, + "width": a.width, + "height": a.height, + "content_type": a.content_type, + } + for a in message.attachments + ] + } + dumped = json.dumps(payload, separators=(",", ":")).encode() + buffer_need = 8192 - len(dumped) + if buffer_need > 0: + dumped += b"\0" * buffer_need + Path("/tmp/jimmy-bridge").write_bytes(dumped) + if message.channel.name == "pinboard": if message.type == discord.MessageType.pins_add: await message.delete(delay=0.01) diff --git a/cogs/other.py b/cogs/other.py index 18eb868..040f665 100644 --- a/cogs/other.py +++ b/cogs/other.py @@ -1540,6 +1540,8 @@ class OtherCog(commands.Cog): use_tor: bool = False ): """Sherlocks a username.""" + # git clone https://github.com/sherlock-project/sherlock.git && cd sherlock && docker build -t sherlock . + if re.search(r"\s", username) is not None: return await ctx.respond("Username cannot contain spaces.") diff --git a/web/server.py b/web/server.py index 44342ab..f2835f2 100644 --- a/web/server.py +++ b/web/server.py @@ -281,3 +281,25 @@ async def verify(code: str): GENERAL, status_code=308 ) + + +@app.post("/bridge") +async def bridge(req: Request): + body = await req.json() + if body["secret"] != app.state.bot.http.token: + raise HTTPException( + status_code=401, + detail="Invalid secret." + ) + + channel = app.state.bot.get_channel(1032974266527907901) + if not channel: + raise HTTPException( + status_code=404, + detail="Channel does not exist." + ) + + await channel.send( + f"**{body['sender']}**:\n>>> {body['message']}" + ) + return {"status": "ok"}