我一直在尝试创建一个机器人命令,在发送命令后侦听消息。这旨在用于创建命令作者的配置文件,以便稍后存储在 JSON 文件中。
@client.command() #creates player profile
async def create(ctx):
await ctx.send("You will be asked a series of questions to create your Profile. If you accidentally typed this wait 15 seconds for it to cancel.")
message = await client.wait_for('message',check=None,timeout=15)
await ctx.send(message) #used to check what message is holding
Run Code Online (Sandbox Code Playgroud)
虽然上面的代码可以工作,但它并没有按照我想要的方式工作。它会发回服务器、成员、频道、消息和作者的 ID 以及其他信息,而不是保留命令作者的回复。
我一直在尝试通过扩展类来创建自定义 HTML 元素HTMLElement。我尝试通过链接与其他两个文件位于同一目录中的 CSS 文件来添加一些样式 -index.html和custom.css.
主文件夹
index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="nofollow" type="text/css" href=''>
</head>
<body>
<script src="./custom.js"></script>
<smooth-button text="Smooth button" no-1 = 1 no-2 = 2></smooth-button>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
custom.css:
smooth-button{
display: block;
color: blue;
background-color: orange;
}
Run Code Online (Sandbox Code Playgroud)
custom.js:
class SmoothButton extends HTMLElement{
constructor(){
super();
this.shadow = this.attachShadow({mode: "open"})
}
connectedCallback(){
this.render();
}
render(){
this.SumOfNo1AndNo2 …Run Code Online (Sandbox Code Playgroud) 我有一个<div>里面有一些孩子,里面包含如下文字:
<div class="accordion-item__panel">
<h5>The baby tears the pages of the</h5>
<p>books with her <span>hands.</span></p>
<p class="body-small">What is the funniest thing the baby does?</p>
</div>
Run Code Online (Sandbox Code Playgroud)
我想要 DIV 中包含的文本accordion-item__panel和输出,例如:
The baby tears the pages of the books with her hands. What is the funniest thing the baby does?
Run Code Online (Sandbox Code Playgroud)
电流输出:
The baby tears the pages of the books with her hands. hands. What is the funniest thing the baby does?
Run Code Online (Sandbox Code Playgroud)
添加了“手”。两倍,因为它在查询元素时保留了两次。
JavaScript:
let desc = "";
const descItems = …Run Code Online (Sandbox Code Playgroud) 我正在使用文件选择器库。
权限代码:
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R || Environment.isExternalStorageManager()) {
//Toast.makeText(this, "We can access all files on external storage now", Toast.LENGTH_SHORT).show()
} else {
Intent intent = new Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION);
startActivityForResult(intent, FILE_REQUEST_CODE);
}
Run Code Online (Sandbox Code Playgroud)
选择文件:
Intent intent = new Intent(this, FilePickerActivity.class);
intent.putExtra(FilePickerActivity.CONFIGS, new Configurations.Builder()
.setCheckPermission(true)
.setSelectedMediaFiles(mediaFiles)
.setShowFiles(true)
.setShowImages(false)
.setShowAudios(false)
.setShowVideos(false)
.setIgnoreNoMedia(false)
.enableVideoCapture(false)
.enableImageCapture(false)
.setIgnoreHiddenFile(false)
.setMaxSelection(5)
.setSuffixes("pdf", "doc", "docx")
//.setTitle("Select a file")
.build());
startActivityForResult(intent, FILE_REQUEST_CODE);
Run Code Online (Sandbox Code Playgroud)
onActivityResult:
if (requestCode == FILE_REQUEST_CODE && resultCode == RESULT_OK && data != null) {
//ArrayList<MediaFile> files …Run Code Online (Sandbox Code Playgroud) 我听说 Java 在较新版本的 Android 上变得越来越快,几乎与 C++ 一样快,并且性能取决于代码/操作的类型。这是真的?如果是,哪个 Java 版本在 Android 上速度最快并且支持 Android 开发?
我目前可能拥有 Java 11;当我进入java --versionCMD时它是这样说的:
java 11.0.11 2021-04-20 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.11+9-LTS-194)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.11+9-LTS-194, mixed mode)
Run Code Online (Sandbox Code Playgroud)
但是,当我打开“关于 Java”应用程序时,我得到了这个:
升级是否值得,它的构建/语法/功能与 Java 8/11 有何不同?更改 Java/JDK 版本是否会影响 Gradle/其他构建工具的版本或设备运行我的应用程序所需的最低 Android 版本?
另外,如果使用不同的编译器、JDK 和优化之间的速度/性能有任何差异,那么更快/更好吗?
任何比较都会有帮助。
android ×2
html ×2
java ×2
javascript ×2
children ×1
css ×1
discord.py ×1
filepicker ×1
foreach ×1
performance ×1
python ×1
realpath ×1
shadow-dom ×1
version ×1