Replies: 2 comments 2 replies
-
Have you installed |
Beta Was this translation helpful? Give feedback.
2 replies
-
Are you sure your keep alive function isn't blocking the bot from starting? @Client.event
async def on_ready():
print("Online and running") Or try commenting out the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone. I'm new to python and coding in general. My first python project is to create a discord but I'm at my wits end trying to get my bot to join a discord channel! I've tried various variations of code and I get no error as the script runs but when I type in !join I have no luck.
Here is my code. Can anyone see any glaring errors?
``import discord
from discord.ext import commands
import requests
import os
from keep_alive import keep_alive
import random
intents = discord.Intents.default()
intents.members = True
Client = commands.Bot(command_prefix = '!', intents=intents)
@Client.command(pass_context = True)
async def join(ctx):
if (ctx.author.voice):
channel = ctx.message.author.voice.channel
await channel.connect()
else:
await ctx.send("Join a voice channel to use this command!")
@Client.command(pass_context = True)
async def leave(ctx):
if (ctx.voice_client):
await ctx.guide.voice_client.disconnect()
await ctx.sent("See ya folks")
else:
await ctx.send("I am not in a voice channel")
keep_alive()
Client.run(os.getenv('TOKEN'))``
Beta Was this translation helpful? Give feedback.
All reactions