{"id":8154,"date":"2026-09-02T21:34:38","date_gmt":"2026-09-02T21:34:38","guid":{"rendered":"https:\/\/kutia.net\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python-2\/"},"modified":"2026-09-02T21:34:38","modified_gmt":"2026-09-02T21:34:38","slug":"create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python","status":"publish","type":"post","link":"https:\/\/kutia.net\/de\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python\/","title":{"rendered":"Erstellen Sie einen Discord-Bot, der OpenAI verwendet, um Antworten auf Nachrichten mit Python zu generieren"},"content":{"rendered":"<p class=\"wp-block-paragraph\">This article intends to explain how to create a simple Discord bot that replies as OpenAI\u2019s chat would do. And gives you a walkthrough of containerizing the application.<\/p>\n<h2 class=\"wp-block-heading\" id=\"db60\">What do you need?<\/h2>\n<p class=\"wp-block-paragraph\" id=\"d8a6\">You need an OpenAI account&nbsp;<code>api-key<\/code>&nbsp;which you can find in your&nbsp;<a href=\"https:\/\/beta.openai.com\/account\/api-keys\" rel=\"noreferrer noopener\" target=\"_blank\">OpenAI account<\/a>.<\/p>\n<p class=\"wp-block-paragraph\" id=\"8695\">You need a configured Discord bot,<a href=\"https:\/\/www.ionos.co.uk\/digitalguide\/server\/know-how\/creating-discord-bot\/\" rel=\"noreferrer noopener\" target=\"_blank\">&nbsp;here is how to do that<\/a>.<\/p>\n<p class=\"wp-block-paragraph\" id=\"20a4\">Make sure your Discord bot has permission to read and send messages, and that it\u2019s added to your discord channel.<\/p>\n<p class=\"wp-block-paragraph\" id=\"d695\">First things first let\u2019s use&nbsp;<a href=\"https:\/\/pypi.org\/project\/discord.py\/\" rel=\"noreferrer noopener\" target=\"_blank\">discord<\/a>\u2019s Client class to create the bot, and install this library with the command:<\/p>\n<p class=\"wp-block-paragraph\" id=\"1184\"><code>pip install discord.py<\/code><\/p>\n<p class=\"wp-block-paragraph\" id=\"e773\">We\u2019ll first create our own class named&nbsp;<code>OpenAIBot<\/code>&nbsp;which will inherit the&nbsp;<code>Client<\/code>&nbsp;class and add two more functions to it. This&nbsp;<code>Client<\/code>&nbsp;class takes intents as a constructor argument on initialization.<br \/>You could use the default&nbsp;<code>Intents<\/code>&nbsp;unless you have a particular one to specify.<\/p>\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"281\" src=\"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.10.51-AM-1024x281.png\" alt=\"\" class=\"wp-image-4476\" srcset=\"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.10.51-AM-1024x281.webp 1024w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.10.51-AM-300x82.webp 300w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.10.51-AM-768x211.webp 768w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.10.51-AM.webp 1436w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<p class=\"wp-block-paragraph\">Let\u2019s override the asynchronous function&nbsp;<code>on_message<\/code>, which is triggered when a message is sent to the channel you added to your discord bot.<\/p>\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"536\" src=\"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.11.57-AM-1024x536.png\" alt=\"\" class=\"wp-image-4479\" srcset=\"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.11.57-AM-1024x536.webp 1024w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.11.57-AM-300x157.webp 300w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.11.57-AM-768x402.webp 768w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.11.57-AM.webp 1426w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<p class=\"wp-block-paragraph\" id=\"5370\">Now we have to deal with&nbsp;<a href=\"https:\/\/github.com\/openai\/openai-python\" rel=\"noreferrer noopener\" target=\"_blank\">OpenAI\u2019s library for python<\/a>, first, let&#8217;s install it:<\/p>\n<p class=\"wp-block-paragraph\" id=\"79f0\"><code>pip install --upgrade openai<\/code><\/p>\n<p class=\"wp-block-paragraph\" id=\"e475\">The only thing we need for OpenAI to be able to respond to our messages is the&nbsp;<code>Completion<\/code>&nbsp;engine and that is possible with a simple request:<\/p>\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"367\" src=\"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.12.35-AM-1024x367.png\" alt=\"\" class=\"wp-image-4482\" srcset=\"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.12.35-AM-1024x367.webp 1024w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.12.35-AM-300x108.webp 300w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.12.35-AM-768x275.webp 768w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.12.35-AM.webp 1400w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<p class=\"wp-block-paragraph\" id=\"9098\">For more information on customizing this call check out the&nbsp;<a href=\"https:\/\/beta.openai.com\/docs\/api-reference\/completions\" rel=\"noreferrer noopener\" target=\"_blank\">API reference of OpenAI<\/a>.<\/p>\n<p class=\"wp-block-paragraph\" id=\"292c\">Back to our code, we will now add a function called&nbsp;<code>openai_response<\/code>&nbsp;which takes a message as an argument and returns a message from OpenAPI.<\/p>\n<p class=\"wp-block-paragraph\" id=\"9f5e\">We will use&nbsp;<code>openai.Completion.create()<\/code>&nbsp;functions to help us out with the communication:<\/p>\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"753\" src=\"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.13.10-AM-1024x753.png\" alt=\"\" class=\"wp-image-4485\" srcset=\"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.13.10-AM-1024x753.webp 1024w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.13.10-AM-300x221.webp 300w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.13.10-AM-768x565.webp 768w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.13.10-AM.webp 1404w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<p class=\"wp-block-paragraph\" id=\"a541\">Great!<\/p>\n<p class=\"wp-block-paragraph\" id=\"7d02\">Now running the bot would require the initialization of this class and the call of&nbsp;<code>run<\/code>&nbsp;of the super-class Client.<\/p>\n<p class=\"wp-block-paragraph\" id=\"3cf2\">We\u2019ll use the condition&nbsp;<code>if __name__==\"__main\":<\/code>&nbsp;to avoid starting the bot when we (if we) import&nbsp;<code>OpenAIBot<\/code>&nbsp;in the near future.<\/p>\n<p class=\"wp-block-paragraph\" id=\"f674\">Now the code looks like this:<\/p>\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1017\" height=\"1024\" src=\"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.14.24-AM-1017x1024.png\" alt=\"\" class=\"wp-image-4488\" srcset=\"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.14.24-AM-1017x1024.webp 1017w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.14.24-AM-298x300.webp 298w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.14.24-AM-150x150.webp 150w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.14.24-AM-768x774.webp 768w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.14.24-AM-418x420.png 418w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.14.24-AM.webp 1392w\" sizes=\"auto, (max-width: 1017px) 100vw, 1017px\" \/><\/figure>\n<p class=\"wp-block-paragraph\" id=\"f0e4\">There is a problem here, it\u2019s not good to directly insert confidential data like API keys on your code. We will use&nbsp;<code>os.getenv<\/code>&nbsp;to load these constants from our system.<\/p>\n<p class=\"wp-block-paragraph\" id=\"8cca\">After some minor tweaks the code will look like this:<\/p>\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"868\" height=\"1024\" src=\"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.15.18-AM-868x1024.png\" alt=\"\" class=\"wp-image-4491\" srcset=\"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.15.18-AM-868x1024.webp 868w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.15.18-AM-254x300.webp 254w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.15.18-AM-768x906.webp 768w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.15.18-AM-1302x1536.webp 1302w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.15.18-AM.webp 1402w\" sizes=\"auto, (max-width: 868px) 100vw, 868px\" \/><\/figure>\n<p class=\"wp-block-paragraph\" id=\"b7f5\">Assuming our main python script is named&nbsp;<code>main.py<\/code>we can proceed to execute it:<\/p>\n<p class=\"wp-block-paragraph\" id=\"2b1d\"><code>python3 main.py<\/code><\/p>\n<p class=\"wp-block-paragraph\" id=\"dba2\">Now you will see indications that our discord bot is running if you configured everything correctly.<\/p>\n<h1 class=\"wp-block-heading\" id=\"657f\">How about using docker?<\/h1>\n<p class=\"wp-block-paragraph\" id=\"1239\">I love Docker, so yes\u2026<\/p>\n<p class=\"wp-block-paragraph\" id=\"fb0c\">Let\u2019s create&nbsp;<code>Dockerfile<\/code>&nbsp;and&nbsp;<code>docker-compose.yml<\/code>&nbsp;for our docker configuration then&nbsp;<code>.env<\/code>&nbsp;for our environment variables, our project structure now looks like this:<\/p>\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"308\" src=\"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.16.15-AM-1024x308.png\" alt=\"\" class=\"wp-image-4494\" srcset=\"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.16.15-AM-1024x308.webp 1024w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.16.15-AM-300x90.webp 300w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.16.15-AM-768x231.webp 768w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.16.15-AM.webp 1388w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<p class=\"wp-block-paragraph\">Here we can explain the content and functionality of our new files,&nbsp;<code>.env<\/code>&nbsp;will hold the Discord and OpenAI tokens.<\/p>\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"162\" src=\"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.16.38-AM-1024x162.png\" alt=\"\" class=\"wp-image-4497\" srcset=\"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.16.38-AM-1024x162.webp 1024w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.16.38-AM-300x47.webp 300w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.16.38-AM-768x121.webp 768w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.16.38-AM.webp 1392w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<p class=\"wp-block-paragraph\" id=\"e017\">A new file in our project is&nbsp;<code>requirements.txt<\/code>&nbsp;as well, you can generate by freezing dependencies to this file with the command:&nbsp;<\/p>\n<p class=\"wp-block-paragraph\" id=\"e017\"><code>pip freeze -&gt; requirements.txt<\/code><\/p>\n<p class=\"wp-block-paragraph\" id=\"04fd\">Avoiding getting extra dependencies written in requirements here is the file I generated using a virtual environment:<\/p>\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"805\" src=\"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.17.05-AM-1024x805.png\" alt=\"\" class=\"wp-image-4500\" srcset=\"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.17.05-AM-1024x805.webp 1024w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.17.05-AM-300x236.webp 300w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.17.05-AM-768x604.webp 768w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.17.05-AM.webp 1414w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<p class=\"wp-block-paragraph\">Now let\u2019s explain&nbsp;<code>Dockerfile<\/code>, first, we\u2019ll use&nbsp;python:3.8-slim-buster&nbsp;as the base image to build our container on, then set&nbsp;\/bot&nbsp;as our working directory, copy&nbsp;bot&nbsp;the directory from the project root to the container and install the required dependencies:<\/p>\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"329\" src=\"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.17.48-AM-1024x329.png\" alt=\"\" class=\"wp-image-4503\" srcset=\"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.17.48-AM-1024x329.webp 1024w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.17.48-AM-300x96.webp 300w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.17.48-AM-768x247.webp 768w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.17.48-AM.webp 1400w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<p class=\"wp-block-paragraph\">Simple&nbsp;<code>docker-compose.yml<\/code>&nbsp;configuration with a single container which is built based on the instructions on&nbsp;<code>Dockerfile<\/code>:<\/p>\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"310\" src=\"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.18.20-AM-1024x310.png\" alt=\"\" class=\"wp-image-4506\" srcset=\"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.18.20-AM-1024x310.webp 1024w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.18.20-AM-300x91.webp 300w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.18.20-AM-768x232.webp 768w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.18.20-AM.webp 1396w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<p class=\"wp-block-paragraph\" id=\"9300\">Build the docker image and spin up the container:<\/p>\n<p class=\"wp-block-paragraph\" id=\"8374\"><code>docker-compose up --build -d<\/code><\/p>\n<p class=\"wp-block-paragraph\" id=\"4d09\">And now you have the OpenAI discord bot running in a container.<\/p>\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"656\" src=\"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.20.19-AM-1024x656.png\" alt=\"\" class=\"wp-image-4512\" srcset=\"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.20.19-AM-1024x656.webp 1024w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.20.19-AM-300x192.webp 300w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.20.19-AM-768x492.webp 768w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.20.19-AM-1536x984.webp 1536w, https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/Screenshot-2022-12-20-at-11.20.19-AM-2048x1313.webp 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Dieser Artikel soll erkl\u00e4ren, wie man einen einfachen Discord-Bot erstellt, der so antwortet, wie es der Chat von OpenAI tun w\u00fcrde. Und gibt Ihnen einen \u00dcberblick \u00fcber die Containerisierung der Anwendung. Was brauchst du? Sie ben\u00f6tigen einen OpenAI-Konto-API-Schl\u00fcssel,\u00a0den Sie in Ihrem\u00a0OpenAI-Konto finden. Sie ben\u00f6tigen einen konfigurierten Discord-Bot. Hier erfahren Sie, wie Sie dies tun k\u00f6nnen. Machen Sie [\u2026]<\/p>\n","protected":false},"author":0,"featured_media":4516,"comment_status":"","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[49],"tags":[],"class_list":["post-8154","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-unkategorisiert"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Create a Discord bot that uses OpenAI to generate responses to messages using Python - Kutia<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kutia.net\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python-2\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Create a Discord bot that uses OpenAI to generate responses to messages using Python - Kutia\" \/>\n<meta property=\"og:description\" content=\"Dieser Artikel soll erkl\u00e4ren, wie man einen einfachen Discord-Bot erstellt, der so antwortet, wie es der Chat von OpenAI tun w\u00fcrde. Und gibt Ihnen einen \u00dcberblick \u00fcber die Containerisierung der Anwendung. Was brauchst du? Sie ben\u00f6tigen einen OpenAI-Konto-API-Schl\u00fcssel,\u00a0den Sie in Ihrem\u00a0OpenAI-Konto finden. Sie ben\u00f6tigen einen konfigurierten Discord-Bot. Hier erfahren Sie, wie Sie dies tun k\u00f6nnen. Machen Sie [\u2026]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kutia.net\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Kutia\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-02T21:34:38+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/kutia.net\\\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python-2\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/kutia.net\\\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python-2\\\/\"},\"author\":{\"name\":\"\",\"@id\":\"\"},\"headline\":\"Erstellen Sie einen Discord-Bot, der OpenAI verwendet, um Antworten auf Nachrichten mit Python zu generieren\",\"datePublished\":\"2026-09-02T21:34:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/kutia.net\\\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python-2\\\/\"},\"wordCount\":14,\"publisher\":{\"@id\":\"https:\\\/\\\/kutia.net\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/kutia.net\\\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python-2\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/kutia.net\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/DiscordBlog_Banner.webp\",\"articleSection\":[\"Unkategorisiert\"],\"inLanguage\":\"de-DE\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/kutia.net\\\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python-2\\\/\",\"url\":\"https:\\\/\\\/kutia.net\\\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python-2\\\/\",\"name\":\"Create a Discord bot that uses OpenAI to generate responses to messages using Python - Kutia\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/kutia.net\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/kutia.net\\\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python-2\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/kutia.net\\\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python-2\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/kutia.net\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/DiscordBlog_Banner.webp\",\"datePublished\":\"2026-09-02T21:34:38+00:00\",\"inLanguage\":\"de-DE\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/kutia.net\\\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python-2\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"de-DE\",\"@id\":\"https:\\\/\\\/kutia.net\\\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python-2\\\/#primaryimage\",\"url\":\"https:\\\/\\\/kutia.net\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/DiscordBlog_Banner.webp\",\"contentUrl\":\"https:\\\/\\\/kutia.net\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/DiscordBlog_Banner.webp\",\"width\":10000,\"height\":5250},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/kutia.net\\\/#website\",\"url\":\"https:\\\/\\\/kutia.net\\\/\",\"name\":\"Kutia\",\"description\":\"Custom software, team augmentation, IT recruitment\",\"publisher\":{\"@id\":\"https:\\\/\\\/kutia.net\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/kutia.net\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"de-DE\"},{\"@type\":[\"Organization\",\"ProfessionalService\"],\"@id\":\"https:\\\/\\\/kutia.net\\\/#organization\",\"name\":\"Kutia\",\"url\":\"https:\\\/\\\/kutia.net\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de-DE\",\"@id\":\"https:\\\/\\\/kutia.net\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/kutia.net\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/android-chrome-512x512-1.png\",\"contentUrl\":\"https:\\\/\\\/kutia.net\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/android-chrome-512x512-1.png\",\"width\":512,\"height\":512,\"caption\":\"Kutia\"},\"image\":{\"@id\":\"https:\\\/\\\/kutia.net\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"alternateName\":\"Kutia Software Company\",\"description\":\"Kutia is a software development company founded in 2013 and headquartered in Pristina, Kosovo, that builds custom software, web and mobile applications and AI systems in production, and provides dedicated engineering teams to companies and public institutions in Europe and the United States.\",\"slogan\":\"We build the systems companies run on.\",\"foundingDate\":\"2013\",\"foundingLocation\":{\"@type\":\"Place\",\"name\":\"Pristina, Kosovo\"},\"address\":{\"@type\":\"PostalAddress\",\"streetAddress\":\"St. C, Sima Com Complex, Building B, No. 7\",\"addressLocality\":\"Pristina\",\"postalCode\":\"10000\",\"addressCountry\":\"XK\"},\"location\":[{\"@type\":\"Place\",\"name\":\"Kutia headquarters, Pristina\",\"address\":{\"@type\":\"PostalAddress\",\"streetAddress\":\"St. C, Sima Com Complex, Building B, No. 7\",\"addressLocality\":\"Pristina\",\"postalCode\":\"10000\",\"addressCountry\":\"XK\"}},{\"@type\":\"Place\",\"name\":\"Kutia Albania\",\"address\":{\"@type\":\"PostalAddress\",\"addressCountry\":\"AL\"}},{\"@type\":\"Place\",\"name\":\"Kutia USA\",\"address\":{\"@type\":\"PostalAddress\",\"addressCountry\":\"US\"}}],\"email\":\"sales@kutia.net\",\"contactPoint\":[{\"@type\":\"ContactPoint\",\"contactType\":\"sales\",\"email\":\"sales@kutia.net\",\"url\":\"https:\\\/\\\/kutia.net\\\/estimate-your-project\\\/\",\"availableLanguage\":\"English\"},{\"@type\":\"ContactPoint\",\"contactType\":\"careers\",\"email\":\"careers@kutia.net\",\"url\":\"https:\\\/\\\/kutia.net\\\/open-positions\\\/\"}],\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":60},\"areaServed\":[{\"@type\":\"Place\",\"name\":\"Europe\"},{\"@type\":\"Country\",\"name\":\"United States\"}],\"knowsAbout\":[\"Custom software development\",\"Dedicated development teams\",\"AI in production\",\"Web application development\",\"Mobile application development\",\"E-commerce development\",\"UX\\\/UI design\",\"Cloud infrastructure on AWS\",\"DevOps\",\"Quality assurance\",\"Legacy modernisation\",\"Software for the public sector\",\"Healthcare software\",\"Fintech and payments software\",\"iGaming software\",\"Energy and utilities software\",\"React\",\"Node.js\",\"TypeScript\",\"PHP\",\"Laravel\",\"React Native\",\"Flutter\"],\"hasCertification\":[{\"@type\":\"Certification\",\"name\":\"ISO 9001\"},{\"@type\":\"Certification\",\"name\":\"ISO\\\/IEC 27001\"},{\"@type\":\"Certification\",\"name\":\"ISO\\\/IEC 20000\"}],\"award\":[\"Impact Stars laureate, Deloitte Technology Fast 50 Central Europe\",\"Most Supportive Business of the Year, TOKA\"],\"founder\":{\"@type\":\"Person\",\"name\":\"Arianit Fazliu\",\"jobTitle\":\"CEO\"},\"owns\":{\"@type\":\"SoftwareApplication\",\"@id\":\"https:\\\/\\\/kutia.net\\\/#sixops\",\"name\":\"sixops\",\"url\":\"https:\\\/\\\/sixops.ai\\\/\",\"applicationCategory\":\"BusinessApplication\",\"operatingSystem\":\"Web\",\"description\":\"sixops is the operating system for professional services: a professional services automation (PSA) platform that runs a services company as one system, from the proposal to the paid invoice, with the estimate and the actual side by side on every project.\",\"publisher\":{\"@id\":\"https:\\\/\\\/kutia.net\\\/#organization\"},\"creator\":{\"@id\":\"https:\\\/\\\/kutia.net\\\/#organization\"}},\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/company\\\/kutia\\\/\",\"https:\\\/\\\/clutch.co\\\/profile\\\/kutia-software-company\",\"https:\\\/\\\/themanifest.com\\\/company\\\/kutia-software-company\",\"https:\\\/\\\/techbehemoths.com\\\/company\\\/kutia-software-company\",\"https:\\\/\\\/www.crunchbase.com\\\/organization\\\/kutia\",\"https:\\\/\\\/github.com\\\/kutia-software-company\",\"https:\\\/\\\/www.facebook.com\\\/kutiasoftware\\\/\",\"https:\\\/\\\/x.com\\\/kutia_net\",\"https:\\\/\\\/www.instagram.com\\\/kutiadigitalagency\\\/\",\"https:\\\/\\\/stikk.org\\\/en\\\/members\\\/kutia-software-company\\\/\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Create a Discord bot that uses OpenAI to generate responses to messages using Python - Kutia","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/kutia.net\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python-2\/","og_locale":"de_DE","og_type":"article","og_title":"Create a Discord bot that uses OpenAI to generate responses to messages using Python - Kutia","og_description":"Dieser Artikel soll erkl\u00e4ren, wie man einen einfachen Discord-Bot erstellt, der so antwortet, wie es der Chat von OpenAI tun w\u00fcrde. Und gibt Ihnen einen \u00dcberblick \u00fcber die Containerisierung der Anwendung. Was brauchst du? Sie ben\u00f6tigen einen OpenAI-Konto-API-Schl\u00fcssel,\u00a0den Sie in Ihrem\u00a0OpenAI-Konto finden. Sie ben\u00f6tigen einen konfigurierten Discord-Bot. Hier erfahren Sie, wie Sie dies tun k\u00f6nnen. Machen Sie [\u2026]","og_url":"https:\/\/kutia.net\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python-2\/","og_site_name":"Kutia","article_published_time":"2026-09-02T21:34:38+00:00","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/kutia.net\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python-2\/#article","isPartOf":{"@id":"https:\/\/kutia.net\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python-2\/"},"author":{"name":"","@id":""},"headline":"Erstellen Sie einen Discord-Bot, der OpenAI verwendet, um Antworten auf Nachrichten mit Python zu generieren","datePublished":"2026-09-02T21:34:38+00:00","mainEntityOfPage":{"@id":"https:\/\/kutia.net\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python-2\/"},"wordCount":14,"publisher":{"@id":"https:\/\/kutia.net\/#organization"},"image":{"@id":"https:\/\/kutia.net\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python-2\/#primaryimage"},"thumbnailUrl":"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/DiscordBlog_Banner.webp","articleSection":["Unkategorisiert"],"inLanguage":"de-DE"},{"@type":"WebPage","@id":"https:\/\/kutia.net\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python-2\/","url":"https:\/\/kutia.net\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python-2\/","name":"Create a Discord bot that uses OpenAI to generate responses to messages using Python - Kutia","isPartOf":{"@id":"https:\/\/kutia.net\/#website"},"primaryImageOfPage":{"@id":"https:\/\/kutia.net\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python-2\/#primaryimage"},"image":{"@id":"https:\/\/kutia.net\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python-2\/#primaryimage"},"thumbnailUrl":"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/DiscordBlog_Banner.webp","datePublished":"2026-09-02T21:34:38+00:00","inLanguage":"de-DE","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kutia.net\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python-2\/"]}]},{"@type":"ImageObject","inLanguage":"de-DE","@id":"https:\/\/kutia.net\/create-a-discord-bot-that-uses-openai-to-generate-responses-to-messages-using-python-2\/#primaryimage","url":"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/DiscordBlog_Banner.webp","contentUrl":"https:\/\/kutia.net\/wp-content\/uploads\/2022\/12\/DiscordBlog_Banner.webp","width":10000,"height":5250},{"@type":"WebSite","@id":"https:\/\/kutia.net\/#website","url":"https:\/\/kutia.net\/","name":"Kutia","description":"Custom software, team augmentation, IT recruitment","publisher":{"@id":"https:\/\/kutia.net\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kutia.net\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"de-DE"},{"@type":["Organization","ProfessionalService"],"@id":"https:\/\/kutia.net\/#organization","name":"Kutia","url":"https:\/\/kutia.net\/","logo":{"@type":"ImageObject","inLanguage":"de-DE","@id":"https:\/\/kutia.net\/#\/schema\/logo\/image\/","url":"https:\/\/kutia.net\/wp-content\/uploads\/2026\/09\/android-chrome-512x512-1.png","contentUrl":"https:\/\/kutia.net\/wp-content\/uploads\/2026\/09\/android-chrome-512x512-1.png","width":512,"height":512,"caption":"Kutia"},"image":{"@id":"https:\/\/kutia.net\/#\/schema\/logo\/image\/"},"alternateName":"Kutia Software Company","description":"Kutia is a software development company founded in 2013 and headquartered in Pristina, Kosovo, that builds custom software, web and mobile applications and AI systems in production, and provides dedicated engineering teams to companies and public institutions in Europe and the United States.","slogan":"We build the systems companies run on.","foundingDate":"2013","foundingLocation":{"@type":"Place","name":"Pristina, Kosovo"},"address":{"@type":"PostalAddress","streetAddress":"St. C, Sima Com Complex, Building B, No. 7","addressLocality":"Pristina","postalCode":"10000","addressCountry":"XK"},"location":[{"@type":"Place","name":"Kutia headquarters, Pristina","address":{"@type":"PostalAddress","streetAddress":"St. C, Sima Com Complex, Building B, No. 7","addressLocality":"Pristina","postalCode":"10000","addressCountry":"XK"}},{"@type":"Place","name":"Kutia Albania","address":{"@type":"PostalAddress","addressCountry":"AL"}},{"@type":"Place","name":"Kutia USA","address":{"@type":"PostalAddress","addressCountry":"US"}}],"email":"sales@kutia.net","contactPoint":[{"@type":"ContactPoint","contactType":"sales","email":"sales@kutia.net","url":"https:\/\/kutia.net\/estimate-your-project\/","availableLanguage":"English"},{"@type":"ContactPoint","contactType":"careers","email":"careers@kutia.net","url":"https:\/\/kutia.net\/open-positions\/"}],"numberOfEmployees":{"@type":"QuantitativeValue","minValue":60},"areaServed":[{"@type":"Place","name":"Europe"},{"@type":"Country","name":"United States"}],"knowsAbout":["Custom software development","Dedicated development teams","AI in production","Web application development","Mobile application development","E-commerce development","UX\/UI design","Cloud infrastructure on AWS","DevOps","Quality assurance","Legacy modernisation","Software for the public sector","Healthcare software","Fintech and payments software","iGaming software","Energy and utilities software","React","Node.js","TypeScript","PHP","Laravel","React Native","Flutter"],"hasCertification":[{"@type":"Certification","name":"ISO 9001"},{"@type":"Certification","name":"ISO\/IEC 27001"},{"@type":"Certification","name":"ISO\/IEC 20000"}],"award":["Impact Stars laureate, Deloitte Technology Fast 50 Central Europe","Most Supportive Business of the Year, TOKA"],"founder":{"@type":"Person","name":"Arianit Fazliu","jobTitle":"CEO"},"owns":{"@type":"SoftwareApplication","@id":"https:\/\/kutia.net\/#sixops","name":"sixops","url":"https:\/\/sixops.ai\/","applicationCategory":"BusinessApplication","operatingSystem":"Web","description":"sixops is the operating system for professional services: a professional services automation (PSA) platform that runs a services company as one system, from the proposal to the paid invoice, with the estimate and the actual side by side on every project.","publisher":{"@id":"https:\/\/kutia.net\/#organization"},"creator":{"@id":"https:\/\/kutia.net\/#organization"}},"sameAs":["https:\/\/www.linkedin.com\/company\/kutia\/","https:\/\/clutch.co\/profile\/kutia-software-company","https:\/\/themanifest.com\/company\/kutia-software-company","https:\/\/techbehemoths.com\/company\/kutia-software-company","https:\/\/www.crunchbase.com\/organization\/kutia","https:\/\/github.com\/kutia-software-company","https:\/\/www.facebook.com\/kutiasoftware\/","https:\/\/x.com\/kutia_net","https:\/\/www.instagram.com\/kutiadigitalagency\/","https:\/\/stikk.org\/en\/members\/kutia-software-company\/"]}]}},"_links":{"self":[{"href":"https:\/\/kutia.net\/de\/wp-json\/wp\/v2\/posts\/8154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kutia.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kutia.net\/de\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/kutia.net\/de\/wp-json\/wp\/v2\/comments?post=8154"}],"version-history":[{"count":0,"href":"https:\/\/kutia.net\/de\/wp-json\/wp\/v2\/posts\/8154\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kutia.net\/de\/wp-json\/wp\/v2\/media\/4516"}],"wp:attachment":[{"href":"https:\/\/kutia.net\/de\/wp-json\/wp\/v2\/media?parent=8154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kutia.net\/de\/wp-json\/wp\/v2\/categories?post=8154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kutia.net\/de\/wp-json\/wp\/v2\/tags?post=8154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}