yihong0618 / tg_bing_dalle

Telegram bing bot DALL-E 3
MIT License
414 stars 53 forks source link

Token and cookie files #49

Closed iPrintScreen closed 9 months ago

iPrintScreen commented 9 months ago

Hi, I cannot find where to place .token and cookie files. I have tried "venv\bin\python" with no luck.

Thanks

iPrintScreen commented 9 months ago

I also receive "NameError: name 'tg_token' is not defined" when running "python tg.py '${tg_token}' '${bing_cookie}'"

iPrintScreen commented 9 months ago

I have pointed towards both files, now I recieve "/usr/bin/bash: Exit 126." after "Ready to run"

Pagliacii commented 9 months ago

Which method did you run?

Pagliacii commented 9 months ago
$ errno 126
ENOKEY 126 Required key not available

Could you attach your error logs to this issue? It will help us analyze the problem you're encountering.

Pagliacii commented 9 months ago

The default location of .token and .cookies is aside with the tg.py.

iPrintScreen commented 9 months ago

I restarted using Python method on Ubuntu as Windows would cause too many other issues. Now I am receiving

(venv) mitch@Python:~/PycharmProjects/tg_bing_dalle$ /bin/bash /home/mitch/PycharmProjects/tg_bing_dalle/run.sh Checking prerequisites... Prerequisites look good! Loading .token... Ready to run... Arg parse done. Bot init done. your 0 cookie is wrong please check error: 'NoneType' object has no attribute 'extract_cookies' Traceback (most recent call last): File "/home/mitch/PycharmProjects/tg_bing_dalle/tg.py", line 215, in <module> main() File "/home/mitch/PycharmProjects/tg_bing_dalle/tg.py", line 94, in main image_obj.get_limit_left() File "/home/mitch/PycharmProjects/tg_bing_dalle/venv/lib/python3.10/site-packages/BingImageCreator.py", line 104, in get_limit_left r = self.session.get("https://www.bing.com/create") File "/home/mitch/PycharmProjects/tg_bing_dalle/venv/lib/python3.10/site-packages/requests/sessions.py", line 602, in get return self.request("GET", url, **kwargs) File "/home/mitch/PycharmProjects/tg_bing_dalle/venv/lib/python3.10/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, **send_kwargs) File "/home/mitch/PycharmProjects/tg_bing_dalle/venv/lib/python3.10/site-packages/requests/sessions.py", line 719, in send extract_cookies_to_jar(self.cookies, request, r.raw) File "/home/mitch/PycharmProjects/tg_bing_dalle/venv/lib/python3.10/site-packages/requests/cookies.py", line 137, in extract_cookies_to_jar jar.extract_cookies(res, req) AttributeError: 'NoneType' object has no attribute 'extract_cookies'

iPrintScreen commented 9 months ago

Also, when I run python3 tg.py '${tg_token}' '${bing_cookie}'

I receive (venv) mitch@Python:~/PycharmProjects/tg_bing_dalle$ python3 tg.py '${tg_token}' '${bing_cookie}' Arg parse done. Traceback (most recent call last): File "/home/mitch/PycharmProjects/tg_bing_dalle/tg.py", line 215, in <module> main() File "/home/mitch/PycharmProjects/tg_bing_dalle/tg.py", line 73, in main bot_name = bot.get_me().username File "/home/mitch/PycharmProjects/tg_bing_dalle/venv/lib/python3.10/site-packages/telebot/__init__.py", line 1236, in get_me result = apihelper.get_me(self.token) File "/home/mitch/PycharmProjects/tg_bing_dalle/venv/lib/python3.10/site-packages/telebot/apihelper.py", line 196, in get_me return _make_request(token, method_url) File "/home/mitch/PycharmProjects/tg_bing_dalle/venv/lib/python3.10/site-packages/telebot/apihelper.py", line 162, in _make_request json_result = _check_result(method_name, result) File "/home/mitch/PycharmProjects/tg_bing_dalle/venv/lib/python3.10/site-packages/telebot/apihelper.py", line 189, in _check_result raise ApiTelegramException(method_name, result, result_json) telebot.apihelper.ApiTelegramException: A request to the Telegram API was unsuccessful. Error code: 404. Description: Not Found

iPrintScreen commented 9 months ago

Above is now resolved, now bot specifies There are no more cookies available, so we might have to wait for a while and there’s a chance of failure.

Bing DALL-E 3 has prohibited your given prompt. Please modify it.

Even with a generic prompt I have used on the Bing website.

iPrintScreen commented 9 months ago

I was using wrong cookie string, I have fixed now.

Pagliacii commented 9 months ago

Glad to hear that, enjoy your bot.