What i want to do is get the stats of an osu. player. However i do not know how to read message content after the $getstats command.
osu_url = 'https://osu.ppy.sh/users/'
if message.content.startswith('$getstats'):
player_name = #read content after $getstats
osu_url = 'https://osu.ppy.sh/users/' + player_name
Can anyone explain how to read message content?
You can simply use
player_name = message.content[9:]
Where 9 = len("$getstats")
A possiable soultion, spliting the string by $getstats
.
osu_url = 'https://osu.ppy.sh/users/'
if message.content.startswith('$getstats'):
_, player_name = message.content.split('$getstats')
osu_url = 'https://osu.ppy.sh/users/' + player_name
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.