Changing name+structure

This commit is contained in:
klemek
2020-08-30 15:01:26 +02:00
parent 339dfc30ef
commit 147182a900
6 changed files with 71 additions and 10 deletions
+5
View File
@@ -4,3 +4,8 @@ __pycache__
.env
error_*
*.log
test.py
*.pyc
.pytest_cache
.coverage
tmp
+62
View File
@@ -0,0 +1,62 @@
[![Total alerts](https://img.shields.io/lgtm/alerts/g/Klemek/miniscord.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Klemek/miniscord/alerts/)
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/Klemek/miniscord.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Klemek/miniscord/context:python)
[![Coverage Status](https://coveralls.io/repos/github/Klemek/miniscord/badge.svg?branch=master)](https://coveralls.io/github/Klemek/miniscord?branch=master)
# Miniscord
*A minimalist discord bot API*
```python
from miniscord import Bot
import discord
async def hello(client: discord.client, message: discord.Message, *args: str):
await message.channel.send("Hello!")
bot = Bot(
"test-app", # name
"0.1-alpha", # version
alias="|" # respond to '|command' messages
)
bot.register_command(
"hello", # command text (regex)
hello, # command function
"hello: says 'Hello!'", # short help
f"```\n" # long help
f"* |help\n"
f"\tSays 'Hello!'.\n"
f"```"
)
bot.start()
# this bot respond to "|help", "|info" and "|hello"
```
![](./sample.jpg)
> **⚠ Disclaimer:** I intend to use this project personally, I'm open to ideas but I don't care if it doesn't work for you. Same for the name, feel free to use it, I'm not registering it on PyPI
## Features
*TODO*
## Installation
*TODO*
## Documentation
*TODO*
## Versions
*TODO*
## TODO
* Finish README.md
* Write tests
* Add comments to code
* Separate branches
* Working CI
* Fix bugs
-8
View File
@@ -1,8 +0,0 @@
import logging
from bot import Bot
logging.basicConfig(format="[%(asctime)s][%(levelname)s][%(module)s] %(message)s", level=logging.INFO)
bot = Bot("test-app", "0.1-alpha", alias="|")
bot.log_calls = True
bot.start()
+1
View File
@@ -0,0 +1 @@
from .bot import Bot
+3 -2
View File
@@ -70,7 +70,7 @@ class Bot(object):
self.alias = alias # can call bot with {alias}{command_name}
self.any_mention = False # bot mention can be anywhere
self.log_calls = False
self.guild_logs_file = "guilds.log"
self.guild_logs_file = "../guilds.log"
self.enforce_write_permission = True
self.lower_command_names = True
self.game_change_delay = 10
@@ -197,6 +197,7 @@ class Bot(object):
f" #{message.channel} in server '{message.guild}'")
return
await command.compute(self.client, message, *command_args)
break
async def on_guild_join(self, guild: discord.guild):
if self.guild_logs_file is not None:
@@ -210,7 +211,7 @@ class Bot(object):
pass
def register_command(self, regex: str, compute: CommandFunction, help_short: str, help_long: str):
self.__commands += [Command(regex, compute, help_short, help_long)]
self.__commands.insert(0, Command(regex, compute, help_short, help_long))
def start(self):
logging.info(f"Current PID: {os.getpid()}")
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB