Add basic bot

This commit is contained in:
Jimmy 2021-08-25 21:57:50 +12:00
parent dc87fb572d
commit 04647424eb
1 changed files with 86 additions and 2 deletions

View File

@ -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": {