command clear_cache youtube dl, prise en compte des commandes dans l'historique kabot
This commit is contained in:
parent
fc29b8931b
commit
0995303080
3 changed files with 34 additions and 20 deletions
|
@ -2,10 +2,7 @@
|
|||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="jdk" jdkName="Python 3.7 (kivy_tuto)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="TestRunnerService">
|
||||
<option name="PROJECT_TEST_RUNNER" value="Unittests" />
|
||||
</component>
|
||||
</module>
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (kabot)" project-jdk-type="Python SDK" />
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (kivy_tuto)" project-jdk-type="Python SDK" />
|
||||
</project>
|
|
@ -83,6 +83,13 @@ class Mybot(commands.Cog):
|
|||
detail = commit.attributes
|
||||
await ctx.channel.send("__" + detail['author_name'] + "__: " + detail['title'] + '\n' + detail['web_url'])
|
||||
|
||||
@commands.command(help='clear cache youtube dl')
|
||||
async def cache_clear(self, ctx):
|
||||
fichiers = os.listdir('/tmp')
|
||||
for fichier in fichiers:
|
||||
if fichier.starwith('discord'):
|
||||
os.remove("/tmp/" + fichier)
|
||||
|
||||
@commands.command()
|
||||
async def disconnect(self, ctx):
|
||||
await ctx.guild.voice_client.disconnect()
|
||||
|
@ -352,6 +359,11 @@ class Mybot(commands.Cog):
|
|||
@commands.command(help="Faire dire des choses au bot")
|
||||
async def say(self, ctx, *message):
|
||||
sentence = ' '.join(message)
|
||||
if sentence.startswith('!'):
|
||||
command_name = sentence.split()[0].replace('!', '')
|
||||
cmd = self.bot.get_command(command_name)
|
||||
await cmd.invoke(message)
|
||||
else:
|
||||
for word in sentence.split():
|
||||
if word.startswith('@'):
|
||||
guild = self.bot.guilds[0]
|
||||
|
@ -538,6 +550,11 @@ def main():
|
|||
with open(path, 'a') as f:
|
||||
f.write(message.content + '\n')
|
||||
response = random.choice(lines).replace(str(bot.user.id), str(message.author.id))
|
||||
if response.startswith('!'):
|
||||
command_name = response.split()[0].replace('!', '')
|
||||
cmd = bot.get_command(command_name)
|
||||
await cmd.invoke(message)
|
||||
else:
|
||||
with message.channel.typing():
|
||||
if "http" in response:
|
||||
await asyncio.sleep(len(response) / 8)
|
||||
|
|
Loading…
Reference in a new issue