فنڪشن ڪود || FunCode
前往频道在 Telegram
683
订阅者
无数据24 小时
-2 9007 天
-3 17530 天
帖子存档
مصنع بوتات تفاعل علي الرسايل ف القناة هينزل
المصنع فكرته جامده اوي
بمعني انك تصنع البوت تبعت التوكن وتبعت الايموجي الي عايزه يتفاعل بيه البوت وترفعه ف قناتك وبعدها البوت اي رساله هتنزل هيتفاعل تليها لوحده هيبقي ليك تصنع 5 بوتات بس وترفعهم وهيتفاعلو ف قناتك اجهزو شويه وهينزل
import tkinter as tk
from tkinter import messagebox
class TicTacToeApp:
def __init__(self, root):
self.root = root
self.root.title("Tic-Tac-Toe")
self.root.configure(bg="black")
self.window_size = 180
self.root.geometry(f"{self.window_size}x{self.window_size}")
self.root.resizable(False, False)
self.board = [[' ' for _ in range(3)] for _ in range(3)]
self.current_player = 'X'
self.x_wins = 0
self.o_wins = 0
self.create_widgets()
def create_widgets(self):
frame = tk.Frame(self.root, bg="black")
frame.place(relx=0.5, rely=0.5, anchor="center")
self.buttons = [[tk.Button(frame, width=4, height=2, bd=3, bg="black", fg="white", font=("Arial", 10, "bold"),
command=lambda row=i, col=j: self.make_move(row, col))
for j in range(3)] for i in range(3)]
for i in range(3):
for j in range(3):
self.buttons[i][j].grid(row=i, column=j, padx=3, pady=3)
reset_button = tk.Button(self.root, text="Reset", font=("Arial", 10, "bold"), command=self.reset_game, bd=3, bg="black", fg="white")
reset_button.place(relx=0.5, rely=0.85, anchor="center")
self.x_points_label = tk.Label(self.root, text="X: 0", font=("Arial", 10), fg="red", bg="black")
self.x_points_label.place(relx=0.15, rely=0.92, anchor="center")
self.o_points_label = tk.Label(self.root, text="O: 0", font=("Arial", 10), fg="blue", bg="black")
self.o_points_label.place(relx=0.85, rely=0.92, anchor="center")
def make_move(self, row, col):
if self.board[row][col] == ' ':
self.board[row][col] = self.current_player
if self.check_winner():
messagebox.showinfo("Result", f"Good luck! Player {self.current_player} won.")
if self.current_player == 'X':
self.x_wins += 1
else:
self.o_wins += 1
self.update_points()
self.reset_game()
elif all(cell != ' ' for row in self.board for cell in row):
messagebox.showinfo("Result", "It's a draw. Try again.")
self.reset_game()
else:
self.current_player = 'O' if self.current_player == 'X' else 'X'
self.update_ui()
def reset_game(self):
self.board = [[' ' for _ in range(3)] for _ in range(3)]
self.current_player = 'X'
self.update_ui()
def update_ui(self):
for i in range(3):
for j in range(3):
button = self.buttons[i][j]
button.config(text=self.board[i][j], state=tk.DISABLED if self.board[i][j] != ' ' else tk.NORMAL,
bg="red" if self.board[i][j] == 'X' else "blue" if self.board[i][j] == 'O' else "black")
def check_winner(self):
for row in self.board:
if all(cell == 'X' for cell in row) or all(cell == 'O' for cell in row):
return True
for col in range(3):
if all(self.board[row][col] == 'X' for row in range(3)) or all(self.board[row][col] == 'O' for row in range(3)):
return True
if all(self.board[i][i] == 'X' for i in range(3)) or all(self.board[i][2 - i] == 'X' for i in range(3)):
return True
return False
def update_points(self):
self.x_points_label.config(text=f"X: {self.x_wins}")
self.o_points_label.config(text=f"O: {self.o_wins}")
if __name__ == "__main__":
root = tk.Tk()
app = TicTacToeApp(root)
root.mainloop()$admin = "000"; #ايديك
$update = json_decode(file_get_contents('php://input'));
if ($update->callback_query) {
$data = $update->callback_query->data;
$chat_id = $update->callback_query->message->chat->id;
$message_id = $update->callback_query->message->message_id;
$name = $update->callback_query->message->chat->first_name;
$from_id = $update->callback_query->from->id;
} elseif ($update->message) {
$message = $update->message;
$message_id = $update->message->message_id;
$chat_id = $message->chat->id;
$text = $message->text;
$name = $message->from->first_name;
$from_id = $message->from->id;
}
$nogom = [];
if (file_exists('nogom.json')) {
$nogom = json_decode(file_get_contents('nogom.json'), true);
}
if ($text == "تقييم") {
$average_rating = $nogom ? array_sum($nogom) / count($nogom) : 0;
$nogomall = count($nogom);
$stars = str_repeat("⭐", round($average_rating));
$average_rating = round($average_rating, 1);
bot('sendMessage', [
'chat_id' => $chat_id,
'text' => "
Evaluation
$stars ($average_rating)
عدد المشاركين في التقييم --> ($nogomall)
يرجى المشاركة في تقييم البوت من خلال الأزرار",
'parse_mode' => "markdown",
'reply_markup' => json_encode([
'inline_keyboard' => [
[['text' => "⭐", 'callback_data' => "1"]],
[['text' => "⭐⭐", 'callback_data' => "2"]],
[['text' => "⭐⭐⭐", 'callback_data' => "3"]],
[['text' => "⭐⭐⭐⭐", 'callback_data' => "4"]],
[['text' => "⭐⭐⭐⭐⭐", 'callback_data' => "5"]],
]
])
]); // خاص ب عبدو @abdo_1
} elseif (in_array($data, ["1", "2", "3", "4", "5"])) {
$rating = (int)$data;
$nogom[$chat_id] = $rating;
file_put_contents('nogom.json', json_encode($nogom));
$average_rating = array_sum($nogom) / count($nogom);
$stars = str_repeat("⭐", round($average_rating));
$average_rating = round($average_rating, 1);
bot('editMessagetext', [
'chat_id' => $chat_id,
'message_id' => $message_id,
'text' => "شكرا لتقييمك
Evaluation
$stars ($average_rating)
",
'parse_mode' => "markdown",
'reply_markup' => json_encode([
'inline_keyboard' => [
[['text' => "إعادة التقييم", 'callback_data' => "nogom"]],
]])
]);
bot("sendMessage", [
"chat_id" => $admin,
"text" => "تم تقيم البوت من $name
تقييمه للبوت $rating ⭐
Acount ",
"parse_mode" => "markdown",
'reply_markup' => json_encode([
'inline_keyboard' => [
[['text' => "إرسال شكر 🌹", 'callback_data' => "shkr|$from_id|$name"]],
]])
]);
} elseif(explode("|", $data)[0] == "shkr") {
$from_id = explode("|", $data)[1];
$name = explode("|", $data)[2];
bot("editMessagetext",[
"chat_id" => $chat_id,
'message_id' => $message_id ,
"text" => "
* -تم ارسال رسالة شكر لـ *$name ✓
" ,
"parse_mode" => "markdown",
]);
bot("sendMessage", [
"chat_id" => $from_id ,
"text" => "
*- شكرا لك على تقييمنا هذا الشكر موجه لك من مالك البوت شخصيا 😊♥*
", #@abdo_1
"parse_mode" => "markdown",
]);
}
كود ال تقييم البوتات موجود ف بوتي بعض الناس طلبوه
كتابتي.. تخمط اذكر المصدر @abdo_1 √
تبعت تقييم وهتظهر لوحة التقييم
المتغيرات متعرفه ممكن تحطه ف اخر الملف بتاعك
الكود كتابتي وواخد الفكره من قناة همس
كل الي طالبه دعوه حلوه عشان امتحاناتي قربت 💔