Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jail command & find a channel #994

Closed
rektile opened this issue Jan 5, 2018 · 6 comments
Closed

jail command & find a channel #994

rektile opened this issue Jan 5, 2018 · 6 comments
Labels
invalid This is not right.

Comments

@rektile
Copy link

rektile commented Jan 5, 2018

so i made a command that jails people for a 1 minute.
to unjail someone i delete the channel.
i want to write some code that checks if the jail channels still exists but it gives me errors

@bot.command(pass_context=True)
@commands.has_role(name="God's")
async def jail(ctx): 
    victim = ctx.message.mentions[0]
    timeout = time.time() + 60 ############1 min##################### 
    jail_channel = await bot.create_channel(ctx.message.server, "jail", type=discord.ChannelType.voice)
    await bot.move_member(victim, jail_channel)
    print(ctx.message.author, "jailed", victim, "for 60 seconden") 
    while time.time() < timeout: 
        print(victim, "is still jailed for ", timeout - time.time(), "seconds")
        ''' some code placed here thats checks if the channel still exists if it exists continue else break the loop '''
        await bot.move_member(victim, jail_channel) 
        await asyncio.sleep(1)
    try: 
        await bot.delete_channel(jail_channel)
        print("channel is deleted") 
     except: 
        print("channel is already deleted")

if you could help me it would be nice :D
btw i know the code isnt clean , im still learning :p

@jwshields
Copy link
Contributor

This doesn't seem to be a library issue, try asking in the discord.py chat https://discord.gg/r3sSKJJ

@rektile
Copy link
Author

rektile commented Jan 5, 2018

the code works but i didnt make something that unbans someone so i want o make something that checks if the jail channel still exists

@rektile
Copy link
Author

rektile commented Jan 5, 2018

do you know a way how i let the bot loop trough all the channels in my server and look if jail channel still exist ?

@jegfish
Copy link

jegfish commented Jan 5, 2018

Use utils.get http://discordpy.readthedocs.io/en/async/api.html#discord.utils.get.

Also if you need more help join the server jwshields linked you to.

@Rapptz
Copy link
Owner

Rapptz commented Jan 6, 2018

These issues are not meant for questions regarding how to implement bot features.

@Rapptz Rapptz closed this as completed Jan 6, 2018
@Rapptz Rapptz added the invalid This is not right. label Jan 6, 2018
@rektile
Copy link
Author

rektile commented Jan 7, 2018

Altarrel ty man :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This is not right.
Projects
None yet
Development

No branches or pull requests

4 participants