87 Commits

Author SHA1 Message Date
Lui
36ea867dcf
[Streams] Check non-existent streams more than once (#5223)
* [Streams] Check non-existent streams more than once

- For YouTube streams, it seems like the RSS feed may sometimes return
  an HTTP 404 for a channel, even though the channel exists.
- If this happens more than a few times, then we should declare the
  stream as non-existent, and purge it from the list of streams we
  check.

* [Streams] Move retry_count reset for YouTubeStream

- Reset after the RSS check, since that is the only place where we raise
  StreamNotFound in that function.

* [Streams] Increase retry to 20

* [Streams] Reduce retry count to 10
2021-09-03 16:25:01 +02:00
PredaaA
8eac787f7b
[Streams] Improve config calls in stream alerts (#4968)
* [Streams] Improve config calls in stream alerts.

* config->guild_data, style changes

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2021-09-02 01:40:15 +02:00
jack1142
f8ecc32dbc
Fix the bug with Twitch display name being set as Twitch login (#5066) 2021-05-25 09:32:32 +01:00
jack1142
c4a9d97a4b
Include status code in APIError and handle APIError in the loop (#4995) 2021-05-23 15:23:58 +01:00
Jamie
c83eae931b
[Streams] Add guild only decorator to streams commands (#5035)
Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2021-05-19 11:58:50 +02:00
Jamie
54e5307307
[Streams] Smashcast removal. (#5040)
* Remove smashcast

* style

* remove smash from cog guides
2021-05-15 08:54:56 -08:00
jack1142
e2c0f2aca8
Revert "[Streams] Remove stream alert if stream not found (#4939)" (#4943)
This reverts commit 3c742e39d2bd7d69827b224d95f2d5d6f892313d.
2021-04-05 23:40:06 +02:00
PredaaA
a6d15dc385
[Streams] Stop suppressing task cancelation in _stream_alerts() (#4940)
* Minimize the API calls

* Address Jack's review.

* [Streams] Actually cancel the _stream_alerts task.
2021-04-05 22:22:20 +02:00
PredaaA
3c742e39d2
[Streams] Remove stream alert if stream not found (#4939)
* Remove stream if not found

* Address Jack's review.
2021-04-05 20:13:00 +00:00
jack1142
67fa735555
Use partial messages in Streams cog to avoid potential leakage (#4742)
* Use partial messages in Streams cog to avoid leakage

* Stop trying to save bot object to Config...

* Put guild id as part of message data

* Fix AttributeError

* Pass bot object to stream classes in commands

* ugh

* Another place we use this class in

* more...
2021-04-05 21:39:33 +02:00
jack1142
f30772a7bd
Raise StreamNotFound for 404 errors in YouTube RSS feed (#4746)
* Raise `StreamNotFound` for 404 errors in YouTube RSS feed

* Catch `StreamNotFound` exception in bg task and remove such streams
2021-03-29 14:05:42 +02:00
Lui
1bdaa9d95e
[Streams] Initialize all variables (#4687) 2020-12-24 15:43:05 +01:00
Kowlin
8ae84b7c81
[Streams] Remove the blank suppression of errors (#4680)
* [Streams] Remove the blank suppression of errors

* Okay, maybe do gracefully handle it a little bit...

* Update redbot/cogs/streams/streams.py

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-12-23 21:00:55 +01:00
jack1142
b36a702e62
Make command usage in help for required arguments consistent (#4589)
* Make command usage in help for required arguments consistent

* Bob 3

* Bob 1

* Docstring updates

* Address Flame's review

* Update cog guides in docs
2020-12-22 14:14:47 -05:00
palmtree5
04cb1befe6
[Docs] Streams user guide (#4521)
* Start on streams user guide

* Finish up streams guide

* Fix a typo in the doc page

* Fix the SAME typo in the relevant command's docstring while we're here

Co-authored-by: palmtree5 <palmtree5+3577255@users.noreply.github.com>
Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-11-27 13:52:56 -05:00
El Laggron
f129dcd1a9
[Streams] Resolve bug with [p]streamalert youtube (#4629)
The command didn't handle channels that were not provided as IDs
2020-11-19 18:50:00 +01:00
El Laggron
6060da0f87
[Streams] Support Youtube stream schedules (#4615)
* Catch scheduled livestreams

* Announce scheduled streams and starts

* Add setting, fix bugs

* Add new dependency

* Black reformat

* Fix the duplicated messages bug

* Do not send messages for schedules

* Format embed
2020-11-18 21:48:36 +01:00
jack1142
4aa84a5d22
Add better error logging for unexpected errors, add error messages for exceeded YouTube quota (#4552) 2020-10-28 11:37:56 +00:00
PredaaA
bd0955ac44
[Streams] Remove the __del__ (#4512)
* [Streams] Remove the `__del__`

* Add a teardown function to call Streams.cog_unload()

* Apparently I forgot cog_unload is called automatically (Thanks @rapptz
lol)

Co-authored-by: palmtree5 <3577255+palmtree5@users.noreply.github.com>
2020-10-28 11:55:05 +01:00
Kowlin
2413c6abd3
[Core] Guild scoped I18n (#3896)
* Guild I18n

Never again!

* Finish off guild scoped i18n

* Black formatting

* Added guild only flags.

* Fix missing import.

* Added listing of guild i18n settings

* Added API support

* Added API support... properly!

* Added API support... for realsies!

* Auto-translate create_cases instances

You're welcome cog creators! Jack talked me into this!

* Fix get_regional_format to actually return properly

* Cleanup `set showsettings`

* Style pass

* Update redbot/core/core_commands.py

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update redbot/core/events.py

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update redbot/core/core_commands.py

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* Fix missing import

* Improve caching

* Removal of unneeded function

* Fix some naming

* IDFK anymore...

* Reformat

* Update redbot/core/settings_caches.py

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update redbot/core/settings_caches.py

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update redbot/core/settings_caches.py

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* Remove line number

* Fix global sets

* Set contextual locale manually where needed

* Reports cog is wonderful...

* Update redbot/core/core_commands.py

Co-authored-by: Draper <27962761+Drapersniper@users.noreply.github.com>

* Set contextual locale manually where needed in Mutes cog

* s

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
Co-authored-by: Draper <27962761+Drapersniper@users.noreply.github.com>
2020-10-26 17:59:11 +01:00
Stonedestroyer
08bd0567ad
Grammar fixes (#4500)
* Grammar fixes

* More changes

* Grammar

* Error grammar

* Spelling

* Grammar

* REsolves grammar

* grammar

* grammar

* grammar

* grammar

* grammar

* grammar

* grammar

* grammar

* "commited" > "committed"

* apostrophe

* more grammar

* grammar

* `funtion` to `function`

* grammar in alias cog

* grammar in cleanup cog

* grammar in customcom cog

* grammar in mod cog

* grammar in reports cog

* fix grammar in streams cog

* missing apostrophe

* grammar fix in trivia cog

Co-authored-by: Jyu Viole Grace <24418520+thisisjvgrace@users.noreply.github.com>
Co-authored-by: Jyu Viole Grace <thisisjvgrace@users.noreply.github.com>
2020-10-18 08:52:56 +01:00
jack1142
85afe19455
Bump black to 20.8b1 (and reformat) (#4371)
* Bump black version

* Reformat with black
2020-08-29 19:12:28 +02:00
Trent Kable
341fd254fb
Add allowed_mentions and mention everyone check to stream alerts (#4182)
* [streams]allowed_mentions on stream announcement

Allows role mentions for discord.py 1.4+
# Type

[x] Bugfix
[ ] Enhancement
[ ] New feature

Description of the changes

Referencing line 747. Gives permissions to mention role on stream announcement.

* Update streams.py

* Add `mention_everyone` defaults

Lines for reference:
- [751-753]:
```py
if can_mention_everyone:
  await self.save_streams()
  return # if bot can mention everyone already, let's stop here```
- [722-774]: 
```py
if can_mention_everyone:
  mentions.append(role.mention)
  return # if bot can mention everyone already, let's stop here (part two)```

Hopefully, this is what you had in mind? Humbly admit I may not have a business in biting this piece but looking forward to feedback on the best methodology for the wanted outcome.
Thanks!

* *sweats*

* imagine variable naming

Should complete all passes.

* misplaced unindent on return

* Update redbot/cogs/streams/streams.py

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update redbot/cogs/streams/streams.py

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* Update redbot/cogs/streams/streams.py

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* You're a beast jack

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* this would cover all channels in guild (think)

* give this a reeeeee

* Update streams.py

* adds channel argument

https://github.com/Cog-Creators/Red-DiscordBot/pull/4182#pullrequestreview-468012281

* image style checking, self

* imagine

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-08-16 00:59:53 +02:00
Kowlin
bf581b9f97
[Streams] Allow for consume all on messages (#4183)
* Added consume all to streams.

* Updated help doc

* Styling checks, man...
2020-08-15 15:04:05 +02:00
maxbooiii
39ae4a3b58
[Streams] Change hitbox to smashcast. (#4161)
* [Streams] Change hitbox to smashcast.

as hitbox is now smashcast.

* Add files via upload

* reee

* :thonk:

* oof

* Add missing new lines at end of file

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-08-05 17:04:36 -08:00
Michael H
c0b1e50a5f
Begin work on a data request API (#4045)
[Core] Data Deletion And Disclosure APIs

 - Adds a Data Deletion API
   - Deletion comes in a few forms based on who is requesting
   - Deletion must be handled by 3rd party
 - Adds a Data Collection Disclosure Command
   - Provides a dynamically generated statement from 3rd party
   extensions
 - Modifies the always available commands to be cog compatible
   - Also prevents them from being unloaded accidentally
2020-08-03 15:09:07 +02:00
Jamie
260a2d5c78
Use mod/admin_or_permissions instead of just mod/admin. (#4109)
* Update modcheck.

* _or_permissions for set nickname & serverprefix
2020-07-29 01:38:19 +02:00
Jamie
57247c5d87
[Streams] Mixer removal (#4072)
* [streams] Mixer is dead soon

* remove Mixer from readme
2020-07-29 01:38:03 +02:00
Michael H
1d80fe9aec
Create cog disabling API (#4043)
* create cog disbale base

* Because defaults...

* lol

* announcer needs to respect this

* defaultdict mishap

* Allow None as guild

- Mostly for interop with with ctx.guild

* a whitespace issue

* Apparently, I broke this too

* Apply suggestions from code review

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* This can probably be more optimized later, but since this is a cached value, it's not a large issue

* Report tunnel closing

* mod too

* whitespace issue

* Fix Artifact of prior method naming

* these 3 places should have the check if i understood it correctly

* Announce the closed tunnels

* tunnel oversight

* Make the player stop at next track

* added where draper said to put it

* Apply suggestions from code review

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
Co-authored-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>
2020-07-28 20:52:36 +02:00
Dav
df410529b0
[i18n/Streams] Change strings mentioning commands to use {command} variable (#3938)
* hopefully all strings in streams.py

* black streams.py

* don't touch docstrings

* uniformity is good

* thx draper

Co-authored-by: Draper <27962761+Drapersniper@users.noreply.github.com>

* aaaaaaaaaaaaaaaaaaaaaa

* translate more

* sure, joining some strings for jack

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* more strings to join

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* yup... I missed this

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* jaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaack blaaaaaaaaaaaaaaaaaaaaaack

Co-authored-by: Draper <27962761+Drapersniper@users.noreply.github.com>
Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-06-21 20:38:31 +02:00
Jamie
84d0282815
[Streams] Invalidate old bearer token when api key is updated. (#3990) 2020-06-21 18:44:38 +01:00
Draper
79d042ad29
[Streams] Only send message about missing client secret once (#3901)
* Send Notify owner messages only when a key has been invalidated since last notify_owner

* grammar

* welp im dumb

* Black and lower config call frequency

* Update redbot/cogs/streams/streams.py

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* dont use a generic name now to avoid a config migration later

* be even more explicit with var name

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-06-18 23:39:52 +02:00
Vexed01
35e83855a8 remove admin only commands 2020-05-31 13:15:38 +01:00
Vexed01
6b086e3eb2 wait grammar exists? who knew... 2020-05-31 11:16:39 +01:00
Vexed01
219586d55d wording changes 2020-05-30 19:57:34 +01:00
Vexed01
6a00c0ee7e black formatting
oops lets not forget what tox checks for
2020-05-30 19:42:33 +01:00
Vexed01
873c7be99e add class docstring to streams 2020-05-30 19:34:01 +01:00
Draper
e4018ec677
Normalize names of attributes with Config instances (#3765)
* Lets normalize how we name config attributes across the bot.

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* ....

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* nothing to see here

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>
2020-04-20 19:12:57 +02:00
jack1142
35ebc4899e
Log failures when requesting Twitch bearer token (#3657)
* [Streams] Log failures when requesting Twitch bearer token

* Oops

* Style
2020-03-28 15:51:36 +01:00
jack1142
4afe1ff569
Use correct prefixes when sending messages to owners (#3632)
* use correct prefixes when sending messages to owners

* make internal util for this instead

* oops

* fix circular import

* let's add back the actual fix I made this PR for...

* fix wrong logger name

* improve log message
2020-03-12 17:31:33 +01:00
jack1142
eedec4ff02
fix: use clean prefix in code blocks (#3591) 2020-02-28 21:23:13 +01:00
PredaaA
ed6d012e6c
[Streams] Use new Twitch API and Bearer tokens (#3487)
* Update streams.py

* Update streams

* Changelog.

* Adress Trusty's review

Co-authored-by: Michael H <michael@michaelhall.tech>
2020-02-15 00:14:34 -05:00
Draper
04b5a5f9ac
[Streams] Significantly reduce number the quota usage for YouTube Data api (#3237)
* chore

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Pre-tests

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* *sigh*

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Streams + black formatting

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* *sigh* lets not spam the logs shall we

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* lets be extra sure

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* chore

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* [Streams] Fix Twitch token for streamalert (#2)

* [Streams] Fix Twitch token for streamalert

* [Streams] Fix Twitch token for streamalert

Co-authored-by: PredaaA <46051820+PredaaA@users.noreply.github.com>
2020-02-15 00:06:03 -05:00
PredaaA
743ce71c5c [Streams] Fix TypeError in TwitchStream class and change stream_alert function for Twitch (#3042)
* Update streamtypes.py

* Create 3042.bugfix.rst

* Black the things.

* Fix Twitch streams alert and [p]streamalert twitch

* Update 3042.bugfix.rst
2020-01-02 19:28:57 -05:00
Michael H
6075c5bde0
Rename bot.db as bot._config (#2967)
* Rename `bot.db` as `bot._config`

  - Continues work towards strong version guarantees
  - Added methods for cog use for a few things which were previously
  only accessible via direct access.
  - Retained private use in a few internal use locations, though most
  methods were updated away from this.
  - Updated documentation for shared api token users

* changelog

* more detail

* docstring fixes

* Apparently, I forgot to commit something I had locally

  - + a copy/paste failue in the changelog

* *sigh*:

* *sigh*
2019-09-01 15:42:28 -04:00
PredaaA
3498f8ccb6 Remove commas for explanations about how to set API keys (#2905)
This removes commas in explanations about how to set API keys in streams, image and audio cogs, since it has been changed in #2692.
2019-08-18 09:50:48 +10:00
PredaaA
03fe3ee720 [i18n] Fix some missing i18n strings in the whole bot (#2633) 2019-06-30 01:13:53 +10:00
Ryan
e956e6e320 [Streams] Ignore lack of rerun info where not available (#2748) 2019-05-31 16:41:23 -04:00
Flame442
6928e2aca2 Fixes some issues with API help commands (#2729)
* Fixes some issues with `[p]streamset youtubekey/twitchtoken`

Lots of general formatting bugs and clarity issues.

* General formatting bugs and clarity issues
2019-05-24 17:52:43 -04:00
Michael H
cdea03792d [Streams] Fix NameError (#2699)
- fixes #2696
 - My fault for just looking at the github diff and seeing the logic fix
 on this one, without verifying the name validity in surrounding
 context. (see my review in #2679)
2019-05-18 00:59:26 -08:00