write README for BENJAMIIIIIIIIIIIN !??

This commit is contained in:
Milka64 2019-10-02 09:28:50 +02:00
parent 86c6f80b26
commit d8af1c1b42
4 changed files with 51 additions and 4 deletions

View file

@ -1,2 +0,0 @@
# Kabot

24
README.rst Normal file
View file

@ -0,0 +1,24 @@
Kabot
=====
Installation
------------
Prerquire :
.. code-block:: bash
pip3 install zc.buildout
clone this repositori, then :
.. code-block:: bash
python3 bootstrap-buildout.py
./bin/buildout
Utilisation
-----------
.. code-block:: bash
./bin/kabot

View file

@ -14,10 +14,20 @@ class Mybot(commands.Cog):
self.bot = bot
@commands.command()
async def join_channel(self, ctx):
async def join(self, ctx):
channel = [x for x in self.bot.get_all_channels() if x.name == "Général"][0]
await channel.connect()
@commands.command()
async def disconnect(self, ctx):
await ctx.guild.voice_client.disconnect()
@commands.command()
async def benjamin(self, ctx):
source = discord.PCMVolumeTransformer(discord.FFmpegPCMAudio("/tmp/Benjamin_Prejent.mp3"))
ctx.voice_client.play(source, after=lambda e: print('Player error: %s' % e) if e else None)
await ctx.send('Now playing')
@commands.command(help='check if bot always online')
async def ping(self, message):
await message.channel.send('pong')
@ -75,6 +85,17 @@ def main():
response = random.choice(lines).replace(str(bot.user.id), str(message.author.id))
await message.channel.send(response)
await bot.process_commands(message)
@bot.event
async def on_voice_state_update(member,before,after):
if "BFlow" in member.name:
if before.channel is None and after.channel:
for channel in bot.get_all_channels():
if channel.name == "général":
current_chan = channel
ctx = bot.get_context(current_chan.last_message)
benjamin = bot.get_command('benjamin')
await benjamin.invoke(ctx)
bot.add_cog(Mybot(bot))
bot.run(token)

View file

@ -11,7 +11,11 @@ with open('README.rst') as readme_file:
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = ['discord.py','requests' ]
requirements = [
'discord.py',
'requests',
'PyNaCl',
]
setup_requirements = [ ]