ssh connection feature added
This commit is contained in:
1 parent
f91c7fed04
commit
21fa63b032
3 files changed
+40
-3
No files matched your search
+7
-3
@@ -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")
|
||||
|
||||
|
||||
@@ -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'))
|
||||
|
||||
@@ -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))
|
||||
Reference in new issue
Block a user