#Give parameters to view (attachment) | SOLVED |
1 messages · Page 1 of 1 (latest)
Subclass discord.ui.View and take a file as argument for init?
i detect the message with
@bot.event
async def on_message(msj):
and then use
await msj.reply(text,view= TartaViews.newPreset())
yea but how can do it?
i have something like this:
class views():
class view1(discord.ui.View):
bla
class view2(discord.ui.View):
bla
how do views take files
i cant add an def __init__(self, file)inside the view1 class since it overdide it
also cant make view "return" something like
response = await msj.reply(text,view= TartaViews.newPreset())
if response:
dothing(file)
a less complicated way is to make a view inside of the on_messgae
so you can still access the file without throwing it everywhere
yea.. that will be a nice feature tu have in the future
idk im the only one who need this lol
it already exists

?
Can't you
def __init__(self, file, *args, **kwargs):
super().__init__()```
i mean, yea, i can do this inside the on_message
I do/did it for some of my views
yeah, but that over complicates things
it’s like screwing a screw in and out and in again
ill try with it, if it works, i prefer to have all this in other file
well... it works
Give parameters to view (attachment) | SOLVED |