Spelling correction of method name in Tunnel (#2496)

`Tunnel.files_from_attatch` was misspelled.

Kept old name as an alias for backwards compatibility.
This commit is contained in:
jack1142 2019-03-04 02:19:40 +01:00 committed by Toby Harradine
parent b4753a02de
commit 30fa9303e8
2 changed files with 7 additions and 4 deletions

View File

@ -165,7 +165,7 @@ class Reports(commands.Cog):
if channel is None: if channel is None:
return None return None
files: List[discord.File] = await Tunnel.files_from_attatch(msg) files: List[discord.File] = await Tunnel.files_from_attach(msg)
ticket_number = await self.config.guild(guild).next_ticket() ticket_number = await self.config.guild(guild).next_ticket()
await self.config.guild(guild).next_ticket.set(ticket_number + 1) await self.config.guild(guild).next_ticket.set(ticket_number + 1)

View File

@ -132,7 +132,7 @@ class Tunnel(metaclass=TunnelMeta):
return rets return rets
@staticmethod @staticmethod
async def files_from_attatch(m: discord.Message) -> List[discord.File]: async def files_from_attach(m: discord.Message) -> List[discord.File]:
""" """
makes a list of file objects from a message makes a list of file objects from a message
returns an empty list if none, or if the sum of file sizes returns an empty list if none, or if the sum of file sizes
@ -158,6 +158,9 @@ class Tunnel(metaclass=TunnelMeta):
files.append(discord.File(_fp, filename=a.filename)) files.append(discord.File(_fp, filename=a.filename))
return files return files
# Backwards-compatible typo fix (GH-2496)
files_from_attatch = files_from_attach
async def communicate( async def communicate(
self, *, message: discord.Message, topic: str = None, skip_message_content: bool = False self, *, message: discord.Message, topic: str = None, skip_message_content: bool = False
): ):
@ -201,10 +204,10 @@ class Tunnel(metaclass=TunnelMeta):
content = topic content = topic
if message.attachments: if message.attachments:
attach = await self.files_from_attatch(message) attach = await self.files_from_attach(message)
if not attach: if not attach:
await message.channel.send( await message.channel.send(
"Could not forward attatchments. " "Could not forward attachments. "
"Total size of attachments in a single " "Total size of attachments in a single "
"message must be less than 8MB." "message must be less than 8MB."
) )