aboutsummaryrefslogtreecommitdiffstats
path: root/bot/seasons/halloween/hacktoberstats.py
diff options
context:
space:
mode:
authorGravatar vivax3794 <[email protected]>2019-10-12 05:10:26 +0200
committerGravatar vivax3794 <[email protected]>2019-10-12 05:10:26 +0200
commit3c41e5b5dc84a1ab78863afbf751b70c2f83ccfc (patch)
tree344746635d27c4f95ec7494c4f261cc0479bd810 /bot/seasons/halloween/hacktoberstats.py
parentFixed forgetting to divide by 100. (diff)
parentMerge branch 'master' into hacktober-issue-finder (diff)
Merge remote-tracking branch 'origin/hacktober-issue-finder' into hacktober-issue-finder
Diffstat (limited to 'bot/seasons/halloween/hacktoberstats.py')
-rw-r--r--bot/seasons/halloween/hacktoberstats.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/bot/seasons/halloween/hacktoberstats.py b/bot/seasons/halloween/hacktoberstats.py
index 20797037..9ad44e3f 100644
--- a/bot/seasons/halloween/hacktoberstats.py
+++ b/bot/seasons/halloween/hacktoberstats.py
@@ -10,12 +10,16 @@ import aiohttp
import discord
from discord.ext import commands
+from bot.constants import Channels, WHITELISTED_CHANNELS
+from bot.decorators import override_in_channel
from bot.utils.persist import make_persistent
+
log = logging.getLogger(__name__)
CURRENT_YEAR = datetime.now().year # Used to construct GH API query
PRS_FOR_SHIRT = 4 # Minimum number of PRs before a shirt is awarded
+HACKTOBER_WHITELIST = WHITELISTED_CHANNELS + (Channels.hacktoberfest_2019,)
class HacktoberStats(commands.Cog):
@@ -27,6 +31,7 @@ class HacktoberStats(commands.Cog):
self.linked_accounts = self.load_linked_users()
@commands.group(name="hacktoberstats", aliases=("hackstats",), invoke_without_command=True)
+ @override_in_channel(HACKTOBER_WHITELIST)
async def hacktoberstats_group(self, ctx: commands.Context, github_username: str = None) -> None:
"""
Display an embed for a user's Hacktoberfest contributions.
@@ -220,7 +225,7 @@ class HacktoberStats(commands.Cog):
not_label = "invalid"
action_type = "pr"
is_query = f"public+author:{github_username}"
- date_range = f"{CURRENT_YEAR}-10-01..{CURRENT_YEAR}-10-31"
+ date_range = f"{CURRENT_YEAR}-10-01T00:00:00%2B14:00..{CURRENT_YEAR}-10-31T23:59:59-11:00"
per_page = "300"
query_url = (
f"{base_url}"
@@ -231,7 +236,7 @@ class HacktoberStats(commands.Cog):
f"&per_page={per_page}"
)
- headers = {"user-agent": "Discord Python Hactoberbot"}
+ headers = {"user-agent": "Discord Python Hacktoberbot"}
async with aiohttp.ClientSession() as session:
async with session.get(query_url, headers=headers) as resp:
jsonresp = await resp.json()