Discord python unban member
Ok, my ban command works ban(member)
, however when doing the same except using unban(member)
the output is always that the user wasn't found.
Here's the code of the ban command, what's the correct usage of the unban command?
@commands.command(pass_context = True)
@commands.has_permissions(ban_members=True)
async def ban(self, ctx, member:discord.Member=None):
"""Bans a member."""
if not member:
await self.bot.say("Who would you like me to ban, 0.mention?".format(ctx.message.author))
pass
await self.bot.ban(member)
await self.bot.say(f"member.mention got banned, what a shame...")
print(colored('moderation.clf: ', 'blue'), colored('Banned member', 'white'))
python python-3.x discord discord.py
add a comment |
Ok, my ban command works ban(member)
, however when doing the same except using unban(member)
the output is always that the user wasn't found.
Here's the code of the ban command, what's the correct usage of the unban command?
@commands.command(pass_context = True)
@commands.has_permissions(ban_members=True)
async def ban(self, ctx, member:discord.Member=None):
"""Bans a member."""
if not member:
await self.bot.say("Who would you like me to ban, 0.mention?".format(ctx.message.author))
pass
await self.bot.ban(member)
await self.bot.say(f"member.mention got banned, what a shame...")
print(colored('moderation.clf: ', 'blue'), colored('Banned member', 'white'))
python python-3.x discord discord.py
unban
takes aUser
, not aMember
. This is because when you ban someone from the server, they aren't aMember
anymore. You need to get theirUser
object instead.
– Patrick Haugh
Nov 13 '18 at 23:51
Ok! does the same happen withawait server_voice_state(user=member, deafen=True)
andawait server_voice_state(user=member, mute=True)
?
– Daniel Casares
Nov 14 '18 at 0:15
server_voice_state
has nouser
parameter. It has amember
parameter
– Patrick Haugh
Nov 14 '18 at 0:24
add a comment |
Ok, my ban command works ban(member)
, however when doing the same except using unban(member)
the output is always that the user wasn't found.
Here's the code of the ban command, what's the correct usage of the unban command?
@commands.command(pass_context = True)
@commands.has_permissions(ban_members=True)
async def ban(self, ctx, member:discord.Member=None):
"""Bans a member."""
if not member:
await self.bot.say("Who would you like me to ban, 0.mention?".format(ctx.message.author))
pass
await self.bot.ban(member)
await self.bot.say(f"member.mention got banned, what a shame...")
print(colored('moderation.clf: ', 'blue'), colored('Banned member', 'white'))
python python-3.x discord discord.py
Ok, my ban command works ban(member)
, however when doing the same except using unban(member)
the output is always that the user wasn't found.
Here's the code of the ban command, what's the correct usage of the unban command?
@commands.command(pass_context = True)
@commands.has_permissions(ban_members=True)
async def ban(self, ctx, member:discord.Member=None):
"""Bans a member."""
if not member:
await self.bot.say("Who would you like me to ban, 0.mention?".format(ctx.message.author))
pass
await self.bot.ban(member)
await self.bot.say(f"member.mention got banned, what a shame...")
print(colored('moderation.clf: ', 'blue'), colored('Banned member', 'white'))
python python-3.x discord discord.py
python python-3.x discord discord.py
asked Nov 13 '18 at 23:05
Daniel CasaresDaniel Casares
497
497
unban
takes aUser
, not aMember
. This is because when you ban someone from the server, they aren't aMember
anymore. You need to get theirUser
object instead.
– Patrick Haugh
Nov 13 '18 at 23:51
Ok! does the same happen withawait server_voice_state(user=member, deafen=True)
andawait server_voice_state(user=member, mute=True)
?
– Daniel Casares
Nov 14 '18 at 0:15
server_voice_state
has nouser
parameter. It has amember
parameter
– Patrick Haugh
Nov 14 '18 at 0:24
add a comment |
unban
takes aUser
, not aMember
. This is because when you ban someone from the server, they aren't aMember
anymore. You need to get theirUser
object instead.
– Patrick Haugh
Nov 13 '18 at 23:51
Ok! does the same happen withawait server_voice_state(user=member, deafen=True)
andawait server_voice_state(user=member, mute=True)
?
– Daniel Casares
Nov 14 '18 at 0:15
server_voice_state
has nouser
parameter. It has amember
parameter
– Patrick Haugh
Nov 14 '18 at 0:24
unban
takes a User
, not a Member
. This is because when you ban someone from the server, they aren't a Member
anymore. You need to get their User
object instead.– Patrick Haugh
Nov 13 '18 at 23:51
unban
takes a User
, not a Member
. This is because when you ban someone from the server, they aren't a Member
anymore. You need to get their User
object instead.– Patrick Haugh
Nov 13 '18 at 23:51
Ok! does the same happen with
await server_voice_state(user=member, deafen=True)
and await server_voice_state(user=member, mute=True)
?– Daniel Casares
Nov 14 '18 at 0:15
Ok! does the same happen with
await server_voice_state(user=member, deafen=True)
and await server_voice_state(user=member, mute=True)
?– Daniel Casares
Nov 14 '18 at 0:15
server_voice_state
has no user
parameter. It has a member
parameter– Patrick Haugh
Nov 14 '18 at 0:24
server_voice_state
has no user
parameter. It has a member
parameter– Patrick Haugh
Nov 14 '18 at 0:24
add a comment |
1 Answer
1
active
oldest
votes
Since members represent users inside a server you can't have a member instance for a user that is currently banned. You have to use the User
instance which is not server-specific to unban, for example await self.bot.unban(server, user)
where server is of type discord.Server
and user of type discord.User
.
I've already done this, but i still appreciate this ^^
– Daniel Casares
Nov 18 '18 at 21:02
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53290828%2fdiscord-python-unban-member%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Since members represent users inside a server you can't have a member instance for a user that is currently banned. You have to use the User
instance which is not server-specific to unban, for example await self.bot.unban(server, user)
where server is of type discord.Server
and user of type discord.User
.
I've already done this, but i still appreciate this ^^
– Daniel Casares
Nov 18 '18 at 21:02
add a comment |
Since members represent users inside a server you can't have a member instance for a user that is currently banned. You have to use the User
instance which is not server-specific to unban, for example await self.bot.unban(server, user)
where server is of type discord.Server
and user of type discord.User
.
I've already done this, but i still appreciate this ^^
– Daniel Casares
Nov 18 '18 at 21:02
add a comment |
Since members represent users inside a server you can't have a member instance for a user that is currently banned. You have to use the User
instance which is not server-specific to unban, for example await self.bot.unban(server, user)
where server is of type discord.Server
and user of type discord.User
.
Since members represent users inside a server you can't have a member instance for a user that is currently banned. You have to use the User
instance which is not server-specific to unban, for example await self.bot.unban(server, user)
where server is of type discord.Server
and user of type discord.User
.
answered Nov 18 '18 at 17:53
MinnMinn
804216
804216
I've already done this, but i still appreciate this ^^
– Daniel Casares
Nov 18 '18 at 21:02
add a comment |
I've already done this, but i still appreciate this ^^
– Daniel Casares
Nov 18 '18 at 21:02
I've already done this, but i still appreciate this ^^
– Daniel Casares
Nov 18 '18 at 21:02
I've already done this, but i still appreciate this ^^
– Daniel Casares
Nov 18 '18 at 21:02
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53290828%2fdiscord-python-unban-member%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
unban
takes aUser
, not aMember
. This is because when you ban someone from the server, they aren't aMember
anymore. You need to get theirUser
object instead.– Patrick Haugh
Nov 13 '18 at 23:51
Ok! does the same happen with
await server_voice_state(user=member, deafen=True)
andawait server_voice_state(user=member, mute=True)
?– Daniel Casares
Nov 14 '18 at 0:15
server_voice_state
has nouser
parameter. It has amember
parameter– Patrick Haugh
Nov 14 '18 at 0:24