当我尝试做empty_Carton = ""
print("Is the milk carton in the fridge empty? y/n")
while (empty_Carton != 'y') or (empty_Carton != 'n'):
if empty_Carton == 'y':
"""Branch here"""
elif empty_Carton == 'n':
"""Branch here"""
else:
print(empty_Carton + " is not a valid input. Type: 'y' or 'n'")
break
时,我总是得到import UIKit
extension UIFont {
private struct CustomFont {
static var fontFamily = "Avenir"
}
/// Returns a bold version of `self`
public var bolded: UIFont {
return fontDescriptor.withSymbolicTraits(.traitBold)
.map { UIFont(descriptor: $0, size: 0) } ?? self
}
/// Returns an italic version of `self`
public var italicized: UIFont {
return fontDescriptor.withSymbolicTraits(.traitItalic)
.map { UIFont(descriptor: $0, size: 0) } ?? self
}
/// Returns a scaled version of `self`
func scaled(scaleFactor: CGFloat) -> UIFont {
let newDescriptor = fontDescriptor.withSize(fontDescriptor.pointSize * scaleFactor)
return UIFont(descriptor: newDescriptor, size: 0)
}
class func preferredCustomFont(forTextStyle textStyle: UIFont.TextStyle) -> UIFont {
// we are using the UIFontDescriptor which is less expensive than creating an intermediate UIFont
let systemFontDescriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: textStyle)
let customFontDescriptor = UIFontDescriptor.init(fontAttributes: [
UIFontDescriptor.AttributeName.family: CustomFont.fontFamily,
UIFontDescriptor.AttributeName.size: systemFontDescriptor.pointSize // use the font size of the default dynamic font
])
// return font of new family with same size as the preferred system font
return UIFont(descriptor: customFontDescriptor, size: 0)
}
}
当我console.log(member.role)我得到:
member.roles.cache
我不知道发生了什么
预先感谢:)
答案 0 :(得分:0)
如果您要查看成员是否具有特定角色(问题尚不清楚),请尝试使用member.roles.cache.some(role => role.name === 'role_name')
。希望这会有所帮助:)
答案 1 :(得分:0)
好的,所以我解决了它:在代码的开头,我运行了guild = client.guilds.cache.find(e=>e.id
= "some id")
,所以它应该与包含公会的变量