Skip to content
Open
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
14 changes: 8 additions & 6 deletions targeter/targeter.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,10 @@ async def red_delete_data_for_user(self, **kwargs):
"""This cog does not store user data"""
return

def lookup(self, ctx, args):
matched = ctx.guild.members
def lookup(self, ctx, args, server):
if not self.bot.is_owner(ctx.author):
server = ctx.guild
matched = server.members
passed = []
# --- Go through each possible argument ---

Expand Down Expand Up @@ -721,26 +723,26 @@ def lookup(self, ctx, args):
return all_passed.intersection(*passed)

# API for other cogs
async def args_to_list(self, ctx: commands.Context, args: str):
async def args_to_list(self, ctx: commands.Context, args: str, server: commands.GuildConverter):
"""
Returns a list of members from the given args, which are
expected to follow the style in the Args converter above.
"""
args = await Args().convert(ctx, args)
compact = functools.partial(self.lookup, ctx, args)
compact = functools.partial(self.lookup, ctx, args, server)
matched = await self.bot.loop.run_in_executor(None, compact)
return matched

@checks.bot_has_permissions(embed_links=True)
@commands.guild_only()
@commands.group(invoke_without_command=True)
async def target(self, ctx, *, args: Args):
async def target(self, ctx, server: commands.GuildConverter, *, args: Args):
"""Targets users based on the passed arguments.

Run `[p]target help` to see a list of valid arguments."""
# await ctx.send(args)
async with ctx.typing():
compact = functools.partial(self.lookup, ctx, args)
compact = functools.partial(self.lookup, ctx, args, server)
matched = await self.bot.loop.run_in_executor(None, compact)

if len(matched) != 0:
Expand Down