minor refactor
This commit is contained in:
parent
41c1636398
commit
c150526df8
|
@ -20,9 +20,6 @@ def generate_address(ctx):
|
||||||
channel_calls_cache = {}
|
channel_calls_cache = {}
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
async def server_mod_check(ctx):
|
|
||||||
return ctx.author.permissions_in(ctx.channel).manage_channels or (await bot.is_owner(ctx.author))
|
|
||||||
|
|
||||||
@bot.group(name="apiotelephone", aliases=["tel", "tele", "telephone", "apiotel"], brief="ApioTelephone lets you 'call' other servers.", help=f"""
|
@bot.group(name="apiotelephone", aliases=["tel", "tele", "telephone", "apiotel"], brief="ApioTelephone lets you 'call' other servers.", help=f"""
|
||||||
Call other (participating) servers with ApioTelephone! To configure a channel for telephony, do `{bot.command_prefix}tel setup` (requires Manage Channels).
|
Call other (participating) servers with ApioTelephone! To configure a channel for telephony, do `{bot.command_prefix}tel setup` (requires Manage Channels).
|
||||||
It's recommended that you give the bot Manage Webhooks permissions in this channel so that it can use webhook calls mode.
|
It's recommended that you give the bot Manage Webhooks permissions in this channel so that it can use webhook calls mode.
|
||||||
|
@ -78,7 +75,7 @@ def setup(bot):
|
||||||
await asyncio.gather(*map(send_to, calls))
|
await asyncio.gather(*map(send_to, calls))
|
||||||
|
|
||||||
@telephone.command()
|
@telephone.command()
|
||||||
@commands.check(server_mod_check)
|
@commands.check(util.server_mod_check(bot))
|
||||||
async def setup(ctx):
|
async def setup(ctx):
|
||||||
num = generate_address(ctx)
|
num = generate_address(ctx)
|
||||||
await ctx.send(f"Your address is {num}.")
|
await ctx.send(f"Your address is {num}.")
|
||||||
|
|
|
@ -224,4 +224,9 @@ def unlyric(text):
|
||||||
def gen_codeblock(content):
|
def gen_codeblock(content):
|
||||||
return "```\n" + content.replace("```", "\\`\\`\\`")[:1900] + "\n```"
|
return "```\n" + content.replace("```", "\\`\\`\\`")[:1900] + "\n```"
|
||||||
|
|
||||||
def json_encode(x): return json.dumps(x, separators=(',', ':'))
|
def json_encode(x): return json.dumps(x, separators=(',', ':'))
|
||||||
|
|
||||||
|
def server_mod_check(bot):
|
||||||
|
async def check(ctx):
|
||||||
|
return ctx.author.permissions_in(ctx.channel).manage_channels or (await bot.is_owner(ctx.author))
|
||||||
|
return check
|
Loading…
Reference in New Issue