@TheDrone7/

discord.py-rewrite

Python

This is a tutorial bot for discord.py-rewrite library commands extension.

fork
loading
Files
  • main.py
  • cogs
  • env
  • keep_alive.py
  • pyproject.toml
  • requirements.txt

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.8526656700445658","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"ZnJvbSBkaXNjb3JkLmV4dCBpbXBvcnQgY29tbWFuZHMKIyBJbXBvcnQgdGhlIGtlZXAgYWxpdmUgZmlsZQppbXBvcnQga2VlcF9hbGl2ZQppbXBvcnQgb3MKaW1wb3J0IHJlcGxpdAoKCmRlZiBnZXRfcHJlZml4KGNsaWVudCwgbWVzc2FnZSk6CgogICAgcHJlZml4ZXMgPSBbJz0nXSAgICAjIHNldHMgdGhlIHByZWZpeGVzLCB1IGNhbiBrZWVwIGl0IGFzIGFuIGFycmF5IG9mIG9ubHkgMSBpdGVtIGlmIHlvdSBuZWVkIG9ubHkgb25lIHByZWZpeAoKICAgIGlmIG5vdCBtZXNzYWdlLmd1aWxkOgogICAgICAgIHByZWZpeGVzID0gWyc9PSddICAgIyBPbmx5IGFsbG93ICc9PScgYXMgYSBwcmVmaXggd2hlbiBpbiBETXMKCiAgICAjIEFsbG93IHVzZXJzIHRvIEBtZW50aW9uIHRoZSBib3QgaW5zdGVhZCBvZiB1c2luZyBhIHByZWZpeCB3aGVuIHVzaW5nIGEgY29tbWFuZC4KICAgIHJldHVybiBjb21tYW5kcy53aGVuX21lbnRpb25lZF9vcigqcHJlZml4ZXMpKGNsaWVudCwgbWVzc2FnZSkKCgpib3QgPSBjb21tYW5kcy5Cb3QoICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICMgQ3JlYXRlIGEgbmV3IGJvdAogICAgY29tbWFuZF9wcmVmaXg9Z2V0X3ByZWZpeCwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAjIFNldCB0aGUgcHJlZml4CiAgICBkZXNjcmlwdGlv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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
from discord.ext import commands
# Import the keep alive file
import keep_alive
import os
import replit


def get_prefix(client, message):

    prefixes = ['=']    # sets the prefixes, u can keep it as an array of only 1 item if you need only one prefix

    if not message.guild:
        prefixes = ['==']   # Only allow '==' as a prefix when in DMs

    # Allow users to @mention the bot instead of using a prefix when using a command.
    return commands.when_mentioned_or(*prefixes)(client, message)


bot = commands.Bot(                                         
    # Create a new bot
    command_prefix=get_prefix,                              # Set the prefix
    description='A bot used for tutorial',                  # Set a description for the bot
    owner_id=374886124126208000,                            # Your unique User ID
    case_insensitive=True                                   # Make the commands case insensitive
)

# case_insensitive=True is used as the commands are case sensitive by default

cogs = ['cogs.basic','cogs.embed']


@bot.event
async def on_ready():
    replit.clear()
    print(f'Logged in as {bot.user.name} - {bot.user.id}')
    bot.remove_command('help')
    # Removes the help command
    # Make sure to do this before loading the cogs
    for cog in cogs:
        bot.load_extension(cog)
    return

# Start the server
keep_alive.keep_alive()

# Finally, login the bot
bot.run(os.environ.get('TOKEN'), bot=True, reconnect=True)