import React, { Component } from "react";
import { StyleSheet, Text, View, SafeAreaView } from "react-native";
export default class Example extends Component {
render() {
return (
<SafeAreaView style={styles.container}>
<View style={{ borderWidth: 1, borderRadius: 5, borderColor: 'red', width: "90%" }}>
<View style={{ borderWidth: 1, borderRadius: 10, borderColor: 'green', width: "100%" }}>
<View style={{ borderWidth: 1, borderRadius: 15, borderColor: 'blue', width: "100%" }}>
<Text style={{alignSelf: 'center'}}>Search</Text>
</View>
</View>
</View>
</SafeAreaView>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
paddingTop: 100,
justifyContent: "center",
alignItems: "center"
}
});
没有输出。绝对没有输出。我希望时间可以返回,或者至少可以。
答案 0 :(得分:0)
确保在before_loop函数参数中包含所有导入内容和self。如果它在齿轮内,请确保在客户之前包括self。在前一点加上小时,分钟和计数+自我似乎可以解决问题。
import discord
from discord.ext import commands, tasks
from datetime import date, datetime
class StackOverflow(commands.Cog):
def __init__(self, client):
self.client = client
self.remind420.start()
@tasks.loop(seconds = 5.0, minutes=0, hours=0 count=None)
async def remind420(self):
print("YES")
print(datetime.now().strftime("%H:%M"))
if datetime.now().strftime("%H:%M") == "16:55" or datetime.now().strftime("%H:%M") == "04:20":
await self.client.get_channel(632933507399942164).send("420!!")
@remind420.before_loop
async def remind420_before(self):
await self.client.wait_until_ready()