Python

My discord bot

fork
loading
Files
  • main.py
  • keep_alive.py
  • mod.py
  • requirements.txt

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.6898506061276737","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"aW1wb3J0IGRpc2NvcmQKaW1wb3J0IG9zCmltcG9ydCBhc3luY2lvCmZyb20gZGlzY29yZC5leHQgaW1wb3J0IGNvbW1hbmRzCmZyb20gZGlzY29yZC5leHQuY29tbWFuZHMgaW1wb3J0IEJvdApmcm9tIGtlZXBfYWxpdmUgaW1wb3J0IGtlZXBfYWxpdmUKCmJvdF9wcmVmaXggPSAnIWR1Y2snCmJvdF9kZXNjcmlwdGlvbj0iRHVja0JvdCBCZXRhIgoKYm90ID0gY29tbWFuZHMuQm90KGNvbW1hbmRfcHJlZml4PWJvdF9wcmVmaXgsIGRlc2NyaXB0aW9uPWJvdF9kZXNjcmlwdGlvbikKCkBib3QuZXZlbnQKYXN5bmMgZGVmIG9uX3JlYWR5KCk6CiAgICBwcmludCgiSSdtIGluIikKICAgIHByaW50KGJvdC51c2VyKQoKQGJvdC5ldmVudAphc3luYyBkZWYgb25fbWVzc2FnZShtZXNzYWdlKToKICAgIGlmIG1lc3NhZ2UuY29udGVudC5zdGFydHN3aXRoKCchZ3JlZXQnKToKICAgICAgICBjaGFubmVsID0gbWVzc2FnZS5jaGFubmVsCiAgICAgICAgYXdhaXQgY2hhbm5lbC5zZW5kKCdTYXkgaGVsbG8hJykKCkBib3QuZXZlbnQKYXN5bmMgZGVmIG9uX21lc3NhZ2UobWVzc2FnZSk6CiAgICBpZiBtZXNzYWdlLmF1dGhvciA9PSBib3QudXNlcjoKICAgICAgICByZXR1cm4KICAgIGlmIG1lc3NhZ2UuY29udGVudCA9PSAiSGVsbG8iOgogICAgICAgIGF3YWl0IGJvdC5zZW5kKG1lc3NhZ2UuY2hhbm5lbCwgIldvcmxkIikKCkBib3QuY29tbWFuZCgpCmFzeW5jIGRlZiBsb2FkKGV4dGVuc2lvbl9uYW1lIDogc3RyKToKICAgICIiIkxvYWRzIGFuIGV4dGVuc2lvbi4iIiIKICAgIHRyeToKICAgICAgICBib3QubG9hZF9leHRlbnNpb24oZXh0ZW5zaW9uX25hbWUpCiAgICBleGNlcHQgKEF0dHJpYnV0ZUVycm9yLCBJbXBvcnRFcnJvcikgYXMgZToKICAgICAgICBhd2FpdCBib3Quc2F5KCJgYGBweVxue306IHt9XG5gYGAiLmZvcm1hdCh0eXBlKGUpLl9fbmFtZV9fLCBzdHIoZSkpKQogICAgICAgIHJldHVybgogICAgYXdhaXQgYm90LnNheSgie30gbG9hZGVkLiIuZm9ybWF0KGV4dGVuc2lvbl9uYW1lKSkKQGJvdC5jb21tYW5kKCkKYXN5bmMgZGVmIHVubG9hZChleHRlbnNpb25fbmFtZSA6IHN0cik6CiAgICAiIiJVbmxvYWRzIGFuIGV4dGVuc2lvbi4iIiIKICAgIGJvdC51bmxvYWRfZXh0ZW5zaW9uKGV4dGVuc2lvbl9uYW1lKQogICAgYXdhaXQgYm90LnNheSgie30gdW5sb2FkZWQuIi5mb3JtYXQoZXh0ZW5zaW9uX25hbWUpKQoKCnRva2VuID0gb3MuZW52aXJvbi5nZXQoIkRJU0NPUkRfQk9UX1NFQ1JFVCIpCmJvdC5ydW4odG9rZW4p"},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import discord
import os
import asyncio
from discord.ext import commands
from discord.ext.commands import Bot
from keep_alive import keep_alive

bot_prefix = '!duck'
bot_description="DuckBot Beta"

bot = commands.Bot(command_prefix=bot_prefix, description=bot_description)

@bot.event
async def on_ready():
    print("I'm in")
    print(bot.user)

@bot.event
async def on_message(message):
    if message.content.startswith('!greet'):
        channel = message.channel
        await channel.send('Say hello!')

@bot.event
async def on_message(message):
    if message.author == bot.user:
        return
    if message.content == "Hello":
        await bot.send(message.channel, "World")

@bot.command()
async def load(extension_name : str):
    """Loads an extension."""
    try:
        bot.load_extension(extension_name)
    except (AttributeError, ImportError) as e:
        await bot.say("```py\n{}: {}\n```".format(type(e).__name__, str(e)))
        return
    await bot.say("{} loaded.".format(extension_name))
@bot.command()
async def unload(extension_name : str):
    """Unloads an extension."""
    bot.unload_extension(extension_name)
    await bot.say("{} unloaded.".format(extension_name))


token = os.environ.get("DISCORD_BOT_SECRET")
bot.run(token)