I own a discord.py bot. I made a few commands that can create a file with a few simple functions. I have a command who let me read the file, but, I want to improve it. I want that the bot read a specific line of the file. Like if i say +file read test txt 9, the bot will read the file test.txt at line 9.
I use a command group in a cog (cogs/owner.py). The command group called "file" who has a False invoke_without_command() (@commmands.group(invoke_without_command=False))
I tried first to just put the "line" variable in the await ctx.send(f.read(line)), but it didn’t worked.
This is the MRE (minimum reproducible example) of the code:
cogs/owner.py
from discord.ext import commands
import discord
class Owner(commands.Cog):
    # the init function
    @commands.group(invoke_without_command=False)
    async def file(self, ctx):
        print=" "
    @file.command()
    async def read(self, ctx, filename, extension, line=None):
        if line == None:
            f = open(f"{filename}.{extension}", "r")
            await ctx.send(f.read())
        else:
            f = open(f"{filename}.{extension}", "r")
            await ctx.send(f.read(line))
            """
            also tried this:
            await ctx.send(f.read(type(Line)))
            """"
#setup function
 
    