瀏覽代碼

added checks for if a server wants to disabled risque commands and applied the checks to suck and spank

tags/v1.3.0
roxie 6 年之前
父節點
當前提交
bf502b9c5c
共有 5 個文件被更改,包括 23 次插入4 次删除
  1. +2
    -1
      checks.py
  2. +3
    -0
      cogs/fun.py
  3. +15
    -1
      cogs/settings.py
  4. +2
    -1
      config/server_config.py
  5. +1
    -1
      config/servers.json

+ 2
- 1
checks.py 查看文件

def is_nfsw_enabled(): def is_nfsw_enabled():
return commands.check(lambda ctx: nsfw_predicate(ctx)) return commands.check(lambda ctx: nsfw_predicate(ctx))



def is_anal():
return commands.check(lambda ctx: ServerConfig().load_config()[ctx.message.server.id]["is_anal"]["y/n"])


def not_pm(): def not_pm():
return commands.check(lambda ctx: ctx.message.channel.type != discord.ChannelType.private) return commands.check(lambda ctx: ctx.message.channel.type != discord.ChannelType.private)

+ 3
- 0
cogs/fun.py 查看文件

import discord import discord
import random import random
import checks
from discord.ext.commands import bot from discord.ext.commands import bot




roll = random.randrange(step, dice + 1, step) roll = random.randrange(step, dice + 1, step)
return await self.bot.say("{} rolled a **{}**".format(ctx.message.author.mention, roll)) return await self.bot.say("{} rolled a **{}**".format(ctx.message.author.mention, roll))


@checks.is_anal()
@bot.command(pass_context=True) @bot.command(pass_context=True)
async def spank(self, ctx, *, user: discord.User = None): async def spank(self, ctx, *, user: discord.User = None):
""" """
return await self.bot.say("You didn't mention someone for me to spank") return await self.bot.say("You didn't mention someone for me to spank")
return await self.bot.say(":peach: :wave: *{} spanks {}*".format(self.bot.user.name, user.name)) return await self.bot.say(":peach: :wave: *{} spanks {}*".format(self.bot.user.name, user.name))


@checks.is_anal()
@bot.command(pass_context=True) @bot.command(pass_context=True)
async def suck(self, ctx, *, user: discord.User = None): async def suck(self, ctx, *, user: discord.User = None):
""" """

+ 15
- 1
cogs/settings.py 查看文件





@group(pass_context=True, hidden=True) @group(pass_context=True, hidden=True)
@checks.is_bot_owner()
@checks.is_admin_or_mod()
async def set(self, ctx): async def set(self, ctx):
if ctx.invoked_subcommand is None: if ctx.invoked_subcommand is None:
return await self.bot.say('Missing Argument') return await self.bot.say('Missing Argument')
self.con.update_config(self.servers) self.con.update_config(self.servers)
return await self.bot.say("'{}' has been removed from the nsfw channel list.".format(channel.name)) return await self.bot.say("'{}' has been removed from the nsfw channel list.".format(channel.name))


@checks.is_admin_or_mod()
@bot.command(pass_context=True)
async def serverisanal(self, ctx):
self.servers = self.con.load_config()
is_anal = self.servers[ctx.message.server.id]["is_anal"]
if is_anal:
self.servers[ctx.message.server.id]["is_anal"]["y/n"] = 0
self.con.update_config(self.servers)
return await self.bot.say("I now know this server is anal")
else:
self.servers[ctx.message.server.id]["is_anal"]["y/n"] = 1
self.con.update_config(self.servers)
return await self.bot.say("I now know this server is NOT anal")



def setup(Bot): def setup(Bot):
Bot.add_cog(Settings(Bot)) Bot.add_cog(Settings(Bot))

+ 2
- 1
config/server_config.py 查看文件

"log_channel": "", "log_channel": "",
"required_days": "", "required_days": "",
"required_score": "", "required_score": "",
}
},
"is_anal": {"y/n": 0}
} }
} }
self.servers = self.load_config() self.servers = self.load_config()

+ 1
- 1
config/servers.json 查看文件

{"304048071963312130": {"greets": {"enabled": 0, "welcome-channel": "", "member-role": "", "custom-message": "hellow", "default-message": "Be sure to read the rules."}, "goodbyes": {"enabled": 0, "goodbye-channel": ""}, "self_assign": {"enabled": 0, "roles": []}, "twitch": {"enabled": 0, "twitch-channel": "", "whitelist": {"enabled": 0, "list": []}}, "mute": {"role": "", "admin-role": []}, "nsfw": {"enabled": 0, "channels": []}, "admin_role": {"role": ""}, "custom_commands": {"0": {"test": "\"testedit\"", "hello": "<:tingles:346838411639914506>", "benis": "\ud83c\udd71enis", "sophie": "<@136619052994002944>", "myra": "<@342213251372941312>", "roxieee": "<@!142735312626515979>", "customs": "\"\ud83d\udec3\"", "zzz": "\ud83d\udca4", "lewd!": "\ud83d\udea8 lewd! \ud83d\udea8"}, "1": {}}, "perm_roles": {"admin": ["334078005347483648"], "mod": []}, "gss": {"logging_channel": "339201847678074880", "required_days": "5", "required_score": "3000000", "log_channel": ""}}, "395632940328943616": {"greets": {"enabled": 0, "welcome-channel": "", "member-role": "", "custom-message": "", "default-message": "Be sure to read the rules."}, "goodbyes": {"enabled": 0, "goodbye-channel": ""}, "self_assign": {"enabled": 0, "roles": []}, "twitch": {"enabled": 0, "twitch-channel": "", "whitelist": {"enabled": 0, "list": []}}, "mute": {"role": ""}, "nsfw": {"enabled": 0, "channels": []}, "perm_roles": {"admin": [], "mod": []}, "custom_commands": {"0": {}, "1": {}}, "gss": {"log_channel": "", "required_days": "", "required_score": ""}
}, "298647714302787595": {"greets": {"enabled": 0, "welcome-channel": "", "member-role": "", "custom-message": "", "default-message": "Be sure to read the rules."}, "goodbyes": {"enabled": 0, "goodbye-channel": ""}, "self_assign": {"enabled": 0, "roles": []}, "twitch": {"enabled": 0, "twitch-channel": "", "whitelist": {"enabled": 0, "list": []}}, "nsfw": {"enabled": 0, "channels": []}, "perm_roles": {"admin": [], "mod": []}, "custom_commands": {"0": {}, "1": {}}, "gss": {"log_channel": "", "required_days": "", "required_score": ""}}, "342276593009557514": {"greets": {"enabled": 0, "welcome-channel": "", "member-role": "", "custom-message": "", "default-message": "Be sure to read the rules."}, "goodbyes": {"enabled": 0, "goodbye-channel": ""}, "self_assign": {"enabled": 0, "roles": []}, "twitch": {"enabled": 0, "twitch-channel": "", "whitelist": {"enabled": 0, "list": []}}, "nsfw": {"enabled": 0, "channels": []}, "perm_roles": {"admin": [], "mod": []}, "custom_commands": {"0": {}, "1": {}}, "gss": {"log_channel": "", "required_days": "", "required_score": ""}}, "358418840872419328": {"greets": {"enabled": 0, "welcome-channel": "", "member-role": "", "custom-message": "", "default-message": "Be sure to read the rules."}, "goodbyes": {"enabled": 0, "goodbye-channel": ""}, "self_assign": {"enabled": 0, "roles": []}, "twitch": {"enabled": 0, "twitch-channel": "", "whitelist": {"enabled": 0, "list": []}}, "nsfw": {"enabled": 0, "channels": []}, "perm_roles": {"admin": [], "mod": []}, "custom_commands": {"0": {}, "1": {}}, "gss": {"log_channel": "", "required_days": "", "required_score": ""}}, "393764974444675073": {"greets": {"enabled": 0, "welcome-channel": "", "member-role": "", "custom-message": "", "default-message": "Be sure to read the rules."}, "goodbyes": {"enabled": 0, "goodbye-channel": ""}, "self_assign": {"enabled": 0, "roles": []}, "twitch": {"enabled": 0, "twitch-channel": "", "whitelist": {"enabled": 0, "list": []}}, "nsfw": {"enabled": 0, "channels": []}, "perm_roles": {"admin": [], "mod": []}, "custom_commands": {"0": {}, "1": {}}, "gss": {"log_channel": "", "required_days": "5", "required_score": "2000"}}}
{"304048071963312130": {"greets": {"enabled": 0, "welcome-channel": "", "member-role": "", "custom-message": "hellow", "default-message": "Be sure to read the rules."}, "goodbyes": {"enabled": 0, "goodbye-channel": ""}, "self_assign": {"enabled": 0, "roles": []}, "twitch": {"enabled": 0, "twitch-channel": "", "whitelist": {"enabled": 0, "list": []}}, "mute": {"role": "", "admin-role": []}, "nsfw": {"enabled": 1, "channels": ["374688008869511168"]}, "admin_role": {"role": ""}, "custom_commands": {"0": {"test": "\"testedit\"", "hello": "<:tingles:346838411639914506>", "benis": "\ud83c\udd71enis", "sophie": "<@136619052994002944>", "myra": "<@342213251372941312>", "roxieee": "<@!142735312626515979>", "customs": "\"\ud83d\udec3\"", "zzz": "\ud83d\udca4", "lewd!": "\ud83d\udea8 lewd! \ud83d\udea8"}, "1": {}}, "perm_roles": {"admin": ["334078005347483648"], "mod": []}, "gss": {"logging_channel": "339201847678074880", "required_days": "5", "required_score": "3000000", "log_channel": ""}, "admin": {"warnings": {}}, "is_anal": {"y/n": 0}}, "395632940328943616": {"greets": {"enabled": 0, "welcome-channel": "", "member-role": "", "custom-message": "", "default-message": "Be sure to read the rules."}, "goodbyes": {"enabled": 0, "goodbye-channel": ""}, "self_assign": {"enabled": 0, "roles": []}, "twitch": {"enabled": 0, "twitch-channel": "", "whitelist": {"enabled": 0, "list": []}}, "mute": {"role": ""}, "nsfw": {"enabled": 0, "channels": []}, "perm_roles": {"admin": [], "mod": []}, "custom_commands": {"0": {}, "1": {}}, "gss": {"log_channel": "", "required_days": "", "required_score": ""}, "admin": {"warnings": {}}, "is_anal": {"y/n": 0}}, "298647714302787595": {"greets": {"enabled": 0, "welcome-channel": "", "member-role": "", "custom-message": "", "default-message": "Be sure to read the rules."}, "goodbyes": {"enabled": 0, "goodbye-channel": ""}, "self_assign": {"enabled": 0, "roles": []}, "twitch": {"enabled": 0, "twitch-channel": "", "whitelist": {"enabled": 0, "list": []}}, "nsfw": {"enabled": 0, "channels": []}, "perm_roles": {"admin": [], "mod": []}, "custom_commands": {"0": {}, "1": {}}, "gss": {"log_channel": "", "required_days": "", "required_score": ""}}, "342276593009557514": {"greets": {"enabled": 0, "welcome-channel": "", "member-role": "", "custom-message": "", "default-message": "Be sure to read the rules."}, "goodbyes": {"enabled": 0, "goodbye-channel": ""}, "self_assign": {"enabled": 0, "roles": []}, "twitch": {"enabled": 0, "twitch-channel": "", "whitelist": {"enabled": 0, "list": []}}, "nsfw": {"enabled": 0, "channels": []}, "perm_roles": {"admin": [], "mod": []}, "custom_commands": {"0": {}, "1": {}}, "gss": {"log_channel": "", "required_days": "", "required_score": ""}}, "358418840872419328": {"greets": {"enabled": 0, "welcome-channel": "", "member-role": "", "custom-message": "", "default-message": "Be sure to read the rules."}, "goodbyes": {"enabled": 0, "goodbye-channel": ""}, "self_assign": {"enabled": 0, "roles": []}, "twitch": {"enabled": 0, "twitch-channel": "", "whitelist": {"enabled": 0, "list": []}}, "nsfw": {"enabled": 0, "channels": []}, "perm_roles": {"admin": [], "mod": []}, "custom_commands": {"0": {}, "1": {}}, "gss": {"log_channel": "", "required_days": "", "required_score": ""}}}

Loading…
取消
儲存