Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format code with black, yapf, autopep8 and isort #275

Merged
merged 1 commit into from
Oct 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion minato_namikaze/bot_files/cogs/info/mysupport.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import datetime
import inspect
import itertools
import os

import discord
import pkg_resources
import psutil
import pygit2, inspect, os
import pygit2
from discord.ext import commands

from ...lib import Embed, PrivacyPolicy, get_or_fetch_member, get_user
Expand Down
9 changes: 6 additions & 3 deletions minato_namikaze/bot_files/cogs/moderation/moderation.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import datetime, DiscordUtils
import re, shlex
import datetime
import re
import shlex
from collections import Counter
from os.path import join
from typing import Optional, Union

import discord
import DiscordUtils
from discord.ext import commands

from ...lib import (
Expand All @@ -16,9 +18,10 @@
PostStats,
check_if_warning_system_setup,
create_paginator,
get_roles,
get_user,
has_permissions,
return_warning_channel,get_roles
return_warning_channel,
)


Expand Down
62 changes: 26 additions & 36 deletions minato_namikaze/bot_files/lib/util/setup_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,40 @@

def perms_dict(ctx):
admin_roles = [
role
for role in ctx.guild.roles
role for role in ctx.guild.roles
if role.permissions.manage_guild and not role.managed
]
overwrite_dict = {}
for i in admin_roles:
overwrite_dict[i] = discord.PermissionOverwrite(read_messages=True)
overwrite_dict.update(
{
ctx.guild.default_role: discord.PermissionOverwrite(read_messages=False),
ctx.guild.me: discord.PermissionOverwrite(read_messages=True),
}
)
overwrite_dict.update({
ctx.guild.default_role:
discord.PermissionOverwrite(read_messages=False),
ctx.guild.me:
discord.PermissionOverwrite(read_messages=True),
})
return admin_roles, overwrite_dict


async def channel_creation(ctx):
admin_roles, overwrite_dict = perms_dict(ctx)

category = (
discord.utils.get(ctx.guild.categories, name="Admin / Feedback")
if discord.utils.get(ctx.guild.categories, name="Admin / Feedback")
else False
)
category = (discord.utils.get(
ctx.guild.categories, name="Admin / Feedback") if discord.utils.get(
ctx.guild.categories, name="Admin / Feedback") else False)

# Feedback Channel
if discord.utils.get(ctx.guild.text_channels, topic=SetupVars.feedback.name):
feed_channel = discord.utils.get(
ctx.guild.text_channels, topic=SetupVars.feedback.name
)
if discord.utils.get(ctx.guild.text_channels,
topic=SetupVars.feedback.name):
feed_channel = discord.utils.get(ctx.guild.text_channels,
topic=SetupVars.feedback.name)
else:
feed_channel = False

# Ban
if discord.utils.get(ctx.guild.text_channels, topic=SetupVars.ban.name):
ban_channel = discord.utils.get(
ctx.guild.text_channels, topic=SetupVars.ban.name
)
ban_channel = discord.utils.get(ctx.guild.text_channels,
topic=SetupVars.ban.name)
else:
ban_channel = False

Expand All @@ -65,26 +61,20 @@ async def channel_creation(ctx):
warns_channel = False

# Support
if discord.utils.get(ctx.guild.text_channels, topic=SetupVars.support.name):
support_channel = discord.utils.get(
ctx.guild.text_channels, topic=SetupVars.support.name
)
if discord.utils.get(ctx.guild.text_channels,
topic=SetupVars.support.name):
support_channel = discord.utils.get(ctx.guild.text_channels,
topic=SetupVars.support.name)
else:
support_channel = False

support_channel_roles = (
discord.utils.get(ctx.guild.roles, name="SupportRequired")
if discord.utils.get(ctx.guild.roles, name="SupportRequired")
else False
)
support_channel_roles = (discord.utils.get(
ctx.guild.roles, name="SupportRequired") if discord.utils.get(
ctx.guild.roles, name="SupportRequired") else False)

if (
isinstance(support_channel, bool)
or isinstance(unban_channel, bool)
or isinstance(ban_channel, bool)
or isinstance(feed_channel, bool)
or isinstance(warns_channel, bool)
):
if (isinstance(support_channel, bool) or isinstance(unban_channel, bool)
or isinstance(ban_channel, bool) or isinstance(feed_channel, bool)
or isinstance(warns_channel, bool)):
if isinstance(category, bool):
category = await ctx.guild.create_category(
"Admin / Feedback",
Expand Down
1 change: 1 addition & 0 deletions webserver/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ def keep_alive():
t = Thread(target=run)
t.start()


if __name__ == "__main__":
run()