on the command i use this
@client.command(pass_context = True)
async def kick(ctx, user: discord.Member):
await client.say(":boot: Cya, {}. Ya loser!".format(user.name))
await client.kick(user)
and when type
This is hard to diagnose without more context and without the correct formatting. Is your code really all on one line?
Out of interest what tutorial are you using this exact phrasing has popped up loads.
In any case, questions like this are typically better directed at the discord server
https://discord.gg/r3sSKJJ
not its
@client.command(pass_context = True)
async def kick(ctx, user: discord.Member):
await client.say(":boot: Cya, {}. Ya loser!".format(user.name))
await client.kick(user)
but in github when i try add `` this makes it 1 line
This doesnt actually give me enough context.
Im going to need to see the rest of your code.
i just started coding in python and i'm a beginner so don't laugh at my code
that's my code
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import time
import socket
import datetime
import urllib.request, json
with urllib.request.urlopen("https://www.example.com/blabla") as url:
data = json.loads(url.read().decode())
Client = discord.Client()
client = commands.Bot(command_prefix = data['prefix'])
@client.event
async def on_ready():
print("Welcome to", data['name'])
print("Version:", data['version'])
print("Prefix:", data['prefix'])
print("Author:", data['author'])
print("Website:", data['website'])
print("")
@client.command(pass_context = True)
async def kick(ctx, user: discord.Member):
await client.say(":boot: Cya, {}. Ya loser!".format(user.name))
await client.kick(user)
@client.event
async def on_message(message):
userId = message.author.id
user = message.author.display_name
if message.content.upper().startswith(data['prefix'] + 'FUNCS'):
await client.send_message(message.channel, "<@%s>" % (userId))
embed = discord.Embed(title=data['name'] + " Functions", color=data['maincolor'])
embed.set_thumbnail(url=client.user.avatar_url)
embed.add_field(name="Funcs:", value="Shows this box")
embed.add_field(name="Self:", value="Gets your client server status | Example: Self @spaxrkl#3378")
embed.add_field(name="Serverinfo:", value="Gets your server status")
embed.add_field(name="Report:", value="Report a user by mentioning him | Example: report @spaxrkl#3378")
embed.add_field(name="[Perm] Say:", value="Make the bot talk with tts message and chat | Example: Say Hello World!")
embed.add_field(name="[HighPerm] doge:", value="Just programming testing & codes showing")
await client.send_message(message.channel, embed=embed)
print(datetime.datetime.now(), ">>- " + "Log: Funcs command completed successfully\n Sender: ",user )
if message.content.upper().startswith(data['prefix'] + 'SELF'):
user = message.author.display_name
userId = message.author.id
userStatus = message.author.status
created = message.author.joined_at
await client.send_message(message.channel, "<@%s>" % (userId))
embed = discord.Embed(title=data['name'] + " User Info", description=user, color=data['maincolor'])
embed.set_thumbnail(url=message.author.avatar_url)
embed.add_field(name="Status:", value=userStatus)
embed.add_field(name="Joined:", value=created)
await client.send_message(message.channel, embed=embed)
print(datetime.datetime.now(), ">>- " + "Log: Self command completed successfully\n Sender: ",user )
#say
if message.content.upper().startswith(data['prefix'] + 'SAY'):
user = message.author.display_name
args = message.content.split(" ")
await client.send_message(message.channel, "%s" % (" ".join(args[1:])), tts=True)
print(datetime.datetime.now(), ">>- " + "Log: Say command completed successfully\n Sender: ",user )
client.run(data['token'])
http://discordpy.readthedocs.io/en/latest/faq.html#why-does-on-message-make-my-commands-stop-working
it didn't help
yes
yes
yes
non't
There is so much to unpack here, and some awful practices, this isn't really going to get anywhere in this thread.
You need to be more fourth coming with information, such as what's not working, any tracebacks or errors that you get and why on earth you are doing a http request for your token.
This is probably better answered on the discord server. https://discord.gg/r3sSKJJ