Skip to content

This bot integrates with Feishu/Lark and generates images utilizing the Image Creator from Microsoft Bing service

License

Notifications You must be signed in to change notification settings

mrchi/lark-dalle3-bot

Repository files navigation

lark-dalle3-bot

This bot integrates with Feishu/Lark and generates images utilizing the Image Creator from Microsoft Bing service.

Alt text

Usage

  • /balance Get tokens balance of Bing cookie
  • /prompt <Your prompt> Create image with prompt
  • /prompt_pro <Your prompt> Create image with prompt revised by GPT

Deployment

Running the Bot with Default Configurations

To make your bot accessible online, you can leverage services like ngrok or Cloudflare Tunnel.

  1. Compile the bot:
    go build .
  2. Initiate a config file from the provided template and modify the lark_event_server_addr as needed:
    cp config.example.json config.json
  3. (Optional) For Lark users, set config is_feishu to false.
  4. Execute the program:
    ./lark-dalle3-bot

This step ensures that the server is reachable when setting up event subscriptions soon.

Creating a Feishu/Lark Bot Application

  1. On the Feishu Open Platform, start by creating a custom app.
  2. In menu Add features, activate the Bot feature.
  3. In menu Permissions & Scopes, add the following API Scopes:
    • im:message
    • im:resource
    • im:message.group_at_msg:readonly
    • im:message.p2p_msg:readonly
  4. In menu Event Subscriptions:
    1. Set Request URL with http(s)://<your domain>:<your port>/dalle3.
    2. Add the im.message.receive_v1 event.
    3. Grant these permissions to the new event:
      • Obtain private messages sent to the bot
      • Obtain group messages mentioning the bot
  5. Publish your app through the Version Management & Release tab.

For Lark users, please visit Lark Open Platform.

Bot Configuration and Restart

From the Feishu/Lark Open Platform:

  1. Acquire the App ID and App Secret from menuCredentials & Basic Info.
  2. Acquire the Encrypt Key and Verification Token from menuEvent Subscriptions.

From Bing:

  1. Follow the instructions in the README at yihong0618/BingImageCreator to obtain your Bing cookie.

Only for Lark users, please set is_feishu to false in config file.

Update your config.json with these credentials, then rerun your bot and enjoy the magic.

Related works

Acknowledgments

Disclaimer

Translated by GPT4.

If you use this project for services open to the public in China, you are required to comply with the relevant laws and regulations, and you may need to obtain the necessary permits or complete relevant procedures. This project is only for technical communication and does not assume responsibility for any legal risks that may arise during your use.

About

This bot integrates with Feishu/Lark and generates images utilizing the Image Creator from Microsoft Bing service

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages