mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-11-15 02:21:21 +01:00
Fix Titan Commands
This commit is contained in:
parent
930c026108
commit
f7caa5ede5
@ -90,8 +90,8 @@ class Titan(discord.AutoShardedClient):
|
|||||||
msg_cmd = msg_arr[1].lower() # get command
|
msg_cmd = msg_arr[1].lower() # get command
|
||||||
cmd = getattr(self.command, msg_cmd, None) #check if cmd exist, if not its none
|
cmd = getattr(self.command, msg_cmd, None) #check if cmd exist, if not its none
|
||||||
if cmd: # if cmd is not none...
|
if cmd: # if cmd is not none...
|
||||||
await self.send_typing(message.channel) #this looks nice
|
async with message.channel.typing(): #this looks nice
|
||||||
await getattr(self.command, msg_cmd)(message) #actually run cmd, passing in msg obj
|
await getattr(self.command, msg_cmd)(message) #actually run cmd, passing in msg obj
|
||||||
|
|
||||||
async def on_message_edit(self, message_before, message_after):
|
async def on_message_edit(self, message_before, message_after):
|
||||||
await self.database.update_message(message_after)
|
await self.database.update_message(message_after)
|
||||||
|
@ -4,38 +4,38 @@ class Commands():
|
|||||||
self.database = database
|
self.database = database
|
||||||
|
|
||||||
async def ban(self, message):
|
async def ban(self, message):
|
||||||
if not message.author.server_permissions.ban_members:
|
if not message.author.guild_permissions.ban_members:
|
||||||
await self.client.send_message(message.channel, message.author.mention + " I'm sorry, but you do not have permissions to ban guest members.")
|
await message.channel.send(message.author.mention + " I'm sorry, but you do not have permissions to ban guest members.")
|
||||||
return
|
return
|
||||||
serverid = message.server.id
|
serverid = message.guild.id
|
||||||
content = message.content.strip()
|
content = message.content.strip()
|
||||||
if len(content.split()) == 2:
|
if len(content.split()) == 2:
|
||||||
await self.client.send_message(message.channel, message.author.mention + " Please provide a username-query (or optionally a discriminator) to ban a guest user.\nExample: `ban Titan#0001`")
|
await message.channel.send(message.author.mention + " Please provide a username-query (or optionally a discriminator) to ban a guest user.\nExample: `ban Titan#0001`")
|
||||||
return
|
return
|
||||||
content = content.split()
|
content = content.split()
|
||||||
username = content[2][:content[2].find("#")] if "#" in content[2] else content[2]
|
username = content[2][:content[2].find("#")] if "#" in content[2] else content[2]
|
||||||
discriminator = int(content[2][content[2].find("#") + 1:]) if "#" in content[2] else None
|
discriminator = int(content[2][content[2].find("#") + 1:]) if "#" in content[2] else None
|
||||||
reason = await self.database.ban_unauth_user_by_query(message.server.id, message.author.id, username, discriminator)
|
reason = await self.database.ban_unauth_user_by_query(message.guild.id, message.author.id, username, discriminator)
|
||||||
await self.client.send_message(message.channel, message.author.mention + " " + reason)
|
await message.channel.send(message.author.mention + " " + reason)
|
||||||
|
|
||||||
async def kick(self, message):
|
async def kick(self, message):
|
||||||
if not message.author.server_permissions.kick_members:
|
if not message.author.guild_permissions.kick_members:
|
||||||
await self.client.send_message(message.channel, message.author.mention + " I'm sorry, but you do not have permissions to kick guest members.")
|
await message.channel.send(message.author.mention + " I'm sorry, but you do not have permissions to kick guest members.")
|
||||||
return
|
return
|
||||||
serverid = message.server.id
|
serverid = message.guild.id
|
||||||
content = message.content.strip()
|
content = message.content.strip()
|
||||||
if len(content.split()) == 2:
|
if len(content.split()) == 2:
|
||||||
await self.client.send_message(message.channel, message.author.mention + " Please provide a username-query (or optionally a discriminator) to kick a guest user.\nExample: `kick Titan#0001`")
|
await message.channel.send(message.author.mention + " Please provide a username-query (or optionally a discriminator) to kick a guest user.\nExample: `kick Titan#0001`")
|
||||||
return
|
return
|
||||||
content = content.split()
|
content = content.split()
|
||||||
username = content[2][:content[2].find("#")] if "#" in content[2] else content[2]
|
username = content[2][:content[2].find("#")] if "#" in content[2] else content[2]
|
||||||
discriminator = int(content[2][content[2].find("#") + 1:]) if "#" in content[2] else None
|
discriminator = int(content[2][content[2].find("#") + 1:]) if "#" in content[2] else None
|
||||||
reason = await self.database.revoke_unauth_user_by_query(message.server.id, username, discriminator)
|
reason = await self.database.revoke_unauth_user_by_query(message.guild.id, username, discriminator)
|
||||||
await self.client.send_message(message.channel, message.author.mention + " " + reason)
|
await message.channel.send(message.author.mention + " " + reason)
|
||||||
|
|
||||||
async def invite(self, message):
|
async def invite(self, message):
|
||||||
await self.client.send_message(message.channel, "You can invite Titan to your server by visiting this link: https://discordapp.com/oauth2/authorize?&client_id=299403260031139840&scope=bot&permissions=641195117")
|
await message.channel.send("You can invite Titan to your server by visiting this link: https://discordapp.com/oauth2/authorize?&client_id=299403260031139840&scope=bot&permissions=641195117")
|
||||||
|
|
||||||
async def server(self, message):
|
async def server(self, message):
|
||||||
await self.client.send_message(message.channel, "Join the Titan Embeds Discord server! https://discord.gg/pFDDtcN")
|
await message.channel.send("Join the Titan Embeds Discord server! https://discord.gg/pFDDtcN")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user