Skip to content

Commit

Permalink
Add commands to kick members
Browse files Browse the repository at this point in the history
Add command to kick member based on name.
Add command to list members inactive in the last month.
Add command to purge members inactive in the last month.
Restructure clan cog to add an admin subgroup.
Restructure server cog to add channel/role subgroups.
Use data classes for most Destiny API responses.
Remove most uses of pickle in favor of msgpack.
  • Loading branch information
henworth committed May 8, 2021
1 parent a2443b5 commit cebfce2
Show file tree
Hide file tree
Showing 17 changed files with 688 additions and 291 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pydest = {git = "https://github.com/henworth/pydest",ref = "9537696c39f36f825008
flask-kvsession = "*"
tenacity = "*"
get-docker-secret = "*"
arq = {git = "https://github.com/henworth/arq",ref = "e3843b6dfec032f85cda0e864f7b033bacf10f3a"}
arq = ">=0.20"
msgpack = "*"
cryptography = ">=3.3.2"
urllib3 = ">=1.26.4"
Expand Down
225 changes: 114 additions & 111 deletions Pipfile.lock

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions arq_worker.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# pylama:ignore=E731
import aioredis
import logging.config
import msgpack

from arq import Worker, func
from arq.worker import get_kwargs
from pydest.pydest import Pydest
from seraphsix.constants import ARQ_JOB_TIMEOUT, ARQ_MAX_JOBS
from seraphsix.database import Database
from seraphsix.models import deserializer, serializer
from seraphsix.tasks.activity import (
get_characters, process_activity, store_member_history, store_last_active, store_all_games
)
from seraphsix.tasks.core import set_cached_members
from seraphsix.tasks.config import Config, log_config
from seraphsix.tasks.parsing import encode_datetime, decode_datetime

config = Config()

Expand Down Expand Up @@ -54,10 +53,10 @@ class WorkerSettings:
job_timeout = ARQ_JOB_TIMEOUT

def job_serializer(b):
return msgpack.packb(b, default=encode_datetime)
return serializer(b)

def job_deserializer(b):
return msgpack.unpackb(b, object_hook=decode_datetime)
return deserializer(b)


if __name__ == '__main__':
Expand Down
16 changes: 8 additions & 8 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
aiohttp==3.7.4.post0
aiopg==1.2.1
aioredis==1.3.1
astroid==2.5.3
arq==0.20
astroid==2.5.6
async-timeout==3.0.1; python_full_version >= '3.5.3'
attrs==20.3.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
attrs==21.1.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
backoff==1.10.0
certifi==2020.12.5
cffi==1.14.5
chardet==4.0.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
click==7.1.2; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
cryptography==3.4.7
dataclasses-json==0.5.2
discord.py==1.7.1
dataclasses-json==0.5.3
discord.py==1.7.2
flask-kvsession==0.6.2
flask==1.1.2
get-docker-secret==1.0.1
git+https://github.com/henworth/arq@e3843b6dfec032f85cda0e864f7b033bacf10f3a#egg=arq
git+https://github.com/henworth/pydest@9537696c39f36f8250082891ddcc0198142d22eb#egg=pydest
git+https://github.com/henworth/the100@f6f39915323e9b3869cf13e269ba72a4596d3352#egg=the100
gunicorn==20.1.0
Expand All @@ -45,16 +45,16 @@ peony-twitter==1.1.7
psycopg2-binary==2.8.6
pycparser==2.20; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
pydantic==1.8.1; python_full_version >= '3.6.1'
pyrate-limiter==2.3.0
pyrate-limiter==2.3.2
pytz==2021.1
redis==3.5.3
requests-oauth2==0.3.0
requests==2.25.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
simplekv==0.14.1
six==1.15.0
six==1.16.0
stringcase==1.2.0
tenacity==7.0.0
typing-extensions==3.7.4.3
typing-extensions==3.10.0.0
typing-inspect==0.6.0
urllib3==1.26.4
werkzeug==1.0.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
Expand Down
7 changes: 4 additions & 3 deletions seraphsix/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
from seraphsix.database import Database, Guild, TwitterChannel

from seraphsix.errors import (
InvalidCommandError, InvalidGameModeError, InvalidMemberError,
NotRegisteredError, ConfigurationError, MissingTimezoneError, MaintenanceError)
InvalidCommandError, InvalidGameModeError, InvalidMemberError, InvalidAdminError,
NotRegisteredError, ConfigurationError, MissingTimezoneError, MaintenanceError,
)
from seraphsix.tasks.core import create_redis_jobs_pool
from seraphsix.tasks.clan import ack_clan_application
from seraphsix.tasks.discord import store_sherpas, update_sherpa
Expand Down Expand Up @@ -232,7 +233,7 @@ async def on_command_error(self, ctx, error):
elif isinstance(error, (
ConfigurationError, InvalidCommandError, InvalidMemberError,
InvalidGameModeError, NotRegisteredError, MissingTimezoneError,
MaintenanceError
MaintenanceError, InvalidAdminError
)):
text = error
elif isinstance(error, commands.CommandNotFound):
Expand Down
Loading

0 comments on commit cebfce2

Please sign in to comment.