fix #3
This commit is contained in:
1 parent
1324fec8dd
commit
3679ba44af
2 files changed
+17
-4
No files matched your search
+7
-3
@@ -1,16 +1,20 @@
|
||||
import subprocess
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
import re
|
||||
|
||||
class SysInfo(commands.Cog):
|
||||
def __init__(self,bot):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
def strip_ansi(self, text):
|
||||
return re.sub(r'\x1b\[[0-9;]*[a-zA-Z]|\[[0-9]+[A-Z]', '', text)
|
||||
|
||||
@commands.command()
|
||||
async def fetch(self, ctx):
|
||||
result = subprocess.run(['fastfetch', '--pipe'], capture_output=True, text=True)
|
||||
await ctx.reply(f'```\n{result.stdout}\n```')
|
||||
|
||||
clean = self.strip_ansi(result.stdout)
|
||||
await ctx.reply(f'```\n{clean}\n```')
|
||||
|
||||
async def setup(bot):
|
||||
await bot.add_cog(SysInfo(bot))
|
||||
Reference in new issue
Block a user