From 21fa63b032bf374e483446685da2a4243989250b Mon Sep 17 00:00:00 2001 From: esefxdz Date: Wed, 1 Jul 2026 00:03:27 +0300 Subject: [PATCH] ssh connection feature added --- cogs/general.py | 10 +++++++--- main.py | 1 + rio/ssh_connection_rio.py | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 rio/ssh_connection_rio.py diff --git a/cogs/general.py b/cogs/general.py index a438997..8fc8966 100644 --- a/cogs/general.py +++ b/cogs/general.py @@ -15,8 +15,6 @@ class General(commands.Cog): async def yuuka(self, ctx): await ctx.send('kanpeki!') - - @commands.command() async def weather(self, ctx, *, city: str = "kayseri"): try: @@ -44,6 +42,12 @@ class General(commands.Cog): async def ferox(self, ctx, duration: str): if ctx.author.id != int(os.getenv("MELLO")): return await ctx.reply("you are not her bro") + ferox = ctx.guild.get_member(int(os.getenv("FEROX"))) + + if duration.lower() in ("off", "unmute"): + await ferox.timeout(None) + await ctx.reply("oh, you want him free? fine.") + return units = { "m": timedelta(minutes=1), @@ -54,7 +58,7 @@ class General(commands.Cog): amount = int(duration[:-1]) delta = amount * units[duration[-1].lower()] - ferox = ctx.guild.get_member(int(os.getenv("FEROX"))) + await ferox.timeout(discord.utils.utcnow() + delta) await ctx.reply(f"muted ferox for {duration}, she knows the best") diff --git a/main.py b/main.py index 27c26fb..955ad02 100644 --- a/main.py +++ b/main.py @@ -57,6 +57,7 @@ async def main(): await bot.load_extension('cogs.currency_converter') await bot.load_extension('ai.ai_roleplay') await bot.load_extension('twitterbridge.leaks_cmd') + await bot.load_extension("rio") try: await bot.start(os.getenv('DISCORD_TOKEN')) diff --git a/rio/ssh_connection_rio.py b/rio/ssh_connection_rio.py new file mode 100644 index 0000000..948f661 --- /dev/null +++ b/rio/ssh_connection_rio.py @@ -0,0 +1,32 @@ +import os +import subprocess +import discord +from discord.ext import commands + +class Rio(commands.Cog): + def __init__(self, bot): + self.bot = bot + + @commands.command() + async def connectrio(self, ctx): + target = os.getenv("RIO_CONNECTION") + + try: + result = subprocess.run( + ["ssh", "-o", "BatchMode=yes", target, "echo ok"], + capture_output=True, + text=True, + timeout=10 + ) + + if result.returncode == 0 and "ok" in result.stdout: + await ctx.reply("ok") + else: + await ctx.reply("failed") + + except Exception as e: + await ctx.reply(f"failed: {e}") + + +async def setup(bot): + await bot.add_cog(Rio(bot)) \ No newline at end of file