Add och!groups command
This commit is contained in:
@@ -4,6 +4,9 @@ from typing import Optional, Any
|
||||
|
||||
CONFIG = 'data/config.json'
|
||||
config: dict = {
|
||||
'groups-category': 'groups',
|
||||
'groups-archive-category': 'archive',
|
||||
'groups-role-prefix': 'group_',
|
||||
'inf19x-insiders-enable': False,
|
||||
'loeh-enable': False,
|
||||
'och-timeout': 10,
|
||||
@@ -13,6 +16,18 @@ config: dict = {
|
||||
'last-och-time': 0,
|
||||
}
|
||||
config_meta: dict = {
|
||||
'groups-category': (
|
||||
True,
|
||||
'Set the channel category to use for groups'
|
||||
),
|
||||
'groups-archive-category': (
|
||||
True,
|
||||
'Sets the archive channel category for groups'
|
||||
),
|
||||
'groups-role-prefix': (
|
||||
True,
|
||||
'Prefix to use for group roles'
|
||||
),
|
||||
'inf19x-insiders-enable': (
|
||||
True,
|
||||
'Enables university insider jokes of INF19X'
|
||||
|
||||
11
lib/utils.py
11
lib/utils.py
@@ -1,8 +1,17 @@
|
||||
from collections import AsyncIterable
|
||||
from typing import Callable, AsyncGenerator
|
||||
from typing import Callable, AsyncGenerator, Optional
|
||||
import discord
|
||||
|
||||
|
||||
async def async_filter(fun: Callable, iterable: AsyncIterable) -> AsyncGenerator:
|
||||
async for val in iterable:
|
||||
if fun(val):
|
||||
yield val
|
||||
|
||||
|
||||
def find_category(guild: discord.Guild, group: str) -> Optional[discord.CategoryChannel]:
|
||||
group = group.lower()
|
||||
for cat in guild.categories:
|
||||
if cat.name.lower() == group:
|
||||
return cat
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user