0
@FiveStarBot.command(pass_context=True)
async def globalmessage(cxt, *, text : str):
    x = message.server.members
    for member in x:
        await FiveStarBot.send_message(member.name, text)

Why doesn't this work?

I'm beginner programmer

4
  • The error is clear. message is an object of type Command, and there is no such attribute as server in this class, i.e. you cannot do message.server.. Maybe you expected message to be of a different type? Commented Jul 23, 2018 at 0:09
  • can you fix my code and write it correctly pls? Commented Jul 23, 2018 at 0:15
  • @Roman how do you expect to learn things and not be a beginner anymore if you want others to do the job instead of you? Commented Jul 23, 2018 at 2:08
  • Welcome to stackoverflow.com please read stackoverflow.com/help/how-to-ask to improve your question. Try to write a clear title Commented Jul 23, 2018 at 5:30

1 Answer 1

1

You need to use ctx to resolve the message:

@FiveStarBot.command(pass_context=True)
async def globalmessage(ctx, *, text : str):
    for member in ctx.message.server.members:
        await FiveStarBot.send_message(member, text)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.