承接 memogram/framework 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

memogram/framework

Composer 安装命令:

composer require memogram/framework

包简介

Make your bot with Laravel framework

README 文档

README

Page & Response

class Container
{
    public function myPage()
    {
        return "Hello World!";
    }
}
class SomethingElse
{
    public function foo()
    {
        open([Container::class, 'myPage']);
    }
}

Message response:

public function myPage()
{
    return messageResponse("Hello world!")
        ->schema([
            [key("Hi")->then(fn() => "Hi too!")]
        ]);
}

Glass message response:

public function myPage()
{
    return glassMessageResponse("Hello world!")
        ->schema([
            [glassKey("Hi")->then(fn() => "Hi too!")]
        ]);
}

Delete message:

public function myPage()
{
    return deleteResponse('main');
}

Listeners:

public function myPage()
{
    onAny(function () {
        return "Hello world";
    });
    onMessage("Bar")->then(function () {
        return "Baz";
    });

    return "Something...";
}

Validations:

Validation::make(['update', 'message', 'text', 'max:255'])->validate();

Extra

Trap Join

routes/bot.php:

onCommand('/start {inviter}', function ($inviter) {
    open([StartSection::class, 'start'], ['inviter' => $inviter]);
});

StartSection.php:

class StartSection
{
    public function start()
    {
        $inviter = useParam('inviter');
        
        if (mounting()) {
            if ($this->joined()) {
                $this->giveInviteCoin($inviter);
                open([HomeSection::class, 'main']);
                return;
            }
        };
        
        onAny(function () {
            return "You should join the channels first.";
        })->atFirst();
        
        return messageResponse("First join the channels.")
            ->schema([
                [key("Check")->atFirst()->then(function {
                    if ($this->joined()) {
                        $this->giveInviteCoin($inviter);
                        yield "Good job!";
                        open([HomeSection::class, 'main']);
                    } else {
                        yield "You're not joined yet!";
                    }
                })],
            ])
    }
}

统计信息

  • 总下载量: 44
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2025-10-15