-2
#Classes

class get:
    def channel(channelname):
        """Returns a channel object from the channel name."""
        return utils.get(Guild.text_channels, name=channelname)

    def role(rolename):
        """Returns a role object from the role name."""
        return utils.get(Guild.roles, name=rolename)

error message: Method should have "self" as first argument

1 Answers1

1

You need to add self as the first argument of any method of a class:

class get:
    def channel(self, channelname):
        """Returns a channel object from the channel name."""
        return utils.get(Guild.text_channels, name=channelname)

    def role(self, rolename):
        """Returns a role object from the role name."""
        return utils.get(Guild.roles, name=rolename)
muhmann
  • 191
  • 9