Use _request shorthand method

This commit is contained in:
thec0sm0s
2020-05-11 21:28:14 +05:30
parent 94d0c536c5
commit bc22196695
2 changed files with 10 additions and 1 deletions

View File

@@ -1,8 +1,17 @@
from flask import current_app
from abc import ABC
class DiscordModelsBase(ABC):
@staticmethod
def _request(*args, **kwargs):
"""A shorthand to :py:func:flask_discord.request`. It uses Flask current_app local proxy to get the
Flask-Discord client.
"""
return current_app.discord.request(*args, **kwargs)
def to_json(self):
"""A utility method which returns raw payload object as it was received from discord.