mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-25 06:27:03 +01:00
I give up caching
This commit is contained in:
parent
e4737444bd
commit
185bf27149
@ -1,6 +1,6 @@
|
|||||||
from titanembeds.database import db, Guilds, UnauthenticatedUsers, UnauthenticatedBans, AuthenticatedUsers
|
from titanembeds.database import db, Guilds, UnauthenticatedUsers, UnauthenticatedBans, AuthenticatedUsers
|
||||||
from titanembeds.decorators import valid_session_required, discord_users_only
|
from titanembeds.decorators import valid_session_required, discord_users_only
|
||||||
from titanembeds.utils import check_guild_existance, guild_query_unauth_users_bool, get_client_ipaddr, discord_api, rate_limiter, channel_ratelimit_key, guild_ratelimit_key, cache, make_guildchannels_cache_key
|
from titanembeds.utils import check_guild_existance, guild_query_unauth_users_bool, get_client_ipaddr, discord_api, rate_limiter, channel_ratelimit_key, guild_ratelimit_key
|
||||||
from titanembeds.oauth import user_has_permission, generate_avatar_url, check_user_can_administrate_guild
|
from titanembeds.oauth import user_has_permission, generate_avatar_url, check_user_can_administrate_guild
|
||||||
from flask import Blueprint, abort, jsonify, session, request
|
from flask import Blueprint, abort, jsonify, session, request
|
||||||
from sqlalchemy import and_
|
from sqlalchemy import and_
|
||||||
@ -114,7 +114,6 @@ def format_post_content(message):
|
|||||||
message = "**<{}#{}>** {}".format(session['username'], session['discriminator'], message) # I would like to do a @ mention, but i am worried about notif spam
|
message = "**<{}#{}>** {}".format(session['username'], session['discriminator'], message) # I would like to do a @ mention, but i am worried about notif spam
|
||||||
return message
|
return message
|
||||||
|
|
||||||
@cache.cache(make_guildchannels_cache_key, expire=60)
|
|
||||||
def get_guild_channels(guild_id):
|
def get_guild_channels(guild_id):
|
||||||
if user_unauthenticated():
|
if user_unauthenticated():
|
||||||
member_roles = [guild_id] #equivilant to @everyone role
|
member_roles = [guild_id] #equivilant to @everyone role
|
||||||
|
@ -110,6 +110,7 @@ class DiscordREST:
|
|||||||
r = self.request("GET", _endpoint)
|
r = self.request("GET", _endpoint)
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
@cache.cache('get_guild_channels', expire=200)
|
||||||
def get_guild_channels(self, guild_id):
|
def get_guild_channels(self, guild_id):
|
||||||
_endpoint = "/guilds/{guild_id}/channels".format(guild_id=guild_id)
|
_endpoint = "/guilds/{guild_id}/channels".format(guild_id=guild_id)
|
||||||
r = self.request("GET", _endpoint)
|
r = self.request("GET", _endpoint)
|
||||||
|
Loading…
Reference in New Issue
Block a user