<commit_before>import discord
import asyncio
import git

client = discord.Client()

@client.event
async def on_ready():
    print('Logged in as')
    print(client.user.name)
    print(client.user.id)
    print('------')

@client.event
async def on_message(message):
    if message.content.startswith('!info'):
        repo = git.Repo(search_parent_directories=True)
        sha = repo.head.object.hexsha
        await client.send_message(message.channel, '```Project StarBot v0.0.1-{}\r\nDeveloped by CorpNewt and <NAME>```'.format(sha[:5]))

client.run('Mjg2NjUxNTk3NDIzOTAyNzIw.C5j0sw.qF968us3onhFSyjOgnv6-fr4_SU')<commit_msg>Creating a module loading system for main.py<commit_after>import discord
import asyncio
import git
import message
from pluginbase import PluginBase

plugin_base = PluginBase(package='plugins')
plugin_source = plugin_base.make_plugin_source(searchpath=['./plugins'])

plugins = []
commands = []

for plugin in plugin_source.list_plugins():
    plugin_temp = plugin_source.load_plugin(plugin)
    plugin_info = plugin_temp.onInit(plugin_temp)
    if plugin_info.plugin == None:
        print("Plugin not defined!")
        pass
    if plugin_info.name == None:
        print("Plugin name not defined")
        pass
    if plugin_info.commands == []:
        print("Plugin did not define any commands.")
        pass
    plugins.append(plugin_info)
    for command in plugin_info.commands:
        if command.plugin == None:
            print("Plugin command does not define parent plugin")
            pass
        if command.name == None:
            print("Plugin command does not define name")
            pass
        commands.append(command)
    print("Plugin registered successfully.")

from plugins import xkcd

client = discord.Client()

@client.event
async def on_ready():
    print('Logged in as')
    print(client.user.name)
    print(client.user.id)
    print('------')

@client.event
async def on_message(message_in):
    if message_in.content.startswith('!info'):
        repo = git.Repo(search_parent_directories=True)
        sha = repo.head.object.hexsha
        await client.send_message(message_in.channel, '```Project StarBot v0.0.1-{}\r\nDeveloped by CorpNewt and <NAME>```'.format(sha[:5]))
    for command in commands:
        if message_in.content == '!' + command.name:
            message_recv = message.message
            message_recv.command = command.name
            message_recv.body = message_in.content.split('!' + command.name)[-1]

            command_result = command.plugin.onCommand(message_recv)

            await client.send_message(message_in.channel, command_result.body)

            #await client.send_message(message.channel, command.plugin.onCommand())

client.run('Mjg2NjUxNTk3NDIzOTAyNzIw.C5j0sw.qF968us3onhFSyjOgnv6-fr4_SU')
{'fraction_non_alphanumeric': 0.11674401999285969, 'fraction_numerical': 0.01035344519814352, 'mean_word_length': 3.3374613003095974, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5113416', 'n_tokens_mistral': 893, 'n_tokens_neox': 874, 'n_words': 181}