BREAKING: Move verification lines to config
FORK MAINTAINERS: Merging this without updating your config WILL lead to your bot not starting properly. This is done to make future upstream merges easier.
This commit is contained in:
parent
c5c5b45741
commit
38d8a4ce5f
3 changed files with 130 additions and 215 deletions
98
README.md
98
README.md
|
@ -31,104 +31,6 @@ If you're moving from Kurisu/Robocop, and want to preserve your data, you'll wan
|
|||
|
||||
---
|
||||
|
||||
## TODO
|
||||
|
||||
All Robocop features are now supported.
|
||||
|
||||
<details>
|
||||
<summary>List of added Kurisu/Robocop features</summary>
|
||||
<p>
|
||||
|
||||
- [x] .py configs
|
||||
- [x] membercount command
|
||||
- [x] Meme commands and pegaswitch (honestly the easiest part)
|
||||
- [x] source command
|
||||
- [x] robocop command
|
||||
- [x] Verification: Actual verification system
|
||||
- [x] Verification: Reset command
|
||||
- [x] Logging: joins
|
||||
- [x] Logging: leaves
|
||||
- [x] Logging: role changes
|
||||
- [x] Logging: bans
|
||||
- [x] Logging: kicks
|
||||
- [x] Moderation: speak
|
||||
- [x] Moderation: ban
|
||||
- [x] Moderation: silentban
|
||||
- [x] Moderation: kick
|
||||
- [x] Moderation: userinfo
|
||||
- [x] Moderation: approve-revoke (community)
|
||||
- [x] Moderation: addhacker-removehacker (hacker)
|
||||
- [x] Moderation: probate-unprobate (participant)
|
||||
- [x] Moderation: lock-softlock-unlock (channel lockdown)
|
||||
- [x] Moderation: mute-unmute
|
||||
- [x] Moderation: playing
|
||||
- [x] Moderation: botnickname
|
||||
- [x] Moderation: nickname
|
||||
- [x] Moderation: clear/purge
|
||||
- [x] Moderation: restrictions (people who leave with muted role will get muted role on join)
|
||||
- [x] Warns: warn
|
||||
- [x] Warns: listwarns-listwarnsid
|
||||
- [x] Warns: clearwarns-clearwarnsid
|
||||
- [x] Warns: delwarnid-delwarn
|
||||
- [x] .serr and .err (thanks tomger!)
|
||||
|
||||
</p>
|
||||
</details>
|
||||
|
||||
---
|
||||
|
||||
The main goal of this project, to get Robocop functionality done, is complete.
|
||||
|
||||
Secondary goal is adding new features:
|
||||
|
||||
- [ ] Purge: On purge, send logs in form of txt file to server logs
|
||||
- [ ] New feature: Modmail
|
||||
- [ ] New feature: Submiterr (relies on modmail)
|
||||
- [ ] Feature creep: Shortlink completion (gl/ao/etc)
|
||||
- [ ] New moderation feature: timelock (channel lockdown with time, relies on robocronp)
|
||||
|
||||
<details>
|
||||
<summary>Completed features</summary>
|
||||
<p>
|
||||
|
||||
- [x] Better security, better checks and better guild whitelisting
|
||||
- [x] Feature creep: Reminds
|
||||
- [x] A system for running jobs in background with an interval (will be called robocronp)
|
||||
- [x] Commands to list said jobs and remove them
|
||||
- [x] New moderation feature: timemute (mute with time, relies on robocronp)
|
||||
- [x] New moderation feature: timeban (ban with expiry, relies on robocronp)
|
||||
- [x] Improvements to lockdown to ensure that staff can talk
|
||||
- [x] New moderation feature: Display of mutes, bans and kicks on listwarns (.userlog now)
|
||||
- [x] New moderation feature: User notes
|
||||
- [x] New moderation feature: Reaction removing features (thanks misson20000!)
|
||||
- [x] New moderation feature: User nickname change
|
||||
- [x] New moderation feature: watch-unwatch
|
||||
- [x] New moderation feature: tracking suspicious keywords
|
||||
- [x] New moderation feature: tracking invites posted
|
||||
- [x] New self-moderation feature: .mywarns
|
||||
- [x] New feature: Highlights (problematic words automatically get posted to modmail channel, relies on modmail)
|
||||
|
||||
</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>TODO for robocronp</summary>
|
||||
<p>
|
||||
|
||||
- [ ] Reduce code repetition on mod_timed.py
|
||||
- [x] Allow non-hour values on timed bans
|
||||
|
||||
the following require me to rethink some of the lockdown code, which I don't feel like
|
||||
|
||||
- [ ] lockdown in helper
|
||||
- [ ] timelock command
|
||||
- [ ] working cronjob for unlock
|
||||
|
||||
</p>
|
||||
</details>
|
||||
|
||||
---
|
||||
|
||||
## Credits
|
||||
|
||||
Robocop-NG was initially developed by @aveao and @tumGER. It is currently maintained by @aveao. Similarly, the official robocop-ng on reswitched discord guild is hosted by @aveao too.
|
||||
|
|
|
@ -10,122 +10,10 @@ import itertools
|
|||
from helpers.checks import check_if_staff
|
||||
|
||||
|
||||
welcome_header = """
|
||||
<:ReSwitched:326421448543567872> __**Welcome to ReSwitched!**__
|
||||
|
||||
__**Be sure you read the following rules and information before participating. If you came here to ask about "backups", this is NOT the place.**__
|
||||
|
||||
__**Got questions about Nintendo Switch hacking? Before asking in the server, please see our FAQ at <https://reswitched.team/faq/> to see if your question has already been answered.**__
|
||||
|
||||
__**This is a server for technical discussion and development support. If you are looking for end-user support, the Nintendo Homebrew discord server may be a better fit: <https://discord.gg/C29hYvh>.**__
|
||||
|
||||
:bookmark_tabs:__Rules:__
|
||||
"""
|
||||
|
||||
welcome_rules = (
|
||||
# 1
|
||||
"""
|
||||
Read all the rules before participating in chat. Not reading the rules is *not* an excuse for breaking them.
|
||||
• It's suggested that you read channel topics and pins before asking questions as well, as some questions may have already been answered in those.
|
||||
""",
|
||||
|
||||
# 2
|
||||
"""
|
||||
Be nice to each other. It's fine to disagree, it's not fine to insult or attack other people.
|
||||
• You may disagree with anyone or anything you like, but you should try to keep it to opinions, and not people. Avoid vitriol.
|
||||
• Constant antagonistic behavior is considered uncivil and appropriate action will be taken.
|
||||
• The use of derogatory slurs -- sexist, racist, homophobic, transphobic, or otherwise -- is unacceptable and may be grounds for an immediate ban.
|
||||
""",
|
||||
|
||||
# 3
|
||||
'If you have concerns about another user, please take up your concerns with a staff member (someone with the "mod" role in the sidebar) in private. Don\'t publicly call other users out.',
|
||||
|
||||
# 4
|
||||
"""
|
||||
From time to time, we may mention everyone in the server. We do this when we feel something important is going on that requires attention. Complaining about these pings may result in a ban.
|
||||
• To disable notifications for these pings, suppress them in "ReSwitched → Notification Settings".
|
||||
""",
|
||||
|
||||
# 5
|
||||
"""
|
||||
Don't spam.
|
||||
• For excessively long text, use a service like <https://0bin.net/>.
|
||||
""",
|
||||
|
||||
# 6
|
||||
"Don't brigade, raid, or otherwise attack other people or communities. Don't discuss participation in these attacks. This may warrant an immediate permanent ban.",
|
||||
|
||||
# 7
|
||||
'Off-topic content goes to #off-topic. Keep low-quality content like memes out.',
|
||||
|
||||
# 8
|
||||
'Trying to evade, look for loopholes, or stay borderline within the rules will be treated as breaking them.',
|
||||
|
||||
# 9
|
||||
"""
|
||||
Absolutely no piracy or related discussion. This includes:
|
||||
• "Backups", even if you legally own a copy of the game.
|
||||
• "Installable" NSPs, XCIs, and NCAs; this **includes** installable homebrew (i.e. on the Home Menu instead of within nx-hbmenu).
|
||||
• Signature and ES patches, also known as "sigpatches"
|
||||
• Usage of piracy-focused groups' (Team Xecuter, etc.) hardware and software, such as SX OS.
|
||||
This is a zero-tolerance, non-negotiable policy that is enforced strictly and swiftly, up to and including instant bans without warning.
|
||||
""",
|
||||
|
||||
# 10
|
||||
'The first character of your server nickname should be alphanumeric if you wish to talk in chat.',
|
||||
|
||||
# 11
|
||||
"""
|
||||
Do not boost the server.
|
||||
• ReSwitched neither wants nor needs your server boosts, and your money is better off elsewhere. Consider the EFF (or a charity of your choice).
|
||||
• Boosting the server is liable to get you kicked (to remove the nitro boost role), and/or warned. Roles you possessed prior to the kick may not be restored in a timely fashion.
|
||||
"""
|
||||
)
|
||||
|
||||
welcome_footer = (
|
||||
"""
|
||||
:hash: __Channel Breakdown:__
|
||||
#news - Used exclusively for updates on ReSwitched progress and community information. Most major announcements are passed through this channel and whenever something is posted there it's usually something you'll want to look at.
|
||||
|
||||
#switch-hacking-meta - For "meta-discussion" related to hacking the switch. This is where we talk *about* the switch hacking that's going on, and where you can get clarification about the hacks that exist and the work that's being done.
|
||||
|
||||
#user-support - End-user focused support, mainly between users. Ask your questions about using switch homebrew here.
|
||||
|
||||
#tool-support - Developer focused support. Ask your questions about using PegaSwitch, libtransistor, Mephisto, and other tools here.
|
||||
|
||||
#hack-n-all - General hacking, hardware and software development channel for hacking on things *other* than the switch. This is a great place to ask about hacking other systems-- and for the community to have technical discussions.
|
||||
""",
|
||||
|
||||
"""
|
||||
#switch-hacking-general - Channel for everyone working on hacking the switch-- both in an exploit and a low-level hardware sense. This is where a lot of our in-the-open development goes on. Note that this isn't the place for developing homebrew-- we have #homebrew-development for that!
|
||||
|
||||
#homebrew-development - Discussion about the development of homebrew goes there. Feel free to show off your latest creation here.
|
||||
|
||||
#off-topic - Channel for discussion of anything that doesn't belong in #general. Anything goes, so long as you make sure to follow the rules and be on your best behavior.
|
||||
|
||||
#toolchain-development - Discussion about the development of libtransistor itself goes there.
|
||||
|
||||
#cfw-development - Development discussion regarding custom firmware (CFW) projects, such as Atmosphère. This channel is meant for the discussion accompanying active development.
|
||||
|
||||
#bot-cmds - Channel for excessive/random use of Robocop's various commands.
|
||||
|
||||
**If you are still not sure how to get access to the other channels, please read the rules again.**
|
||||
**If you have questions about the rules, feel free to ask here!**
|
||||
|
||||
**Note: This channel is completely automated (aside from responding to questions about the rules). If your message didn't give you access to the other channels, you failed the test. Feel free to try again.**
|
||||
""",
|
||||
)
|
||||
|
||||
hidden_term_line = ' • When you have finished reading all of the rules, send a message in this channel that includes the {0} hex digest of your discord "name#discriminator", and bot will automatically grant you access to the other channels. You can find your "name#discriminator" (your username followed by a ‘#’ and four numbers) under the discord channel list.'
|
||||
|
||||
|
||||
class Verification(Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
# https://docs.python.org/3.7/library/hashlib.html#shake-variable-length-digests
|
||||
self.blacklisted_hashes = {"shake_128", "shake_256"}
|
||||
self.hash_choice = random.choice(tuple(hashlib.algorithms_guaranteed -
|
||||
self.blacklisted_hashes))
|
||||
self.hash_choice = random.choice(config.welcome_hashes)
|
||||
|
||||
# Export reset channel functions
|
||||
self.bot.do_reset = self.do_reset
|
||||
|
@ -134,9 +22,9 @@ class Verification(Cog):
|
|||
async def do_reset(self, channel, author, limit: int = 100):
|
||||
await channel.purge(limit=limit)
|
||||
|
||||
await channel.send(welcome_header)
|
||||
await channel.send(config.welcome_header)
|
||||
rules = ['**{}**. {}'.format(i, cleandoc(r)) for i, r in
|
||||
enumerate(welcome_rules, 1)]
|
||||
enumerate(config.welcome_rules, 1)]
|
||||
rule_choice = random.randint(2, len(rules))
|
||||
hash_choice_str = self.hash_choice.upper()
|
||||
if hash_choice_str == "BLAKE2B":
|
||||
|
@ -144,7 +32,7 @@ class Verification(Cog):
|
|||
elif hash_choice_str == "BLAKE2S":
|
||||
hash_choice_str += "-256"
|
||||
rules[rule_choice - 1] += \
|
||||
'\n' + hidden_term_line.format(hash_choice_str)
|
||||
'\n' + config.hidden_term_line.format(hash_choice_str)
|
||||
msg = f"🗑 **Reset**: {author} cleared {limit} messages "\
|
||||
f" in {channel.mention}"
|
||||
msg += f"\n💬 __Current challenge location__: under rule {rule_choice}"
|
||||
|
@ -170,7 +58,7 @@ class Verification(Cog):
|
|||
await channel.send(item)
|
||||
await asyncio.sleep(1)
|
||||
|
||||
for x in welcome_footer:
|
||||
for x in config.welcome_footer:
|
||||
await channel.send(cleandoc(x))
|
||||
await asyncio.sleep(1)
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import hashlib
|
||||
import datetime
|
||||
|
||||
# Basic bot config, insert your token here, update description if you want
|
||||
|
@ -156,3 +157,127 @@ suspect_ignored_words = ["excit",
|
|||
# == Only if you want to use cogs.pin ==
|
||||
# Used for the pinboard. Leave empty if you don't wish for a gist pinboard.
|
||||
github_oauth_token = ""
|
||||
|
||||
# == For cogs.verification ==
|
||||
# ReSwitched verification system is rather unique.
|
||||
# You might want to reimplement it.
|
||||
# If you do, use a different name for easier upstream merge.
|
||||
|
||||
# https://docs.python.org/3.7/library/hashlib.html#shake-variable-length-digests
|
||||
_welcome_blacklisted_hashes = {"shake_128", "shake_256"}
|
||||
|
||||
# List of hashes that are to be used during verification
|
||||
welcome_hashes = tuple(hashlib.algorithms_guaranteed - _welcome_blacklisted_hashes)
|
||||
|
||||
# Header before rules in #newcomers - https://elixi.re/i/opviq90y.png
|
||||
welcome_header = """
|
||||
<:ReSwitched:326421448543567872> __**Welcome to ReSwitched!**__
|
||||
|
||||
__**Be sure you read the following rules and information before participating. If you came here to ask about "backups", this is NOT the place.**__
|
||||
|
||||
__**Got questions about Nintendo Switch hacking? Before asking in the server, please see our FAQ at <https://reswitched.team/faq/> to see if your question has already been answered.**__
|
||||
|
||||
__**This is a server for technical discussion and development support. If you are looking for end-user support, the Nintendo Homebrew discord server may be a better fit: <https://discord.gg/C29hYvh>.**__
|
||||
|
||||
:bookmark_tabs:__Rules:__
|
||||
"""
|
||||
|
||||
# Rules in #newcomers - https://elixi.re/i/dp3enq5i.png
|
||||
welcome_rules = (
|
||||
# 1
|
||||
"""
|
||||
Read all the rules before participating in chat. Not reading the rules is *not* an excuse for breaking them.
|
||||
• It's suggested that you read channel topics and pins before asking questions as well, as some questions may have already been answered in those.
|
||||
""",
|
||||
|
||||
# 2
|
||||
"""
|
||||
Be nice to each other. It's fine to disagree, it's not fine to insult or attack other people.
|
||||
• You may disagree with anyone or anything you like, but you should try to keep it to opinions, and not people. Avoid vitriol.
|
||||
• Constant antagonistic behavior is considered uncivil and appropriate action will be taken.
|
||||
• The use of derogatory slurs -- sexist, racist, homophobic, transphobic, or otherwise -- is unacceptable and may be grounds for an immediate ban.
|
||||
""",
|
||||
|
||||
# 3
|
||||
'If you have concerns about another user, please take up your concerns with a staff member (someone with the "mod" role in the sidebar) in private. Don\'t publicly call other users out.',
|
||||
|
||||
# 4
|
||||
"""
|
||||
From time to time, we may mention everyone in the server. We do this when we feel something important is going on that requires attention. Complaining about these pings may result in a ban.
|
||||
• To disable notifications for these pings, suppress them in "ReSwitched → Notification Settings".
|
||||
""",
|
||||
|
||||
# 5
|
||||
"""
|
||||
Don't spam.
|
||||
• For excessively long text, use a service like <https://0bin.net/>.
|
||||
""",
|
||||
|
||||
# 6
|
||||
"Don't brigade, raid, or otherwise attack other people or communities. Don't discuss participation in these attacks. This may warrant an immediate permanent ban.",
|
||||
|
||||
# 7
|
||||
'Off-topic content goes to #off-topic. Keep low-quality content like memes out.',
|
||||
|
||||
# 8
|
||||
'Trying to evade, look for loopholes, or stay borderline within the rules will be treated as breaking them.',
|
||||
|
||||
# 9
|
||||
"""
|
||||
Absolutely no piracy or related discussion. This includes:
|
||||
• "Backups", even if you legally own a copy of the game.
|
||||
• "Installable" NSPs, XCIs, and NCAs; this **includes** installable homebrew (i.e. on the Home Menu instead of within nx-hbmenu).
|
||||
• Signature and ES patches, also known as "sigpatches"
|
||||
• Usage of piracy-focused groups' (Team Xecuter, etc.) hardware and software, such as SX OS.
|
||||
This is a zero-tolerance, non-negotiable policy that is enforced strictly and swiftly, up to and including instant bans without warning.
|
||||
""",
|
||||
|
||||
# 10
|
||||
'The first character of your server nickname should be alphanumeric if you wish to talk in chat.',
|
||||
|
||||
# 11
|
||||
"""
|
||||
Do not boost the server.
|
||||
• ReSwitched neither wants nor needs your server boosts, and your money is better off elsewhere. Consider the EFF (or a charity of your choice).
|
||||
• Boosting the server is liable to get you kicked (to remove the nitro boost role), and/or warned. Roles you possessed prior to the kick may not be restored in a timely fashion.
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
# Footer after rules in #newcomers - https://elixi.re/i/uhfiecib.png
|
||||
welcome_footer = (
|
||||
"""
|
||||
:hash: __Channel Breakdown:__
|
||||
#news - Used exclusively for updates on ReSwitched progress and community information. Most major announcements are passed through this channel and whenever something is posted there it's usually something you'll want to look at.
|
||||
|
||||
#switch-hacking-meta - For "meta-discussion" related to hacking the switch. This is where we talk *about* the switch hacking that's going on, and where you can get clarification about the hacks that exist and the work that's being done.
|
||||
|
||||
#user-support - End-user focused support, mainly between users. Ask your questions about using switch homebrew here.
|
||||
|
||||
#tool-support - Developer focused support. Ask your questions about using PegaSwitch, libtransistor, Mephisto, and other tools here.
|
||||
|
||||
#hack-n-all - General hacking, hardware and software development channel for hacking on things *other* than the switch. This is a great place to ask about hacking other systems-- and for the community to have technical discussions.
|
||||
""",
|
||||
|
||||
"""
|
||||
#switch-hacking-general - Channel for everyone working on hacking the switch-- both in an exploit and a low-level hardware sense. This is where a lot of our in-the-open development goes on. Note that this isn't the place for developing homebrew-- we have #homebrew-development for that!
|
||||
|
||||
#homebrew-development - Discussion about the development of homebrew goes there. Feel free to show off your latest creation here.
|
||||
|
||||
#off-topic - Channel for discussion of anything that doesn't belong in #general. Anything goes, so long as you make sure to follow the rules and be on your best behavior.
|
||||
|
||||
#toolchain-development - Discussion about the development of libtransistor itself goes there.
|
||||
|
||||
#cfw-development - Development discussion regarding custom firmware (CFW) projects, such as Atmosphère. This channel is meant for the discussion accompanying active development.
|
||||
|
||||
#bot-cmds - Channel for excessive/random use of Robocop's various commands.
|
||||
|
||||
**If you are still not sure how to get access to the other channels, please read the rules again.**
|
||||
**If you have questions about the rules, feel free to ask here!**
|
||||
|
||||
**Note: This channel is completely automated (aside from responding to questions about the rules). If your message didn't give you access to the other channels, you failed the test. Feel free to try again.**
|
||||
""",
|
||||
)
|
||||
|
||||
# Line to be hidden in rules
|
||||
hidden_term_line = ' • When you have finished reading all of the rules, send a message in this channel that includes the {0} hex digest of your discord "name#discriminator", and bot will automatically grant you access to the other channels. You can find your "name#discriminator" (your username followed by a ‘#’ and four numbers) under the discord channel list.'
|
||||
|
|
Loading…
Reference in a new issue