drizzle-mizzle / CharacterAI-Discord-Bot

CharacterAI for your Discord server
MIT License
245 stars 60 forks source link

[Investigating] Cloudflare blocks some Windows clients #28

Closed JcynR closed 1 year ago

JcynR commented 1 year ago

On linux I'm getting this with every command:

The input text has too few parameters., BadArgCount

The only command that's is triggered is .ai set RQrrOj-UNdEV2_PC5D03US-27MZ7EUtaRH_husjbRQA but it's not working:

Fetching character info... Error!
 Request failed! (https://beta.character.ai/chat/character/info/)
 Response: Internal Server Error
 Request Content: external_id=1
 Response Content: {"error": "Server Error (500)"}

On windows I get this:

 Error!
 Request failed! (https://beta.character.ai/chat/character/info/)
 Response: Forbidden
 Request Content: external_id=RQrrOj-UNdEV2_PC5D03US-27MZ7EUtaRH_husjbRQA
 Response Content: <!DOCTYPE html>
<html lang="en-US">
   <head>
[...]

I'm using version 1.81

JcynR commented 1 year ago

it's not picking up any of my messages with .ai either .ai hunt is working but it's still not responding to any of my messages, no errors in the console either.

drizzle-mizzle commented 1 year ago

Hello. Please, explain everything you did in steps so I could reproduce it. Because I can't really encounter any problem

image

image

drizzle-mizzle commented 1 year ago
Fetching character info... Error!
 Request failed! (https://beta.character.ai/chat/character/info/)
 Response: Internal Server Error
 Request Content: external_id=1
 Response Content: {"error": "Server Error (500)"}

external_id=1

If you have really specified id with 1, then ofc it would not work.

 Error!
 Request failed! (https://beta.character.ai/chat/character/info/)
 Response: Forbidden
 Request Content: external_id=RQrrOj-UNdEV2_PC5D03US-27MZ7EUtaRH_husjbRQA
 Response Content: <!DOCTYPE html>
<html lang="en-US">
   <head>
[...]

Forbidden

Something like this usually happens when you specify wrong auth token, either servers were simply down for a time

drizzle-mizzle commented 1 year ago

The input text has too few parameters., BadArgCount On linux I'm getting this with every command:

Please, provide screenshots of actual examples

drizzle-mizzle commented 1 year ago

it's not picking up any of my messages with .ai either .ai hunt is working but it's still not responding to any of my messages, no errors in the console either.

If you were using auto_setup, checkout this: Additional configuration

image

JcynR commented 1 year ago

Resetting it did the trick. Thank you. As for the BadArgCount, you changed the commands to accept numbers now, that's why it told me that. So !!help and others didn't work. Imo you should just show all 3 pages at once for the help command. As for setting the char id to 1, i was just testing it out if it would respond at all and got confused with the windows bot I was running. However, windows still has that error page with auto setup and !!set RQrrOj-UNdEV2_PC5D03US-27MZ7EUtaRH_husjbRQA. I'm using the same config as on linux.

drizzle-mizzle commented 1 year ago

Imo you should just show all 3 pages at once for the help command.

I wanted to, but it's impossible due to text size limit, so I quickly split it with pages but forgot to set page 1 as default. I'll simply make proper modal with buttons later.

However, windows still has that error page with auto setup and !!set RQrrOj-UNdEV2_PC5D03US-27MZ7EUtaRH_husjbRQA. I'm using the same config as on linux.

I can't imagine any reasons for it to act different. Show me the full Response content of it

JcynR commented 1 year ago
01:10:04 Discord     Discord.Net v3.9.0 (API v10)
01:10:04 Gateway     Connecting
01:10:05 Gateway     You're using the GuildPresences intent without listening to the PresenceUpdate event, consider removing the intent from your config.
01:10:05 Gateway     Connected
01:10:05 Gateway     Ready

Starting character setup...
  (Character ID: RQrrOj-UNdEV2_PC5D03US-27MZ7EUtaRH_husjbRQA)
Fetching character info... Error!
 Request failed! (https://beta.character.ai/chat/character/info/)
 Response: Forbidden
 Request Content: external_id=RQrrOj-UNdEV2_PC5D03US-27MZ7EUtaRH_husjbRQA
 Response Content: <!DOCTYPE html>
<html lang="en-US">
   <head>
      <title>Access denied</title>
      <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
      <meta name="robots" content="noindex, nofollow" />
      <meta name="viewport" content="width=device-width,initial-scale=1" />
      <link rel="stylesheet" href="/cdn-cgi/styles/errors.css" media="screen" />
      <script>
(function(){if(document.addEventListener&&window.XMLHttpRequest&&JSON&&JSON.stringify){var e=function(a){var c=document.getElementById("error-feedback-survey"),d=document.getElementById("error-feedback-success"),b=new XMLHttpRequest;a={event:"feedback clicked",properties:{errorCode:1020,helpful:a,version:5}};b.open("POST","https://sparrow.cloudflare.com/api/v1/event");b.setRequestHeader("Content-Type","application/json");b.setRequestHeader("Sparrow-Source-Key","c771f0e4b54944bebf4261d44bd79a1e");
b.send(JSON.stringify(a));c.classList.add("feedback-hidden");d.classList.remove("feedback-hidden")};document.addEventListener("DOMContentLoaded",function(){var a=document.getElementById("error-feedback"),c=document.getElementById("feedback-button-yes"),d=document.getElementById("feedback-button-no");"classList"in a&&(a.classList.remove("feedback-hidden"),c.addEventListener("click",function(){e(!0)}),d.addEventListener("click",function(){e(!1)}))})}})();
</script>

      <script>
      (function(){function d(c){var b=document.getElementById("copy-label"),a=document.getElementById("cf-details-wrapper-expandable");c.target.checked?a.classList.add("expanded"):(a.classList.remove("expanded"),b.innerText="Click to copy")}if(document.addEventListener){var e=function(){var c=document.getElementById("copy-label");var b=document.getElementById("error-details").textContent;if(navigator.clipboard)navigator.clipboard.writeText(b);else{var a=document.createElement("textarea");a.value=b;a.style.top="0";a.style.left="0";a.style.position="fixed";document.body.appendChild(a);a.focus();a.select();document.execCommand("copy");document.body.removeChild(a)}c.innerText="Copied text to clipboard"};document.addEventListener("DOMContentLoaded",function(){var c=document.getElementById("error-details-checkbox"),b=document.getElementById("click-to-copy-btn");document.getElementById("copy-label").classList.remove("hidden");c.addEventListener("change",d);b.addEventListener("click",e)})}})();
      </script>
      <script defer src="https://performance.radar.cloudflare.com/beacon.js"></script>
   </head>
   <body>
   <div class="cf-main-wrapper" role="main">
      <div class="cf-header cf-section">
         <div class="cf-error-title">
            <h1>Access denied</h1>
            <span class="cf-code-label">Error code <span>1020</span></span>
         </div>
         <div class="cf-error-description">
            <p>You do not have access to beta.character.ai.</p><p>The site owner may have set restrictions that prevent you from accessing the site.</p>
         </div>
      </div>
   </div>

   <div class="cf-details-wrapper">
      <div class="cf-section" role="region">
         <div class="cf-expandable" id="cf-details-wrapper-expandable">
            <label for="error-details-checkbox" title="Error details" class="cf-expandable-btn">
               <p class="cf-dropdown-title">Error details</p>
               <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAElBMVEUAAAAwMDAxMTEyMjIwMDAxMTF+89HTAAAABXRSTlMAf2CAMKS61bwAAABTSURBVCjPzcq7DcAgFENR5zMATfo06TNCViAS+6+CeFi6gglw4eLqaPVtaQpXnkApaQT/k0dw70EAUhCA1AnABGACMAGYAEwAkCOAydv+I5xaZhXWbQrD80TkkQAAAABJRU5ErkJggg=="
               class="cf-caret-icon" id="caret-icon" alt="Caret icon" />
            </label>

            <input id="error-details-checkbox" class="hidden" type="checkbox">

            <div class="cf-expandable-error-info hidden">
               <p class="cf-error-copy-description">Provide the site owner this information.</p>
               <button class="cf-click-to-copy-btn" id="click-to-copy-btn" title="Click to copy" type="button">
<div class="cf-error-wrapper" id="error-details"><p class="cf-error-details-endpoint">I got an error when visiting beta.character.ai/chat/character/info/.</p>

<p>Error code: 1020</p>
<p>Ray ID: 79cb41cbee14b7b2</p>
<p>Country: ****</p>
<p>Data center: ****</p>
<p>IP: ****</p>
<p>Timestamp: ****</p>
</div>
                  <p class="cf-copy-label hidden" id="copy-label">Click to copy</p>
               </button>
            </div>
         </div>
      </div>

      <div class="clearfix cf-footer cf-section" role="contentinfo">
      <div class="cf-column">
           <div class="feedback-hidden py-8 text-center" id="error-feedback">
    <div id="error-feedback-survey" class="footer-line-wrapper">
        Was this page helpful?
        <button class="border border-solid bg-white cf-button cursor-pointer ml-4 px-4 py-2 rounded" id="feedback-button-yes" type="button">Yes</button>
        <button class="border border-solid bg-white cf-button cursor-pointer ml-4 px-4 py-2 rounded" id="feedback-button-no" type="button">No</button>
    </div>
    <div class="feedback-success feedback-hidden" id="error-feedback-success">
        Thank you for your feedback!
    </div>
</div>

      </div>
         <div class="cf-column cf-footer-line-wrapper text-center">
            <p>
               Performance &amp; security by <a rel="noopener noreferrer" href="https://www.cloudflare.com?utm_source=1020_error" target="_blank">Cloudflare <img class="external-link" title="Opens in new tab" src="/cdn-cgi/images/external.png" alt="External link"></a>
            </p>
         </div>
      </div>
   </div>
<script>(function(){var js = "window['__CF$cv$params']={r:'79cb41cbee14b7b2',m:'.L6nWcRdgPM3dEmjuodB1kl6ec_57Hs7_09_UG07k6U-1676938206-0-AdGO34I6cmyTay9N0AIsOfYbPXK6KKCPBJ085lw6qVle2ZXae3OPaltcW2ZSXc7qcH7WFuK4n7PTgy7iGX2mwq58iv8xvkYzJj1k67IoE9tyC/b2V6rw1S1rJe8hHxf/EuRsyLXjVdbR12YoaxHnkdE=',s:[0x3882fd9ce6,0xcc5b710e90],u:'/cdn-cgi/challenge-platform/h/g'};var now=Date.now()/1000,offset=14400,ts=''+(Math.floor(now)-Math.floor(now%offset)),_cpo=document.createElement('script');_cpo.nonce='',_cpo.src='/cdn-cgi/challenge-platform/h/g/scripts/alpha/invisible.js?ts='+ts,document.getElementsByTagName('head')[0].appendChild(_cpo);";var _0xh = document.createElement('iframe');_0xh.height = 1;_0xh.width = 1;_0xh.style.position = 'absolute';_0xh.style.top = 0;_0xh.style.left = 0;_0xh.style.border = 'none';_0xh.style.visibility = 'hidden';document.body.appendChild(_0xh);function handler() {var _0xi = _0xh.contentDocument || _0xh.contentWindow.document;if (_0xi) {var _0xj = _0xi.createElement('script');_0xj.nonce = '';_0xj.innerHTML = js;_0xi.getElementsByTagName('head')[0].appendChild(_0xj);}}if (document.readyState !== 'loading') {handler();} else if (window.addEventListener) {document.addEventListener('DOMContentLoaded', handler);} else {var prev = document.onreadystatechange || function () {};document.onreadystatechange = function (e) {prev(e);if (document.readyState !== 'loading') {document.onreadystatechange = prev;handler();}};}})();</script><script defer src="https://static.cloudflareinsights.com/beacon.min.js/vaafb692b2aea4879b33c060e79fe94621666317369993" integrity="sha512-0ahDYl866UMhKuYcW078ScMalXqtFJggm7TmlUtp0UlD4eQk0Ixfnm5ykXKvGJNFjLMoortdseTfsRT8oCfgGA==" data-cf-beacon='{"rayId":"79cb41cbee14b7b2","token":"de6c8a8324c04a50b30bdeb96bc8d410","version":"2023.2.0","si":100}' crossorigin="anonymous"></script>
</body>
</html>
drizzle-mizzle commented 1 year ago

Some cloudflare bs, as I was expecting. Gotta try to mess with headers again...

FutureQueenBee commented 1 year ago

I have been having this problem with the Windows client as well:

CloudFlare 1020 error.

drizzle-mizzle commented 1 year ago

Well, right now the only solution is to refuse from using it on Windows and switch on Linux/WSL

drizzle-mizzle commented 1 year ago

@FutureQueenBee could you try to use it with VPN and tell me if problem goes away?

drizzle-mizzle commented 1 year ago

When (or if :c) Cloudflare problem will be fixed, this one must go away, 'cause HttpClient is not being used anymore.