Skip to content

Commit a9161f5

Browse files
committed
hhhhh
1 parent ee36c22 commit a9161f5

File tree

10 files changed

+79
-19
lines changed

10 files changed

+79
-19
lines changed

assets/languages/english.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"bot.errors.disabled_command":"This command has been disabled.",
3-
"bot.errors.dev_only":"This command can only be ran by the bot developers.",
43
"bot.errors.owner_only":"This command can only be ran by the bot owner.",
4+
"bot.errors.dev_only":"This command can only be ran by the bot developers.",
5+
"bot.errors.support_only":"This command can only be ran by the bot's support team.",
56
"bot.errors.not_nsfw_channel":"This command can only be ran in NSFW channels.",
67
"bot.errors.not_guild_owner":"Only the server owner (`{0}`) can use this command.",
78
"bot.errors.no_permission":"You do not have permission to use this command.",
@@ -212,7 +213,7 @@
212213
"myanimelist.no_anime_found":"Couldn't find any anime named `{0}`.",
213214
"myanimelist.no_manga_found":"Couldn't find any manga named `{0}`.",
214215
"configuration.set_success":"Successfully set the {0} to `{1}`",
215-
"config.invalid_set_type":"`{0}` is not a valid type! Valid types are `mod-role` and `mute-role`",
216+
"configuration.invalid_set_type":"`{0}` is not a valid type! Valid types are `mod-role` and `mute-role`",
216217
"configuration.mod_role":"Mod Role",
217218
"configuration.mute_role":"Mute Role",
218219
"configuration.server_configuration":"Server Configuration",

assets/languages/finnish.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"bot.errors.disabled_command":"Tama komento to poistettu kaytösta.",
3+
"bot.errors.owner_only":"Vain botin omistaja voi suorittaa taman komennon.",
34
"bot.errors.dev_only":"Vain kehittajat voivat kayttaa tata komentoa.",
4-
"bot.errors.owner_only":"vain botin omistaja voi suorittaa taman komennon.",
5+
"bot.errors.support_only":"This command can only be ran by the bot's support team.",
56
"bot.errors.not_nsfw_channel":"Tama komento voidaan suorittaa vain NSFW kanavissa.",
67
"bot.errors.not_guild_owner":"Ainoastaan Palvelimen omistaja (`{0}`) voi suorittaa taman komennon.",
78
"bot.errors.no_permission":"Sinulla ei ole oikeuksia kayttaa tata komentoa.",
@@ -212,7 +213,7 @@
212213
"myanimelist.no_anime_found":"Couldn't find any anime named `{0}`.",
213214
"myanimelist.no_manga_found":"Couldn't find any manga named `{0}`.",
214215
"configuration.set_success":"Successfully set the {0} to `{1}`",
215-
"config.invalid_set_type":"`{0}` is not a valid type! Valid types are `mod-role` and `mute-role`",
216+
"configuration.invalid_set_type":"`{0}` is not a valid type! Valid types are `mod-role` and `mute-role`",
216217
"configuration.mod_role":"Mod Role",
217218
"configuration.mute_role":"Mute Role",
218219
"configuration.server_configuration":"Server Configuration",

assets/languages/french.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"bot.errors.disabled_command":"Cette commande a été désactivé.",
3-
"bot.errors.dev_only":"Cette commande ne peut être utilisé que par les développeurs du bot.",
43
"bot.errors.owner_only":"Cette commande ne peut être utilisé que par le propriétaire.",
4+
"bot.errors.dev_only":"Cette commande ne peut être utilisé que par les développeurs du bot.",
5+
"bot.errors.support_only":"This command can only be ran by the bot's support team.",
56
"bot.errors.not_nsfw_channel":" Cette commande ne peut être utilisé que dans les salons NSFW.",
67
"bot.errors.not_guild_owner":"Seulement le propriétaire du serveur (`{0}`) peut utiliser cette commande.",
78
"bot.errors.no_permission":"Vouz n’avez pas le droit d’utiliser cette commande.",
@@ -211,7 +212,7 @@
211212
"myanimelist.no_anime_found":"Impossible de trouver un anime nommé `{0}`.",
212213
"myanimelist.no_manga_found":"Impossible de trouver un manga nommé `{0}`.",
213214
"configuration.set_success":"Mit le {0} à `{1}`",
214-
"config.invalid_set_type":"`{0}` N’est pas un type valide! Les types valides sont `mod-role` et `mute-role`",
215+
"configuration.invalid_set_type":"`{0}` N’est pas un type valide! Les types valides sont `mod-role` et `mute-role`",
215216
"configuration.mod_role":"Rôle de moderateur",
216217
"configuration.mute_role":"Rôle de muet",
217218
"configuration.server_configuration":"Configuration serveur",

assets/languages/hebrew.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"bot.errors.disabled_command":"פונקציה זו כבויה.",
3-
"bot.errors.dev_only":"פונקציה זו מיועדת למפתחים.",
43
"bot.errors.owner_only":"פונקציה זו מיועדת לבעלים.",
4+
"bot.errors.dev_only":"פונקציה זו מיועדת למפתחים.",
5+
"bot.errors.support_only":"This command can only be ran by the bot's support team.",
56
"bot.errors.not_nsfw_channel":"פונקציה זו חייבת להתבצע בערוץ NSFW.",
67
"bot.errors.not_guild_owner":"רק בעל השרת ('{0}') מיועדת לבצע את הפונקציה הזו.",
78
"bot.errors.no_permission":"אין לך רשות נאחוץ הפונקציה הזה.",
@@ -212,7 +213,7 @@
212213
"myanimelist.no_anime_found":"לא מצאתי אנימה עם השם `{0}`.",
213214
"myanimelist.no_manga_found":"לא מצאתי מנגה עם השם `{0}`.",
214215
"configuration.set_success":"הצלחתי לשנות את ה-{0} ל-`{1}`",
215-
"config.invalid_set_type":"`{0}` זה לא סוג זמין! סוגות זמינים הם `mod-role` ו-`mute-role`",
216+
"configuration.invalid_set_type":"`{0}` זה לא סוג זמין! סוגות זמינים הם `mod-role` ו-`mute-role`",
216217
"configuration.mod_role":"תפקיד מנחה",
217218
"configuration.mute_role":"תפקיד אילם",
218219
"configuration.server_configuration":"תצורה של השרת",

assets/languages/spanish.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"bot.errors.disabled_command":"Este comando ha sido deshabilitado.",
3-
"bot.errors.dev_only":"Este comando solo puede ser usado por uno de los desarrolladores.",
43
"bot.errors.owner_only":"Este comando solo puede ser usado por el dueño del bot",
4+
"bot.errors.dev_only":"Este comando solo puede ser usado por uno de los desarrolladores.",
5+
"bot.errors.support_only":"This command can only be ran by the bot's support team.",
56
"bot.errors.not_nsfw_channel":"Este comando solo puede ser usado en los canales NSFW.",
67
"bot.errors.not_guild_owner":"Solo el dueño (`{0}`) puede usar este comando.",
78
"bot.errors.no_permission":"No tienes los permisos para usar este comando.",
@@ -212,7 +213,7 @@
212213
"myanimelist.no_anime_found":"No se pudo encontrar ningún anime llamado`{0}`.",
213214
"myanimelist.no_manga_found":"No se pudo encontrar ningún manga llamado `{0}`.",
214215
"configuration.set_success":"Se ha puesto {0} a `{1}`",
215-
"config.invalid_set_type":"`{0}` no es un tipo válido. Los tipos válidos son `mod-role` y `mute-role`",
216+
"configuration.invalid_set_type":"`{0}` no es un tipo válido. Los tipos válidos son `mod-role` y `mute-role`",
216217
"configuration.mod_role":"Rol de moderador",
217218
"configuration.mute_role":"Rol de silenciado",
218219
"configuration.server_configuration":"Configuración del servidor.",

bot.py

+22-5
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,14 @@
5151
"Fixed the userinfocommand ",
5252
"Fixed the serverinfo command",
5353
"Fixed the invite command ",
54-
"Fixed the joinserver command"
54+
"Fixed the joinserver command",
55+
"Fixed the uploadfile command",
56+
"+ uppercase",
57+
"+ lowercase",
5558
"Other things:",
5659
"Now using python 3.6",
60+
"Fixed the \"no nsfw channel\" message that wouldn't display in dms",
61+
"Support team members now ave a seperate id config entry."
5762
]
5863

5964
async def _restart_bot():
@@ -151,11 +156,14 @@ async def on_command_error(ctx, error):
151156
if isinstance(error, commands.DisabledCommand):
152157
await ctx.send(Language.get("bot.errors.disabled_command", ctx))
153158
return
159+
if isinstance(error, checks.owner_only):
160+
await ctx.send(Language.get("bot.errors.owner_only", ctx))
161+
return
154162
if isinstance(error, checks.dev_only):
155163
await ctx.send(Language.get("bot.errors.dev_only", ctx))
156164
return
157-
if isinstance(error, checks.owner_only):
158-
await ctx.send(Language.get("bot.errors.owner_only", ctx))
165+
if isinstance(error, checks.support_only):
166+
await ctx.send(Language.get("bot.errors.support_only", ctx))
159167
return
160168
if isinstance(error, checks.not_nsfw_channel):
161169
await ctx.send(Language.get("bot.errors.not_nsfw_channel", ctx))
@@ -321,6 +329,10 @@ async def notifydev(ctx, *, message:str):
321329
dev = bot.get_user(id)
322330
if dev:
323331
await dev.send("You have received a new message! The user's ID is `{}` Server: {}".format(ctx.author.id, guild), embed=msg)
332+
for id in config.support_ids:
333+
support_member = bot.get_user(id)
334+
if support_member:
335+
await support_member.send("You have received a new message! The user's ID is `{}` Server: {}".format(ctx.author.id, guild), embed=msg)
324336
await ctx.author.send(Language.get("bot.dev_notify", ctx).format(message))
325337

326338
@bot.command()
@@ -338,6 +350,10 @@ async def suggest(ctx, *, suggestion:str):
338350
dev = bot.get_user(id)
339351
if dev:
340352
await dev.send("You have received a new suggestion! The user's ID is `{}` Server: {}".format(ctx.author.id, guild), embed=msg)
353+
for id in config.support_ids:
354+
support_member = bot.get_user(id)
355+
if support_member:
356+
await support_member.send("You have received a new message! The user's ID is `{}` Server: {}".format(ctx.author.id, guild), embed=msg)
341357
await ctx.author.send(Language.get("bot.errors.dev_suggest", ctx).format(suggestion))
342358

343359
@bot.command(hidden=True)
@@ -458,7 +474,7 @@ async def uploadfile(ctx, *, path:str):
458474
"""Uploads any file on the system. What is this hackery?"""
459475
await ctx.channel.trigger_typing()
460476
try:
461-
await bot.send_file(ctx.channel, path)
477+
await ctx.send(file=discord.File(path))
462478
except FileNotFoundError:
463479
await ctx.send("That file does not exist!")
464480

@@ -473,7 +489,7 @@ async def version(ctx):
473489
await ctx.send(Language.get("bot.version", ctx).format(BUILD_VERSION, BUILD_AUTHORS, BUILD_CODENAME, BUILD_DATE))
474490

475491
@bot.command(hidden=True)
476-
@checks.is_dev()
492+
@checks.is_support()
477493
async def dm(ctx, id:int, *, message:str):
478494
"""DMs a user"""
479495
msg = make_message_embed(ctx.author, 0xFF0000, message, formatUser=True)
@@ -566,6 +582,7 @@ async def stats(ctx):
566582
await ctx.send(embed=embed)
567583

568584
@bot.command()
585+
@commands.guild_only()
569586
@checks.is_dev()
570587
async def editmessage(ctx, id:int, *, newmsg:str):
571588
"""Edits a message sent by the bot"""

commands/fun.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -281,14 +281,24 @@ async def md5(self, ctx, *, msg:str):
281281
await ctx.send("`{}`".format(hashlib.md5(bytes(msg.encode("utf-8"))).hexdigest()))\
282282

283283
@commands.command()
284-
async def sha256(self, ctx, *, msg: str):
284+
async def sha256(self, ctx, *, msg:str):
285285
"""Convert something to sha256"""
286286
await ctx.send("`{}`".format(hashlib.sha256(bytes(msg.encode("utf-8"))).hexdigest()))
287287

288288
@commands.command()
289-
async def sha512(self, ctx, *, msg: str):
289+
async def sha512(self, ctx, *, msg:str):
290290
"""Convert something to sha512"""
291291
await ctx.send("`{}`".format(hashlib.sha512(bytes(msg.encode("utf-8"))).hexdigest()))
292292

293+
@commands.command()
294+
async def uppercase(self, ctx, *, msg:str):
295+
"""UPPERCASE DIS"""
296+
await ctx.send(msg.upper())
297+
298+
@commands.command()
299+
async def lowercase(self, ctx, *, msg: str):
300+
"""lowercase dis"""
301+
await ctx.send(msg.lower())
302+
293303
def setup(bot):
294304
bot.add_cog(Fun(bot))

config/config.ini.example

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ Command_Prefix = *
3131
; Do NOT put the owner ID here!
3232
;Developer_IDs =
3333

34+
; Example: ID1 ID2 ID3
35+
; Be sure to uncomment if you are entering a developer ID!
36+
; Do NOT put the owner ID or any dev IDs here!
37+
;Support_IDs =
38+
3439
; How many results should the NSFW commands get?
3540
Max_NSFW_Count = 500
3641

utils/checks.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33
from utils.mysql import *
44
config = Config()
55

6+
class owner_only(commands.CommandError):
7+
pass
8+
69
class dev_only(commands.CommandError):
710
pass
811

9-
class owner_only(commands.CommandError):
12+
class support_only(commands.CommandError):
1013
pass
1114

1215
class not_nsfw_channel(commands.CommandError):
@@ -34,9 +37,17 @@ def predicate(ctx):
3437
raise dev_only
3538
return commands.check(predicate)
3639

40+
def is_support():
41+
def predicate(ctx):
42+
if ctx.author.id in config.support_ids or ctx.author.id in config.dev_ids or ctx.author.id == int(config.owner_id):
43+
return True
44+
else:
45+
raise support_only
46+
return commands.check(predicate)
47+
3748
def is_nsfw_channel():
3849
def predicate(ctx):
39-
if ctx.channel.is_nsfw():
50+
if not isinstance(ctx.channel, discord.DMChannel) and ctx.channel.is_nsfw():
4051
return True
4152
else:
4253
raise not_nsfw_channel

utils/config.py

+12
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class Defaults:
1111
owner_id = None
1212
command_prefix = "*"
1313
dev_ids = []
14+
support_ids = []
1415
skip_votes_needed = 3
1516
channel_logger_id = None
1617
debug = False
@@ -55,6 +56,7 @@ def __init__(self):
5556
self.command_prefix = config.get("Bot", "Command_Prefix", fallback=Defaults.command_prefix)
5657
self.max_nsfw_count = config.getint("Bot", "Max_NSFW_Count", fallback=Defaults.max_nsfw_count)
5758
self.dev_ids = config.get("Bot", "Developer_IDs", fallback=Defaults.dev_ids)
59+
self.support_ids = config.get("Bot", "Support_IDs", fallback=Defaults.support_ids)
5860
self.skip_votes_needed = config.getint("Bot", "Skip_Votes_Needed", fallback=Defaults.skip_votes_needed)
5961
self.lock_status = config.getboolean("Status", "Lock_Status", fallback=Defaults.lock_status)
6062
self.enable_default_status = config.getboolean("Status", "Enable_Default_Status", fallback=Defaults.enable_default_status)
@@ -91,6 +93,16 @@ def check(self):
9193
log.warning("Developer IDs are invalid, all developer IDs have been ignored!")
9294
self.dev_ids = Defaults.dev_ids
9395

96+
if len(self.support_ids) is not 0:
97+
try:
98+
ids = self.support_ids.split()
99+
self.support_ids = []
100+
for id in ids:
101+
self.support_ids.append(int(id))
102+
except:
103+
log.warning("Support IDs are invalid, all support member IDs have been ignored!")
104+
self.support_ids = Defaults.support_ids
105+
94106
if self.enableMal:
95107
if not self._malUsername and not self._malPassword:
96108
log.critical("The MyAnimeList module was enabled, but no MAL credinals were specified!")

0 commit comments

Comments
 (0)