Skip to content

Commit

Permalink
✔ Use the bot request if the model requires bot token, not OAuth
Browse files Browse the repository at this point in the history
  • Loading branch information
weibeu committed Jun 29, 2020
1 parent 0bab72c commit 3ea0fcc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion flask_discord/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def __init__(cls, name, *args, **kwargs):

class DiscordModelsBase(metaclass=DiscordModelsMeta):

BOT = False
MANY = False

@abstractmethod
Expand Down Expand Up @@ -46,7 +47,8 @@ def fetch_from_api(cls):
List of instances of this model when many of these models exist.
"""
payload = cls._request(cls.ROUTE)
request_method = cls._bot_request if cls.BOT else cls._request
payload = request_method(cls.ROUTE)
if cls.MANY:
return [cls(_) for _ in payload]
return cls(payload)
Expand Down

0 comments on commit 3ea0fcc

Please sign in to comment.