import discord
from discord.ui import Modal, TextInput

class MForModal:
    def __init__(self):
        self.name = None
        self.options = []
        self.callback = None

    def set_name(self, name):
        self.name = name

    def set_options(self, *options):
        self.options = list(options)

    def set_callback(self, callback):
        self.callback = callback

    def create_modal(self):
        class CustomModal(Modal):
            def __init__(self):
                super().__init__(title=self.name)
                for option in self.options:
                    self.add_item(TextInput(label=option))

            async def on_submit(self, interaction: discord.Interaction):
                values = [child.value for child in self.children]
                if self.callback:
                    command, args = self.callback.split('-', 1)
                    formatted_args = args.format(*values)
                    await interaction.response.send_message(f"Command: {command}\nArguments: {formatted_args}")

        return CustomModal()

mformodal_instance = MForModal()

def mformodal(name=None, options=None, callback=None):
    if name:
        mformodal_instance.set_name(name)
    if options:
        mformodal_instance.set_options(*options)
    if callback:
        mformodal_instance.set_callback(callback)
    return mformodal_instance.create_modal()