fixing some stuff

This commit is contained in:
Brandon 2022-10-23 18:36:28 -04:00
parent 9b76935ea6
commit daf9f69faf
5 changed files with 58 additions and 21 deletions

View File

@ -1859,15 +1859,6 @@ class ActivityLogger(commands.Cog):
),
)
# drop users who do not correlate to anyone else
for column in adj_matrix.columns:
try:
if (adj_matrix.loc[column] == 0).all():
adj_matrix = adj_matrix.drop(columns=column)
adj_matrix = adj_matrix.drop(index=column)
except KeyError: # not sure why this happens... TODO figure it out
continue
# define table save paths
table_save_path = str(PATH / f"plot_data_{ctx.message.id}.txt")

View File

@ -402,7 +402,8 @@ class NameChange(commands.Cog):
currency_name = await bank.get_currency_name(ctx.guild)
await ctx.send(
info(f"It costs {current_cost} {currency_name} **per minute** to change someone's name."), delete_after=30,
info(f"It costs {current_cost} {currency_name} **per minute** to change someone's name."),
delete_after=30,
)
@namechange.command(name="optin")

View File

@ -52,7 +52,11 @@ async def create_thread(
}
reason = "Punish Thread Creation"
r = Route("POST", "/channels/{channel_id}/threads", channel_id=channel.id,)
r = Route(
"POST",
"/channels/{channel_id}/threads",
channel_id=channel.id,
)
return (await bot.http.request(r, json=fields, reason=reason))["id"]
@ -67,6 +71,11 @@ async def add_user_thread(bot, channel: int, member: discord.Member):
"""
reason = "Punish Add Member"
r = Route("POST", "/channels/{channel_id}/thread-members/{user_id}", channel_id=channel, user_id=member.id,)
r = Route(
"POST",
"/channels/{channel_id}/thread-members/{user_id}",
channel_id=channel,
user_id=member.id,
)
return await bot.http.request(r, reason=reason)

View File

@ -29,7 +29,10 @@ async def create_thread(bot, channel: discord.TextChannel, message: discord.Mess
reason = "Thread Manager"
r = Route(
"POST", "/channels/{channel_id}/messages/{message_id}/threads", channel_id=channel.id, message_id=message.id,
"POST",
"/channels/{channel_id}/messages/{message_id}/threads",
channel_id=channel.id,
message_id=message.id,
)
return (await bot.http.request(r, json=fields, reason=reason))["id"]
@ -45,7 +48,12 @@ async def add_user_thread(bot, channel: int, member: discord.Member):
"""
reason = "Thread Manager"
r = Route("POST", "/channels/{channel_id}/thread-members/{user_id}", channel_id=channel, user_id=member.id,)
r = Route(
"POST",
"/channels/{channel_id}/thread-members/{user_id}",
channel_id=channel,
user_id=member.id,
)
return await bot.http.request(r, reason=reason)
@ -63,7 +71,11 @@ async def get_active_threads(bot, guild: discord.Guild):
reason = "Thread Manager"
r = Route("GET", "/guilds/{guild_id}/threads/active", guild_id=guild.id,)
r = Route(
"GET",
"/guilds/{guild_id}/threads/active",
guild_id=guild.id,
)
res = await bot.http.request(r, reason=reason)

View File

@ -4,7 +4,11 @@ from discord.http import Route
async def create_thread(
bot, channel: discord.TextChannel, name: str, archive: int = 1440, message: discord.Message = None,
bot,
channel: discord.TextChannel,
name: str,
archive: int = 1440,
message: discord.Message = None,
):
"""
Creates a new thread in the channel from the message
@ -39,13 +43,20 @@ async def create_thread(
)
else:
fields["type"] = 11
r = Route("POST", "/channels/{channel_id}/threads", channel_id=channel.id,)
r = Route(
"POST",
"/channels/{channel_id}/threads",
channel_id=channel.id,
)
return (await bot.http.request(r, json=fields, reason=reason))["id"]
async def send_thread_message(
bot, thread_id: int, content: str, mention_roles: list = [],
bot,
thread_id: int,
content: str,
mention_roles: list = [],
):
"""
Send a message in a thread, allowing pings for roles
@ -61,7 +72,11 @@ async def send_thread_message(
"""
fields = {"content": content, "allowed_mentions": {"roles": mention_roles}}
r = Route("POST", "/channels/{channel_id}/messages", channel_id=thread_id,)
r = Route(
"POST",
"/channels/{channel_id}/messages",
channel_id=thread_id,
)
return (await bot.http.request(r, json=fields))["id"]
@ -76,7 +91,12 @@ async def add_user_thread(bot, channel: int, member: discord.Member):
"""
reason = "Thread Manager"
r = Route("POST", "/channels/{channel_id}/thread-members/{user_id}", channel_id=channel, user_id=member.id,)
r = Route(
"POST",
"/channels/{channel_id}/thread-members/{user_id}",
channel_id=channel,
user_id=member.id,
)
return await bot.http.request(r, reason=reason)
@ -94,7 +114,11 @@ async def get_active_threads(bot, guild: discord.Guild):
reason = "Thread Manager"
r = Route("GET", "/guilds/{guild_id}/threads/active", guild_id=guild.id,)
r = Route(
"GET",
"/guilds/{guild_id}/threads/active",
guild_id=guild.id,
)
res = await bot.http.request(r, reason=reason)