• Stars
    star
    418
  • Rank 103,620 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created about 1 year ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Telegram bing bot DALL-E 3

tg_bing_dalle

Telegram bot using bing dalle-3

Usage

Live Show: https://t.me/c/1941649644/2798

In any chat with the bot, send your message like prompt: something or /prompt something or @bot_name something. You can also send your message like /quota or quota? or @bot_name quota? to get the limit.

Using /prompt_pro or prompt_pro: will make use of GPT to rewrite your prompt.

How to

How to make your own DALL-E 3 bing tg bot.

Method 1 (Run Python directly)

Important

This project requires openai-python which does not install on Python 3.12 due to a compatibility issue.

Read this first if you are new to code

  1. Make sure your ip can open https://bing.com/create not jump cn.bing (can use GitHub to login)

  2. Use https://bing.com/images/create create a new png, F12 in chrome to get cookie string as bing_cookie

    Highly recommanded to use Edge or Chrome to get the cookie, and don't use incognito/privacy mode. We encountered errors when using cookie got by Firefox.

image

  1. Get tg token, ask Google or ChatGPT, need get it from BotFather
  2. pip install -r requirements.txt
  3. python tg.py '${tg_token}' '${bing_cookie}'
  4. you can also save your cookies to a new .cookies file in this directory, one cookie per line. then run python tg.py '${tg_token}'

You can provide multiple cookies, to increase the use limit. see:

usage: tg.py [-h] [-c CONFIG_FILE] tg_token bing_cookie [bing_cookie ...]

positional arguments:
  tg_token        tg token
  bing_cookie     bing cookie

options:
  -h, --help      show this help message and exit
  -c CONFIG_FILE  additional config file

Method 2 (Run from a shell script)

Or you can start with run.sh:

  1. Save your tg token to a new .token file in this directory.
  2. Save your cookies to a new .cookies file in this directory, one cookie per line.
  3. chmod +x run.sh
  4. ./run.sh or ./run.sh -c <config_file>

Method 3 (Run from Docker)

Or you can use docker to run it:

  1. docker build -t tg_bing_dalle .
  2. docker run -d --name tg_bing_dalle -e tg_token='${tg_token}' -e bing_cookie='${bing_cookie}' --network host tg_bing_dalle

If you want to use multiple cookies, you could save to credentials/.cookies with one cookie per line. Then use this command to run it:

docker run -d --name tg_bing_dalle -e tg_token='${tg_token}' --network host --volume ./credentials/:/credentials tg_bing_dalle

You could also save your tg token to credentials/.token to instead of passing it via environment variables.

Method 4 (Deploy to Fly.io)

  1. Install flyctl
  2. flyctl auth login
  3. flyctl launch

    [!NOTE] Change the app name to your own name in fly.toml

  4. flyctl secrets set tg_token=your tg_token
  5. flyctl secrets set bing_cookie=your bing_cookie
  6. flyctl deploy

If you want to use multiple cookies, you just need to set the key of secrets to start with bing_cookie. For example:

flyctl secrets set bing_cookie_0=your bing_cookie_0

Method 5 (Deploy to Zeabur)

Deploy on Zeabur

Advanced

GPT Enhance

To enable prompt_pro, copy config.sample.toml to config.toml, and edit the file to setup your OpenAI API.

Then add the option -c config.toml to start the server.

python tg.py '${tg_token}' '${bing_cookie}' -c config.toml

If you are running it using Method 3 (Run from Docker), you need to rebuild the image and add the option -e config_file='config.toml' to start it.

docker run -d --name tg_bing_dalle -e tg_token='${tg_token}' -e bing_cookie='${bing_cookie}' \
-e config_file='config.toml' --network host tg_bing_dalle

If you are running it using Method 4 (Deploy to Fly.io), you need to add the option -e config_file='config.toml' to deploy.

flyctl deploy -e config_file='config.toml'

@bot

To enable @bot_name ${prompts}, you can either disable privacy mode or add the bot as a Group Admin (not recommended for public groups). Please note that this may decrease the efficiency of the bot since it will have to process all messages in the group, potentially overloading the server running it.

Recommend

Contribution

  • Any issue reports or PRs are welcome.
  • Any other bot type like slack/discord welcome
  • Before PR, use pip install -U black then black . first

Appreciation

  • Thank you, that's enough. Just enjoy it.

More Repositories

1

bilingual_book_maker

Make bilingual epub books Using AI translate
Python
7,286
star
2

xiaogpt

Play ChatGPT and other LLM with Xiaomi AI Speaker
Python
6,039
star
3

running_page

Make your own running home page
Python
3,565
star
4

Kindle_download_helper

Download all your kindle books script.
Python
2,612
star
5

GitHubPoster

Make everything a GitHub svg poster and Skyline!
Python
1,774
star
6

gitblog

People Die, but Long Live GitHub
Python
1,386
star
7

tg_bot_collections

collections of yihong0618's telegram bot
Python
557
star
8

epubhv

Make your epub books vertical or horizontal.
Python
454
star
9

blue

新的 PR(Issue) 来了来了来了!
Python
305
star
10

iBeats

Apple Watch 心率数据采集 - Your Soul, Your Beats!
Python
279
star
11

SunoSongsCreator

About High quality songs generation by https://www.suno.ai/. Reverse engineered API.
Python
276
star
12

2021

关于我的 2021 的一些记录。
Python
274
star
13

2022

2022 gogogo
Python
270
star
14

2023

Another year
Python
204
star
15

iWhat

What is it? Using AI Inspired by pyWhat
Python
190
star
16

shanbay_remember

扇贝自动发送今日新词到 telegram
JavaScript
189
star
17

duolingo_remember

Automatically send new words from duolingo to telegram
Python
166
star
18

2020

2020计划,喜欢的文章,博客,以及其它
C
137
star
19

github-readme-stats

generate my_github status using GitHub Actions
Go
134
star
20

vscode-gcores

VSCode 玩转机核
TypeScript
127
star
21

dalian-IT

『大连互联网』大连基本没啥互联网
114
star
22

gaycore

use command-line to listen gadio
Python
113
star
23

klingCreator

About High quality video and image generation by https://klingai.kuaishou.com and https://klingai.com/ Reverse engineered API.
Python
77
star
24

IdeoImageCreator

About High quality image generation by ideogram. Reverse engineered API.
Python
60
star
25

2024

Change
Python
42
star
26

yihong0618

41
star
27

kai_xin_ci_chang

开心词场帮助程序
Python
33
star
28

nbnhhsh-cli

「能不能好好说话?」 cli 版本
Python
31
star
29

gcores_calendar

gcores audios calendar
JavaScript
30
star
30

pengdu_helper

网易云歌词自动生成《捧读》用的 epub, 帮助学习。(GitHub Actions + shortcuts + telegram)
Go
29
star
31

my_kindle_stats

Show my read on kindle this year
Python
24
star
32

Runtastic

Download all your Runtastic (Adidas Running) activities save to gpx
Python
21
star
33

running_skyline

Generate a 3D Skyline in STL format from your running App
Python
20
star
34

blog

blog
JavaScript
14
star
35

github-readme-stats-server

Server for github-readme-stats
HTML
14
star
36

Python365

Python365天精进计划
Python
11
star
37

run

Python
10
star
38

resume

resume
HTML
4
star
39

remote_mp3_duration

Estimate the duration in seconds of the remote MP3 file without full download(python version)
Python
3
star
40

github_upstream_script

Using script to fetch upstream and sync
Python
2
star
41

500

learn 500 lines from 500lines-rewrite
1
star
42

edocteel001

100days leetcode
JavaScript
1
star