Cascade ={"remove"}, orphanRemoval=true
当我运行它时,会有一个额外的空间,旁边还有其他所有东西。我想完全删除提及,但即使async def on_message(self, message):
attachmentimage = re.compile(r'(.(jpe?g|JPE?G|png|PNG))')
attachmentgif = re.compile(r'(.(gif|GIF))')
streamables = re.compile(r'streamable(\.com)\/([\w-]{2,50})')
customemoji = re.compile(r'<:[\w]+:[\d]+>')
animatedcustomemoji = re.compile(r'<a:[\w]+:[\d]+>')
username = re.compile(r'@([A-Za-z0-9`~!@#$%^&*()_|+\-=?;:\'",.<>\{\}\[\]\\\/]{2,32})')
path = 'C:/xxxx/xxxx/xxxx/xxxx/Images/'
words = re.sub(r'(@([A-Za-z0-9`~!@#$%^&*()_|+\-=?;:\'",.<>\{\}\[\]\\\/]{2,32}))', '', message.clean_content)
if message.author == self.user:
return
if len(message.attachments) > 0 and attachmentimage.search(message.attachments[0].url) and message.channel.id == 423899570871861252:
if message.mentions or customemoji.search(message.clean_content) or animatedcustomemoji.search(message.clean_content):
print(re.sub(r'(<:|<a:|:[\d]+>)', '', words))
以某种方式创建了额外的空间。
这是输出:
''
正如您所看到的,它确实删除了提及,因为:
hype
但是在不应该有炒作之前还有一个空间。我该如何解决这个问题?