mirror of
https://github.com/myned/modufur.git
synced 2025-01-31 18:15:19 +00:00
Change references to use id instead of object
This commit is contained in:
parent
d6ec61b648
commit
bc62169e90
3 changed files with 20 additions and 20 deletions
|
@ -337,12 +337,12 @@ class MsG(cmds.Cog):
|
||||||
@get.command(name='pool', aliases=['p'], brief='(get) Get pool from query', description='Return pool info for given query\n\nExample:\n\{p\}get pool 1145042')
|
@get.command(name='pool', aliases=['p'], brief='(get) Get pool from query', description='Return pool info for given query\n\nExample:\n\{p\}get pool 1145042')
|
||||||
async def _get_pool(self, ctx, *args):
|
async def _get_pool(self, ctx, *args):
|
||||||
def on_reaction(reaction, user):
|
def on_reaction(reaction, user):
|
||||||
if reaction.emoji == '\N{OCTAGONAL SIGN}' and reaction.message.id == ctx.message.id and user is ctx.author:
|
if reaction.emoji == '\N{OCTAGONAL SIGN}' and reaction.message.id == ctx.message.id and user.id is ctx.author.id:
|
||||||
raise exc.Abort(match)
|
raise exc.Abort(match)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def on_message(msg):
|
def on_message(msg):
|
||||||
return msg.content.isdigit() and int(msg.content) <= len(pools) and int(msg.content) > 0 and msg.author is ctx.author and msg.channel is ctx.channel
|
return msg.content.isdigit() and int(msg.content) <= len(pools) and int(msg.content) > 0 and msg.author.id is ctx.author.id and msg.channel.id is ctx.channel.id
|
||||||
|
|
||||||
try:
|
try:
|
||||||
kwargs = u.get_kwargs(ctx, args)
|
kwargs = u.get_kwargs(ctx, args)
|
||||||
|
@ -613,12 +613,12 @@ class MsG(cmds.Cog):
|
||||||
|
|
||||||
async def _get_pool(self, ctx, *, booru='e621', query=[]):
|
async def _get_pool(self, ctx, *, booru='e621', query=[]):
|
||||||
def on_reaction(reaction, user):
|
def on_reaction(reaction, user):
|
||||||
if reaction.emoji == '\N{OCTAGONAL SIGN}' and reaction.message.id == ctx.message.id and user is ctx.author:
|
if reaction.emoji == '\N{OCTAGONAL SIGN}' and reaction.message.id == ctx.message.id and user.id is ctx.author.id:
|
||||||
raise exc.Abort(match)
|
raise exc.Abort(match)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def on_message(msg):
|
def on_message(msg):
|
||||||
return msg.content.isdigit() and int(msg.content) <= len(pools) and int(msg.content) > 0 and msg.author is ctx.author and msg.channel is ctx.channel
|
return msg.content.isdigit() and int(msg.content) <= len(pools) and int(msg.content) > 0 and msg.author.id is ctx.author.id and msg.channel.id is ctx.channel.id
|
||||||
|
|
||||||
posts = {}
|
posts = {}
|
||||||
pool = {}
|
pool = {}
|
||||||
|
@ -748,20 +748,20 @@ class MsG(cmds.Cog):
|
||||||
@cmds.cooldown(1, 5, cmds.BucketType.member)
|
@cmds.cooldown(1, 5, cmds.BucketType.member)
|
||||||
async def pool_paginator(self, ctx, *args):
|
async def pool_paginator(self, ctx, *args):
|
||||||
def on_reaction(reaction, user):
|
def on_reaction(reaction, user):
|
||||||
if reaction.emoji == '\N{OCTAGONAL SIGN}' and reaction.message.id == ctx.message.id and (user is ctx.author or user.permissions_in(reaction.message.channel).manage_messages):
|
if reaction.emoji == '\N{OCTAGONAL SIGN}' and reaction.message.id == ctx.message.id and (user.id is ctx.author.id or user.permissions_in(reaction.message.channel).manage_messages):
|
||||||
raise exc.Abort
|
raise exc.Abort
|
||||||
elif reaction.emoji == '\N{HEAVY BLACK HEART}' and reaction.message.id == paginator.id and user is ctx.author:
|
elif reaction.emoji == '\N{HEAVY BLACK HEART}' and reaction.message.id == paginator.id and user.id is ctx.author.id:
|
||||||
raise exc.Save
|
raise exc.Save
|
||||||
elif reaction.emoji == '\N{LEFTWARDS BLACK ARROW}' and reaction.message.id == paginator.id and user is ctx.author:
|
elif reaction.emoji == '\N{LEFTWARDS BLACK ARROW}' and reaction.message.id == paginator.id and user.id is ctx.author.id:
|
||||||
raise exc.Left
|
raise exc.Left
|
||||||
elif reaction.emoji == '\N{NUMBER SIGN}\N{COMBINING ENCLOSING KEYCAP}' and reaction.message.id == paginator.id and user is ctx.author:
|
elif reaction.emoji == '\N{NUMBER SIGN}\N{COMBINING ENCLOSING KEYCAP}' and reaction.message.id == paginator.id and user.id is ctx.author.id:
|
||||||
raise exc.GoTo
|
raise exc.GoTo
|
||||||
elif reaction.emoji == '\N{BLACK RIGHTWARDS ARROW}' and reaction.message.id == paginator.id and user is ctx.author:
|
elif reaction.emoji == '\N{BLACK RIGHTWARDS ARROW}' and reaction.message.id == paginator.id and user.id is ctx.author.id:
|
||||||
raise exc.Right
|
raise exc.Right
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def on_message(msg):
|
def on_message(msg):
|
||||||
return msg.content.isdigit() and 0 <= int(msg.content) <= len(posts) and msg.author is ctx.author and msg.channel is ctx.channel
|
return msg.content.isdigit() and 0 <= int(msg.content) <= len(posts) and msg.author.id is ctx.author.id and msg.channel.id is ctx.channel.id
|
||||||
|
|
||||||
try:
|
try:
|
||||||
kwargs = u.get_kwargs(ctx, args)
|
kwargs = u.get_kwargs(ctx, args)
|
||||||
|
@ -883,18 +883,18 @@ class MsG(cmds.Cog):
|
||||||
|
|
||||||
async def _get_paginator(self, ctx, args, booru='e621'):
|
async def _get_paginator(self, ctx, args, booru='e621'):
|
||||||
def on_reaction(reaction, user):
|
def on_reaction(reaction, user):
|
||||||
if reaction.emoji == '\N{OCTAGONAL SIGN}' and reaction.message.id == ctx.message.id and (user is ctx.author or user.permissions_in(reaction.message.channel).manage_messages):
|
if reaction.emoji == '\N{OCTAGONAL SIGN}' and reaction.message.id == ctx.message.id and (user.id is ctx.author.id or user.permissions_in(reaction.message.channel).manage_messages):
|
||||||
raise exc.Abort
|
raise exc.Abort
|
||||||
elif reaction.emoji == '\N{HEAVY BLACK HEART}' and reaction.message.id == paginator.id and user is ctx.author:
|
elif reaction.emoji == '\N{HEAVY BLACK HEART}' and reaction.message.id == paginator.id and user.id is ctx.author.id:
|
||||||
raise exc.Save
|
raise exc.Save
|
||||||
elif reaction.emoji == '\N{LEFTWARDS BLACK ARROW}' and reaction.message.id == paginator.id and user is ctx.author:
|
elif reaction.emoji == '\N{LEFTWARDS BLACK ARROW}' and reaction.message.id == paginator.id and user.id is ctx.author.id:
|
||||||
raise exc.Left
|
raise exc.Left
|
||||||
elif reaction.emoji == '\N{BLACK RIGHTWARDS ARROW}' and reaction.message.id == paginator.id and user is ctx.author:
|
elif reaction.emoji == '\N{BLACK RIGHTWARDS ARROW}' and reaction.message.id == paginator.id and user.id is ctx.author.id:
|
||||||
raise exc.Right
|
raise exc.Right
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def on_message(msg):
|
def on_message(msg):
|
||||||
return msg.content.isdigit() and 0 <= int(msg.content) <= len(posts) and msg.author is ctx.author and msg.channel is ctx.channel
|
return msg.content.isdigit() and 0 <= int(msg.content) <= len(posts) and msg.author.id is ctx.author.id and msg.channel.id is ctx.channel.id
|
||||||
|
|
||||||
try:
|
try:
|
||||||
kwargs = u.get_kwargs(ctx, args)
|
kwargs = u.get_kwargs(ctx, args)
|
||||||
|
|
|
@ -40,7 +40,7 @@ class Admin(cmds.Cog):
|
||||||
@_prune_user.command(name='channel', aliases=['channels', 'chans', 'chan', 'ch', 'c'])
|
@_prune_user.command(name='channel', aliases=['channels', 'chans', 'chan', 'ch', 'c'])
|
||||||
async def _prune_user_channel(self, ctx, user: d.User, *channels: d.TextChannel):
|
async def _prune_user_channel(self, ctx, user: d.User, *channels: d.TextChannel):
|
||||||
def confirm(r, u):
|
def confirm(r, u):
|
||||||
if u is ctx.author:
|
if u.id is ctx.author.id:
|
||||||
if r.emoji == '\N{OCTAGONAL SIGN}':
|
if r.emoji == '\N{OCTAGONAL SIGN}':
|
||||||
raise exc.Abort
|
raise exc.Abort
|
||||||
if r.emoji == '\N{THUMBS UP SIGN}':
|
if r.emoji == '\N{THUMBS UP SIGN}':
|
||||||
|
@ -92,7 +92,7 @@ class Admin(cmds.Cog):
|
||||||
@cmds.is_owner()
|
@cmds.is_owner()
|
||||||
async def _prune_user_all(self, ctx, user: d.User):
|
async def _prune_user_all(self, ctx, user: d.User):
|
||||||
def confirm(r, u):
|
def confirm(r, u):
|
||||||
if u is ctx.author:
|
if u.id is ctx.author.id:
|
||||||
if r.emoji == '\N{OCTAGONAL SIGN}':
|
if r.emoji == '\N{OCTAGONAL SIGN}':
|
||||||
raise exc.Abort
|
raise exc.Abort
|
||||||
if r.emoji == '\N{THUMBS UP SIGN}':
|
if r.emoji == '\N{THUMBS UP SIGN}':
|
||||||
|
|
|
@ -213,19 +213,19 @@ class Tools(cmds.Cog):
|
||||||
@cmds.is_owner()
|
@cmds.is_owner()
|
||||||
async def console(self, ctx):
|
async def console(self, ctx):
|
||||||
def execute(msg):
|
def execute(msg):
|
||||||
if msg.content.lower().startswith('exec ') and msg.author is ctx.author and msg.channel is ctx.channel:
|
if msg.content.lower().startswith('exec ') and msg.author.id is ctx.author.id and msg.channel.id is ctx.channel.id:
|
||||||
msg.content = msg.content[5:]
|
msg.content = msg.content[5:]
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def evaluate(msg):
|
def evaluate(msg):
|
||||||
if msg.content.lower().startswith('eval ') and msg.author is ctx.author and msg.channel is ctx.channel:
|
if msg.content.lower().startswith('eval ') and msg.author.id is ctx.author.id and msg.channel.id is ctx.channel.id:
|
||||||
msg.content = msg.content[5:]
|
msg.content = msg.content[5:]
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def exit(reaction, user):
|
def exit(reaction, user):
|
||||||
if reaction.emoji == '\N{OCTAGONAL SIGN}' and user is ctx.author and reaction.message.id == ctx.message.id:
|
if reaction.emoji == '\N{OCTAGONAL SIGN}' and user.id is ctx.author.id and reaction.message.id == ctx.message.id:
|
||||||
raise exc.Abort
|
raise exc.Abort
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue