From 1fd5dffdc7753c0c4f804f60cd5cef245343b17b Mon Sep 17 00:00:00 2001 From: Redjumpman Date: Fri, 1 Jun 2018 04:20:12 -0500 Subject: [PATCH] [V3/Misc] Spelling, Grammar, and doc string fixes. (#1747) * Update streams.py * Update filter.py * Update permissions.py * Update customcom.py * Update image.py * Update trivia.py * Update warnings.py --- redbot/cogs/customcom/customcom.py | 10 ++++-- redbot/cogs/filter/filter.py | 23 +++++++------ redbot/cogs/image/image.py | 17 +++++----- redbot/cogs/permissions/permissions.py | 46 +++++++++++++------------- redbot/cogs/streams/streams.py | 43 +++++++++++------------- redbot/cogs/trivia/trivia.py | 10 +++--- redbot/cogs/warnings/warnings.py | 18 +++++----- 7 files changed, 84 insertions(+), 83 deletions(-) diff --git a/redbot/cogs/customcom/customcom.py b/redbot/cogs/customcom/customcom.py index dd6d3f759..72b329e72 100644 --- a/redbot/cogs/customcom/customcom.py +++ b/redbot/cogs/customcom/customcom.py @@ -42,7 +42,7 @@ class CommandObj: intro = _( "Welcome to the interactive random {} maker!\n" "Every message you send will be added as one of the random " - "response to choose from once this {} is " + "responses to choose from once this {} is " "triggered. To exit this interactive menu, type `{}`" ).format("customcommand", "customcommand", "exit()") await ctx.send(intro) @@ -74,7 +74,7 @@ class CommandObj: return ccinfo["response"] async def create(self, ctx: commands.Context, command: str, response): - """Create a customcommand""" + """Create a custom command""" # Check if this command is already registered as a customcommand if await self.db(ctx.guild).commands.get_raw(command, default=None): raise AlreadyExists() @@ -131,6 +131,7 @@ class CommandObj: @cog_i18n(_) class CustomCommands: """Custom commands + Creates commands used to display text""" def __init__(self, bot): @@ -173,6 +174,7 @@ class CustomCommands: async def cc_add_random(self, ctx: commands.Context, command: str): """ Create a CC where it will randomly choose a response! + Note: This is interactive """ channel = ctx.channel @@ -184,7 +186,7 @@ class CustomCommands: await ctx.send(_("Custom command successfully added.")) except AlreadyExists: await ctx.send( - _("This command already exists. Use " "`{}` to edit it.").format( + _("This command already exists. Use `{}` to edit it.").format( "{}customcom edit".format(ctx.prefix) ) ) @@ -195,6 +197,7 @@ class CustomCommands: @checks.mod_or_permissions(administrator=True) async def cc_add_simple(self, ctx, command: str, *, text): """Adds a simple custom command + Example: [p]customcom add simple yourcommand Text you want """ @@ -217,6 +220,7 @@ class CustomCommands: @checks.mod_or_permissions(administrator=True) async def cc_edit(self, ctx, command: str, *, text=None): """Edits a custom command + Example: [p]customcom edit yourcommand Text you want """ diff --git a/redbot/cogs/filter/filter.py b/redbot/cogs/filter/filter.py index 8b9ecb8df..0a9583043 100644 --- a/redbot/cogs/filter/filter.py +++ b/redbot/cogs/filter/filter.py @@ -124,8 +124,8 @@ class Filter: @_filter.command(name="names") async def filter_names(self, ctx: commands.Context): - """ - Toggles whether or not to check names and nicknames against the filter + """Toggles whether or not to check names and nicknames against the filter + This is disabled by default """ guild = ctx.guild @@ -133,27 +133,28 @@ class Filter: await self.settings.guild(guild).filter_names.set(not current_setting) if current_setting: await ctx.send( - _("Names and nicknames will no longer be " "checked against the filter") + _("Names and nicknames will no longer be " "checked against the filter.") ) else: - await ctx.send(_("Names and nicknames will now be checked against " "the filter")) + await ctx.send(_("Names and nicknames will now be checked against the filter.")) @_filter.command(name="defaultname") async def filter_default_name(self, ctx: commands.Context, name: str): - """ - Sets the default name to use if filtering names is enabled + """Sets the default name to use if filtering names is enabled + Note that this has no effect if filtering names is disabled + The default name used is John Doe """ guild = ctx.guild await self.settings.guild(guild).filter_default_name.set(name) - await ctx.send(_("The name to use on filtered names has been set")) + await ctx.send(_("The name to use on filtered names has been set.")) @_filter.command(name="ban") async def filter_ban(self, ctx: commands.Context, count: int, timeframe: int): - """ - Sets up an autoban if the specified number of messages are - filtered in the specified amount of time (in seconds) + """Autobans if the specified number of messages are filtered in the timeframe + + The timeframe is represented by seconds. """ if (count <= 0) != (timeframe <= 0): await ctx.send( @@ -223,7 +224,7 @@ class Filter: user_count >= filter_count and message.created_at.timestamp() < next_reset_time ): - reason = "Autoban (too many filtered messages)" + reason = "Autoban (too many filtered messages.)" try: await server.ban(author, reason=reason) except: diff --git a/redbot/cogs/image/image.py b/redbot/cogs/image/image.py index 156aec9ef..ba6c1b5ba 100644 --- a/redbot/cogs/image/image.py +++ b/redbot/cogs/image/image.py @@ -43,7 +43,7 @@ class Image: imgur_client_id = await self.settings.imgur_client_id() if not imgur_client_id: await ctx.send( - _("A client ID has not been set! Please set one with {}").format( + _("A client ID has not been set! Please set one with {}.").format( "`{}imgurcreds`".format(ctx.prefix) ) ) @@ -55,7 +55,7 @@ class Image: if data["success"]: results = data["data"] if not results: - await ctx.send(_("Your search returned no results")) + await ctx.send(_("Your search returned no results.")) return shuffle(results) msg = _("Search results...\n") @@ -64,7 +64,7 @@ class Image: msg += "\n" await ctx.send(msg) else: - await ctx.send(_("Something went wrong. Error code is {}").format(data["status"])) + await ctx.send(_("Something went wrong. Error code is {}.").format(data["status"])) @_imgur.command(name="subreddit") async def imgur_subreddit( @@ -92,7 +92,7 @@ class Image: imgur_client_id = await self.settings.imgur_client_id() if not imgur_client_id: await ctx.send( - _("A client ID has not been set! Please set one with {}").format( + _("A client ID has not been set! Please set one with {}.").format( "`{}imgurcreds`".format(ctx.prefix) ) ) @@ -117,12 +117,13 @@ class Image: else: await ctx.send(_("No results found.")) else: - await ctx.send(_("Something went wrong. Error code is {}").format(data["status"])) + await ctx.send(_("Something went wrong. Error code is {}.").format(data["status"])) @checks.is_owner() @commands.command() async def imgurcreds(self, ctx, imgur_client_id: str): """Sets the imgur client id + You will need an account on Imgur to get this You can get these by visiting https://api.imgur.com/oauth2/addclient @@ -131,7 +132,7 @@ class Image: set the authorization callback url to 'https://localhost' leave the app website blank, enter a valid email address, and enter a description. Check the box for the captcha, then click Next. - Your client ID will be on the page that loads""" + Your client ID will be on the page that loads.""" await self.settings.imgur_client_id.set(imgur_client_id) await ctx.send(_("Set the imgur client id!")) @@ -156,7 +157,7 @@ class Image: else: await ctx.send(_("No results found.")) else: - await ctx.send(_("Error contacting the API")) + await ctx.send(_("Error contacting the API.")) @commands.command(pass_context=True, no_pm=True) async def gifr(self, ctx, *keywords): @@ -179,4 +180,4 @@ class Image: else: await ctx.send(_("No results found.")) else: - await ctx.send(_("Error contacting the API")) + await ctx.send(_("Error contacting the API.")) diff --git a/redbot/cogs/permissions/permissions.py b/redbot/cogs/permissions/permissions.py index b5e6d5f6b..4fd548157 100644 --- a/redbot/cogs/permissions/permissions.py +++ b/redbot/cogs/permissions/permissions.py @@ -39,7 +39,7 @@ class Permissions: def add_check(self, check_obj: object, before_or_after: str): """ - adds a check to the check ordering + Adds a check to the check ordering checks should be a function taking 2 arguments: ctx: commands.Context @@ -73,7 +73,7 @@ class Permissions: def remove_check(self, check_obj: object, before_or_after: str): """ - removes a previously registered check object + Removes a previously registered check object 3rd party cogs should keep a copy of of any checks they registered and deregister then on unload @@ -206,10 +206,10 @@ class Permissions: "\n" "1. Rules about a user.\n" "2. Rules about the voice channel a user is in.\n" - "3. Rules about the text channel a command was issued in\n" + "3. Rules about the text channel a command was issued in.\n" "4. Rules about a role the user has " - "(The highest role they have with a rule will be used)\n" - "5. Rules about the guild a user is in (Owner level only)" + "(The highest role they have with a rule will be used).\n" + "5. Rules about the guild a user is in (Owner level only)." "\n\nFor more details, please read the official documentation." ) @@ -254,13 +254,13 @@ class Permissions: Take a YAML file upload to set permissions from """ if not ctx.message.attachments: - return await ctx.send(_("You must upload a file")) + return await ctx.send(_("You must upload a file.")) try: await yamlset_acl(ctx, config=self.config.owner_models, update=False) except Exception as e: print(e) - return await ctx.send(_("Inalid syntax")) + return await ctx.send(_("Invalid syntax.")) else: await ctx.send(_("Rules set.")) @@ -280,13 +280,13 @@ class Permissions: Take a YAML file upload to set permissions from """ if not ctx.message.attachments: - return await ctx.send(_("You must upload a file")) + return await ctx.send(_("You must upload a file.")) try: await yamlset_acl(ctx, config=self.config.guild(ctx.guild).owner_models, update=False) except Exception as e: print(e) - return await ctx.send(_("Inalid syntax")) + return await ctx.send(_("Invalid syntax.")) else: await ctx.send(_("Rules set.")) @@ -309,13 +309,13 @@ class Permissions: Use this to not lose existing rules """ if not ctx.message.attachments: - return await ctx.send(_("You must upload a file")) + return await ctx.send(_("You must upload a file.")) try: await yamlset_acl(ctx, config=self.config.guild(ctx.guild).owner_models, update=True) except Exception as e: print(e) - return await ctx.send(_("Inalid syntax")) + return await ctx.send(_("Invalid syntax.")) else: await ctx.send(_("Rules set.")) @@ -328,13 +328,13 @@ class Permissions: Use this to not lose existing rules """ if not ctx.message.attachments: - return await ctx.send(_("You must upload a file")) + return await ctx.send(_("You must upload a file.")) try: await yamlset_acl(ctx, config=self.config.owner_models, update=True) except Exception as e: print(e) - return await ctx.send(_("Inalid syntax")) + return await ctx.send(_("Invalid syntax.")) else: await ctx.send(_("Rules set.")) @@ -348,7 +348,7 @@ class Permissions: who_or_what: str, ): """ - adds something to the rules + Adds something to the rules allow_or_deny: "allow" or "deny", depending on the rule to modify @@ -363,7 +363,7 @@ class Permissions: """ obj = self.find_object_uniquely(who_or_what) if not obj: - return await ctx.send(_("No unique matches. Try using an ID or mention")) + return await ctx.send(_("No unique matches. Try using an ID or mention.")) model_type, type_name = cog_or_command async with self.config.owner_models() as models: data = {k: v for k, v in models.items()} @@ -392,7 +392,7 @@ class Permissions: who_or_what: str, ): """ - adds something to the rules + Adds something to the rules allow_or_deny: "allow" or "deny", depending on the rule to modify @@ -407,7 +407,7 @@ class Permissions: """ obj = self.find_object_uniquely(who_or_what) if not obj: - return await ctx.send(_("No unique matches. Try using an ID or mention")) + return await ctx.send(_("No unique matches. Try using an ID or mention.")) model_type, type_name = cog_or_command async with self.config.guild(ctx.guild).owner_models() as models: data = {k: v for k, v in models.items()} @@ -450,7 +450,7 @@ class Permissions: """ obj = self.find_object_uniquely(who_or_what) if not obj: - return await ctx.send(_("No unique matches. Try using an ID or mention")) + return await ctx.send(_("No unique matches. Try using an ID or mention.")) model_type, type_name = cog_or_command async with self.config.owner_models() as models: data = {k: v for k, v in models.items()} @@ -494,7 +494,7 @@ class Permissions: """ obj = self.find_object_uniquely(who_or_what) if not obj: - return await ctx.send(_("No unique matches. Try using an ID or mention")) + return await ctx.send(_("No unique matches. Try using an ID or mention.")) model_type, type_name = cog_or_command async with self.config.guild(ctx.guild).owner_models() as models: data = {k: v for k, v in models.items()} @@ -540,7 +540,7 @@ class Permissions: data[model_type][type_name]["default"] = val_to_set models.update(data) - await ctx.send(_("Defualt set.")) + await ctx.send(_("Default set.")) @checks.is_owner() @permissions.command(name="setdefaultglobalrule") @@ -570,7 +570,7 @@ class Permissions: data[model_type][type_name]["default"] = val_to_set models.update(data) - await ctx.send(_("Defualt set.")) + await ctx.send(_("Default set.")) @commands.bot_has_permissions(add_reactions=True) @checks.is_owner() @@ -592,7 +592,7 @@ class Permissions: if REACTS.get(str(reaction)): await self.config.owner_models.clear() - await ctx.send(_("Global settings cleared")) + await ctx.send(_("Global settings cleared.")) else: await ctx.send(_("Okay.")) @@ -617,7 +617,7 @@ class Permissions: if REACTS.get(str(reaction)): await self.config.guild(ctx.guild).owner_models.clear() - await ctx.send(_("Guild settings cleared")) + await ctx.send(_("Guild settings cleared.")) else: await ctx.send(_("Okay.")) diff --git a/redbot/cogs/streams/streams.py b/redbot/cogs/streams/streams.py index cb784202f..4ed2eaa39 100644 --- a/redbot/cogs/streams/streams.py +++ b/redbot/cogs/streams/streams.py @@ -77,9 +77,7 @@ class Streams: @commands.command() async def youtube(self, ctx: commands.Context, channel_id_or_name: str): - """ - Checks if a Youtube channel is streaming - """ + """Checks if a Youtube channel is streaming""" apikey = await self.db.tokens.get_raw(YoutubeStream.__name__, default=None) is_name = self.check_name_or_id(channel_id_or_name) if is_name: @@ -115,19 +113,19 @@ class Streams: await ctx.send(_("The channel doesn't seem to exist.")) except InvalidTwitchCredentials: await ctx.send( - _("The twitch token is either invalid or has not been set. " "See `{}`.").format( + _("The twitch token is either invalid or has not been set. See `{}`.").format( "{}streamset twitchtoken".format(ctx.prefix) ) ) except InvalidYoutubeCredentials: await ctx.send( - _("The Youtube API key is either invalid or has not been set. " "See {}.").format( + _("The Youtube API key is either invalid or has not been set. See {}.").format( "`{}streamset youtubekey`".format(ctx.prefix) ) ) except APIError: await ctx.send( - _("Something went wrong whilst trying to contact the " "stream service's API.") + _("Something went wrong whilst trying to contact the stream service's API.") ) else: await ctx.send(embed=embed) @@ -152,8 +150,7 @@ class Streams: @_twitch.command(name="community") async def twitch_alert_community(self, ctx: commands.Context, community: str): - """Sets a Twitch stream alert notification in the channel - for the specified community.""" + """Sets a Twitch stream alert notification in the channel for the specified community.""" await self.community_alert(ctx, TwitchCommunity, community.lower()) @streamalert.command(name="youtube") @@ -257,7 +254,7 @@ class Streams: return except APIError: await ctx.send( - _("Something went wrong whilst trying to contact the " "stream service's API.") + _("Something went wrong whilst trying to contact the stream service's API.") ) return else: @@ -276,7 +273,7 @@ class Streams: await community.get_community_streams() except InvalidTwitchCredentials: await ctx.send( - _("The twitch token is either invalid or has not been set. " "See {}.").format( + _("The twitch token is either invalid or has not been set. See {}.").format( "`{}streamset twitchtoken`".format(ctx.prefix) ) ) @@ -286,7 +283,7 @@ class Streams: return except APIError: await ctx.send( - _("Something went wrong whilst trying to contact the " "stream service's API.") + _("Something went wrong whilst trying to contact the stream service's API.") ) return except OfflineCommunity: @@ -350,16 +347,14 @@ class Streams: if current_setting: await self.db.guild(guild).mention_everyone.set(False) await ctx.send( - _("{} will no longer be mentioned " "for a stream alert.").format( - "@\u200beveryone" - ) + _("{} will no longer be mentioned for a stream alert.").format("@\u200beveryone") ) else: await self.db.guild(guild).mention_everyone.set(True) await ctx.send( _( "When a stream configured for stream alerts " - "comes online, {} will be mentioned" + "comes online, {} will be mentioned." ).format("@\u200beveryone") ) @@ -372,14 +367,14 @@ class Streams: if current_setting: await self.db.guild(guild).mention_here.set(False) await ctx.send( - _("{} will no longer be mentioned " "for a stream alert.").format("@\u200bhere") + _("{} will no longer be mentioned for a stream alert.").format("@\u200bhere") ) else: await self.db.guild(guild).mention_here.set(True) await ctx.send( _( "When a stream configured for stream alerts " - "comes online, {} will be mentioned" + "comes online, {} will be mentioned." ).format("@\u200bhere") ) @@ -394,7 +389,7 @@ class Streams: if current_setting: await self.db.role(role).mention.set(False) await ctx.send( - _("{} will no longer be mentioned " "for a stream alert").format( + _("{} will no longer be mentioned for a stream alert.").format( "@\u200b{}".format(role.name) ) ) @@ -403,7 +398,7 @@ class Streams: await ctx.send( _( "When a stream configured for stream alerts " - "comes online, {} will be mentioned" + "comes online, {} will be mentioned." "" ).format("@\u200b{}".format(role.name)) ) @@ -414,7 +409,7 @@ class Streams: """Toggles automatic deletion of notifications for streams that go offline""" await self.db.guild(ctx.guild).autodelete.set(on_off) if on_off: - await ctx.send("The notifications will be deleted once " "streams go offline.") + await ctx.send("The notifications will be deleted once streams go offline.") else: await ctx.send("Notifications will never be deleted.") @@ -424,7 +419,7 @@ class Streams: if stream not in self.streams: self.streams.append(stream) await ctx.send( - _("I'll send a notification in this channel when {} " "is online.").format( + _("I'll send a notification in this channel when {} is online.").format( stream.name ) ) @@ -433,7 +428,7 @@ class Streams: if not stream.channels: self.streams.remove(stream) await ctx.send( - _("I won't send notifications about {} in this " "channel anymore.").format( + _("I won't send notifications about {} in this channel anymore.").format( stream.name ) ) @@ -448,7 +443,7 @@ class Streams: await ctx.send( _( "I'll send a notification in this channel when a " - "channel is streaming to the {} community" + "channel is streaming to the {} community." "" ).format(community.name) ) @@ -459,7 +454,7 @@ class Streams: await ctx.send( _( "I won't send notifications about channels streaming " - "to the {} community in this channel anymore" + "to the {} community in this channel anymore." "" ).format(community.name) ) diff --git a/redbot/cogs/trivia/trivia.py b/redbot/cogs/trivia/trivia.py index fe67c3a8b..ee6eda36c 100644 --- a/redbot/cogs/trivia/trivia.py +++ b/redbot/cogs/trivia/trivia.py @@ -161,7 +161,7 @@ class Trivia: return await settings.payout_multiplier.set(multiplier) if not multiplier: - await ctx.send("Done. I will no longer reward the winner with a" " payout.") + await ctx.send("Done. I will no longer reward the winner with a payout.") return await ctx.send("Done. Payout multiplier set to {}.".format(multiplier)) @@ -207,7 +207,7 @@ class Trivia: return if not trivia_dict: await ctx.send( - "The trivia list was parsed successfully, however" " it appears to be empty!" + "The trivia list was parsed successfully, however it appears to be empty!" ) return settings = await self.conf.guild(ctx.guild).all() @@ -383,7 +383,7 @@ class Trivia: try: priority.remove(key) except ValueError: - raise ValueError("{} is not a valid key".format(key)) + raise ValueError("{} is not a valid key.".format(key)) # Put key last in reverse priority priority.append(key) items = data.items() @@ -481,13 +481,13 @@ class Trivia: try: path = next(p for p in self._all_lists() if p.stem == category) except StopIteration: - raise FileNotFoundError("Could not find the `{}` category" "".format(category)) + raise FileNotFoundError("Could not find the `{}` category.".format(category)) with path.open(encoding="utf-8") as file: try: dict_ = yaml.load(file) except yaml.error.YAMLError as exc: - raise InvalidListError("YAML parsing failed") from exc + raise InvalidListError("YAML parsing failed.") from exc else: return dict_ diff --git a/redbot/cogs/warnings/warnings.py b/redbot/cogs/warnings/warnings.py index d77a8ed04..2347261a8 100644 --- a/redbot/cogs/warnings/warnings.py +++ b/redbot/cogs/warnings/warnings.py @@ -56,7 +56,7 @@ class Warnings: guild = ctx.guild await self.config.guild(guild).allow_custom_reasons.set(allowed) await ctx.send( - _("Custom reasons have been {}").format(_("enabled") if allowed else _("disabled")) + _("Custom reasons have been {}.").format(_("enabled") if allowed else _("disabled")) ) @commands.group() @@ -84,7 +84,7 @@ class Warnings: try: msg = await ctx.bot.wait_for("message", check=same_author_check, timeout=30) except asyncio.TimeoutError: - await ctx.send(_("Ok then")) + await ctx.send(_("Ok then.")) return if msg.content.lower() == "y": @@ -161,7 +161,7 @@ class Warnings: async with guild_settings.reasons() as registered_reasons: registered_reasons.update(completed) - await ctx.send(_("That reason has been registered")) + await ctx.send(_("That reason has been registered.")) @warnreason.command(name="del") @commands.guild_only() @@ -173,7 +173,7 @@ class Warnings: if registered_reasons.pop(reason_name.lower(), None): await ctx.tick() else: - await ctx.send(_("That is not a registered reason name")) + await ctx.send(_("That is not a registered reason name.")) @commands.command() @commands.guild_only() @@ -230,7 +230,7 @@ class Warnings: await ctx.send( _( "Custom reasons are not allowed! Please see {} for " - "a complete list of valid reasons" + "a complete list of valid reasons." ).format("`{}reasonlist`".format(ctx.prefix)) ) return @@ -275,7 +275,7 @@ class Warnings: else: if not await is_admin_or_superior(self.bot, ctx.author): await ctx.send( - warning(_("You are not allowed to check " "warnings for other users!")) + warning(_("You are not allowed to check warnings for other users!")) ) return else: @@ -336,7 +336,7 @@ class Warnings: try: msg = await ctx.bot.wait_for("message", check=same_author_check, timeout=30) except asyncio.TimeoutError: - await ctx.send(_("Ok then")) + await ctx.send(_("Ok then.")) return try: int(msg.content) @@ -349,11 +349,11 @@ class Warnings: return to_add["points"] = int(msg.content) - await ctx.send(_("Enter a description for this reason")) + await ctx.send(_("Enter a description for this reason.")) try: msg = await ctx.bot.wait_for("message", check=same_author_check, timeout=30) except asyncio.TimeoutError: - await ctx.send(_("Ok then")) + await ctx.send(_("Ok then.")) return to_add["description"] = msg.content return to_add