aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helpers.py (unfollow)
Commit message (Collapse)AuthorLines
2021-03-30HelpChannels: refactor get_closing_timeGravatar MarkKoz-43/+43
2021-03-30HelpChannels: use aware datetimes everywhereGravatar MarkKoz-27/+34
Fix issues converting timestamps to datetimes and vice-versa. The main culprit id `datetime.timestamp()`, which always assumes naïve objects are in local time. That behaviour conflicts with discord.py, which returns naïve objects in UTC rather than local time. Switching from `utcfromtimestamp` to `fromtimestamp` was incorrect since the latter also assumes the timestamp is in local time.
2021-03-30Update arrow to 1.0.3Gravatar MarkKoz-267/+336
It has some API changes, so it's best to update now before the project starts using the library more.
2021-03-26Switch to datetime.fromtimestamp() to avoid over-compensationGravatar Chris-3/+3
Previously we were using `utcfromtimestamp()` which would compensate the timestamp when converting to UTC even though the timestamp itself was in UTC: >>> datetime.utcnow() datetime.datetime(2021, 3, 26, 22, 8, 47, 441603) >>> a = datetime.utcnow().timestamp() 1616821624.207364 >>> a = datetime.utcfromtimestamp(a) datetime.datetime(2021, 3, 27, 5, 7, 4, 207364) By switching to `fromtimestamp()` this avoids that behaviour.
2021-03-26Use correct constant for each type of help session userGravatar Chris-5/+5
2021-03-26Add 1 second due to POSIX timestamps being lower resolution than datetime ↵Gravatar Chris-3/+5
objects.
2021-03-26Fix error when converting non claimant messageGravatar Chris-7/+10
datetime.min cannot be converted to a timestamp as it's pre-epoch. Instead wait until we actuall need it and then create the correct datetime object depending on teh cache contents.
2021-03-25Convert to timestamp before posting to redisGravatar Chris-2/+2
2021-03-25Reset a channel's non-claimant cache on claim, to indicate that the session ↵Gravatar Chris-7/+9
has yet to be answered.
2021-03-25Refactor if block within help channel system to be more readableGravatar Chris-6/+7
2021-03-25Refactor help channel update message cache function for clearer flowGravatar Chris-9/+8
2021-03-25Create utc datetime objects from timestampsGravatar Chris-4/+4
2021-03-25Change help channel caching logic to use timezone naive stampsGravatar Chris-3/+3
2021-03-25Only fetch claimant id onceGravatar Chris-2/+3
2021-03-25update help channel on_message docstring to reflect unchanged responsibilityGravatar Chris-6/+1
2021-03-25Schedule channels just opened using claimant configured idle timeGravatar Chris-1/+1
2021-03-25Check for close on command explictly.Gravatar Chris-1/+1
2021-03-25Remove unneeded cache clearingGravatar Chris-8/+0
2021-03-25Change help channel logic to use timezone naive stampsGravatar Chris-8/+6
2021-03-25Don't prepend command closes with autoGravatar Chris-2/+3
2021-03-24Add back seperation whitespaceGravatar Chris-0/+1
2021-03-24Use claiment idle time as default idle minutes.Gravatar Chris-1/+1
2021-03-24Use fallback behaviour during cog initGravatar Chris-5/+8
2021-03-20run precommit with all depsGravatar laundmo-1/+1
2021-03-20passing pre-commitGravatar laundmo-4/+11
2021-03-19reset cache on bot start, stats for different close reasonsGravatar laundmo-28/+39
2021-03-18More descriptive comment for when an if block is enteredGravatar Chris-1/+1
2021-03-18Determine closing time from last message if either cache is empty, rather ↵Gravatar Chris-2/+2
than if both are empty
2021-03-18If the channel is empty, determine closing time based on last message.Gravatar Chris-4/+5
2021-03-18Move return behaviour comments to in-line rather than docstring.Gravatar Chris-8/+4
2021-03-18Delete cached claimant message time.Gravatar Chris-0/+1
2021-03-18Update function name to describe new behaviour.Gravatar Chris-3/+3
Also updates the doc string to reflect this new behaviour.
2021-03-18Repurpose unanswered cache for storing non-claimant last message timesGravatar Chris-59/+48
The unanswered cache was previously just a boolen of whether a non-claimant every replied to a help channel. With us now needing to know the time at which a non-claimant messaged in a given channel, we infer the answered status from this cache instead.
2021-03-17Improve docs strings and variable names within the help channel systemGravatar Chris-20/+20
2021-03-17Improve availible channel embed footerGravatar Chris-1/+1
2021-03-16Improve trace message.Gravatar Chris-1/+1
2021-03-16Extend close time logic to differentiate between the claimant and other users.Gravatar Chris-29/+75
2021-03-16Update help availible footerGravatar Chris-1/+1
As we have complicated this logic, we now don't specify exactly how long until the channel will close.
2021-03-16Set a reasonable default for `idle_minutes_others`.Gravatar Chris-1/+1
2021-03-16Split out help channel idle time constantsGravatar Chris-3/+8
This allows us to configure the idle time allowed for claiments seperate from tohers.
2021-03-15Info: account for defcon threshold being NoneGravatar MarkKoz-1/+2
Fixes BOT-XK
2021-03-15Defcon: fix naming conflict between threshold cmd and attributeGravatar MarkKoz-2/+2
2021-03-13Use .gitattributes to normalise line endings on check-inGravatar MarkKoz-2/+1
Remove the mixed line endings pre-commit hook because it is obsolete. Relying on git to handle line endings means contributors have more flexibility with which line endings they want to use on check-out. The settings in .gitattributes only impose which line endings will be used upon check-in (LF), which should not impact local development; git will still respect the core.eol and core.autocrlf settings.
2021-03-13master => mainGravatar Joe Banks-22/+22
2021-03-13Update help channel names from chemical elements to fruitGravatar Joe Banks-126/+59
* Update and rename elements.json to fruits.json * Update _name.py * Update _cog.py
2021-03-12Added '_' to allowed chars, shortened embed.Gravatar xithrius-21/+12
2021-03-12Fix typo in the token removerGravatar Matteo Bertucci-1/+1
2021-03-11Remove invoked command and message after failure.Gravatar xithrius-27/+35
2021-03-12Compose: read all environment variables from '.env'Gravatar kwzrd-4/+2
2021-03-11Compose: read GitHub API key from '.env'Gravatar kwzrd-0/+1