Skip to content
This repository has been archived by the owner on Dec 23, 2020. It is now read-only.

Commit

Permalink
Creates message file if doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
WardPearce committed Aug 22, 2020
1 parent 16a1f25 commit 543f882
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
8 changes: 0 additions & 8 deletions SourceQueryBot/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
class NoSuchConfigFile(Exception):
"""
Raised when config file doesn't exist.
"""

pass


class InvalidChannel(Exception):
"""
Raised when a channel ID is invalid or can't be accessed.
Expand Down
5 changes: 2 additions & 3 deletions SourceQueryBot/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

from os import path, getcwd

from .exceptions import NoSuchConfigFile


class Messages:
_saved_messages = []
Expand Down Expand Up @@ -40,7 +38,8 @@ async def get(self) -> list:

await file.truncate(0)
else:
raise NoSuchConfigFile()
async with aiofiles.open(self.location, "w+") as file:
await file.close()

async def save(self, line: typing.Any) -> None:
"""
Expand Down

0 comments on commit 543f882

Please sign in to comment.