Merge pull request #174 from sourcery-ai-bot/master
Sourcery Starbot ⭐ refactored bobloy/Fox-V3
This commit is contained in:
commit
95931d24f3
@ -54,8 +54,7 @@ class AnnounceDaily(Cog):
|
|||||||
|
|
||||||
Do `[p]help annd <subcommand>` for more details
|
Do `[p]help annd <subcommand>` for more details
|
||||||
"""
|
"""
|
||||||
if ctx.invoked_subcommand is None:
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@checks.guildowner()
|
@checks.guildowner()
|
||||||
|
@ -168,7 +168,7 @@ class AudioTrivia(Trivia):
|
|||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def audiotrivia_list(self, ctx: commands.Context):
|
async def audiotrivia_list(self, ctx: commands.Context):
|
||||||
"""List available trivia including audio categories."""
|
"""List available trivia including audio categories."""
|
||||||
lists = set(p.stem for p in self._all_audio_lists())
|
lists = {p.stem for p in self._all_audio_lists()}
|
||||||
if await ctx.embed_requested():
|
if await ctx.embed_requested():
|
||||||
await ctx.send(
|
await ctx.send(
|
||||||
embed=discord.Embed(
|
embed=discord.Embed(
|
||||||
|
@ -48,8 +48,7 @@ class CCRole(commands.Cog):
|
|||||||
"""Custom commands management with roles
|
"""Custom commands management with roles
|
||||||
|
|
||||||
Highly customizable custom commands with role management."""
|
Highly customizable custom commands with role management."""
|
||||||
if not ctx.invoked_subcommand:
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
@ccrole.command(name="add")
|
@ccrole.command(name="add")
|
||||||
@checks.mod_or_permissions(administrator=True)
|
@checks.mod_or_permissions(administrator=True)
|
||||||
@ -228,7 +227,7 @@ class CCRole(commands.Cog):
|
|||||||
if not role_list:
|
if not role_list:
|
||||||
return "None"
|
return "None"
|
||||||
return ", ".join(
|
return ", ".join(
|
||||||
[discord.utils.get(ctx.guild.roles, id=roleid).name for roleid in role_list]
|
discord.utils.get(ctx.guild.roles, id=roleid).name for roleid in role_list
|
||||||
)
|
)
|
||||||
|
|
||||||
embed.add_field(name="Text", value="```{}```".format(cmd["text"]), inline=False)
|
embed.add_field(name="Text", value="```{}```".format(cmd["text"]), inline=False)
|
||||||
@ -252,7 +251,7 @@ class CCRole(commands.Cog):
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
cmd_list = ", ".join([ctx.prefix + c for c in sorted(cmd_list.keys())])
|
cmd_list = ", ".join(ctx.prefix + c for c in sorted(cmd_list.keys()))
|
||||||
cmd_list = "Custom commands:\n\n" + cmd_list
|
cmd_list = "Custom commands:\n\n" + cmd_list
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@ -325,9 +324,7 @@ class CCRole(commands.Cog):
|
|||||||
|
|
||||||
async def eval_cc(self, cmd, message: discord.Message, ctx: commands.Context):
|
async def eval_cc(self, cmd, message: discord.Message, ctx: commands.Context):
|
||||||
"""Does all the work"""
|
"""Does all the work"""
|
||||||
if cmd["proles"] and not (
|
if cmd["proles"] and not {role.id for role in message.author.roles} & set(cmd["proles"]):
|
||||||
set(role.id for role in message.author.roles) & set(cmd["proles"])
|
|
||||||
):
|
|
||||||
log.debug(f"{message.author} missing required role to execute {ctx.invoked_with}")
|
log.debug(f"{message.author} missing required role to execute {ctx.invoked_with}")
|
||||||
return # Not authorized, do nothing
|
return # Not authorized, do nothing
|
||||||
|
|
||||||
|
@ -196,8 +196,7 @@ class Chatter(Cog):
|
|||||||
"""
|
"""
|
||||||
Base command for this cog. Check help for the commands list.
|
Base command for this cog. Check help for the commands list.
|
||||||
"""
|
"""
|
||||||
if ctx.invoked_subcommand is None:
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
@checks.admin()
|
@checks.admin()
|
||||||
@chatter.command(name="channel")
|
@chatter.command(name="channel")
|
||||||
|
@ -58,11 +58,7 @@ class CogLint(Cog):
|
|||||||
|
|
||||||
future = await self.bot.loop.run_in_executor(None, lint.py_run, path, "return_std=True")
|
future = await self.bot.loop.run_in_executor(None, lint.py_run, path, "return_std=True")
|
||||||
|
|
||||||
if future:
|
(pylint_stdout, pylint_stderr) = future or (None, None)
|
||||||
(pylint_stdout, pylint_stderr) = future
|
|
||||||
else:
|
|
||||||
(pylint_stdout, pylint_stderr) = None, None
|
|
||||||
|
|
||||||
# print(pylint_stderr)
|
# print(pylint_stderr)
|
||||||
# print(pylint_stdout)
|
# print(pylint_stdout)
|
||||||
|
|
||||||
|
@ -67,9 +67,8 @@ class Conquest(commands.Cog):
|
|||||||
"""
|
"""
|
||||||
Base command for conquest cog. Start with `[p]conquest set map` to select a map.
|
Base command for conquest cog. Start with `[p]conquest set map` to select a map.
|
||||||
"""
|
"""
|
||||||
if ctx.invoked_subcommand is None:
|
if ctx.invoked_subcommand is None and self.current_map is not None:
|
||||||
if self.current_map is not None:
|
await self._conquest_current(ctx)
|
||||||
await self._conquest_current(ctx)
|
|
||||||
|
|
||||||
@conquest.command(name="list")
|
@conquest.command(name="list")
|
||||||
async def _conquest_list(self, ctx: commands.Context):
|
async def _conquest_list(self, ctx: commands.Context):
|
||||||
@ -80,14 +79,13 @@ class Conquest(commands.Cog):
|
|||||||
|
|
||||||
with maps_json.open() as maps:
|
with maps_json.open() as maps:
|
||||||
maps_json = json.load(maps)
|
maps_json = json.load(maps)
|
||||||
map_list = "\n".join(map_name for map_name in maps_json["maps"])
|
map_list = "\n".join(maps_json["maps"])
|
||||||
await ctx.maybe_send_embed(f"Current maps:\n{map_list}")
|
await ctx.maybe_send_embed(f"Current maps:\n{map_list}")
|
||||||
|
|
||||||
@conquest.group(name="set")
|
@conquest.group(name="set")
|
||||||
async def conquest_set(self, ctx: commands.Context):
|
async def conquest_set(self, ctx: commands.Context):
|
||||||
"""Base command for admin actions like selecting a map"""
|
"""Base command for admin actions like selecting a map"""
|
||||||
if ctx.invoked_subcommand is None:
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
@conquest_set.command(name="resetzoom")
|
@conquest_set.command(name="resetzoom")
|
||||||
async def _conquest_set_resetzoom(self, ctx: commands.Context):
|
async def _conquest_set_resetzoom(self, ctx: commands.Context):
|
||||||
|
@ -30,8 +30,7 @@ class MapMaker(commands.Cog):
|
|||||||
"""
|
"""
|
||||||
Base command for managing current maps or creating new ones
|
Base command for managing current maps or creating new ones
|
||||||
"""
|
"""
|
||||||
if ctx.invoked_subcommand is None:
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
@mapmaker.command(name="upload")
|
@mapmaker.command(name="upload")
|
||||||
async def _mapmaker_upload(self, ctx: commands.Context, map_path=""):
|
async def _mapmaker_upload(self, ctx: commands.Context, map_path=""):
|
||||||
|
@ -65,7 +65,7 @@ def floodfill(image, xy, value, border=None, thresh=0) -> set:
|
|||||||
if border is None:
|
if border is None:
|
||||||
fill = _color_diff(p, background) <= thresh
|
fill = _color_diff(p, background) <= thresh
|
||||||
else:
|
else:
|
||||||
fill = p != value and p != border
|
fill = p not in [value, border]
|
||||||
if fill:
|
if fill:
|
||||||
pixel[s, t] = value
|
pixel[s, t] = value
|
||||||
new_edge.add((s, t))
|
new_edge.add((s, t))
|
||||||
|
@ -27,8 +27,7 @@ class ExclusiveRole(Cog):
|
|||||||
async def exclusive(self, ctx):
|
async def exclusive(self, ctx):
|
||||||
"""Base command for managing exclusive roles"""
|
"""Base command for managing exclusive roles"""
|
||||||
|
|
||||||
if not ctx.invoked_subcommand:
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
@exclusive.command(name="add")
|
@exclusive.command(name="add")
|
||||||
@checks.mod_or_permissions(administrator=True)
|
@checks.mod_or_permissions(administrator=True)
|
||||||
@ -85,7 +84,7 @@ class ExclusiveRole(Cog):
|
|||||||
if role_set is None:
|
if role_set is None:
|
||||||
role_set = set(await self.config.guild(member.guild).role_list())
|
role_set = set(await self.config.guild(member.guild).role_list())
|
||||||
|
|
||||||
member_set = set([role.id for role in member.roles])
|
member_set = {role.id for role in member.roles}
|
||||||
to_remove = (member_set - role_set) - {member.guild.default_role.id}
|
to_remove = (member_set - role_set) - {member.guild.default_role.id}
|
||||||
|
|
||||||
if to_remove and member_set & role_set:
|
if to_remove and member_set & role_set:
|
||||||
@ -103,7 +102,7 @@ class ExclusiveRole(Cog):
|
|||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
|
|
||||||
role_set = set(await self.config.guild(after.guild).role_list())
|
role_set = set(await self.config.guild(after.guild).role_list())
|
||||||
member_set = set([role.id for role in after.roles])
|
member_set = {role.id for role in after.roles}
|
||||||
|
|
||||||
if role_set & member_set:
|
if role_set & member_set:
|
||||||
try:
|
try:
|
||||||
|
15
fifo/fifo.py
15
fifo/fifo.py
@ -68,10 +68,7 @@ class CapturePrint:
|
|||||||
self.string = None
|
self.string = None
|
||||||
|
|
||||||
def write(self, string):
|
def write(self, string):
|
||||||
if self.string is None:
|
self.string = string if self.string is None else self.string + "\n" + string
|
||||||
self.string = string
|
|
||||||
else:
|
|
||||||
self.string = self.string + "\n" + string
|
|
||||||
|
|
||||||
|
|
||||||
class FIFO(commands.Cog):
|
class FIFO(commands.Cog):
|
||||||
@ -197,8 +194,8 @@ class FIFO(commands.Cog):
|
|||||||
async def _get_tz(self, user: Union[discord.User, discord.Member]) -> Union[None, tzinfo]:
|
async def _get_tz(self, user: Union[discord.User, discord.Member]) -> Union[None, tzinfo]:
|
||||||
if self.tz_cog is None:
|
if self.tz_cog is None:
|
||||||
self.tz_cog = self.bot.get_cog("Timezone")
|
self.tz_cog = self.bot.get_cog("Timezone")
|
||||||
if self.tz_cog is None:
|
if self.tz_cog is None:
|
||||||
self.tz_cog = False # only try once to get the timezone cog
|
self.tz_cog = False # only try once to get the timezone cog
|
||||||
|
|
||||||
if not self.tz_cog:
|
if not self.tz_cog:
|
||||||
return None
|
return None
|
||||||
@ -230,8 +227,7 @@ class FIFO(commands.Cog):
|
|||||||
"""
|
"""
|
||||||
Base command for handling scheduling of tasks
|
Base command for handling scheduling of tasks
|
||||||
"""
|
"""
|
||||||
if ctx.invoked_subcommand is None:
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
@fifo.command(name="wakeup")
|
@fifo.command(name="wakeup")
|
||||||
async def fifo_wakeup(self, ctx: commands.Context):
|
async def fifo_wakeup(self, ctx: commands.Context):
|
||||||
@ -522,8 +518,7 @@ class FIFO(commands.Cog):
|
|||||||
"""
|
"""
|
||||||
Add a new trigger for a task from the current guild.
|
Add a new trigger for a task from the current guild.
|
||||||
"""
|
"""
|
||||||
if ctx.invoked_subcommand is None:
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
@fifo_trigger.command(name="interval")
|
@fifo_trigger.command(name="interval")
|
||||||
async def fifo_trigger_interval(
|
async def fifo_trigger_interval(
|
||||||
|
@ -55,8 +55,7 @@ class Flag(Cog):
|
|||||||
"""
|
"""
|
||||||
Commands for managing Flag settings
|
Commands for managing Flag settings
|
||||||
"""
|
"""
|
||||||
if ctx.invoked_subcommand is None:
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
@flagset.command(name="expire")
|
@flagset.command(name="expire")
|
||||||
async def flagset_expire(self, ctx: commands.Context, days: int):
|
async def flagset_expire(self, ctx: commands.Context, days: int):
|
||||||
|
@ -147,8 +147,7 @@ class Hangman(Cog):
|
|||||||
@checks.mod_or_permissions(administrator=True)
|
@checks.mod_or_permissions(administrator=True)
|
||||||
async def hangset(self, ctx):
|
async def hangset(self, ctx):
|
||||||
"""Adjust hangman settings"""
|
"""Adjust hangman settings"""
|
||||||
if ctx.invoked_subcommand is None:
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
@hangset.command()
|
@hangset.command()
|
||||||
async def face(self, ctx: commands.Context, theface):
|
async def face(self, ctx: commands.Context, theface):
|
||||||
@ -250,7 +249,7 @@ class Hangman(Cog):
|
|||||||
|
|
||||||
self.winbool[guild] = True
|
self.winbool[guild] = True
|
||||||
for i in self.the_data[guild]["answer"]:
|
for i in self.the_data[guild]["answer"]:
|
||||||
if i == " " or i == "-":
|
if i in [" ", "-"]:
|
||||||
out_str += i * 2
|
out_str += i * 2
|
||||||
elif i in self.the_data[guild]["guesses"] or i not in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":
|
elif i in self.the_data[guild]["guesses"] or i not in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":
|
||||||
out_str += "__" + i + "__ "
|
out_str += "__" + i + "__ "
|
||||||
@ -262,9 +261,7 @@ class Hangman(Cog):
|
|||||||
|
|
||||||
def _guesslist(self, guild):
|
def _guesslist(self, guild):
|
||||||
"""Returns the current letter list"""
|
"""Returns the current letter list"""
|
||||||
out_str = ""
|
out_str = "".join(str(i) + "," for i in self.the_data[guild]["guesses"])
|
||||||
for i in self.the_data[guild]["guesses"]:
|
|
||||||
out_str += str(i) + ","
|
|
||||||
out_str = out_str[:-1]
|
out_str = out_str[:-1]
|
||||||
|
|
||||||
return out_str
|
return out_str
|
||||||
|
@ -65,9 +65,9 @@ class InfoChannel(Cog):
|
|||||||
"offline": "Offline: {count}",
|
"offline": "Offline: {count}",
|
||||||
}
|
}
|
||||||
|
|
||||||
default_channel_ids = {k: None for k in self.default_channel_names.keys()}
|
default_channel_ids = {k: None for k in self.default_channel_names}
|
||||||
# Only members is enabled by default
|
# Only members is enabled by default
|
||||||
default_enabled_counts = {k: k == "members" for k in self.default_channel_names.keys()}
|
default_enabled_counts = {k: k == "members" for k in self.default_channel_names}
|
||||||
|
|
||||||
default_guild = {
|
default_guild = {
|
||||||
"category_id": None,
|
"category_id": None,
|
||||||
@ -159,8 +159,7 @@ class InfoChannel(Cog):
|
|||||||
"""
|
"""
|
||||||
Toggle different types of infochannels
|
Toggle different types of infochannels
|
||||||
"""
|
"""
|
||||||
if not ctx.invoked_subcommand:
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
@infochannelset.command(name="togglechannel")
|
@infochannelset.command(name="togglechannel")
|
||||||
async def _infochannelset_togglechannel(
|
async def _infochannelset_togglechannel(
|
||||||
|
@ -36,58 +36,6 @@ class LaunchLib(commands.Cog):
|
|||||||
|
|
||||||
async def _embed_launch_data(self, launch: ll.AsyncLaunch):
|
async def _embed_launch_data(self, launch: ll.AsyncLaunch):
|
||||||
|
|
||||||
if False:
|
|
||||||
example_launch = ll.AsyncLaunch(
|
|
||||||
id="9279744e-46b2-4eca-adea-f1379672ec81",
|
|
||||||
name="Atlas LV-3A | Samos 2",
|
|
||||||
tbddate=False,
|
|
||||||
tbdtime=False,
|
|
||||||
status={"id": 3, "name": "Success"},
|
|
||||||
inhold=False,
|
|
||||||
windowstart="1961-01-31 20:21:19+00:00",
|
|
||||||
windowend="1961-01-31 20:21:19+00:00",
|
|
||||||
net="1961-01-31 20:21:19+00:00",
|
|
||||||
info_urls=[],
|
|
||||||
vid_urls=[],
|
|
||||||
holdreason=None,
|
|
||||||
failreason=None,
|
|
||||||
probability=0,
|
|
||||||
hashtag=None,
|
|
||||||
agency=None,
|
|
||||||
changed=None,
|
|
||||||
pad=ll.Pad(
|
|
||||||
id=93,
|
|
||||||
name="Space Launch Complex 3W",
|
|
||||||
latitude=34.644,
|
|
||||||
longitude=-120.593,
|
|
||||||
map_url="http://maps.google.com/maps?q=34.644+N,+120.593+W",
|
|
||||||
retired=None,
|
|
||||||
total_launch_count=3,
|
|
||||||
agency_id=161,
|
|
||||||
wiki_url=None,
|
|
||||||
info_url=None,
|
|
||||||
location=ll.Location(
|
|
||||||
id=11,
|
|
||||||
name="Vandenberg AFB, CA, USA",
|
|
||||||
country_code="USA",
|
|
||||||
total_launch_count=83,
|
|
||||||
total_landing_count=3,
|
|
||||||
pads=None,
|
|
||||||
),
|
|
||||||
map_image="https://spacelaunchnow-prod-east.nyc3.digitaloceanspaces.com/media/launch_images/pad_93_20200803143225.jpg",
|
|
||||||
),
|
|
||||||
rocket=ll.Rocket(
|
|
||||||
id=2362,
|
|
||||||
name=None,
|
|
||||||
default_pads=None,
|
|
||||||
family=None,
|
|
||||||
wiki_url=None,
|
|
||||||
info_url=None,
|
|
||||||
image_url=None,
|
|
||||||
),
|
|
||||||
missions=None,
|
|
||||||
)
|
|
||||||
|
|
||||||
# status: ll.AsyncLaunchStatus = await launch.get_status()
|
# status: ll.AsyncLaunchStatus = await launch.get_status()
|
||||||
status = launch.status
|
status = launch.status
|
||||||
|
|
||||||
@ -102,11 +50,7 @@ class LaunchLib(commands.Cog):
|
|||||||
if launch.pad:
|
if launch.pad:
|
||||||
urls += [launch.pad.info_url, launch.pad.wiki_url]
|
urls += [launch.pad.info_url, launch.pad.wiki_url]
|
||||||
|
|
||||||
if urls:
|
url = next((url for url in urls if urls is not None), None) if urls else None
|
||||||
url = next((url for url in urls if urls is not None), None)
|
|
||||||
else:
|
|
||||||
url = None
|
|
||||||
|
|
||||||
color = discord.Color.green() if status["id"] in [1, 3] else discord.Color.red()
|
color = discord.Color.green() if status["id"] in [1, 3] else discord.Color.red()
|
||||||
|
|
||||||
em = discord.Embed(title=title, description=description, url=url, color=color)
|
em = discord.Embed(title=title, description=description, url=url, color=color)
|
||||||
@ -171,8 +115,7 @@ class LaunchLib(commands.Cog):
|
|||||||
@commands.group()
|
@commands.group()
|
||||||
async def launchlib(self, ctx: commands.Context):
|
async def launchlib(self, ctx: commands.Context):
|
||||||
"""Base command for getting launches"""
|
"""Base command for getting launches"""
|
||||||
if ctx.invoked_subcommand is None:
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
@launchlib.command()
|
@launchlib.command()
|
||||||
async def next(self, ctx: commands.Context, num_launches: int = 1):
|
async def next(self, ctx: commands.Context, num_launches: int = 1):
|
||||||
|
@ -25,8 +25,7 @@ class Leaver(Cog):
|
|||||||
@checks.mod_or_permissions(administrator=True)
|
@checks.mod_or_permissions(administrator=True)
|
||||||
async def leaverset(self, ctx):
|
async def leaverset(self, ctx):
|
||||||
"""Adjust leaver settings"""
|
"""Adjust leaver settings"""
|
||||||
if ctx.invoked_subcommand is None:
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
@leaverset.command()
|
@leaverset.command()
|
||||||
async def channel(self, ctx: Context):
|
async def channel(self, ctx: Context):
|
||||||
@ -57,5 +56,3 @@ class Leaver(Cog):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
await channel.send(out)
|
await channel.send(out)
|
||||||
else:
|
|
||||||
pass
|
|
||||||
|
@ -45,14 +45,12 @@ class LastSeen(Cog):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_date_time(s):
|
def get_date_time(s):
|
||||||
d = dateutil.parser.parse(s)
|
return dateutil.parser.parse(s)
|
||||||
return d
|
|
||||||
|
|
||||||
@commands.group(aliases=["setlseen"], name="lseenset")
|
@commands.group(aliases=["setlseen"], name="lseenset")
|
||||||
async def lset(self, ctx: commands.Context):
|
async def lset(self, ctx: commands.Context):
|
||||||
"""Change settings for lseen"""
|
"""Change settings for lseen"""
|
||||||
if ctx.invoked_subcommand is None:
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
@lset.command(name="toggle")
|
@lset.command(name="toggle")
|
||||||
async def lset_toggle(self, ctx: commands.Context):
|
async def lset_toggle(self, ctx: commands.Context):
|
||||||
|
@ -111,9 +111,8 @@ async def _withdraw_points(gardener: Gardener, amount):
|
|||||||
|
|
||||||
if (gardener.points - amount) < 0:
|
if (gardener.points - amount) < 0:
|
||||||
return False
|
return False
|
||||||
else:
|
gardener.points -= amount
|
||||||
gardener.points -= amount
|
return True
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
class PlantTycoon(commands.Cog):
|
class PlantTycoon(commands.Cog):
|
||||||
@ -245,11 +244,9 @@ class PlantTycoon(commands.Cog):
|
|||||||
await self._load_plants_products()
|
await self._load_plants_products()
|
||||||
|
|
||||||
modifiers = sum(
|
modifiers = sum(
|
||||||
[
|
self.products[product]["modifier"]
|
||||||
self.products[product]["modifier"]
|
for product in gardener.products
|
||||||
for product in gardener.products
|
if gardener.products[product] > 0
|
||||||
if gardener.products[product] > 0
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
degradation = (
|
degradation = (
|
||||||
@ -290,38 +287,31 @@ class PlantTycoon(commands.Cog):
|
|||||||
product = product.lower()
|
product = product.lower()
|
||||||
product_category = product_category.lower()
|
product_category = product_category.lower()
|
||||||
if product in self.products and self.products[product]["category"] == product_category:
|
if product in self.products and self.products[product]["category"] == product_category:
|
||||||
if product in gardener.products:
|
if product in gardener.products and gardener.products[product] > 0:
|
||||||
if gardener.products[product] > 0:
|
gardener.current["health"] += self.products[product]["health"]
|
||||||
gardener.current["health"] += self.products[product]["health"]
|
gardener.products[product] -= 1
|
||||||
gardener.products[product] -= 1
|
if gardener.products[product] == 0:
|
||||||
if gardener.products[product] == 0:
|
del gardener.products[product.lower()]
|
||||||
del gardener.products[product.lower()]
|
if product_category == "fertilizer":
|
||||||
if product_category == "water":
|
emoji = ":poop:"
|
||||||
emoji = ":sweat_drops:"
|
elif product_category == "water":
|
||||||
elif product_category == "fertilizer":
|
emoji = ":sweat_drops:"
|
||||||
emoji = ":poop:"
|
else:
|
||||||
# elif product_category == "tool":
|
emoji = ":scissors:"
|
||||||
|
message = "Your plant got some health back! {}".format(emoji)
|
||||||
|
if gardener.current["health"] > gardener.current["threshold"]:
|
||||||
|
gardener.current["health"] -= self.products[product]["damage"]
|
||||||
|
if product_category == "tool":
|
||||||
|
damage_msg = "You used {} too many times!".format(product)
|
||||||
else:
|
else:
|
||||||
emoji = ":scissors:"
|
damage_msg = "You gave too much of {}.".format(product)
|
||||||
message = "Your plant got some health back! {}".format(emoji)
|
message = "{} Your plant lost some health. :wilted_rose:".format(damage_msg)
|
||||||
if gardener.current["health"] > gardener.current["threshold"]:
|
gardener.points += self.defaults["points"]["add_health"]
|
||||||
gardener.current["health"] -= self.products[product]["damage"]
|
await gardener.save_gardener()
|
||||||
if product_category == "tool":
|
elif product in gardener.products or product_category != "tool":
|
||||||
damage_msg = "You used {} too many times!".format(product)
|
message = "You have no {}. Go buy some!".format(product)
|
||||||
else:
|
|
||||||
damage_msg = "You gave too much of {}.".format(product)
|
|
||||||
message = "{} Your plant lost some health. :wilted_rose:".format(
|
|
||||||
damage_msg
|
|
||||||
)
|
|
||||||
gardener.points += self.defaults["points"]["add_health"]
|
|
||||||
await gardener.save_gardener()
|
|
||||||
else:
|
|
||||||
message = "You have no {}. Go buy some!".format(product)
|
|
||||||
else:
|
else:
|
||||||
if product_category == "tool":
|
message = "You don't have a {}. Go buy one!".format(product)
|
||||||
message = "You don't have a {}. Go buy one!".format(product)
|
|
||||||
else:
|
|
||||||
message = "You have no {}. Go buy some!".format(product)
|
|
||||||
else:
|
else:
|
||||||
message = "Are you sure you are using {}?".format(product_category)
|
message = "Are you sure you are using {}?".format(product_category)
|
||||||
|
|
||||||
@ -412,24 +402,18 @@ class PlantTycoon(commands.Cog):
|
|||||||
gardener.current = plant
|
gardener.current = plant
|
||||||
await gardener.save_gardener()
|
await gardener.save_gardener()
|
||||||
|
|
||||||
em = discord.Embed(description=message, color=discord.Color.green())
|
|
||||||
else:
|
else:
|
||||||
plant = gardener.current
|
plant = gardener.current
|
||||||
message = "You're already growing {} **{}**, silly.".format(
|
message = "You're already growing {} **{}**, silly.".format(
|
||||||
plant["article"], plant["name"]
|
plant["article"], plant["name"]
|
||||||
)
|
)
|
||||||
em = discord.Embed(description=message, color=discord.Color.green())
|
em = discord.Embed(description=message, color=discord.Color.green())
|
||||||
|
|
||||||
await ctx.send(embed=em)
|
await ctx.send(embed=em)
|
||||||
|
|
||||||
@_gardening.command(name="profile")
|
@_gardening.command(name="profile")
|
||||||
async def _profile(self, ctx: commands.Context, *, member: discord.Member = None):
|
async def _profile(self, ctx: commands.Context, *, member: discord.Member = None):
|
||||||
"""Check your gardening profile."""
|
"""Check your gardening profile."""
|
||||||
if member is not None:
|
author = member if member is not None else ctx.author
|
||||||
author = member
|
|
||||||
else:
|
|
||||||
author = ctx.author
|
|
||||||
|
|
||||||
gardener = await self._gardener(author)
|
gardener = await self._gardener(author)
|
||||||
try:
|
try:
|
||||||
await self._apply_degradation(gardener)
|
await self._apply_degradation(gardener)
|
||||||
@ -440,9 +424,7 @@ class PlantTycoon(commands.Cog):
|
|||||||
avatar = author.avatar_url if author.avatar else author.default_avatar_url
|
avatar = author.avatar_url if author.avatar else author.default_avatar_url
|
||||||
em.set_author(name="Gardening profile of {}".format(author.name), icon_url=avatar)
|
em.set_author(name="Gardening profile of {}".format(author.name), icon_url=avatar)
|
||||||
em.add_field(name="**Thneeds**", value=str(gardener.points))
|
em.add_field(name="**Thneeds**", value=str(gardener.points))
|
||||||
if not gardener.current:
|
if gardener.current:
|
||||||
em.add_field(name="**Currently growing**", value="None")
|
|
||||||
else:
|
|
||||||
em.set_thumbnail(url=gardener.current["image"])
|
em.set_thumbnail(url=gardener.current["image"])
|
||||||
em.add_field(
|
em.add_field(
|
||||||
name="**Currently growing**",
|
name="**Currently growing**",
|
||||||
@ -450,16 +432,15 @@ class PlantTycoon(commands.Cog):
|
|||||||
gardener.current["name"], gardener.current["health"]
|
gardener.current["name"], gardener.current["health"]
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
em.add_field(name="**Currently growing**", value="None")
|
||||||
if not gardener.badges:
|
if not gardener.badges:
|
||||||
em.add_field(name="**Badges**", value="None")
|
em.add_field(name="**Badges**", value="None")
|
||||||
else:
|
else:
|
||||||
badges = ""
|
badges = "".join("{}\n".format(badge.capitalize()) for badge in gardener.badges)
|
||||||
for badge in gardener.badges:
|
|
||||||
badges += "{}\n".format(badge.capitalize())
|
|
||||||
em.add_field(name="**Badges**", value=badges)
|
em.add_field(name="**Badges**", value=badges)
|
||||||
if not gardener.products:
|
if gardener.products:
|
||||||
em.add_field(name="**Products**", value="None")
|
|
||||||
else:
|
|
||||||
products = ""
|
products = ""
|
||||||
for product_name, product_data in gardener.products.items():
|
for product_name, product_data in gardener.products.items():
|
||||||
if self.products[product_name] is None:
|
if self.products[product_name] is None:
|
||||||
@ -470,6 +451,8 @@ class PlantTycoon(commands.Cog):
|
|||||||
self.products[product_name]["modifier"],
|
self.products[product_name]["modifier"],
|
||||||
)
|
)
|
||||||
em.add_field(name="**Products**", value=products)
|
em.add_field(name="**Products**", value=products)
|
||||||
|
else:
|
||||||
|
em.add_field(name="**Products**", value="None")
|
||||||
if gardener.current:
|
if gardener.current:
|
||||||
degradation = await self._degradation(gardener)
|
degradation = await self._degradation(gardener)
|
||||||
die_in = await _die_in(gardener, degradation)
|
die_in = await _die_in(gardener, degradation)
|
||||||
@ -600,7 +583,6 @@ class PlantTycoon(commands.Cog):
|
|||||||
self.products[pd]["category"],
|
self.products[pd]["category"],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
await ctx.send(embed=em)
|
|
||||||
else:
|
else:
|
||||||
if amount <= 0:
|
if amount <= 0:
|
||||||
message = "Invalid amount! Must be greater than 1"
|
message = "Invalid amount! Must be greater than 1"
|
||||||
@ -629,7 +611,8 @@ class PlantTycoon(commands.Cog):
|
|||||||
else:
|
else:
|
||||||
message = "I don't have this product."
|
message = "I don't have this product."
|
||||||
em = discord.Embed(description=message, color=discord.Color.green())
|
em = discord.Embed(description=message, color=discord.Color.green())
|
||||||
await ctx.send(embed=em)
|
|
||||||
|
await ctx.send(embed=em)
|
||||||
|
|
||||||
@_gardening.command(name="convert")
|
@_gardening.command(name="convert")
|
||||||
async def _convert(self, ctx: commands.Context, amount: int):
|
async def _convert(self, ctx: commands.Context, amount: int):
|
||||||
@ -663,8 +646,7 @@ class PlantTycoon(commands.Cog):
|
|||||||
else:
|
else:
|
||||||
gardener.current = {}
|
gardener.current = {}
|
||||||
message = "You successfully shovelled your plant out."
|
message = "You successfully shovelled your plant out."
|
||||||
if gardener.points < 0:
|
gardener.points = max(gardener.points, 0)
|
||||||
gardener.points = 0
|
|
||||||
await gardener.save_gardener()
|
await gardener.save_gardener()
|
||||||
|
|
||||||
em = discord.Embed(description=message, color=discord.Color.dark_grey())
|
em = discord.Embed(description=message, color=discord.Color.dark_grey())
|
||||||
@ -681,12 +663,12 @@ class PlantTycoon(commands.Cog):
|
|||||||
except discord.Forbidden:
|
except discord.Forbidden:
|
||||||
# Couldn't DM the degradation
|
# Couldn't DM the degradation
|
||||||
await ctx.send("ERROR\nYou blocked me, didn't you?")
|
await ctx.send("ERROR\nYou blocked me, didn't you?")
|
||||||
product = "water"
|
|
||||||
product_category = "water"
|
|
||||||
if not gardener.current:
|
if not gardener.current:
|
||||||
message = "You're currently not growing a plant."
|
message = "You're currently not growing a plant."
|
||||||
await _send_message(channel, message)
|
await _send_message(channel, message)
|
||||||
else:
|
else:
|
||||||
|
product = "water"
|
||||||
|
product_category = "water"
|
||||||
await self._add_health(channel, gardener, product, product_category)
|
await self._add_health(channel, gardener, product, product_category)
|
||||||
|
|
||||||
@commands.command(name="fertilize")
|
@commands.command(name="fertilize")
|
||||||
@ -700,11 +682,11 @@ class PlantTycoon(commands.Cog):
|
|||||||
await ctx.send("ERROR\nYou blocked me, didn't you?")
|
await ctx.send("ERROR\nYou blocked me, didn't you?")
|
||||||
channel = ctx.channel
|
channel = ctx.channel
|
||||||
product = fertilizer
|
product = fertilizer
|
||||||
product_category = "fertilizer"
|
|
||||||
if not gardener.current:
|
if not gardener.current:
|
||||||
message = "You're currently not growing a plant."
|
message = "You're currently not growing a plant."
|
||||||
await _send_message(channel, message)
|
await _send_message(channel, message)
|
||||||
else:
|
else:
|
||||||
|
product_category = "fertilizer"
|
||||||
await self._add_health(channel, gardener, product, product_category)
|
await self._add_health(channel, gardener, product, product_category)
|
||||||
|
|
||||||
@commands.command(name="prune")
|
@commands.command(name="prune")
|
||||||
@ -717,12 +699,12 @@ class PlantTycoon(commands.Cog):
|
|||||||
# Couldn't DM the degradation
|
# Couldn't DM the degradation
|
||||||
await ctx.send("ERROR\nYou blocked me, didn't you?")
|
await ctx.send("ERROR\nYou blocked me, didn't you?")
|
||||||
channel = ctx.channel
|
channel = ctx.channel
|
||||||
product = "pruner"
|
|
||||||
product_category = "tool"
|
|
||||||
if not gardener.current:
|
if not gardener.current:
|
||||||
message = "You're currently not growing a plant."
|
message = "You're currently not growing a plant."
|
||||||
await _send_message(channel, message)
|
await _send_message(channel, message)
|
||||||
else:
|
else:
|
||||||
|
product = "pruner"
|
||||||
|
product_category = "tool"
|
||||||
await self._add_health(channel, gardener, product, product_category)
|
await self._add_health(channel, gardener, product, product_category)
|
||||||
|
|
||||||
# async def check_degradation(self):
|
# async def check_degradation(self):
|
||||||
|
@ -97,9 +97,7 @@ class ReactRestrict(Cog):
|
|||||||
"""
|
"""
|
||||||
current_combos = await self.combo_list()
|
current_combos = await self.combo_list()
|
||||||
|
|
||||||
to_keep = [
|
to_keep = [c for c in current_combos if c.message_id != message_id or c.role_id != role.id]
|
||||||
c for c in current_combos if not (c.message_id == message_id and c.role_id == role.id)
|
|
||||||
]
|
|
||||||
|
|
||||||
if to_keep != current_combos:
|
if to_keep != current_combos:
|
||||||
await self.set_combo_list(to_keep)
|
await self.set_combo_list(to_keep)
|
||||||
@ -210,8 +208,7 @@ class ReactRestrict(Cog):
|
|||||||
"""
|
"""
|
||||||
Base command for this cog. Check help for the commands list.
|
Base command for this cog. Check help for the commands list.
|
||||||
"""
|
"""
|
||||||
if ctx.invoked_subcommand is None:
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
@reactrestrict.command()
|
@reactrestrict.command()
|
||||||
async def add(self, ctx: commands.Context, message_id: int, *, role: discord.Role):
|
async def add(self, ctx: commands.Context, message_id: int, *, role: discord.Role):
|
||||||
|
@ -69,13 +69,12 @@ class RPSLS(Cog):
|
|||||||
|
|
||||||
def get_emote(self, choice):
|
def get_emote(self, choice):
|
||||||
if choice == "rock":
|
if choice == "rock":
|
||||||
emote = ":moyai:"
|
return ":moyai:"
|
||||||
elif choice == "spock":
|
elif choice == "spock":
|
||||||
emote = ":vulcan:"
|
return ":vulcan:"
|
||||||
elif choice == "paper":
|
elif choice == "paper":
|
||||||
emote = ":page_facing_up:"
|
return ":page_facing_up:"
|
||||||
elif choice in ["scissors", "lizard"]:
|
elif choice in ["scissors", "lizard"]:
|
||||||
emote = ":{}:".format(choice)
|
return ":{}:".format(choice)
|
||||||
else:
|
else:
|
||||||
emote = None
|
return None
|
||||||
return emote
|
|
||||||
|
@ -69,8 +69,7 @@ class StealEmoji(Cog):
|
|||||||
"""
|
"""
|
||||||
Base command for this cog. Check help for the commands list.
|
Base command for this cog. Check help for the commands list.
|
||||||
"""
|
"""
|
||||||
if ctx.invoked_subcommand is None:
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
@stealemoji.command(name="clearemojis")
|
@stealemoji.command(name="clearemojis")
|
||||||
@ -268,37 +267,36 @@ class StealEmoji(Cog):
|
|||||||
break
|
break
|
||||||
|
|
||||||
if guildbank is None:
|
if guildbank is None:
|
||||||
if await self.config.autobank():
|
if not await self.config.autobank():
|
||||||
try:
|
|
||||||
guildbank: discord.Guild = await self.bot.create_guild(
|
|
||||||
"StealEmoji Guildbank", code="S93bqTqKQ9rM"
|
|
||||||
)
|
|
||||||
except discord.HTTPException:
|
|
||||||
await self.config.autobank.set(False)
|
|
||||||
log.exception("Unable to create guilds, disabling autobank")
|
|
||||||
return
|
|
||||||
async with self.config.guildbanks() as guildbanks:
|
|
||||||
guildbanks.append(guildbank.id)
|
|
||||||
# Track generated guilds for easier deletion
|
|
||||||
async with self.config.autobanked_guilds() as autobanked_guilds:
|
|
||||||
autobanked_guilds.append(guildbank.id)
|
|
||||||
|
|
||||||
await asyncio.sleep(2)
|
|
||||||
|
|
||||||
if guildbank.text_channels:
|
|
||||||
channel = guildbank.text_channels[0]
|
|
||||||
else:
|
|
||||||
# Always hits the else.
|
|
||||||
# Maybe create_guild doesn't return guild object with
|
|
||||||
# the template channel?
|
|
||||||
channel = await guildbank.create_text_channel("invite-channel")
|
|
||||||
invite = await channel.create_invite()
|
|
||||||
|
|
||||||
await self.bot.send_to_owners(invite)
|
|
||||||
log.info(f"Guild created id {guildbank.id}. Invite: {invite}")
|
|
||||||
else:
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
|
guildbank: discord.Guild = await self.bot.create_guild(
|
||||||
|
"StealEmoji Guildbank", code="S93bqTqKQ9rM"
|
||||||
|
)
|
||||||
|
except discord.HTTPException:
|
||||||
|
await self.config.autobank.set(False)
|
||||||
|
log.exception("Unable to create guilds, disabling autobank")
|
||||||
|
return
|
||||||
|
async with self.config.guildbanks() as guildbanks:
|
||||||
|
guildbanks.append(guildbank.id)
|
||||||
|
# Track generated guilds for easier deletion
|
||||||
|
async with self.config.autobanked_guilds() as autobanked_guilds:
|
||||||
|
autobanked_guilds.append(guildbank.id)
|
||||||
|
|
||||||
|
await asyncio.sleep(2)
|
||||||
|
|
||||||
|
if guildbank.text_channels:
|
||||||
|
channel = guildbank.text_channels[0]
|
||||||
|
else:
|
||||||
|
# Always hits the else.
|
||||||
|
# Maybe create_guild doesn't return guild object with
|
||||||
|
# the template channel?
|
||||||
|
channel = await guildbank.create_text_channel("invite-channel")
|
||||||
|
invite = await channel.create_invite()
|
||||||
|
|
||||||
|
await self.bot.send_to_owners(invite)
|
||||||
|
log.info(f"Guild created id {guildbank.id}. Invite: {invite}")
|
||||||
# Next, have I saved this emoji before (because uploaded emoji != orignal emoji)
|
# Next, have I saved this emoji before (because uploaded emoji != orignal emoji)
|
||||||
|
|
||||||
if str(emoji.id) in await self.config.stolemoji():
|
if str(emoji.id) in await self.config.stolemoji():
|
||||||
|
@ -77,8 +77,7 @@ class Timerole(Cog):
|
|||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def timerole(self, ctx):
|
async def timerole(self, ctx):
|
||||||
"""Adjust timerole settings"""
|
"""Adjust timerole settings"""
|
||||||
if ctx.invoked_subcommand is None:
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
@timerole.command()
|
@timerole.command()
|
||||||
async def addrole(
|
async def addrole(
|
||||||
@ -201,7 +200,7 @@ class Timerole(Cog):
|
|||||||
reapply = all_guilds[guild_id]["reapply"]
|
reapply = all_guilds[guild_id]["reapply"]
|
||||||
role_dict = all_guilds[guild_id]["roles"]
|
role_dict = all_guilds[guild_id]["roles"]
|
||||||
|
|
||||||
if not any(role_data for role_data in role_dict.values()): # No roles
|
if not any(role_dict.values()): # No roles
|
||||||
log.debug(f"No roles are configured for guild: {guild}")
|
log.debug(f"No roles are configured for guild: {guild}")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -232,7 +231,7 @@ class Timerole(Cog):
|
|||||||
log.debug(f"{member.display_name} - Not time to check again yet")
|
log.debug(f"{member.display_name} - Not time to check again yet")
|
||||||
continue
|
continue
|
||||||
member: discord.Member
|
member: discord.Member
|
||||||
has_roles = set(r.id for r in member.roles)
|
has_roles = {r.id for r in member.roles}
|
||||||
|
|
||||||
# Stop if they currently have or don't have the role, and mark had_role
|
# Stop if they currently have or don't have the role, and mark had_role
|
||||||
if (int(role_id) in has_roles and not role_data["remove"]) or (
|
if (int(role_id) in has_roles and not role_data["remove"]) or (
|
||||||
|
@ -19,8 +19,7 @@ class Unicode(Cog):
|
|||||||
@commands.group(name="unicode", pass_context=True)
|
@commands.group(name="unicode", pass_context=True)
|
||||||
async def unicode(self, ctx):
|
async def unicode(self, ctx):
|
||||||
"""Encode/Decode a Unicode character."""
|
"""Encode/Decode a Unicode character."""
|
||||||
if ctx.invoked_subcommand is None:
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
@unicode.command()
|
@unicode.command()
|
||||||
async def decode(self, ctx: commands.Context, character):
|
async def decode(self, ctx: commands.Context, character):
|
||||||
|
@ -90,7 +90,7 @@ async def parse_code(code, game):
|
|||||||
if len(built) < digits:
|
if len(built) < digits:
|
||||||
built += c
|
built += c
|
||||||
|
|
||||||
if built == "T" or built == "W" or built == "N":
|
if built in ["T", "W", "N"]:
|
||||||
# Random Towns
|
# Random Towns
|
||||||
category = built
|
category = built
|
||||||
built = ""
|
built = ""
|
||||||
@ -116,8 +116,6 @@ async def parse_code(code, game):
|
|||||||
options = [role for role in ROLE_LIST if 10 + idx in role.category]
|
options = [role for role in ROLE_LIST if 10 + idx in role.category]
|
||||||
elif category == "N":
|
elif category == "N":
|
||||||
options = [role for role in ROLE_LIST if 20 + idx in role.category]
|
options = [role for role in ROLE_LIST if 20 + idx in role.category]
|
||||||
pass
|
|
||||||
|
|
||||||
if not options:
|
if not options:
|
||||||
raise IndexError("No Match Found")
|
raise IndexError("No Match Found")
|
||||||
|
|
||||||
@ -130,11 +128,8 @@ async def parse_code(code, game):
|
|||||||
|
|
||||||
async def encode(role_list, rand_roles):
|
async def encode(role_list, rand_roles):
|
||||||
"""Convert role list to code"""
|
"""Convert role list to code"""
|
||||||
out_code = ""
|
|
||||||
|
|
||||||
digit_sort = sorted(role for role in role_list if role < 10)
|
digit_sort = sorted(role for role in role_list if role < 10)
|
||||||
for role in digit_sort:
|
out_code = "".join(str(role) for role in digit_sort)
|
||||||
out_code += str(role)
|
|
||||||
|
|
||||||
digit_sort = sorted(role for role in role_list if 10 <= role < 100)
|
digit_sort = sorted(role for role in role_list if 10 <= role < 100)
|
||||||
if digit_sort:
|
if digit_sort:
|
||||||
|
@ -526,9 +526,10 @@ class Game:
|
|||||||
|
|
||||||
async def _notify(self, event_name, **kwargs):
|
async def _notify(self, event_name, **kwargs):
|
||||||
for i in range(1, 7): # action guide 1-6 (0 is no action)
|
for i in range(1, 7): # action guide 1-6 (0 is no action)
|
||||||
tasks = []
|
tasks = [
|
||||||
for event in self.listeners.get(event_name, {}).get(i, []):
|
asyncio.create_task(event(**kwargs))
|
||||||
tasks.append(asyncio.create_task(event(**kwargs)))
|
for event in self.listeners.get(event_name, {}).get(i, [])
|
||||||
|
]
|
||||||
|
|
||||||
# Run same-priority task simultaneously
|
# Run same-priority task simultaneously
|
||||||
await asyncio.gather(*tasks)
|
await asyncio.gather(*tasks)
|
||||||
@ -555,10 +556,7 @@ class Game:
|
|||||||
async def generate_targets(self, channel, with_roles=False):
|
async def generate_targets(self, channel, with_roles=False):
|
||||||
embed = discord.Embed(title="Remaining Players", description="[ID] - [Name]")
|
embed = discord.Embed(title="Remaining Players", description="[ID] - [Name]")
|
||||||
for i, player in enumerate(self.players):
|
for i, player in enumerate(self.players):
|
||||||
if player.alive:
|
status = "" if player.alive else "*[Dead]*-"
|
||||||
status = ""
|
|
||||||
else:
|
|
||||||
status = "*[Dead]*-"
|
|
||||||
if with_roles or not player.alive:
|
if with_roles or not player.alive:
|
||||||
embed.add_field(
|
embed.add_field(
|
||||||
name=f"{i} - {status}{player.member.display_name}",
|
name=f"{i} - {status}{player.member.display_name}",
|
||||||
@ -579,7 +577,7 @@ class Game:
|
|||||||
if channel_id not in self.p_channels:
|
if channel_id not in self.p_channels:
|
||||||
self.p_channels[channel_id] = self.default_secret_channel.copy()
|
self.p_channels[channel_id] = self.default_secret_channel.copy()
|
||||||
|
|
||||||
for x in range(10): # Retry 10 times
|
for _ in range(10): # Retry 10 times
|
||||||
try:
|
try:
|
||||||
await asyncio.sleep(1) # This will have multiple calls
|
await asyncio.sleep(1) # This will have multiple calls
|
||||||
self.p_channels[channel_id]["players"].append(role.player)
|
self.p_channels[channel_id]["players"].append(role.player)
|
||||||
@ -706,9 +704,7 @@ class Game:
|
|||||||
if not self.any_votes_remaining:
|
if not self.any_votes_remaining:
|
||||||
await channel.send("Voting is not allowed right now")
|
await channel.send("Voting is not allowed right now")
|
||||||
return
|
return
|
||||||
elif channel.name in self.p_channels:
|
elif channel.name not in self.p_channels:
|
||||||
pass
|
|
||||||
else:
|
|
||||||
# Not part of the game
|
# Not part of the game
|
||||||
await channel.send("Cannot vote in this channel")
|
await channel.send("Cannot vote in this channel")
|
||||||
return
|
return
|
||||||
@ -757,14 +753,14 @@ class Game:
|
|||||||
await self._at_voted(target)
|
await self._at_voted(target)
|
||||||
|
|
||||||
async def eval_results(self, target, source=None, method=None):
|
async def eval_results(self, target, source=None, method=None):
|
||||||
if method is not None:
|
if method is None:
|
||||||
out = "**{ID}** - " + method
|
|
||||||
return out.format(ID=target.id, target=target.member.display_name)
|
|
||||||
else:
|
|
||||||
return "**{ID}** - {target} the {role} was found dead".format(
|
return "**{ID}** - {target} the {role} was found dead".format(
|
||||||
ID=target.id, target=target.member.display_name, role=await target.role.get_role()
|
ID=target.id, target=target.member.display_name, role=await target.role.get_role()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
out = "**{ID}** - " + method
|
||||||
|
return out.format(ID=target.id, target=target.member.display_name)
|
||||||
|
|
||||||
async def _quit(self, player):
|
async def _quit(self, player):
|
||||||
"""
|
"""
|
||||||
Have player quit the game
|
Have player quit the game
|
||||||
|
@ -75,8 +75,7 @@ class Werewolf(Cog):
|
|||||||
"""
|
"""
|
||||||
Base command to adjust settings. Check help for command list.
|
Base command to adjust settings. Check help for command list.
|
||||||
"""
|
"""
|
||||||
if ctx.invoked_subcommand is None:
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@wwset.command(name="list")
|
@wwset.command(name="list")
|
||||||
@ -166,8 +165,7 @@ class Werewolf(Cog):
|
|||||||
"""
|
"""
|
||||||
Base command for this cog. Check help for the commands list.
|
Base command for this cog. Check help for the commands list.
|
||||||
"""
|
"""
|
||||||
if ctx.invoked_subcommand is None:
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@ww.command(name="new")
|
@ww.command(name="new")
|
||||||
@ -348,8 +346,7 @@ class Werewolf(Cog):
|
|||||||
"""
|
"""
|
||||||
Find custom roles by name, alignment, category, or ID
|
Find custom roles by name, alignment, category, or ID
|
||||||
"""
|
"""
|
||||||
if ctx.invoked_subcommand is None or ctx.invoked_subcommand == self.ww_search:
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
@ww_search.command(name="name")
|
@ww_search.command(name="name")
|
||||||
async def ww_search_name(self, ctx: commands.Context, *, name):
|
async def ww_search_name(self, ctx: commands.Context, *, name):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user