optimize imports and pep8

pull/28/head
Bobloy 7 years ago
parent 9ac6d396a8
commit deb96a73b6

@ -3,15 +3,13 @@ from collections import defaultdict
from random import choice from random import choice
import discord import discord
from discord.ext import commands
# Import all roles here # Import all roles here
from redbot.core import RedContext from redbot.core import RedContext
from redbot.core.utils.menus import menu, prev_page, next_page, close_menu
from werewolf.roles.seer import Seer from werewolf.roles.seer import Seer
from werewolf.roles.vanillawerewolf import VanillaWerewolf from werewolf.roles.vanillawerewolf import VanillaWerewolf
from werewolf.roles.villager import Villager from werewolf.roles.villager import Villager
from redbot.core.utils.menus import menu, prev_page, next_page, close_menu
# All roles in this list for iterating # All roles in this list for iterating
@ -120,8 +118,6 @@ async def parse_code(code, game):
digits += 1 digits += 1
continue continue
try: try:
idx = int(built) idx = int(built)
except ValueError: except ValueError:
@ -146,7 +142,6 @@ async def parse_code(code, game):
built = "" built = ""
return decode return decode
@ -321,7 +316,7 @@ class GameBuilder:
pass pass
if page >= len(ROLE_LIST): if page >= len(ROLE_LIST):
self.rand_roles.append(CATEGORY_COUNT[page-len(ROLE_LIST)]) self.rand_roles.append(CATEGORY_COUNT[page - len(ROLE_LIST)])
else: else:
self.code.append(page) self.code.append(page)

@ -2,7 +2,6 @@ import asyncio
import random import random
import discord import discord
from discord.ext import commands
from redbot.core import RedContext from redbot.core import RedContext
from werewolf.builder import parse_code from werewolf.builder import parse_code

@ -30,4 +30,4 @@ class Player:
try: try:
await self.member.send(message) # Lets do embeds later await self.member.send(message) # Lets do embeds later
except discord.Forbidden: except discord.Forbidden:
await self.role.game.village_channel.send("Couldn't DM {}, uh oh".format(self.mention)) await self.role.game.village_channel.send("Couldn't DM {}, uh oh".format(self.mention))

@ -16,7 +16,6 @@ class Seer(Role):
description = "A mystic in search of answers in a chaotic town.\n" \ description = "A mystic in search of answers in a chaotic town.\n" \
"Calls upon the cosmos to discern those of Lycan blood" "Calls upon the cosmos to discern those of Lycan blood"
def __init__(self, game): def __init__(self, game):
super().__init__(game) super().__init__(game)
# self.game = game # self.game = game

@ -1,12 +1,11 @@
import discord import discord
from discord.ext import commands from discord.ext import commands
from redbot.core import Config, checks, RedContext from redbot.core import Config, checks, RedContext
from redbot.core.bot import Red from redbot.core.bot import Red
from redbot.core.utils.menus import menu, DEFAULT_CONTROLS
from werewolf.builder import GameBuilder, role_from_name, role_from_alignment, role_from_category, role_from_id from werewolf.builder import GameBuilder, role_from_name, role_from_alignment, role_from_category, role_from_id
from werewolf.game import Game from werewolf.game import Game
from redbot.core.utils.menus import menu, DEFAULT_CONTROLS
class Werewolf: class Werewolf:
@ -74,7 +73,7 @@ class Werewolf:
@commands.guild_only() @commands.guild_only()
@wwset.command(name="role") @wwset.command(name="role")
async def wwset_role(self, ctx: RedContext, role: discord.Role=None): async def wwset_role(self, ctx: RedContext, role: discord.Role = None):
""" """
Assign the game role Assign the game role
This role should not be manually assigned This role should not be manually assigned
@ -105,7 +104,7 @@ class Werewolf:
@commands.guild_only() @commands.guild_only()
@wwset.command(name="channel") @wwset.command(name="channel")
async def wwset_channel(self, ctx: RedContext, channel: discord.TextChannel=None): async def wwset_channel(self, ctx: RedContext, channel: discord.TextChannel = None):
""" """
Assign the village channel Assign the village channel
""" """
@ -118,7 +117,7 @@ class Werewolf:
@commands.guild_only() @commands.guild_only()
@wwset.command(name="logchannel") @wwset.command(name="logchannel")
async def wwset_log_channel(self, ctx: RedContext, channel: discord.TextChannel=None): async def wwset_log_channel(self, ctx: RedContext, channel: discord.TextChannel = None):
""" """
Assign the log channel Assign the log channel
""" """
@ -388,4 +387,3 @@ class Werewolf:
return False, None, None, None, None return False, None, None, None, None
return True, role, category, channel, log_channel return True, role, category, channel, log_channel

Loading…
Cancel
Save