Forums

Discord bot

Hello, I want to have my discord bot running 24/7. I think I find the good tool with python anywhere ! With a free account I have an error, I tried to solve it but I can't ! Before taking a paid accounts (especially for the "always-on-tasks" feature) I want to be sure that my bot will work ! Can someone help me ?

This is the error, I search on github and the whole internet nothing works :

aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host discord.com:443 ssl:default [Connect call failed ('162.159.135.232', 443)]

Thank you in advance :D

[edit by admin: formatting]

Unfortunately the normal discord.py library won't work inside free accounts on PythonAnywhere -- free accounts need to use a proxy server (which we provide) in order to access other sites, and that library doesn't work with proxies.

However, it should work fine with a paid account -- so with our 30-day money-back guarantee, the best way to try things out is to upgrade (which I see you've already done since making your forum post) and then get things up and running. If you can't get it working, then you can always downgrade to a free account again and get in touch with us for a refund.

Thank you giles for your response ! I tried but i get an error and i don't know how to solve it :'( https://www.pythonanywhere.com/forums/topic/28575/ Thank you in advance :D

No problem, I'll answer in your other thread.

Hello i also have a question for admin:you wrote that need to upgrade my account to some level for hosting discord bot yes?,but my ask is to what level?

Every paid account has unrestricted internet access, so you can start with the basic Hacker one.

its very interesting but my meaning is would can i use discord bot and how much time if i will upgrade to hacker level i asked it becouse i see that program with 100 lines for telegram bot working and very light bot with 10 lines for discord doesnt work

Number of lines of code is an irrelevant factor here. Discord is not working since it's not handling the proxy correctly in our environment and all free accounts have restricted internet access. Paid accounts don't have this restriction, so the proxy is no longer an issue.

OK, does the hacker level have access to the hosting for the discord bot? im asking so many questions becouse im starter in programming and i finished course for discord bots by a python and i want to know exactly if i will buy hacker upgrade would can i use my discord bot in pythonanywhere and how much time it will work after launch

Yes

ok,thank you

ok,thank you

more question if i will buy hacker level i will have 2000cpu seconds so it telling that every 2000 seconds i will need to launch my discord program or i will have 2000sec for 1 day?

See https://help.pythonanywhere.com/pages/WhatAreCPUSeconds/

Hi guys is this error related to because I didn't pay yet ? : ccxt.base.errors.NetworkError: binance GET https://api.binance.com/

No, binance has started blocked access to their API from the US, where our servers are located.

ccxt.base.errors.NetworkError: kucoin GET https://api.kucoin.com/api/v1/currencies , is there something I can do ??

Are you sure that your code is using proxy correctly? Could you show the full traceback?

.

The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/home/wpacino/CryptoTradeBot.py", line 50, in <module>
    ticker = exchange.fetch_ticker(symbol)
  File "/home/wpacino/.local/lib/python3.10/site-packages/ccxt/kucoin.py", line 1059, in fetch_ticker
    self.load_markets()
  File "/home/wpacino/.local/lib/python3.10/site-packages/ccxt/base/exchange.py", line 1459, in load_markets
    currencies = self.fetch_currencies()
  File "/home/wpacino/.local/lib/python3.10/site-packages/ccxt/kucoin.py", line 704, in fetch_currencies
    response = self.publicGetCurrencies(params)
  File "/home/wpacino/.local/lib/python3.10/site-packages/ccxt/base/exchange.py", line 505, in inner
    return entry(_self, **inner_kwargs)
  File "/home/wpacino/.local/lib/python3.10/site-packages/ccxt/base/exchange.py", line 2833, in request
    return self.fetch2(path, api, method, params, headers, body, config, context)
  File "/home/wpacino/.local/lib/python3.10/site-packages/ccxt/base/exchange.py", line 2830, in fetch2
    return self.fetch(request['url'], request['method'], request['headers'], request['body'])
  File "/home/wpacino/.local/lib/python3.10/site-packages/ccxt/base/exchange.py", line 652, in fetch
    raise NetworkError(details) from e
ccxt.base.errors.NetworkError: kucoin GET https://api.kucoin.com/api/v1/currencies

the code works on the local computer fine but not on the console online

Are you sure that your requests are going through the proxy server? See https://help.pythonanywhere.com/pages/403ForbiddenError/#proxy-details

the web site i need to use is Kucoin and is whitelisted in that list , I really don't understand why it doesn't work , im not using any proxy im just using a py file and that's it with api kucoin

Check documentation for ccxt if you can configure the proxy, as suggested in the help page posted above.