added async
This commit is contained in:
parent
4c6a0cc81a
commit
5265d1a8cb
1 changed files with 4 additions and 4 deletions
|
|
@ -31,7 +31,7 @@ class InkyScreen(commands.Cog):
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def write_to_display(self, text: list):
|
async def write_to_display(self, text: list):
|
||||||
if text is not self.old_message:
|
if text is not self.old_message:
|
||||||
image = Image.new("P", (self.display.WIDTH, self.display.HEIGHT))
|
image = Image.new("P", (self.display.WIDTH, self.display.HEIGHT))
|
||||||
draw = ImageDraw.Draw(image)
|
draw = ImageDraw.Draw(image)
|
||||||
|
|
@ -63,7 +63,7 @@ class InkyScreen(commands.Cog):
|
||||||
sparky_uptime = time.time() - self.start_time
|
sparky_uptime = time.time() - self.start_time
|
||||||
return str(datetime.timedelta(seconds=sparky_uptime))
|
return str(datetime.timedelta(seconds=sparky_uptime))
|
||||||
|
|
||||||
def generate_message(self):
|
async def generate_message(self):
|
||||||
message_list = []
|
message_list = []
|
||||||
try:
|
try:
|
||||||
message_list.append(f"IP: {self.get_ip_address()}")
|
message_list.append(f"IP: {self.get_ip_address()}")
|
||||||
|
|
@ -83,8 +83,8 @@ class InkyScreen(commands.Cog):
|
||||||
@commands.command()
|
@commands.command()
|
||||||
async def inkyscreen_update(self, ctx):
|
async def inkyscreen_update(self, ctx):
|
||||||
if ctx.author.id in self.admin_ids:
|
if ctx.author.id in self.admin_ids:
|
||||||
message = self.generate_message()
|
message = await self.generate_message()
|
||||||
self.write_to_display(message)
|
await self.write_to_display(message)
|
||||||
await ctx.send("InkyScreen updated.")
|
await ctx.send("InkyScreen updated.")
|
||||||
else:
|
else:
|
||||||
await ctx.send("You do not have permission to use this command.")
|
await ctx.send("You do not have permission to use this command.")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue