mirror of
https://github.com/brandons209/Red-bot-Cogs.git
synced 2024-06-02 10:34:54 +12:00
Fix broken async and await calls
This commit is contained in:
parent
79509db4e8
commit
3bef65a7f3
|
@ -5,11 +5,15 @@ import contextlib
|
||||||
import datetime
|
import datetime
|
||||||
import discord
|
import discord
|
||||||
import itertools
|
import itertools
|
||||||
|
from typing import (
|
||||||
|
Any,
|
||||||
|
Dict,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
from redbot.core import commands, Config, checks
|
from redbot.core import commands, Config, checks
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
from redbot.core.config import Group
|
from redbot.core.config import _ValueCtxManager, Group, Value
|
||||||
from redbot.core.i18n import Translator, cog_i18n
|
from redbot.core.i18n import Translator, cog_i18n
|
||||||
from redbot.core.commands import Context, Cog
|
from redbot.core.commands import Context, Cog
|
||||||
|
|
||||||
|
@ -124,9 +128,10 @@ class Birthdays(Cog):
|
||||||
await channel.send(self.BDAY_INVALID())
|
await channel.send(self.BDAY_INVALID())
|
||||||
else:
|
else:
|
||||||
await self.remove_user_bday(message.guild.id, author.id)
|
await self.remove_user_bday(message.guild.id, author.id)
|
||||||
await self.get_date_config(message.guild.id, birthday.toordinal()).get_attr(author.id)
|
self.get_date_config(message.guild.id, birthday.toordinal()).get_attr(author.id)
|
||||||
bday_month_str = birthday.strftime("%B")
|
bday_month_str = birthday.strftime("%B")
|
||||||
bday_day_str = birthday.strftime("%d").lstrip("0")
|
bday_day_str = birthday.strftime("%d").lstrip("0")
|
||||||
|
|
||||||
await channel.send(self.BDAY_SET(bday_month_str + " " + bday_day_str))
|
await channel.send(self.BDAY_SET(bday_month_str + " " + bday_day_str))
|
||||||
|
|
||||||
@bday.command(name="list")
|
@bday.command(name="list")
|
||||||
|
@ -257,14 +262,14 @@ class Birthdays(Cog):
|
||||||
await self.config.custom(self.GUILD_DATE_GROUP, "backup").set_raw(value=previous)
|
await self.config.custom(self.GUILD_DATE_GROUP, "backup").set_raw(value=previous)
|
||||||
self.logger.info("Previous birthdays have been backed up in the config file.")
|
self.logger.info("Previous birthdays have been backed up in the config file.")
|
||||||
|
|
||||||
def get_date_config(self, guild_id: int, date: int) -> Group:
|
def get_date_config(self, guild_id: int, date: int):
|
||||||
return self.config.custom(self.GUILD_DATE_GROUP, str(guild_id), str(date))
|
return self.config.custom(self.GUILD_DATE_GROUP, str(guild_id), str(date))
|
||||||
|
|
||||||
def get_guild_date_config(self, guild_id: int) -> Group:
|
def get_guild_date_config(self, guild_id: int):
|
||||||
return self.config.custom(self.GUILD_DATE_GROUP, str(guild_id))
|
return self.config.custom(self.GUILD_DATE_GROUP, str(guild_id))
|
||||||
|
|
||||||
async def get_guild_date_configs(self, guild_id: int) -> dict:
|
async def get_guild_date_configs(self, guild_id: int) -> _ValueCtxManager[Dict[str, Any]]:
|
||||||
return await self.get_guild_date_config(guild_id).all()
|
return (await self.get_guild_date_config(guild_id).all())
|
||||||
|
|
||||||
async def get_all_date_configs(self) -> dict:
|
def get_all_date_configs(self):
|
||||||
return await self.config.custom(self.GUILD_DATE_GROUP).all()
|
return self.config.custom(self.GUILD_DATE_GROUP).all()
|
||||||
|
|
Loading…
Reference in a new issue