mirror of
https://github.com/Ryujinx/ryuko-ng.git
synced 2025-01-03 16:45:33 +00:00
Rewrite the verification code to the one required by Ryujinx Guild
This commit is contained in:
parent
3309ad6a23
commit
0877351cca
|
@ -589,12 +589,6 @@ class Mod(Cog):
|
||||||
if warn_count == 2:
|
if warn_count == 2:
|
||||||
msg += " __The next warn will automatically kick.__"
|
msg += " __The next warn will automatically kick.__"
|
||||||
if warn_count == 3:
|
if warn_count == 3:
|
||||||
msg += (
|
|
||||||
"\n\nYou were kicked because of this warning. "
|
|
||||||
"You can join again right away. "
|
|
||||||
"Two more warnings will result in an automatic ban."
|
|
||||||
)
|
|
||||||
if warn_count == 4:
|
|
||||||
msg += (
|
msg += (
|
||||||
"\n\nYou were kicked because of this warning. "
|
"\n\nYou were kicked because of this warning. "
|
||||||
"This is your final warning. "
|
"This is your final warning. "
|
||||||
|
@ -602,8 +596,8 @@ class Mod(Cog):
|
||||||
"**one more warn will result in a ban**."
|
"**one more warn will result in a ban**."
|
||||||
)
|
)
|
||||||
chan_msg += "**This resulted in an auto-kick.**\n"
|
chan_msg += "**This resulted in an auto-kick.**\n"
|
||||||
if warn_count == 5:
|
if warn_count == 4:
|
||||||
msg += "\n\nYou were automatically banned due to five warnings."
|
msg += "\n\nYou were automatically banned due to four warnings."
|
||||||
chan_msg += "**This resulted in an auto-ban.**\n"
|
chan_msg += "**This resulted in an auto-ban.**\n"
|
||||||
try:
|
try:
|
||||||
await target.send(msg)
|
await target.send(msg)
|
||||||
|
@ -611,9 +605,9 @@ class Mod(Cog):
|
||||||
# Prevents log issues in cases where user blocked bot
|
# Prevents log issues in cases where user blocked bot
|
||||||
# or has DMs disabled
|
# or has DMs disabled
|
||||||
pass
|
pass
|
||||||
if warn_count == 3 or warn_count == 4:
|
if warn_count == 3:
|
||||||
await target.kick()
|
await target.kick()
|
||||||
if warn_count >= 5: # just in case
|
if warn_count >= 4: # just in case
|
||||||
await target.ban(reason="exceeded warn limit", delete_message_days=0)
|
await target.ban(reason="exceeded warn limit", delete_message_days=0)
|
||||||
await ctx.send(
|
await ctx.send(
|
||||||
f"{target.mention} warned. " f"User has {warn_count} warning(s)."
|
f"{target.mention} warned. " f"User has {warn_count} warning(s)."
|
||||||
|
|
94
robocop_ng/cogs/ryujinx_verification.py
Normal file
94
robocop_ng/cogs/ryujinx_verification.py
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
import discord
|
||||||
|
from discord.ext import commands
|
||||||
|
from discord.ext.commands import Cog
|
||||||
|
import config
|
||||||
|
import random
|
||||||
|
from helpers.checks import check_if_staff
|
||||||
|
|
||||||
|
|
||||||
|
class RyujinxVerification(Cog):
|
||||||
|
def __init__(self, bot):
|
||||||
|
self.bot = bot
|
||||||
|
|
||||||
|
# Export reset channel functions
|
||||||
|
self.bot.do_reset = self.do_reset
|
||||||
|
self.bot.do_resetalgo = self.do_resetalgo
|
||||||
|
|
||||||
|
@Cog.listener()
|
||||||
|
async def on_member_join(self, member):
|
||||||
|
await self.bot.wait_until_ready()
|
||||||
|
|
||||||
|
if (member.guild.id not in config.guild_whitelist):
|
||||||
|
return
|
||||||
|
|
||||||
|
join_channel = self.bot.get_channel(config.welcome_channel)
|
||||||
|
|
||||||
|
if join_channel is not None:
|
||||||
|
await join_channel.send('Hello {0.mention}! Welcome to Ryujinx! Please read the <#411271165429022730>, and then type the verifying command here to gain access to the rest of the channels.\n\nIf you need help with basic common questions, visit the <#585288848704143371> channel after joining.\n\nIf you need help with Animal Crossing visit the <#692104087889641472> channel for common issues and solutions. If you need help that is not Animal Crossing related, please visit the <#410208610455519243> channel after verifying.'.format(member))
|
||||||
|
|
||||||
|
async def process_message(self, message):
|
||||||
|
"""Process the verification process"""
|
||||||
|
if message.channel.id == config.welcome_channel:
|
||||||
|
# Assign common stuff into variables to make stuff less of a mess
|
||||||
|
mcl = message.content.lower()
|
||||||
|
|
||||||
|
# Get the role we will give in case of success
|
||||||
|
success_role = message.guild.get_role(config.participant_role)
|
||||||
|
|
||||||
|
if config.verification_string == mcl:
|
||||||
|
await message.author.add_roles(success_role)
|
||||||
|
await message.delete()
|
||||||
|
|
||||||
|
@Cog.listener()
|
||||||
|
async def on_message(self, message):
|
||||||
|
if message.author.bot:
|
||||||
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
|
await self.process_message(message)
|
||||||
|
except discord.errors.Forbidden:
|
||||||
|
chan = self.bot.get_channel(message.channel)
|
||||||
|
await chan.send("💢 I don't have permission to do this.")
|
||||||
|
|
||||||
|
@Cog.listener()
|
||||||
|
async def on_message_edit(self, before, after):
|
||||||
|
if after.author.bot:
|
||||||
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
|
await self.process_message(after)
|
||||||
|
except discord.errors.Forbidden:
|
||||||
|
chan = self.bot.get_channel(after.channel)
|
||||||
|
await chan.send("💢 I don't have permission to do this.")
|
||||||
|
|
||||||
|
@Cog.listener()
|
||||||
|
async def on_member_join(self, member):
|
||||||
|
await self.bot.wait_until_ready()
|
||||||
|
|
||||||
|
if (member.guild.id not in config.guild_whitelist):
|
||||||
|
return
|
||||||
|
|
||||||
|
join_channel = self.bot.get_channel(config.welcome_channel)
|
||||||
|
|
||||||
|
if join_channel is not None:
|
||||||
|
await join_channel.send(config.join_message.format(member))
|
||||||
|
|
||||||
|
@commands.check(check_if_staff)
|
||||||
|
@commands.command()
|
||||||
|
async def reset(self, ctx, limit: int = 100, force: bool = False):
|
||||||
|
"""Wipes messages and pastes the welcome message again. Staff only."""
|
||||||
|
if ctx.message.channel.id != config.welcome_channel and not force:
|
||||||
|
await ctx.send(f"This command is limited to"
|
||||||
|
f" <#{config.welcome_channel}>, unless forced.")
|
||||||
|
return
|
||||||
|
await self.do_reset(ctx.channel, ctx.author.mention, limit)
|
||||||
|
|
||||||
|
async def do_reset(self, channel, author, limit: int = 100):
|
||||||
|
await channel.purge(limit=limit)
|
||||||
|
|
||||||
|
async def do_resetalgo(self, channel, author, limit: int = 100):
|
||||||
|
# We only auto clear the channel daily
|
||||||
|
await self.do_reset(channel, author)
|
||||||
|
|
||||||
|
def setup(bot):
|
||||||
|
bot.add_cog(RyujinxVerification(bot))
|
|
@ -51,6 +51,10 @@ initial_cogs = [
|
||||||
# and sends pins above limit to a github gist
|
# and sends pins above limit to a github gist
|
||||||
|
|
||||||
|
|
||||||
|
# The string that users need to say to get past verification
|
||||||
|
verification_string = "go read the rules, not the code"
|
||||||
|
|
||||||
|
|
||||||
# Minimum account age required to join the guild
|
# Minimum account age required to join the guild
|
||||||
# If user's account creation is shorter than the time delta given here
|
# If user's account creation is shorter than the time delta given here
|
||||||
# then user will be kicked and informed
|
# then user will be kicked and informed
|
||||||
|
|
Loading…
Reference in a new issue