{ "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": "cedc5095", "metadata": {}, "outputs": [], "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": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.10" } }, "nbformat": 4, "nbformat_minor": 5 }