소스 검색

fixed multiple bugs with the scrapper and improved speeds for the reddit cog.

tags/v2.0.0
Roxie Gibson 5 년 전
부모
커밋
3b040ad7a7
1개의 변경된 파일2개의 추가작업 그리고 5개의 파일을 삭제
  1. +2
    -5
      roxbot/cogs/reddit.py

+ 2
- 5
roxbot/cogs/reddit.py 파일 보기

@@ -23,7 +23,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
import time

import random
import fnmatch
@@ -178,7 +178,6 @@ class Reddit:
Example:
{command_prefix}subreddit pics
"""
start = time.time()
subreddit = subreddit.lower()
if isinstance(ctx.channel, discord.DMChannel):
cache_id = ctx.author.id
@@ -187,6 +186,7 @@ class Reddit:

self.scrapper.cache_refresh(cache_id)
posts = await self.scrapper.sub_request(subreddit)

if not posts:
return await ctx.send("Error ;-; That subreddit probably doesn't exist. Please check your spelling")

@@ -197,9 +197,6 @@ class Reddit:

choice = await self.scrapper.random(posts["children"], cache_id, nsfw_allowed)

end = time.time()
print("Time Taken: {}s".format(end-start))

if not choice:
return await ctx.send("I couldn't find any images from that subreddit.")
elif choice.get("success", True) is False:

Loading…
취소
저장