This code i’m using to try to make a discord bot that will change people’s nicknames in my server for them, won’t work.
JavaScript
x
21
21
1
from discord.ext import commands
2
from discord import embeds
3
from discord import message
4
import random
5
from typing import ValuesView
6
import os
7
from discord.ext.commands.core import has_guild_permissions
8
9
client=commands.Bot(command_prefix='g!')
10
11
@client.event
12
async def on_ready():
13
print('Gilbert is now online!')
14
15
@client.command(pass_content=True)
16
async def changenick(ctx, member: discord.Member, nick):
17
await member.edit(nick=nick)
18
await ctx.send(f'Nickname has been changed for {member.mention}.')
19
20
client.run=('mydiscordtoken')
21
Here’s what my terminal and member list look like
Advertisement
Answer
client.run
is not a variable, as you have treated it in your question, but instead more similar to a function. Replacing your last line with the following should fix your problem.
JavaScript
1
2
1
client.run('mydiscordtoken')
2