如果只输入文字,我会尝试显示明文框 当我在文本框中输入内容时,为什么它没有显示明文?
有任何建议如何解决它
UnicodeDecodeError: 'ascii' codec cant decode byte 0xef in position 2141: ordinal not in range(128)

import asyncio
import random
import discord.ext.commands
import markovify
import nltk
import re
with open("/root/sample.txt") as f:
text = f.read()
class POSifiedText(markovify.Text):
def word_split(self, sentence):
words = re.split(self.word_split_pattern, sentence)
words = [w for w in words if len(w) > 0]
words = [" :: ".join(tag) for tag in nltk.pos_tag(words)]
return words
def word_join(self, words):
sentence = "".join(word.split("::")[0] for word in words)
return sentence
text_model = POSifiedText(text, state_size=1)
client = discord.Client()
async def background_loop():
await client.wait_until_ready()
while not client.is_closed:
channel = client.get_channel('286342556600762369')
messages = [(text_model.make_sentence(tries=33, max_overlap_total=10, default_max_overlap_ratio=0.5))]
await client.send_message(channel, random.choice(messages))
await asyncio.sleep(15)
client.loop.create_task(background_loop())
client.run("MjY2NjkwNDY4MjI4NzU5NTU4.C5jcdw.WFfBTUmAY7UcrwKTwYFJ9_bFHjI")

答案 0 :(得分:1)
您需要创建一个侦听器来侦听输入字段的更改。
for (int x = 0; x < count; x++){
if (userInputUsername.equals(username[x]) && userInputPassword.equals( password[x]))
{
loginSuccesful();
}
else if (!userInputUsername.equals(username[x]) ||
!userInputPassword.equals(password[x]))
{
loginFailed(); // Seems to give the login failed message multiple times based on the # of lines in an array in the login.txt document.
}
}