diff --git a/discord.ipynb b/discord.ipynb index c809888..60be839 100644 --- a/discord.ipynb +++ b/discord.ipynb @@ -1,12 +1,96 @@ { "cells": [ + { + "cell_type": "markdown", + "id": "94c544b3", + "metadata": {}, + "source": [ + "# Discord Bot" + ] + }, + { + "cell_type": "markdown", + "id": "d067ec9a", + "metadata": {}, + "source": [ + "## Create bot" + ] + }, + { + "cell_type": "markdown", + "id": "349850de", + "metadata": {}, + "source": [ + "https://discordpy.readthedocs.io/en/stable/discord.html" + ] + }, { "cell_type": "code", "execution_count": null, - "id": "538f8cf6", + "id": "cedc5095", "metadata": {}, "outputs": [], - "source": [] + "source": [ + "token=\"\"" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "d9df2dfa", + "metadata": {}, + "outputs": [], + "source": [ + "from discord.ext import commands" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "1ea89ae6", + "metadata": {}, + "outputs": [], + "source": [ + "bot = commands.Bot(command_prefix='!')" + ] + }, + { + "cell_type": "markdown", + "id": "39a6d65b", + "metadata": {}, + "source": [ + "### Create a command !echo " + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "92d8a63a", + "metadata": {}, + "outputs": [], + "source": [ + "@bot.command()\n", + "async def echo(ctx, arg):\n", + " ctx.send(arg)" + ] + }, + { + "cell_type": "markdown", + "id": "3d1c2f78", + "metadata": {}, + "source": [ + "### Start the bot" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ec254e81", + "metadata": {}, + "outputs": [], + "source": [ + "bot.run(token)" + ] } ], "metadata": {