Fix a bunch o' warnings

This commit is contained in:
2021-03-24 09:58:36 +01:00
parent 63ac49fac0
commit ffe6b0b60e

14
bot.py
View File

@@ -4,14 +4,14 @@ import random
import re
import time
from types import coroutine
from typing import Optional, List
from typing import Optional, List, Dict
import discord
import gtts
from discord.ext import commands
from dotenv import load_dotenv
from lib.config import config, config_meta, config_load, config_save, config_get, config_set, config_get_descriptions, \
from lib.config import config, config_load, config_save, config_get, config_set, config_get_descriptions, \
config_set_raw
from lib.utils import async_filter, find_category, find_role_case_insensitive
@@ -264,7 +264,7 @@ async def flip_pipelin_command(ctx: commands.Context):
@bot.command(name='quote', brief='Get a random quote or add new ones')
async def quote_command(ctx: commands.Context, author: Optional[str], *, quote: Optional[str]):
quotes: Optional[dict[str, List[str]]] = config_get("guild_quotes", guild=ctx.guild.id)
quotes: Optional[Dict[str, List[str]]] = config_get("guild_quotes", guild=ctx.guild.id)
if quotes is None:
quotes = {}
config_set_raw("guild_quotes", quotes, ctx.guild.id)
@@ -332,7 +332,7 @@ async def quote_command(ctx: commands.Context, author: Optional[str], *, quote:
async def quote_remove_command(ctx: commands.Context, author: str, quote: str):
if not ctx.author.guild_permissions.administrator:
await ctx.channel.send("Only admins are allowed to remove quotes!")
quotes: Optional[dict[str, List[str]]] = config_get("guild_quotes", guild=ctx.guild.id)
quotes: Optional[Dict[str, List[str]]] = config_get("guild_quotes", guild=ctx.guild.id)
if quotes is None:
await ctx.channel.send("No quotes available!")
@@ -377,10 +377,10 @@ async def group_command(ctx: commands.Context, subcommand: Optional[str], arg: O
guild: discord.Guild = ctx.guild
role_prefix = config_get("groups-role-prefix", guild.id)
def collect_group_channels(cat: discord.CategoryChannel) -> dict[str, discord.abc.GuildChannel]:
def collect_group_channels(cat: discord.CategoryChannel) -> Dict[str, discord.abc.GuildChannel]:
return {channel.name: channel for channel in cat.text_channels}
async def collect_group_roles() -> list[discord.Role]:
async def collect_group_roles() -> List[discord.Role]:
return list(filter(lambda role: role.name.startswith(role_prefix), await guild.fetch_roles()))
async def fail_category(type: str, expected: str):
@@ -503,7 +503,7 @@ async def group_command(ctx: commands.Context, subcommand: Optional[str], arg: O
await channel.send("Hi, " + role.mention)
await ctx.send("Group " + arg + " created.")
elif subcommand == 'clear_vcs':
cors: list[coroutine] = []
cors: List[coroutine] = []
for vc in groups_cat.voice_channels:
cors.append(vc.delete(reason="Clear temporary vcs, as requested by " + ctx.author.mention))
for cor in cors: