[{"data":1,"prerenderedAt":29},["ShallowReactive",2],{"doc-en-host-discord-bot-python":3},{"path":4,"slug":5,"title":6,"description":7,"category":8,"subcategory":9,"icon":10,"date":11,"author":12,"order":13,"image":14,"tags":15,"keywords":20,"docGroup":26,"docGroupIcon":26,"link_fr":27,"bodyHtml":28},"\u002Fdocs\u002Fen\u002Fcloud\u002Fbot-discord\u002Fhost-discord-bot-python","host-discord-bot-python","How to Host Your Discord Bot with Python (discord.py)","Host your discord.py bot at Winheberg, token from the Discord portal, Python environment, requirements.txt, .env file, Python version and common errors.","cloud","bot-discord","tabler:brand-python","2026-11-02","Winheberg",168,"\u002Fstatics\u002Fimages\u002Fdocs\u002Fen\u002Fcloud\u002Fbot-discord\u002Fhost-discord-bot-python.webp",[16,17,18,19],"discord bot","discord.py","python","panel",[21,22,17,23,24,25],"host discord bot python","discord bot hosting","python discord bot","requirements.txt","discord bot token","","\u002Fdocs\u002Fbot-discord\u002Fheberger-bot-discord-python","\u003Ch2>Context\u003C\u002Fh2>\n\u003Cp>A Discord bot only responds while its program is running. When it runs on your own computer, it goes offline as soon as you shut the computer down or your connection drops. \u003Ca href=\"https:\u002F\u002Fwinheberg.com\u002Fen\u002Fcloud\u002Fdiscord-bot\">Winheberg Discord bot hosting\u003C\u002Fa> runs your bot on a server built for this purpose, which you manage from the panel, with a live console, a file manager and a choice of Python versions.\u003C\u002Fp>\n\u003Cp>This guide takes as its example a bot written in Python with the discord.py library. You will first create the bot on the Discord developer portal and invite it to your Discord server. Then, on the panel, you will switch the service to the Python environment if needed, upload the bot&#39;s code with its token stored in a \u003Ccode>.env\u003C\u002Fcode> file and choose the Python version, before starting the bot and checking in the console that it is connected.\u003C\u002Fp>\n\u003Cp>Is your bot written in JavaScript? See our guide \u003Cstrong>How to Host Your Discord Bot with Node.js (discord.js)\u003C\u002Fstrong> instead.\u003C\u002Fp>\n\u003Ch2>Prerequisites\u003C\u002Fh2>\n\u003Cul>\n\u003Cli>An active Winheberg Discord Bot service, reachable from the panel at \u003Ccode>https:\u002F\u002Fpanel.winheberg.com\u002F\u003C\u002Fcode>\u003C\u002Fli>\n\u003Cli>A Discord account and a Discord server where you have the \u003Cstrong>Manage Server\u003C\u002Fstrong> permission\u003C\u002Fli>\n\u003Cli>Your bot&#39;s code with its \u003Ccode>requirements.txt\u003C\u002Fcode> file, or the example provided in this guide\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch2>1. Create the application and get the token\u003C\u002Fh2>\n\u003Cp>Go to the Discord developer portal at \u003Ccode>https:\u002F\u002Fdiscord.com\u002Fdevelopers\u002Fapplications\u003C\u002Fcode> and log in with your Discord account. Click \u003Cstrong>New Application\u003C\u002Fstrong>, give your bot a name, then confirm with \u003Cstrong>Create\u003C\u002Fstrong>.\u003C\u002Fp>\n\u003Cp>Next, open the application&#39;s \u003Cstrong>Bot\u003C\u002Fstrong> page. In the \u003Cstrong>Token\u003C\u002Fstrong> section, click \u003Cstrong>Reset Token\u003C\u002Fstrong> and confirm. Discord then shows your bot&#39;s token. Copy it right away, because it is no longer visible once you leave the page, and you would then have to generate a new one.\u003C\u002Fp>\n\u003Cdiv class=\"markdown-alert markdown-alert-caution\">\u003Cspan class=\"alert-icon\">\u003Csvg xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\u003Ccircle cx=\"12\" cy=\"12\" r=\"10\"\u002F>\u003Cline x1=\"12\" y1=\"8\" x2=\"12\" y2=\"12\"\u002F>\u003Cline x1=\"12\" y1=\"16\" x2=\"12.01\" y2=\"16\"\u002F>\u003C\u002Fsvg>\u003C\u002Fspan>\u003Cdiv class=\"markdown-alert-body\">\u003Cp>The token gives full control of your bot. Anyone who has it can use your bot as if it were theirs. Never publish it, whether in a screenshot, a message or a Git repository. If it has leaked, click \u003Cstrong>Reset Token\u003C\u002Fstrong> to invalidate it and put the new one in your \u003Ccode>.env\u003C\u002Fcode> file.\u003C\u002Fp>\n\u003C\u002Fdiv>\u003C\u002Fdiv>\n\u003Ch3>Enable privileged intents if your bot needs them\u003C\u002Fh3>\n\u003Cp>Still on the \u003Cstrong>Bot\u003C\u002Fstrong> page, the \u003Cstrong>Privileged Gateway Intents\u003C\u002Fstrong> section groups three kinds of access that Discord does not grant by default. The example bot in this guide uses \u003Ccode>discord.Intents.default()\u003C\u002Fcode>, which enables none of them. If you use it as is, skip straight to step 2.\u003C\u002Fp>\n\u003Ctable>\n\u003Cthead>\n\u003Ctr>\n\u003Cth>Intent in discord.py\u003C\u002Fth>\n\u003Cth>What it allows\u003C\u002Fth>\n\u003C\u002Ftr>\n\u003C\u002Fthead>\n\u003Ctbody>\u003Ctr>\n\u003Ctd>\u003Ccode>intents.message_content\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>Read message content, for example for prefix commands such as \u003Ccode>!ping\u003C\u002Fcode>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>intents.members\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>Receive the server&#39;s member list and member updates\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>intents.presences\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>See members&#39; status and activity\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftbody>\u003C\u002Ftable>\n\u003Cp>Only enable in the portal the ones your code sets to \u003Ccode>True\u003C\u002Fcode>. As long as your application has fewer than 10,000 users, the toggle in the portal is enough.\u003C\u002Fp>\n\u003Ch2>2. Invite the bot to your Discord server\u003C\u002Fh2>\n\u003Cp>In the portal, open your application&#39;s \u003Cstrong>Installation\u003C\u002Fstrong> page. Tick \u003Cstrong>Guild Install\u003C\u002Fstrong> under \u003Cstrong>Installation Contexts\u003C\u002Fstrong>, then choose \u003Cstrong>Discord Provided Link\u003C\u002Fstrong> under \u003Cstrong>Install Link\u003C\u002Fstrong>.\u003C\u002Fp>\n\u003Cp>Under \u003Cstrong>Default Install Settings\u003C\u002Fstrong>, add the \u003Ccode>applications.commands\u003C\u002Fcode> and \u003Ccode>bot\u003C\u002Fcode> scopes to \u003Cstrong>Guild Install\u003C\u002Fstrong>. The \u003Cstrong>Permissions\u003C\u002Fstrong> menu then appears. Select the permissions your bot needs, for example \u003Cstrong>Send Messages\u003C\u002Fstrong> and \u003Cstrong>View Channels\u003C\u002Fstrong>.\u003C\u002Fp>\n\u003Cp>Copy the install link shown on the page, open it in your browser, pick your Discord server and confirm. The bot shows up in the member list, offline until its program runs.\u003C\u002Fp>\n\u003Cdiv class=\"markdown-alert markdown-alert-tip\">\u003Cspan class=\"alert-icon\">\u003Csvg xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\u003Ccircle cx=\"12\" cy=\"12\" r=\"10\"\u002F>\u003Cpath d=\"M12 16v-4\"\u002F>\u003Cpath d=\"M12 8h.01\"\u002F>\u003C\u002Fsvg>\u003C\u002Fspan>\u003Cdiv class=\"markdown-alert-body\">\u003Cp>The link generator on the \u003Cstrong>OAuth2\u003C\u002Fstrong> page, in the \u003Cstrong>OAuth2 URL Generator\u003C\u002Fstrong> section, works too. Tick the same \u003Ccode>bot\u003C\u002Fcode> and \u003Ccode>applications.commands\u003C\u002Fcode> scopes, then copy the generated URL at the bottom of the page.\u003C\u002Fp>\n\u003C\u002Fdiv>\u003C\u002Fdiv>\n\u003Ch2>3. Switch the service to the Python environment\u003C\u002Fh2>\n\u003Cp>Log in to the Winheberg panel and select your Discord Bot service. In the side menu, click \u003Cstrong>Software Changer\u003C\u002Fstrong>. The page lists the available environments, and the active one shows a \u003Cstrong>REINSTALL\u003C\u002Fstrong> button instead of \u003Cstrong>INSTALL\u003C\u002Fstrong>.\u003C\u002Fp>\n\u003Cdiv class=\"markdown-alert markdown-alert-warning\">\u003Cspan class=\"alert-icon\">\u003Csvg xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\u003Cpath d=\"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z\"\u002F>\u003Cline x1=\"12\" y1=\"9\" x2=\"12\" y2=\"13\"\u002F>\u003Cline x1=\"12\" y1=\"17\" x2=\"12.01\" y2=\"17\"\u002F>\u003C\u002Fsvg>\u003C\u002Fspan>\u003Cdiv class=\"markdown-alert-body\">\u003Cp>Make a backup before switching environments, especially if the server already holds files you care about.\u003C\u002Fp>\n\u003C\u002Fdiv>\u003C\u002Fdiv>\n\u003Cp>If \u003Cstrong>python generic\u003C\u002Fstrong> is not the active environment, click its \u003Cstrong>INSTALL\u003C\u002Fstrong> button, then confirm with \u003Cstrong>Yes\u003C\u002Fstrong>.\u003C\u002Fp>\n\u003Cimg src=\"\u002Fstatics\u002Fimages\u002Fdocs\u002Fen\u002Fcloud\u002Fbot-discord\u002Fhost-discord-bot-python-1793644515863-4fda87aa063d51bc1ae0be65.webp\" alt=\"Software Changer with the python generic environment active and its REINSTALL button\" width=\"400\" \u002F>\n\n\u003Ch2>4. Prepare the bot&#39;s files\u003C\u002Fh2>\n\u003Cp>A minimal discord.py bot fits in three files, all placed at the root of the server.\u003C\u002Fp>\n\u003Ctable>\n\u003Cthead>\n\u003Ctr>\n\u003Cth>File\u003C\u002Fth>\n\u003Cth>Purpose\u003C\u002Fth>\n\u003C\u002Ftr>\n\u003C\u002Fthead>\n\u003Ctbody>\u003Ctr>\n\u003Ctd>\u003Ccode>requirements.txt\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>Lists the libraries the bot needs\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>app.py\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>The bot&#39;s code, run at startup\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Ccode>.env\u003C\u002Fcode>\u003C\u002Ftd>\n\u003Ctd>The token, kept apart from the code\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftbody>\u003C\u002Ftable>\n\u003Cp>The \u003Ccode>requirements.txt\u003C\u002Fcode> file declares discord.py and python-dotenv, the library that reads the \u003Ccode>.env\u003C\u002Fcode> file.\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-bash\">discord.py&gt;=2.7\npython-dotenv&gt;=1.2\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>The \u003Ccode>app.py\u003C\u002Fcode> file loads the token, connects the bot and writes a line to the console once the connection is up.\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-python\">import os\n\nimport discord\nfrom dotenv import load_dotenv\n\nload_dotenv()\n\nintents = discord.Intents.default()\nclient = discord.Client(intents=intents)\n\n\n@client.event\nasync def on_ready():\n    print(f&quot;Ready! Logged in as {client.user}&quot;)\n\n\nclient.run(os.getenv(&quot;DISCORD_TOKEN&quot;))\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>The \u003Ccode>.env\u003C\u002Fcode> file holds a single line, with the token copied in step 1 in place of the sample text.\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-bash\">DISCORD_TOKEN=PASTE_YOUR_BOT_TOKEN_HERE\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cdiv class=\"markdown-alert markdown-alert-important\">\u003Cspan class=\"alert-icon\">\u003Csvg xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\u003Cpath d=\"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10z\"\u002F>\u003Cpath d=\"M12 8v4\"\u002F>\u003Cpath d=\"M12 16h.01\"\u002F>\u003C\u002Fsvg>\u003C\u002Fspan>\u003Cdiv class=\"markdown-alert-body\">\u003Cp>Do not upload a virtual environment or a library folder. At every start, the server runs \u003Ccode>pip install -U\u003C\u002Fcode> on the \u003Ccode>requirements.txt\u003C\u002Fcode> file and installs or upgrades the listed libraries itself.\u003C\u002Fp>\n\u003C\u002Fdiv>\u003C\u002Fdiv>\n\u003Ch2>5. Upload the files to the server\u003C\u002Fh2>\n\u003Cp>In the side menu, click \u003Cstrong>Files\u003C\u002Fstrong>. The \u003Cstrong>Upload\u003C\u002Fstrong> button lets you send your files from your computer. Drop them at the root, meaning directly in the folder shown by \u003Cstrong>Files\u003C\u002Fstrong>, not in a subfolder.\u003C\u002Fp>\n\u003Cp>You can also create each file on the server. Click \u003Cstrong>New file\u003C\u002Fstrong>, paste the content into the editor, click \u003Cstrong>Create File\u003C\u002Fstrong>, then name the file, \u003Ccode>requirements.txt\u003C\u002Fcode> in the example below. Do the same for \u003Ccode>app.py\u003C\u002Fcode> and \u003Ccode>.env\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Cimg src=\"\u002Fstatics\u002Fimages\u002Fdocs\u002Fen\u002Fcloud\u002Fbot-discord\u002Fhost-discord-bot-python-1793644516268-da42faddbde1a554d0c99a8a.webp\" alt=\"requirements.txt file with discord.py and python-dotenv and the Create File button\" width=\"800\" \u002F>\n\n\u003Cp>The three files then show up in the file manager.\u003C\u002Fp>\n\u003Cimg src=\"\u002Fstatics\u002Fimages\u002Fdocs\u002Fen\u002Fcloud\u002Fbot-discord\u002Fhost-discord-bot-python-1793644750489-d16393fd263ddf4c6c35138a.webp\" alt=\".env, app.py and requirements.txt files in the panel file manager\" width=\"800\" \u002F>\n\n\u003Cdiv class=\"markdown-alert markdown-alert-tip\">\u003Cspan class=\"alert-icon\">\u003Csvg xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\u003Ccircle cx=\"12\" cy=\"12\" r=\"10\"\u002F>\u003Cpath d=\"M12 16v-4\"\u002F>\u003Cpath d=\"M12 8h.01\"\u002F>\u003C\u002Fsvg>\u003C\u002Fspan>\u003Cdiv class=\"markdown-alert-body\">\u003Cp>For a large project or many files, use SFTP. Our guide \u003Ca href=\"https:\u002F\u002Fwinheberg.com\u002Fen\u002Fdocs\u002Fpanel-gaming\u002Fsftp-gaming-server\">How to Connect to Your Gaming Server via SFTP\u003C\u002Fa> covers the connection with FileZilla or WinSCP, and it works the same way for a Discord Bot service.\u003C\u002Fp>\n\u003C\u002Fdiv>\u003C\u002Fdiv>\n\u003Ch2>6. Choose the Python version and the main file\u003C\u002Fh2>\n\u003Cp>In the side menu, click \u003Cstrong>Startup\u003C\u002Fstrong>. The \u003Cstrong>Docker Image\u003C\u002Fstrong> menu sets the Python version the bot runs on. It offers Python 2.7 as well as versions 3.7 to 3.13.\u003C\u002Fp>\n\u003Cimg src=\"\u002Fstatics\u002Fimages\u002Fdocs\u002Fen\u002Fcloud\u002Fbot-discord\u002Fhost-discord-bot-python-1793644750832-1a7397aada7bd66772ea936d.webp\" alt=\"Startup page with the Python startup command and the Docker Image menu set to Python 3.13\" width=\"800\" \u002F>\n\n\u003Cp>The discord.py 2.7 library requires Python 3.8 or newer, and python-dotenv 1.2 needs Python 3.10 or newer. For the example bot, choose an image from Python 3.10 upwards.\u003C\u002Fp>\n\u003Cp>Further down, the \u003Cstrong>Variables\u003C\u002Fstrong> section holds the startup settings.\u003C\u002Fp>\n\u003Cimg src=\"\u002Fstatics\u002Fimages\u002Fdocs\u002Fen\u002Fcloud\u002Fbot-discord\u002Fhost-discord-bot-python-1793644751193-12f7796bf7ccb1163a40bf00.webp\" alt=\"APP PY FILE, ADDITIONAL PYTHON PACKAGES and REQUIREMENTS FILE startup variables\" width=\"800\" \u002F>\n\n\u003Ctable>\n\u003Cthead>\n\u003Ctr>\n\u003Cth>Variable\u003C\u002Fth>\n\u003Cth>Purpose\u003C\u002Fth>\n\u003C\u002Ftr>\n\u003C\u002Fthead>\n\u003Ctbody>\u003Ctr>\n\u003Ctd>\u003Cstrong>APP PY FILE\u003C\u002Fstrong>\u003C\u002Ftd>\n\u003Ctd>The file run at startup, \u003Ccode>app.py\u003C\u002Fcode> by default\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Cstrong>REQUIREMENTS FILE\u003C\u002Fstrong>\u003C\u002Ftd>\n\u003Ctd>The file listing the libraries installed at every start, \u003Ccode>requirements.txt\u003C\u002Fcode> by default\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003Ctr>\n\u003Ctd>\u003Cstrong>ADDITIONAL PYTHON PACKAGES\u003C\u002Fstrong>\u003C\u002Ftd>\n\u003Ctd>Extra libraries installed at every start, separated by spaces\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftbody>\u003C\u002Ftable>\n\u003Cp>If your bot&#39;s entry point has another name, \u003Ccode>bot.py\u003C\u002Fcode> or \u003Ccode>main.py\u003C\u002Fcode> for example, enter it in \u003Cstrong>APP PY FILE\u003C\u002Fstrong>. The panel saves the value as you type it.\u003C\u002Fp>\n\u003Cdiv class=\"markdown-alert markdown-alert-note\">\u003Cspan class=\"alert-icon\">\u003Csvg xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\u003Ccircle cx=\"12\" cy=\"12\" r=\"10\"\u002F>\u003Cline x1=\"12\" y1=\"16\" x2=\"12\" y2=\"12\"\u002F>\u003Cline x1=\"12\" y1=\"8\" x2=\"12.01\" y2=\"8\"\u002F>\u003C\u002Fsvg>\u003C\u002Fspan>\u003Cdiv class=\"markdown-alert-body\">\u003Cp>Right after going through \u003Cstrong>Software Changer\u003C\u002Fstrong>, the \u003Cstrong>APP PY FILE\u003C\u002Fstrong> and \u003Cstrong>REQUIREMENTS FILE\u003C\u002Fstrong> fields may only show greyed-out sample text. Type the values yourself, \u003Ccode>app.py\u003C\u002Fcode> and \u003Ccode>requirements.txt\u003C\u002Fcode> for the example bot.\u003C\u002Fp>\n\u003C\u002Fdiv>\u003C\u002Fdiv>\n\u003Ch2>7. Start the bot and check the console\u003C\u002Fh2>\n\u003Cp>In the side menu, click \u003Cstrong>Console\u003C\u002Fstrong>, then \u003Cstrong>Start\u003C\u002Fstrong>. The server shows the Python version, installs the libraries from \u003Ccode>requirements.txt\u003C\u002Fcode>, then runs \u003Ccode>app.py\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-bash\">Python 3.13.18\nCollecting discord.py&gt;=2.7 (from -r requirements.txt (line 1))\nCollecting python-dotenv&gt;=1.2 (from -r requirements.txt (line 2))\nSuccessfully installed aiohappyeyeballs-2.7.1 aiohttp-3.14.5 aiosignal-1.4.0 attrs-26.1.0 audioop-lts-0.2.2 discord.py-2.7.1 frozenlist-1.8.0 idna-3.20 multidict-7.2.1 propcache-0.5.4 python-dotenv-1.2.4 yarl-1.25.1\n2026-11-02 19:29:33 INFO     discord.client logging in using static token\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Once the connection to Discord is up, the example bot writes the following line, with your bot&#39;s name. The bot then shows as online in your Discord server&#39;s member list.\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-bash\">Ready! Logged in as MyBot#1234\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>On later starts, pip answers \u003Ccode>Requirement already satisfied\u003C\u002Fcode> for each library already up to date, so the bot starts faster.\u003C\u002Fp>\n\u003Ch2>If you run into trouble\u003C\u002Fh2>\n\u003Ch3>❌ discord.errors.LoginFailure: Improper token has been passed.\u003C\u002Fh3>\n\u003Cimg src=\"\u002Fstatics\u002Fimages\u002Fdocs\u002Fen\u002Fcloud\u002Fbot-discord\u002Fhost-discord-bot-python-1793644516634-d83bb0ba4dcb0aa5222f1f94.webp\" alt=\"Panel console showing the discord.errors.LoginFailure Improper token has been passed error\" width=\"640\" \u002F>\n\n\u003Cul>\n\u003Cli>Check that the file is named exactly \u003Ccode>.env\u003C\u002Fcode> and sits at the root, next to \u003Ccode>app.py\u003C\u002Fcode>\u003C\u002Fli>\n\u003Cli>Check that the variable name is the same in \u003Ccode>.env\u003C\u002Fcode> and in the code, \u003Ccode>DISCORD_TOKEN\u003C\u002Fcode> in the example\u003C\u002Fli>\n\u003Cli>Copy the whole token again, with no space before or after it\u003C\u002Fli>\n\u003Cli>If you have clicked \u003Cstrong>Reset Token\u003C\u002Fstrong> since then, put the new token in \u003Ccode>.env\u003C\u002Fcode>, the old one no longer works\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch3>❌ can&#39;t open file &#39;\u002Fhome\u002Fcontainer\u002Fbot.py&#39;: [Errno 2] No such file or directory\u003C\u002Fh3>\n\u003Cimg src=\"\u002Fstatics\u002Fimages\u002Fdocs\u002Fen\u002Fcloud\u002Fbot-discord\u002Fhost-discord-bot-python-1793644517041-3dcaab4514dc146164f7c19f.webp\" alt=\"Panel console showing can't open file bot.py No such file or directory\" width=\"800\" \u002F>\n\n\u003Cul>\n\u003Cli>The \u003Cstrong>APP PY FILE\u003C\u002Fstrong> value does not match any file at the root of the server\u003C\u002Fli>\n\u003Cli>Open \u003Cstrong>Files\u003C\u002Fstrong> and check the exact name of your main file, capital letters included\u003C\u002Fli>\n\u003Cli>Enter that name in \u003Cstrong>APP PY FILE\u003C\u002Fstrong> on the \u003Cstrong>Startup\u003C\u002Fstrong> page, then restart\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch3>❌ ModuleNotFoundError: No module named &#39;discord&#39;\u003C\u002Fh3>\n\u003Cul>\n\u003Cli>Check that \u003Ccode>requirements.txt\u003C\u002Fcode> is at the root and that its name matches the \u003Cstrong>REQUIREMENTS FILE\u003C\u002Fstrong> variable\u003C\u002Fli>\n\u003Cli>Check that it contains the \u003Ccode>discord.py\u003C\u002Fcode> line, because the code imports the \u003Ccode>discord\u003C\u002Fcode> module while the library to install is called \u003Ccode>discord.py\u003C\u002Fcode>\u003C\u002Fli>\n\u003Cli>Scroll up in the console to the pip lines to spot any install error, then restart\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch3>❌ discord.errors.PrivilegedIntentsRequired\u003C\u002Fh3>\n\u003Cp>The full message starts with \u003Ccode>Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal.\u003C\u002Fcode>\u003C\u002Fp>\n\u003Cul>\n\u003Cli>Your code requests a privileged intent, \u003Ccode>message_content\u003C\u002Fcode>, \u003Ccode>members\u003C\u002Fcode> or \u003Ccode>presences\u003C\u002Fcode>, that is not enabled on the developer portal&#39;s \u003Cstrong>Bot\u003C\u002Fstrong> page\u003C\u002Fli>\n\u003Cli>Enable the matching intent under \u003Cstrong>Privileged Gateway Intents\u003C\u002Fstrong>\u003C\u002Fli>\n\u003Cli>Or remove the intent your bot does not need from the code, then restart\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch3>❌ Prefix commands do not respond\u003C\u002Fh3>\n\u003Cp>If your bot uses \u003Ccode>commands.Bot\u003C\u002Fcode>, the console shows the following warning.\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-bash\">Privileged message content intent is missing, commands may not work as expected.\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cul>\n\u003Cli>Add the line \u003Ccode>intents.message_content = True\u003C\u002Fcode> to your code before creating the bot\u003C\u002Fli>\n\u003Cli>Enable the message content intent under \u003Cstrong>Privileged Gateway Intents\u003C\u002Fstrong> in the portal, then restart\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch2>Best practices\u003C\u002Fh2>\n\u003Cul>\n\u003Cli>\u003Cstrong>Keep the token in \u003Ccode>.env\u003C\u002Fcode>\u003C\u002Fstrong>, never in \u003Ccode>app.py\u003C\u002Fcode>, and add \u003Ccode>.env\u003C\u002Fcode> to your \u003Ccode>.gitignore\u003C\u002Fcode> if your code is on Git\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Bound the versions\u003C\u002Fstrong> in \u003Ccode>requirements.txt\u003C\u002Fcode>, for example \u003Ccode>discord.py&gt;=2.7,&lt;3\u003C\u002Fcode>, because at every start the server moves to the latest version within those bounds\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Make a backup before a major update\u003C\u002Fstrong> of the bot or of discord.py, our guide \u003Ca href=\"https:\u002F\u002Fwinheberg.com\u002Fen\u002Fdocs\u002Fpanel-gaming\u002Fcreate-restore-backup-gaming-server\">How to Create and Restore a Backup of Your Gaming Server\u003C\u002Fa> explains how\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Use a MySQL database\u003C\u002Fstrong> if your bot needs to keep data, our guide \u003Ca href=\"https:\u002F\u002Fwinheberg.com\u002Fen\u002Fdocs\u002Fpanel-gaming\u002Fcreate-mysql-database-panel\">How to Create a MySQL Database from the Gaming Panel\u003C\u002Fa> applies to the Discord Bot service too\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Give helpers a sub-user account\u003C\u002Fstrong> rather than sharing your password, as explained in our guide \u003Ca href=\"https:\u002F\u002Fwinheberg.com\u002Fen\u002Fdocs\u002Fpanel-gaming\u002Fadd-sub-user-gaming-panel\">How to Add a Sub-User to Your Gaming Panel\u003C\u002Fa>\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch2>Need help?\u003C\u002Fh2>\n\u003Cp>If your bot refuses to start or does not connect to Discord despite these checks, our team is here to help. Open a ticket in the \u003Cstrong>Technical\u003C\u002Fstrong> department from your client area, fill in the \u003Cstrong>Related Product\u003C\u002Fstrong> field with your Discord Bot service and include the error message shown in the console, without ever adding the token.\u003C\u002Fp>\n\u003Cp>Your Discord bot is now running on Winheberg 🤖\u003C\u002Fp>\n",1794353869687]