mirror of
https://github.com/Ryujinx/ryuko-ng.git
synced 2024-12-22 20:35:36 +00:00
Move some count commands over to a separate cog
This commit is contained in:
parent
cdd98f49b5
commit
4450573013
|
@ -27,29 +27,11 @@ class Basic(Cog):
|
|||
"""Converts base 10 to 16"""
|
||||
await ctx.send(f"{ctx.author.mention}: {int(num, 16)}")
|
||||
|
||||
@commands.guild_only()
|
||||
@commands.command()
|
||||
async def communitycount(self, ctx):
|
||||
"""Prints the community member count of the server."""
|
||||
community = ctx.guild.get_role(config.named_roles["community"])
|
||||
await ctx.send(
|
||||
f"{ctx.guild.name} has " f"{len(community.members)} community members!"
|
||||
)
|
||||
|
||||
@commands.guild_only()
|
||||
@commands.command()
|
||||
async def hackercount(self, ctx):
|
||||
"""Prints the hacker member count of the server."""
|
||||
h4x0r = ctx.guild.get_role(config.named_roles["hacker"])
|
||||
await ctx.send(
|
||||
f"{ctx.guild.name} has " f"{len(h4x0r.members)} people with hacker role!"
|
||||
)
|
||||
|
||||
@commands.guild_only()
|
||||
@commands.command()
|
||||
async def membercount(self, ctx):
|
||||
"""Prints the member count of the server."""
|
||||
await ctx.send(f"{ctx.guild.name} has " f"{ctx.guild.member_count} members!")
|
||||
await ctx.send(f"{ctx.guild.name} has {ctx.guild.member_count} members!")
|
||||
|
||||
@commands.command(aliases=["robocopng", "robocop-ng"])
|
||||
async def robocop(self, ctx):
|
||||
|
@ -75,7 +57,7 @@ class Basic(Cog):
|
|||
gw_ms = self.bot.latency * 1000
|
||||
|
||||
message_text = (
|
||||
f":ping_pong:\n" f"rtt: `{rtt_ms:.1f}ms`\n" f"gw: `{gw_ms:.1f}ms`"
|
||||
f":ping_pong:\nrtt: `{rtt_ms:.1f}ms`\ngw: `{gw_ms:.1f}ms`"
|
||||
)
|
||||
self.bot.log.info(message_text)
|
||||
await tmp.edit(content=message_text)
|
||||
|
|
30
cogs/basic_reswitched.py
Normal file
30
cogs/basic_reswitched.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
import config
|
||||
from discord.ext import commands
|
||||
from discord.ext.commands import Cog
|
||||
|
||||
|
||||
class BasicReswitched(Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
@commands.guild_only()
|
||||
@commands.command()
|
||||
async def communitycount(self, ctx):
|
||||
"""Prints the community member count of the server."""
|
||||
community = ctx.guild.get_role(config.named_roles["community"])
|
||||
await ctx.send(
|
||||
f"{ctx.guild.name} has {len(community.members)} community members!"
|
||||
)
|
||||
|
||||
@commands.guild_only()
|
||||
@commands.command()
|
||||
async def hackercount(self, ctx):
|
||||
"""Prints the hacker member count of the server."""
|
||||
h4x0r = ctx.guild.get_role(config.named_roles["hacker"])
|
||||
await ctx.send(
|
||||
f"{ctx.guild.name} has {len(h4x0r.members)} people with hacker role!"
|
||||
)
|
||||
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(BasicReswitched(bot))
|
|
@ -35,7 +35,7 @@ class Robocronp(Cog):
|
|||
job_details = repr(ctab[jobtype][jobtimestamp][job_name])
|
||||
embed.add_field(
|
||||
name=f"{jobtype} for {job_name}",
|
||||
value=f"Timestamp: {jobtimestamp}, " f"Details: {job_details}",
|
||||
value=f"Timestamp: {jobtimestamp}, Details: {job_details}",
|
||||
inline=False,
|
||||
)
|
||||
await ctx.send(embed=embed)
|
||||
|
@ -82,7 +82,7 @@ class Robocronp(Cog):
|
|||
target = await self.bot.fetch_user(int(job_name))
|
||||
if target:
|
||||
await target.send(
|
||||
"You asked to be reminded about" f" `{text}` on {added_on}."
|
||||
f"You asked to be reminded about `{text}` on {added_on}."
|
||||
)
|
||||
delete_job(timestamp, jobtype, job_name)
|
||||
except:
|
||||
|
@ -105,12 +105,12 @@ class Robocronp(Cog):
|
|||
if len(purge_res) != 100:
|
||||
done_cleaning = True
|
||||
await log_channel.send(
|
||||
f"Wiped {count} messages from " f"<#{channel.id}> automatically."
|
||||
f"Wiped {count} messages from <#{channel.id}> automatically."
|
||||
)
|
||||
except:
|
||||
# Don't kill cronjobs if something goes wrong.
|
||||
await log_channel.send(
|
||||
"Cronclean has errored: ```" f"{traceback.format_exc()}```"
|
||||
f"Cronclean has errored: ```{traceback.format_exc()}```"
|
||||
)
|
||||
|
||||
async def minutely(self):
|
||||
|
@ -131,7 +131,7 @@ class Robocronp(Cog):
|
|||
except:
|
||||
# Don't kill cronjobs if something goes wrong.
|
||||
await log_channel.send(
|
||||
"Cron-minutely has errored: ```" f"{traceback.format_exc()}```"
|
||||
f"Cron-minutely has errored: ```{traceback.format_exc()}```"
|
||||
)
|
||||
await asyncio.sleep(60)
|
||||
|
||||
|
@ -151,7 +151,7 @@ class Robocronp(Cog):
|
|||
except:
|
||||
# Don't kill cronjobs if something goes wrong.
|
||||
await log_channel.send(
|
||||
"Cron-hourly has errored: ```" f"{traceback.format_exc()}```"
|
||||
f"Cron-hourly has errored: ```{traceback.format_exc()}```"
|
||||
)
|
||||
# Your stuff that should run an hour after boot
|
||||
# and after that every hour goes here
|
||||
|
@ -170,7 +170,7 @@ class Robocronp(Cog):
|
|||
except:
|
||||
# Don't kill cronjobs if something goes wrong.
|
||||
await log_channel.send(
|
||||
"Cron-daily has errored: ```" f"{traceback.format_exc()}```"
|
||||
f"Cron-daily has errored: ```{traceback.format_exc()}```"
|
||||
)
|
||||
await asyncio.sleep(86400)
|
||||
# Your stuff that should run a day after boot
|
||||
|
|
Loading…
Reference in a new issue