dmc12321

Untitled

Apr 21st, 2024
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 62.50 KB | None | 0 0
  1. import discord
  2. import random
  3. import asyncio
  4. import os
  5. from discord.ext import commands
  6.  
  7. # Define the intents your bot will use
  8. intents = discord.Intents.default()
  9. intents.messages = True # Enable receiving message events
  10. intents.guilds = True # Enable receiving guild events
  11. intents.members = True # Enable receiving member events
  12. intents.message_content = True
  13.  
  14. # Initialize the Discord client with intents
  15. bot = commands.Bot(command_prefix="!", intents=intents)
  16.  
  17. # Define puzzles for each category
  18. ANIMALS_PUZZLES = [
  19. "Speedy Cheetah races across the African savannah",
  20. "Majestic Elephant trumpets loudly in the wilderness",
  21. "Graceful Giraffe stretches to reach high tree leaves",
  22. "Fierce Lion roars proudly on the African plains",
  23. "Majestic Eagle soars high above the rugged mountains",
  24. "Playful Dolphin leaps joyfully in the ocean waves",
  25. "Nocturnal Owl watches silently from the treetops",
  26. "Stealthy Panther prowls through the dense jungle",
  27. "Mighty Rhino charges through the African grasslands",
  28. "Curious Meerkat stands alert on the desert sands",
  29. "Sleek Leopard stalks its prey through the jungle",
  30. "Elegant Swan glides gracefully on the tranquil lake",
  31. "Gentle Deer grazes peacefully in the forest glade",
  32. "Agile Monkey swings effortlessly through the trees",
  33. "Regal Lioness leads her pride across the savannah",
  34. "Fearless Wolf howls under the silver moonlight",
  35. "Clever Fox darts through the underbrush in search of food",
  36. "Majestic Horse gallops freely in the open fields",
  37. "Adorable Bunny hops joyfully through the meadow",
  38. "Mysterious Black Panther lurks in the shadows",
  39. "Beautiful Peacock flaunts its vibrant feathers",
  40. "Swift Hummingbird flits from flower to flower",
  41. "Mighty Gorilla pounds its chest in the dense jungle",
  42. "Colorful Parrot squawks loudly in the tropical forest",
  43. "Steadfast Ox plows the fields with unwavering determination",
  44. "Sly Raccoon scavenges for food in the moonlight",
  45. "Enigmatic Chameleon blends seamlessly into its surroundings",
  46. "Noble Stag stands regally on the forest edge",
  47. "Swift Falcon dives swiftly from the sky in pursuit of prey",
  48. "Gentle Lamb frolics in the green pastures",
  49. ]
  50.  
  51. FOOD_DRINK_PUZZLES = [
  52. "Golden brown Croissant with a delicate buttery aroma",
  53. "Sizzling Fajitas with onions and peppers on a skillet",
  54. "Tantalizing Tiramisu layered with creamy mascarpone",
  55. "Spicy Pad Thai garnished with crushed peanuts and lime",
  56. "Buttery Lobster Tail served with drawn garlic butter",
  57. "Exotic Dragon Fruit with vibrant pink flesh and black seeds",
  58. "Crunchy Tempura Shrimp dipped in a tangy soy sauce",
  59. "Hearty Beef Stew simmered with root vegetables and herbs",
  60. "Refreshing Mojito with muddled mint and lime wedges",
  61. "Creamy Risotto infused with saffron and Parmesan cheese",
  62. "Fluffy Belgian Waffle topped with fresh berries and whipped cream",
  63. "Smoky BBQ Ribs glazed with tangy barbecue sauce",
  64. "Decadent Chocolate Fondue with assorted fruits and marshmallows",
  65. "Savory Gourmet Burger topped with melted cheese and crispy bacon",
  66. "Zesty Margherita Pizza with fresh tomatoes and basil leaves",
  67. "Velvety Pumpkin Soup garnished with roasted pumpkin seeds",
  68. "Fizzy Prosecco Champagne served in elegant crystal flutes",
  69. "Rich Chocolate Lava Cake oozing with molten chocolate center",
  70. "Crispy Calamari Rings served with spicy marinara dipping sauce",
  71. "Tangy Kimchi made from fermented cabbage and chili peppers",
  72. "Creamy Lobster Bisque garnished with fresh chives",
  73. "Aromatic Jasmine Rice steamed to fluffy perfection",
  74. "Juicy Watermelon slices chilled and refreshing on a hot day",
  75. "Tender Beef Wellington wrapped in flaky puff pastry",
  76. "Silky Chocolate Mousse topped with whipped cream and chocolate shavings",
  77. "Fragrant Earl Grey Tea served with a slice of lemon",
  78. "Succulent Roast Duck with crispy skin and tender meat",
  79. "Sweet and Sour Pineapple Chicken served over steamed rice",
  80. "Crunchy Kale Chips seasoned with sea salt and nutritional yeast",
  81. "Sizzling Beef Bulgogi marinated in a spicy sweet sauce",
  82. ]
  83.  
  84. QUOTES_PUZZLES = [
  85. "The journey of a thousand miles begins with a single step",
  86. "In the midst of chaos, there is also opportunity",
  87. "To live is the rarest thing in the world",
  88. "The only way to do great work is to love what you do",
  89. "Dream big and dare to fail",
  90. "Life is what happens when you're busy making other plans",
  91. "Success is not final, failure is not fatal",
  92. "The greatest glory in living lies not in never falling",
  93. "Believe you can and you're halfway there",
  94. "The future belongs to those who believe in the beauty",
  95. "Life is either a daring adventure or nothing at all",
  96. "Nothing in life is to be feared, it is only to be understood",
  97. "The only limit to our realization of tomorrow",
  98. "It is our choices that show what we truly are",
  99. "Every child is an artist. The problem is how to remain",
  100. "The only thing worse than being blind is having sight",
  101. "Do not go where the path may lead",
  102. "The only true wisdom is in knowing you know nothing",
  103. "A journey of a thousand miles begins with a single step",
  104. "The best way to predict the future is to invent it",
  105. "The secret of getting ahead is getting started",
  106. "You must be the change you wish to see in the world",
  107. "The future belongs to those who believe in the beauty",
  108. "Life is what happens when you're busy making other plans",
  109. "Strive not to be a success, but rather to be of value",
  110. "Change your thoughts and you change your world",
  111. "The only thing necessary for the triumph of evil",
  112. "The only way to do great work is to love what you do",
  113. "The best preparation for tomorrow is doing your best today",
  114. ]
  115.  
  116. MOVIES_PUZZLES = [
  117. "Inception A mind bending journey into the depths of dreams",
  118. "The Shawshank Redemption A tale of hope and redemption",
  119. "The Matrix A groundbreaking sci-fi adventure with mind bending twists",
  120. "Fight Club An edgy exploration of identity and consumerism",
  121. "The Dark Knight A gripping tale of chaos and morality",
  122. "Pulp Fiction A nonlinear narrative with unforgettable characters",
  123. "Forrest Gump A heartwarming story of love, loss, and destiny",
  124. "The Silence of the Lambs A chilling psychological thriller",
  125. "The Lord of the Rings An epic fantasy saga of friendship and heroism",
  126. "The Godfather A timeless tale of power, family, and betrayal",
  127. "The Shawshank Redemption A story of hope and resilience",
  128. "Schindler's List A poignant portrayal of humanity amid tragedy",
  129. "Star Wars A space opera that captured the imaginations of millions",
  130. "Casablanca A classic romance set against the backdrop of World War II",
  131. "The Lion King An animated masterpiece with timeless themes",
  132. "Titanic A tragic love story set aboard the ill-fated RMS Titanic",
  133. "The Wizard of Oz A whimsical journey through a magical land",
  134. "Goodfellas A gritty crime drama based on true events",
  135. "The Godfather A saga of power, loyalty, and betrayal",
  136. "Back to the Future A thrilling adventure through time",
  137. "The Matrix A mind bending journey into a simulated reality",
  138. "The Dark Knight A dark and complex exploration of heroism",
  139. "Fight Club A provocative examination of modern masculinity",
  140. "Inception A cerebral heist thriller set within the architecture of the mind",
  141. "The Shawshank Redemption A powerful tale of friendship and redemption",
  142. "Pulp Fiction A non-linear narrative weaving multiple storylines",
  143. "Forrest Gump A heartwarming journey through American history",
  144. "The Silence of the Lambs A gripping psychological thriller",
  145. "The Lord of the Rings An epic fantasy adventure of good versus evil",
  146. "Star Wars A timeless space opera that defined a generation",
  147. ]
  148.  
  149. PLACES_PUZZLES = [
  150. "Eiffel Tower An iconic landmark of Paris",
  151. "Statue of Liberty A symbol of freedom and democracy",
  152. "Great Wall of China An ancient marvel visible from space",
  153. "Machu Picchu A mystical Incan city perched high in the Andes Mountains",
  154. "Taj Mahal A magnificent marble mausoleum in Agra",
  155. "Pyramids of Giza Ancient wonders shrouded in mystery",
  156. "Grand Canyon A breathtaking natural wonder carved by the Colorado River",
  157. "Colosseum An iconic symbol of ancient Rome",
  158. "Sydney Opera House An architectural marvel on Sydney Harbour",
  159. "Mount Everest The tallest peak on Earth",
  160. "Niagara Falls A majestic natural wonder on the US-Canada border",
  161. "Bora Bora A tropical paradise with crystal-clear waters",
  162. "Angkor Wat A stunning temple complex in Cambodia",
  163. "Petra A historic city carved into rose-colored rock",
  164. "Acropolis An ancient citadel overlooking Athens",
  165. "Stonehenge A prehistoric monument in Wiltshire",
  166. "Times Square A bustling commercial and entertainment hub",
  167. "Big Ben An iconic clock tower in London",
  168. "Kremlin A historic fortress in the heart of Moscow",
  169. "Hollywood Walk of Fame A sidewalk tribute to entertainment icons",
  170. "Neuschwanstein Castle A fairytale castle nestled in the Bavarian Alps",
  171. "Mount Fuji An iconic volcanic peak in Japan",
  172. "Forbidden City A vast imperial palace complex in Beijing",
  173. "Easter Island Moai Enigmatic stone statues on a remote island",
  174. "Sistine Chapel Home to Michelangelo's masterpiece",
  175. "Burj Khalifa The tallest building in the world",
  176. "Mount Rushmore A monumental sculpture carved into granite",
  177. "Christ the Redeemer A towering monument in Rio de Janeiro",
  178. "Alhambra A stunning Moorish palace in Granada",
  179. "Golden Gate Bridge An iconic symbol of San Francisco",
  180. ]
  181.  
  182. FICTIONAL_CHARACTERS_PUZZLES = [
  183. "Hannibal Lecter A brilliant yet twisted psychiatrist and serial killer",
  184. "Sherlock Holmes A master detective with keen powers of observation",
  185. "Atticus Finch A principled lawyer defending justice in the South",
  186. "Darth Vader A dark lord of the Sith with a tragic past",
  187. "Katniss Everdeen A courageous rebel fighting against tyranny",
  188. "Lara Croft A fearless archaeologist exploring ancient ruins",
  189. "Dorothy Gale A plucky girl on a fantastical journey through Oz",
  190. "Captain Jack Sparrow A witty and eccentric pirate captain",
  191. "Hermione Granger A brilliant witch and loyal friend",
  192. "Frodo Baggins A humble hobbit tasked with saving Middle-earth",
  193. "Indiana Jones An adventurous archaeologist and treasure hunter",
  194. "Lisbeth Salander A fierce and enigmatic hacker seeking justice",
  195. "James Bond A suave and sophisticated MI6 agent",
  196. "Wolverine A fierce mutant with retractable claws and rapid healing",
  197. "Princess Leia A fearless leader of the Rebel Alliance",
  198. "Don Quixote An idealistic knight-errant on a quest for chivalry",
  199. "Winnie the Pooh A lovable bear with a penchant for honey",
  200. "The Joker A chaotic and unpredictable criminal mastermind",
  201. "Wonder Woman A powerful Amazonian warrior fighting for justice",
  202. "Peter Pan A mischievous boy who refuses to grow up",
  203. "Captain Ahab A obsessed captain on a quest for vengeance",
  204. "Spartacus A slave who leads a revolt against the Roman Empire",
  205. "Tarzan A jungle-dwelling hero raised by apes",
  206. "Mulan A courageous warrior who disguises herself as a man",
  207. "Luke Skywalker A farm boy who becomes a Jedi Knight",
  208. "The Wicked Witch of the West A malevolent sorceress from Oz",
  209. "Dracula A charismatic vampire with a thirst for blood",
  210. "Bilbo Baggins A reluctant hero on a journey to reclaim treasure",
  211. "Hercules A demi-god with superhuman strength",
  212. "Puss in Boots A charming and cunning feline adventurer",
  213. ]
  214.  
  215. WHAT_ARE_YOU_DOING_PUZZLES = [
  216. "Exploring the depths of a mysterious ancient ruin",
  217. "Embarking on a perilous journey across uncharted seas",
  218. "Deciphering the cryptic clues of a hidden treasure map",
  219. "Venturing into the heart of a dense and enchanted forest",
  220. "Unraveling the dark secrets of a haunted mansion",
  221. "Surviving in a post-apocalyptic wasteland overrun by mutants",
  222. "Navigating the treacherous waters of a pirate-infested sea",
  223. "Fighting alongside valiant knights in a medieval battlefield",
  224. "Confronting the ultimate evil in a battle for the fate of the world",
  225. "Embarking on a quest to save a kidnapped princess from a dragon",
  226. "Traversing the vast expanse of a desert kingdom on camelback",
  227. "Solving the riddles of an enigmatic sphinx in the desert sands",
  228. "Outwitting a cunning and ruthless bandit king in a high-stakes heist",
  229. "Exploring the mystical realms of the fae in search of hidden treasures",
  230. "Engaging in a deadly game of cat-and-mouse with a notorious assassin",
  231. "Surviving the harsh conditions of an unforgiving arctic wilderness",
  232. "Fulfilling an ancient prophecy to bring balance to the world",
  233. "Discovering the lost civilization of an ancient and forgotten people",
  234. "Rescuing a group of hostages from a terrorist stronghold",
  235. "Escaping from a maximum-security prison with cunning and stealth",
  236. "Sailing the high seas in search of fame, fortune, and adventure",
  237. "Defeating a horde of rampaging monsters threatening a peaceful village",
  238. "Challenging a powerful sorcerer to a magical duel of wits and wills",
  239. "Exploring the dark and twisted corridors of a cursed castle",
  240. "Surviving a zombie apocalypse with quick thinking and resourcefulness",
  241. "Embarking on an epic quest to recover a stolen artifact of immense power",
  242. "Confronting the ghostly inhabitants of a haunted mansion",
  243. "Braving the dangers of a dense and forbidding jungle",
  244. "Racing against time to stop an impending cataclysmic event",
  245. "Battling against hordes of demons to save the world from eternal darkness",
  246. ]
  247.  
  248. WHAT_ARE_YOU_WEARING_PUZZLES = [
  249. "A suit of shining armor adorned with intricate engravings",
  250. "A flowing robe woven from the finest silk and embroidered with gold thread",
  251. "A cloak of invisibility that renders its wearer unseen to all but the keenest eyes",
  252. "A pendant imbued with ancient magic that grants its wearer protection from harm",
  253. "A crown of shimmering diamonds that glitters in the light of the full moon",
  254. "A pair of enchanted boots that allow their wearer to walk on water",
  255. "A mask of cunning disguise that conceals its wearer's true identity",
  256. "A cloak of shadows that renders its wearer invisible to mortal eyes",
  257. "A pair of wings fashioned from feathers of purest white that grant their wearer the gift of flight",
  258. "A circlet of starlight that bestows upon its wearer visions of the future",
  259. "A robe of flowing lava that grants its wearer mastery over fire",
  260. "A helm of shining steel that protects its wearer from all harm",
  261. "A pair of gauntlets forged from the heart of a fallen star that grant their wearer the strength of a titan",
  262. "A cloak of whispers that grants its wearer the power of persuasion",
  263. "A mask of many faces that grants its wearer the ability to change their appearance at will",
  264. "A pair of sandals that grant their wearer the speed of Hermes",
  265. "A crown of flames that grants its wearer the power of pyrokinesis",
  266. "A helm of shadows that grants its wearer the power to command the darkness",
  267. "A cloak of shimmering moonlight that grants its wearer the power of illusion",
  268. "A pair of gloves that grant their wearer mastery over the elements",
  269. "A belt of stars that grants its wearer the power to control the heavens",
  270. ]
  271.  
  272. SONG_TITLES_PUZZLES = [
  273. "Tears Dry on Their Own",
  274. "Killing Me Softly with His Song",
  275. "Dancing Queen in the Moonlight",
  276. "A Whiter Shade of Pale",
  277. "The Sound of Silence",
  278. "You're the One That I Want",
  279. "The Thrill Is Gone Away",
  280. "I Can't Help Falling in Love",
  281. "You Can't Always Get What You Want",
  282. "With or Without You",
  283. "Come As You Are",
  284. "Bridge Over Troubled Water",
  285. "Wish You Were Here with Me",
  286. "Don't Let the Sun Go Down on Me",
  287. "I Heard It Through the Grapevine",
  288. "A Horse with No Name",
  289. "When You Were Young and Free",
  290. "Girls Just Want to Have Fun",
  291. "Dream a Little Dream of Me",
  292. "What's Love Got to Do with It"
  293. ]
  294.  
  295. RIDDLES_AND_RHYMES_PUZZLES = [
  296. "Measure of Time, Yet Subjective in Length",
  297. "Once in a Minute, Yet Fleeting as Thought",
  298. "Head and Tail, Yet Mobility Without Limbs",
  299. "Take and Leave, Yet Always Equally Balanced",
  300. "Keys to Gates, Yet Doors Remain Shut",
  301. "Neck Without Head, Yet Graceful in Form",
  302. "Made and Sold, Yet Never Truly Owned",
  303. "Broken Before Use, Yet Intact in Concept",
  304. "Wet and Dry, Yet Both in Simultaneous State",
  305. "Speech Without Words, Yet Communicative in Nature",
  306. "Sightless Gaze, Yet Perceptive in Insight",
  307. "Many Keys, Yet None Fit the Lock",
  308. "Yours to Hold, Yet Others to Employ",
  309. "Endless Journey, Yet Stationary in Space",
  310. "Face and Hands, Yet Bodyless and Free",
  311. "Head and Tail, Yet Earthy in Hue",
  312. "Grows in Absence, Yet Shrinks in Presence",
  313. "Balanced Step, Yet Straddled Between Realms",
  314. "Descends Forever, Yet Never Soars",
  315. "Cracked, Made, Told, Played, Yet Eternal Cycle",
  316. "Civilization's Map, Yet Nature's Dominion",
  317. "Catches Dreams, Yet Lets Realities Slip",
  318. "Expands Limitlessly, Yet Occupies No Volume",
  319. "Letter of Start and Finish, Yet Infinite in Between",
  320. "Grip of Right, Yet Released by the Left",
  321. "Shattered by Force, Yet Never Felled by Gravity",
  322. "Sees All, Yet Remains Blind to Truth",
  323. "Speaks of Hunger, Yet Nourishes Not",
  324. "Quantified for Preparation, Yet Unmeasured in Impact",
  325. ]
  326.  
  327. PUZZLES = {
  328. "Animals": ANIMALS_PUZZLES,
  329. "Food and Drink": FOOD_DRINK_PUZZLES,
  330. "Quotations": QUOTES_PUZZLES,
  331. "Movie Quotes": MOVIES_PUZZLES,
  332. "Places": PLACES_PUZZLES,
  333. "Fictional Characters": FICTIONAL_CHARACTERS_PUZZLES,
  334. "What Are You Doing": WHAT_ARE_YOU_DOING_PUZZLES,
  335. "What Are You Wearing": WHAT_ARE_YOU_WEARING_PUZZLES,
  336. "Song Titles": SONG_TITLES_PUZZLES,
  337. "Riddles and Rhymes": RIDDLES_AND_RHYMES_PUZZLES,
  338. }
  339.  
  340. # Define possible outcomes for spinning the wheel
  341. WHEEL_OUTCOMES = [
  342. "Robbed",
  343. "Spin Lost",
  344. "Spin Again",
  345. "100",
  346. "200",
  347. "300",
  348. "400",
  349. "500",
  350. "600",
  351. "700",
  352. "800",
  353. "900",
  354. "1000",
  355. "1500"
  356. ]
  357.  
  358. SUPER_WHEEL_OUTCOMES = [
  359. "1000",
  360. "1500",
  361. "2500"
  362. ]
  363.  
  364. ULTRA_WHEEL_OUTCOMES = [
  365. "2000",
  366. "3000",
  367. "4000"
  368. ]
  369.  
  370. MEGA_WHEEL_OUTCOMES = [
  371. "2500",
  372. "4000",
  373. "5000"
  374. ]
  375.  
  376. # Define a dictionary of commands and their descriptions
  377. commands_dict = {
  378. '!ssw': 'Start a new game',
  379. '!join': 'Join the game.',
  380. '!joint': 'Special command for joey',
  381. '!spin': 'Spin the wheel.',
  382. '!guess [letter]': 'Guess a letter in the puzzle.',
  383. '!solve [puzzle]': 'Attempt to solve the puzzle.',
  384. '!superspin': 'Spin the wheel with extra chance of winning (requires win count between 10 and 24).',
  385. '!ultraspin': 'Spin the wheel with extra chance of winning (requires win count between 25 and 49).',
  386. '!megaspin': 'Spin the wheel with extra chance of winning (requires win count of 50 or more).',
  387. '!commands': 'Display the list of available commands.'
  388. }
  389.  
  390. special_players = {
  391. "480539285607546910": "WELCOME QUEEN LIZZY! YOU ARE AMAZING!\nhttps://tenor.com/view/lizard-elmo-liz-hi-liz-hi-lizzy-elmo-lizzy-gif-26781052",
  392. "1222299615538450465": "SUPREMEEE VICTORYYY!\nhttps://tenor.com/view/sabrewulf-video-games-gaming-xbox-killer-instinct-gif-3538282248554946598",
  393. "1197590901741076601": "Welcome the coup queen!\nhttps://tenor.com/view/hi-kira-e-chill-gif-24196509",
  394. "725242689498513458": "Soft kitty...Warm Kitty... I AM ANGRY KITTY... WOMP WOMP\nhttps://tenor.com/view/annoyed-disappointed-mad-upset-gif-26051038",
  395. "1063542949314560092": "JOEY HAS ARRIVED PUFF PUFF PASS!\nhttps://tenor.com/view/sister-joe-dirt-david-spade-hands-up-gif-16731619"
  396. }
  397.  
  398. # Global variables
  399. game_created = False
  400. game_started = False # Flag to track if the game has started
  401. players = {}
  402. current_player = None
  403. current_puzzle = ""
  404. current_category = None # Define current_category globally
  405. revealed_letters = []
  406. scoreboard = {}
  407. guessed_correctly = False
  408. outcome = None # Define outcome here to avoid reference error
  409. solve_attempted = False # Flag to track if a solve attempt was made
  410. game_initiator = None # Store the user who initiated the game
  411. guessed_letters = [] # GUESSED LETTERS
  412. win_counts = {} # Initialize win counts dictionary
  413.  
  414.  
  415. # Initialize players dictionary with win counts
  416. def initialize_players():
  417. global players
  418. win_counts = read_win_counts()
  419. # Initialize players with win counts
  420. for player_id in win_counts.keys():
  421. players[player_id] = {'win_count': win_counts[player_id], 'spun': False, 'superspun': False, 'ultraspun': False,
  422. 'megaspun': False}
  423.  
  424.  
  425. # Function to reset game state
  426. def reset_game():
  427. global game_created, game_started, players, current_player, current_puzzle, revealed_letters, scoreboard, \
  428. guessed_correctly, outcome, solve_attempted, game_initiator
  429. game_created = False
  430. game_started = False
  431. players.clear()
  432. current_player = None
  433. current_puzzle = ""
  434. revealed_letters = []
  435. scoreboard = {}
  436. guessed_correctly = False
  437. outcome = None
  438. solve_attempted = False
  439. game_initiator = None
  440. global guessed_letters
  441. guessed_letters = []
  442. current_category = None
  443.  
  444.  
  445. # Event: Bot is ready
  446. @bot.event
  447. async def on_ready():
  448. print(f'Logged in as {bot.user}')
  449.  
  450. # Function to load win counts from file
  451. def load_win_counts():
  452. win_counts = {}
  453. with open('wincount.txt', 'r') as file:
  454. for line in file:
  455. user_id, count = line.strip().split(':')
  456. win_counts[user_id] = int(count)
  457. return win_counts
  458.  
  459. # Function to initialize players dictionary with win counts from the file
  460. def initialize_players():
  461. players = {}
  462. win_counts = load_win_counts()
  463. for user_id in win_counts:
  464. players[user_id] = {'win_count': win_counts[user_id], 'spun': False,
  465. 'superspun': False} # Include 'spun' and 'superspun'
  466. return players
  467.  
  468.  
  469. # Event: Message received
  470. @bot.event
  471. async def on_message(message):
  472. global game_created, game_started, current_player, current_puzzle, revealed_letters, scoreboard, \
  473. guessed_correctly, outcome, solve_attempted, game_initiator, players
  474. if message.author == bot.user:
  475. return
  476.  
  477. if message.content == '!ssw':
  478. # Create a new game if one isn't already in progress
  479. if not game_created:
  480. reset_game()
  481. game_initiator = message.author # Store the user who initiated the game
  482. game_created = True
  483. await message.channel.send('Saberwulfs Spin Wheel! Type !join to join the game! and !start to start')
  484. await message.channel.send("Copyright Disclaimer:\n"
  485. "This Wheel of Fortune game is inspired by the original "
  486. "\"Wheel of Fortune\" television show created by Merv Griffin. "
  487. "All rights for the original concept, format, and trademarks belong "
  488. "to their respective owners. This game is created purely for entertainment "
  489. "purposes and is not affiliated with, endorsed by, or sponsored by the creators "
  490. "of the original \"Wheel of Fortune\" show.")
  491. # Add the user who typed !ssw to the game
  492. if message.author not in players:
  493. players[message.author] = {'spun': False, 'superspun': False, 'ultraspun': False,
  494. 'megaspun': False} # Initialize spun status for the player
  495. await message.channel.send(f'{message.author.mention} joined the game!')
  496.  
  497. # Check if the user is special and send the corresponding message
  498. if str(message.author.id) in special_players:
  499. await message.channel.send(special_players[str(message.author.id)])
  500.  
  501. # Allow players to join regardless of whether a game is created or not
  502. # Allow players to join regardless of whether a game is created or not
  503. # Allow players to join regardless of whether a game is created or not
  504. if message.content == '!join':
  505. # Add the player to the game if it's created and not started
  506. if game_created and not game_started:
  507. if message.author not in players:
  508. # Initialize spun and superspun status for the player
  509. players[message.author] = {'spun': False, 'superspun': False, 'ultraspun': False, 'megaspun': False}
  510. await message.channel.send(f'{message.author.mention} joined the game!')
  511. # Send a message after the command is entered
  512. await message.channel.send("Thank you for joining the game!")
  513. # Send a list of players who have joined the game
  514. if players:
  515. player_list = '\n'.join([p.mention for p in players.keys()])
  516. await message.channel.send(f'Players in the game: {player_list}')
  517. # Special messages for specific users
  518. if str(message.author.id) == "480539285607546910": # Lizzy's ID
  519. await message.channel.send("WELCOME QUEEN LIZZY! YOU ARE AMAZING!")
  520. await message.channel.send(
  521. "https://tenor.com/view/lizard-elmo-liz-hi-liz-hi-lizzy-elmo-lizzy-gif-26781052")
  522. elif str(message.author.id) == "1222299615538450465": # SABERS's ID
  523. await message.channel.send("SUPREME VICTORYYY!")
  524. await message.channel.send(
  525. "https://tenor.com/view/sabrewulf-video-games-gaming-xbox-killer-instinct-gif-3538282248554946598")
  526. elif str(message.author.id) == "1197590901741076601": # Kira's ID
  527. await message.channel.send("Welcome the coup queen!")
  528. await message.channel.send("https://tenor.com/view/hi-kira-e-chill-gif-24196509")
  529. elif str(message.author.id) == "725242689498513458": # Rere's ID
  530. await message.channel.send("Soft kitty...Warm Kitty... I AM ANGRY KITTY... WOMP WOMP")
  531. await message.channel.send("https://tenor.com/view/annoyed-disappointed-mad-upset-gif-26051038")
  532. else:
  533. await message.channel.send('You have already joined the game.')
  534. elif game_started:
  535. await message.channel.send('Sorry, the game has already started. You cannot join now.')
  536. else:
  537. await message.channel.send('There is no game currently. Please create a game using !ssw.')
  538.  
  539. elif message.content == '!commands':
  540. command_list = '\n'.join([f'{command}: {description}' for command, description in commands_dict.items()])
  541. await message.channel.send(f'Available Commands:\n{command_list}')
  542.  
  543. elif message.content == '!joint':
  544. # Check if the author of the message is the allowed user
  545. if str(message.author.id) == "1063542949314560092": # Replace this ID with the desired user's ID
  546. # Add the player to the game if it's created and not started
  547. if game_created and not game_started:
  548. if message.author not in players:
  549. # Initialize spun and superspun status for the player
  550. players[message.author] = {'spun': False, 'superspun': False, 'ultraspun': False, 'megaspun': False}
  551. await message.channel.send(f'{message.author.mention} joined the game!')
  552. # Send a message after the command is entered
  553. await message.channel.send("Thank you for joining the game!")
  554. await message.channel.send("JOEY HAS ARRIVED PUFF PUFF PASS!")
  555. await message.channel.send(
  556. "https://tenor.com/view/sister-joe-dirt-david-spade-hands-up-gif-16731619") # Additional message for !joint
  557. # Send a list of players who have joined the game
  558. if players:
  559. player_list = '\n'.join([p.mention for p in players.keys()])
  560. await message.channel.send(f'Players in the game: {player_list}')
  561. elif game_started:
  562. await message.channel.send('Sorry, the game has already started. You cannot join now.')
  563. else:
  564. await message.channel.send('There is no game currently. Please create a game using !ssw.')
  565. else:
  566. await message.channel.send("You are not authorized to use this command.")
  567.  
  568.  
  569. elif message.content == '!start':
  570. global current_category # Ensure current_category is declared as global here
  571. # Start the game if the person who created the game types the command
  572. if message.author == game_initiator and not current_player:
  573. # Check if enough players have joined
  574. if len(players) >= 1:
  575. game_started = True # Mark the game as started
  576. await message.channel.send('Game started! Waiting for spins...')
  577. # Prompt the player to select a category
  578. await message.channel.send('Please pick a category for the puzzles:\n'
  579. 'Categories:\n'
  580. '1. Riddles and Rhymes\n'
  581. '2. Food and Drink\n'
  582. '3. Places\n'
  583. '4. Fictional Characters\n'
  584. '5. Movie Quotes\n'
  585. '6. Quotations\n'
  586. '7. What Are You Doing\n'
  587. '8. What Are You Wearing\n'
  588. '9. Song Titles\n'
  589. '10. Animals')
  590. # Store the selected category
  591. selected_category = None
  592. category_names = {
  593. 1: "Riddles and Rhymes",
  594. 2: "Food and Drink",
  595. 3: "Places",
  596. 4: "Fictional Characters",
  597. 5: "Movie Quotes",
  598. 6: "Quotations",
  599. 7: "What Are You Doing",
  600. 8: "What Are You Wearing",
  601. 9: "Song Titles",
  602. 10: "Animals"
  603. }
  604.  
  605. puzzles = None
  606.  
  607. def check_category(m):
  608. return m.author == message.author and m.content.isdigit() and 1 <= int(m.content) <= 10
  609.  
  610. try:
  611. category_message = await bot.wait_for('message', check=check_category, timeout=30)
  612. selected_category = int(category_message.content)
  613. except asyncio.TimeoutError:
  614. await message.channel.send('You took too long to select a category. Game ended.')
  615. reset_game()
  616. return
  617.  
  618. # Define puzzles for each category
  619. if selected_category == 1:
  620. puzzles = RIDDLES_AND_RHYMES_PUZZLES
  621. elif selected_category == 2:
  622. puzzles = FOOD_DRINK_PUZZLES
  623. elif selected_category == 3:
  624. puzzles = PLACES_PUZZLES
  625. elif selected_category == 4:
  626. puzzles = FICTIONAL_CHARACTERS_PUZZLES
  627. elif selected_category == 5:
  628. puzzles = MOVIES_PUZZLES
  629. elif selected_category == 6:
  630. puzzles = QUOTES_PUZZLES
  631. elif selected_category == 7:
  632. puzzles = WHAT_ARE_YOU_DOING_PUZZLES
  633. elif selected_category == 8:
  634. puzzles = WHAT_ARE_YOU_WEARING_PUZZLES
  635. elif selected_category == 9:
  636. puzzles = SONG_TITLES_PUZZLES
  637. elif selected_category == 10:
  638. puzzles = ANIMALS_PUZZLES
  639.  
  640. current_puzzle = random.choice(puzzles)
  641. # Check if the current puzzle contains a category name
  642. if ":" in current_puzzle:
  643. category, puzzle_text = current_puzzle.split(":", 1)
  644. else:
  645. # If the puzzle text contains colons, consider the entire puzzle text as the puzzle and choose a default category name
  646. category = category_names[selected_category]
  647. puzzle_text = current_puzzle
  648. revealed_letters = ['-' if char.isalpha() else char for char in puzzle_text]
  649. # Display the puzzle with "-" for unrevealed letters and guessed letters underneath
  650. puzzle_display = ' '.join(revealed_letters)
  651. # Save the current category
  652. current_category = category_names[selected_category]
  653. await message.channel.send(f'Category: {current_category}\nPuzzle: {puzzle_display}')
  654. # Initialize scoreboard
  655. for player in players.keys():
  656. scoreboard[player] = 0
  657. # Select a random player to start
  658. current_player = random.choice(list(players.keys()))
  659. if current_player is not None:
  660. await message.channel.send(f"It's {current_player.mention}'s turn to spin! Use !spin")
  661. else:
  662. await message.channel.send('There are not enough players to start the game.')
  663. else:
  664. await message.channel.send('You are not authorized to start the game.')
  665.  
  666. elif message.content == '!category':
  667. if current_category:
  668. await message.channel.send(f"The current category is: {current_category}")
  669. else:
  670. await message.channel.send("No category has been selected yet.")
  671.  
  672.  
  673. # Inside your existing !spin command handler
  674. elif message.content == '!spin':
  675. # Spin Sabers wheel
  676. if message.author == current_player and not players[current_player]['spun']:
  677. outcome = random.choice(WHEEL_OUTCOMES)
  678. if current_player is not None:
  679. await message.channel.send(f'{current_player.mention} spun the wheel and got: {outcome}')
  680. # Display the puzzle with correctly guessed letters
  681. puzzle_display = ' '.join(revealed_letters)
  682. await message.channel.send(f'Current Puzzle: {puzzle_display}')
  683. await message.channel.send(f"The current category is: {current_category}")
  684. guessed_letters_display = ', '.join(guessed_letters)
  685. await message.channel.send(f'Letters Already Guessed: {guessed_letters_display}')
  686. players[current_player]['spun'] = True
  687. # If outcome allows, prompt the player to guess a letter
  688. # Handle the outcome of the spin
  689. if outcome.isdigit():
  690. await message.channel.send('Guess a letter using !guess or !solve to Solve.')
  691. guessed_correctly = False
  692. elif outcome == "Spin Again":
  693. await message.channel.send('You got Spin Again! Please !spin again...')
  694. await message.channel.send(
  695. 'https://tenor.com/view/zach-galifianakis-angry-intense-mad-rage-gif-20192527')
  696. # Reset the spin status for the player
  697. players[current_player]['spun'] = False
  698. # Remind the player to spin again
  699. if current_player is not None:
  700. await message.channel.send(f'{current_player.mention}, it\'s your turn to spin again! use !spin')
  701. elif outcome == "Robbed":
  702. await message.channel.send('You spun "Robbed"! You lose all your points. WOMP WOMP!')
  703. await message.channel.send('https://tenor.com/view/spongebob-money-in-the-bag-gif-21484249')
  704. scoreboard[current_player] = 0 # Reset player's score to 0
  705. await message.channel.send('Your score has been reset to 0.')
  706. current_player = next_player()
  707. for player in players.keys():
  708. players[player]['spun'] = False
  709. if current_player is not None:
  710. await message.channel.send(f'It\'s {current_player.mention}\'s turn to spin! use !spin')
  711. else:
  712. await message.channel.send('You Lose your turn! It\'s now the next player\'s turn.')
  713. await message.channel.send('https://tenor.com/view/hehe-not-hehe-no-angry-cat-angry-gif-23436666')
  714. current_player = next_player()
  715. for player in players.keys():
  716. players[player]['spun'] = False
  717. if current_player is not None:
  718. await message.channel.send(f'It\'s {current_player.mention}\'s turn to spin! use !spin')
  719.  
  720. # Start a timer for 90 seconds for the player to guess or solve
  721. try:
  722. msg = await bot.wait_for('message', timeout=30,
  723. check=lambda m: m.author == current_player
  724. and not guessed_correctly
  725. and (m.content.startswith('!solve') or m.content.startswith(
  726. '!guess')
  727. or m.content.startswith('!spin')))
  728. if msg.content == '!solve' or msg.content == '!guess':
  729. # Proceed with guessing or solving
  730. # Your existing logic here
  731. pass
  732. else:
  733. # Ignore the message and allow the player to continue their turn
  734. pass
  735. except asyncio.TimeoutError:
  736. await message.channel.send("You took too long to guess or solve. It's now the next player's turn.")
  737. current_player = next_player()
  738. for player in players.keys():
  739. players[player]['spun'] = False
  740. if current_player is not None:
  741. await message.channel.send(f"It's {current_player.mention}'s turn to spin! use !spin")
  742.  
  743. elif message.author == current_player and players[current_player]['spun']:
  744. # Check if the player needs to guess or solve
  745. if not guessed_correctly:
  746. await message.channel.send('Please guess a letter using !guess or solve the puzzle using !solve.')
  747. else:
  748. await (message.channel.send
  749. ('Please wait for your next turn.'))
  750. else:
  751. await message.channel.send('It is not your turn to spin')
  752.  
  753.  
  754. elif message.content == '!superspin':
  755. # Read win counts from the file
  756. win_counts = {}
  757. with open('wincount.txt', 'r') as file:
  758. for line in file:
  759. # Split the line based on whitespace
  760. parts = line.strip().split()
  761. if len(parts) >= 2: # Ensure there are at least two parts
  762. user_id = parts[0]
  763. count = int(parts[1])
  764. win_counts[user_id] = count
  765. else:
  766. print(f"Ignoring invalid line in wincount.txt: {line.strip()}")
  767.  
  768. if current_player is not None:
  769. # Check if the author is the current player, the command hasn't been used yet in this game,
  770. # and the win count is between 10 and 24
  771. if message.author == current_player and not players[current_player]['spun'] and not players[current_player][
  772. 'superspun']:
  773. # Check if the player has the required win count
  774. author_id = str(message.author.id)
  775. if author_id in win_counts and 10 <= win_counts[author_id] <= 24: # Adjust range as needed
  776. outcome = random.choice(SUPER_WHEEL_OUTCOMES)
  777. if message.author:
  778. await message.channel.send(f'{message.author.mention} spun the wheel and got: {outcome}')
  779. # Display the puzzle with correctly guessed letters
  780. puzzle_display = ' '.join(revealed_letters)
  781. await message.channel.send(f'Current Puzzle: {puzzle_display}')
  782. await message.channel.send(f"The current category is: {current_category}")
  783. guessed_letters_display = ', '.join(guessed_letters)
  784. await message.channel.send(f'Letters Already Guessed: {guessed_letters_display}')
  785. else:
  786. await message.channel.send("Sorry, I couldn't determine who spun the wheel.")
  787. players[current_player]['superspun'] = True # Mark that the command has been used in this game
  788. players[current_player]['spun'] = True # Mark that the player has spun
  789. # Handle other logic based on outcome
  790. if outcome.isdigit():
  791. await message.channel.send('Guess a letter using !guess or !solve to Solve.')
  792. guessed_correctly = False
  793. update_win_count(current_player) # Update win count
  794. else:
  795. # Inform the player that they don't have the proper win count
  796. await message.channel.send(
  797. "Sorry, you need to have a win count between 10 and 24 to use !superspin.")
  798. elif message.author == current_player and players[current_player]['spun']:
  799. # Check if the player needs to guess or solve
  800. if not guessed_correctly:
  801. await message.channel.send('Please guess a letter using !guess or solve the puzzle using !solve.')
  802. else:
  803. await message.channel.send('Please wait for your next turn.')
  804. elif message.author == current_player and players[current_player]['superspun']:
  805. # Inform the player that they have already used the !superspin command in this game
  806. await message.channel.send("Sorry, you can only use the !superspin command once per game.")
  807. else:
  808. await message.channel.send('You already super spun')
  809. else:
  810. await message.channel.send('An error occurred: Current player is None.')
  811.  
  812.  
  813.  
  814. elif message.content == '!ultraspin':
  815. # Read win counts from the file
  816. win_counts = {}
  817. with open('wincount.txt', 'r') as file:
  818. for line in file:
  819. # Split the line based on whitespace
  820. parts = line.strip().split()
  821. if len(parts) >= 2: # Ensure there are at least two parts
  822. user_id = parts[0]
  823. count = int(parts[1])
  824. win_counts[user_id] = count
  825. else:
  826. print(f"Ignoring invalid line in wincount.txt: {line.strip()}")
  827.  
  828. if current_player is None:
  829. await message.channel.send("Sorry, there's no current player.")
  830. return
  831.  
  832. if message.author == current_player and not players[current_player]['spun'] and not players[current_player][
  833. 'ultraspun']:
  834. # Check if the author's win count is within the required range
  835. author_id = str(message.author.id)
  836. if author_id in win_counts and 25 <= win_counts[author_id] <= 49: # Adjust range as needed
  837. outcome = random.choice(ULTRA_WHEEL_OUTCOMES)
  838. if message.author:
  839. await message.channel.send(f'{message.author.mention} spun the wheel and got: {outcome}')
  840. # Display the puzzle with correctly guessed letters
  841. puzzle_display = ' '.join(revealed_letters)
  842. await message.channel.send(f'Current Puzzle: {puzzle_display}')
  843. await message.channel.send(f"The current category is: {current_category}")
  844. guessed_letters_display = ', '.join(guessed_letters)
  845. await message.channel.send(f'Letters Already Guessed: {guessed_letters_display}')
  846. else:
  847. await message.channel.send("Sorry, I couldn't determine who spun the wheel.")
  848. players[current_player]['ultraspun'] = True
  849. players[current_player]['spun'] = True
  850. # Handle other logic based on outcome
  851. if outcome.isdigit():
  852. await message.channel.send('Guess a letter using !guess or !solve to Solve.')
  853. guessed_correctly = False
  854. try:
  855. msg = await bot.wait_for('message', timeout=30,
  856. check=lambda m: m.author == current_player
  857. and not guessed_correctly
  858. and (m.content.startswith(
  859. '!solve') or m.content.startswith('!guess')))
  860. if msg.content.startswith('!solve') or msg.content.startswith('!guess'):
  861. # Proceed with guessing or solving
  862. pass
  863. else:
  864. # Inform the player and allow the player to continue their turn
  865. await message.channel.send("Invalid command. Please use !guess or !solve to proceed.")
  866. except asyncio.TimeoutError:
  867. await message.channel.send("You took too long to guess or solve. It's now the next player's turn.")
  868. current_player = next_player()
  869. for player in players.keys():
  870. players[player]['spun'] = False
  871. if current_player is not None:
  872. await message.channel.send(f"It's {current_player.mention}'s turn to spin! use !spin")
  873. else:
  874. await message.channel.send("Sorry, you need to have a win count between 25 and 49 to use !ultraspin.")
  875. else:
  876. await message.channel.send('You already ultra spun')
  877.  
  878.  
  879. elif message.content == '!megaspin':
  880. # Read win counts from the file
  881. win_counts = {}
  882. with open('wincount.txt', 'r') as file:
  883. for line in file:
  884. # Split the line based on whitespace
  885. parts = line.strip().split()
  886. if len(parts) >= 2: # Ensure there are at least two parts
  887. user_id = parts[0]
  888. count = int(parts[1])
  889. win_counts[user_id] = count
  890. else:
  891. print(f"Ignoring invalid line in wincount.txt: {line.strip()}")
  892.  
  893. if current_player is None:
  894. await message.channel.send("Sorry, there's no current player.")
  895. return
  896.  
  897. if message.author == current_player and not players[current_player]['spun'] and not players[current_player][
  898. 'megaspun']:
  899. # Check if the author's win count is above the threshold
  900. author_id = str(message.author.id)
  901. if author_id in win_counts and win_counts[author_id] >= 50: # Adjust threshold as needed
  902. outcome = random.choice(MEGA_WHEEL_OUTCOMES)
  903. if message.author:
  904. await message.channel.send(f'{message.author.mention} spun the wheel and got: {outcome}')
  905. # Display the puzzle with correctly guessed letters
  906. puzzle_display = ' '.join(revealed_letters)
  907. await message.channel.send(f'Current Puzzle: {puzzle_display}')
  908. await message.channel.send(f"The current category is: {current_category}")
  909. guessed_letters_display = ', '.join(guessed_letters)
  910. await message.channel.send(f'Letters Already Guessed: {guessed_letters_display}')
  911. else:
  912. await message.channel.send("Sorry, I couldn't determine who spun the wheel.")
  913. players[current_player]['megaspun'] = True
  914. players[current_player]['spun'] = True
  915. # Handle other logic based on outcome
  916. if outcome.isdigit():
  917. await message.channel.send('Guess a letter using !guess or !solve to Solve.')
  918. guessed_correctly = False
  919. try:
  920. msg = await bot.wait_for('message', timeout=30,
  921. check=lambda m: m.author == current_player
  922. and not guessed_correctly
  923. and (m.content.startswith(
  924. '!solve') or m.content.startswith('!guess')))
  925. if msg.content.startswith('!solve') or msg.content.startswith('!guess'):
  926. # Proceed with guessing or solving
  927. pass
  928. else:
  929. # Inform the player and allow the player to continue their turn
  930. await message.channel.send("Invalid command. Please use !guess or !solve to proceed.")
  931. except asyncio.TimeoutError:
  932. await message.channel.send("You took too long to guess or solve. It's now the next player's turn.")
  933. current_player = next_player()
  934. for player in players.keys():
  935. players[player]['spun'] = False
  936. if current_player is not None:
  937. await message.channel.send(f"It's {current_player.mention}'s turn to spin! use !spin")
  938. else:
  939. await message.channel.send("Sorry, you need to have a win count of 50 or more to use !megaspin.")
  940. else:
  941. await message.channel.send('You already mega spun')
  942.  
  943.  
  944. elif message.content == '!guess':
  945. # Handle letter guessing
  946. if current_player and message.author == current_player and players[current_player][
  947. 'spun'] and not guessed_correctly:
  948. # Ask the player to guess a letter
  949. await message.channel.send('Which letter would you like to guess?')
  950.  
  951. def check(m):
  952. return m.author == current_player and len(m.content) == 1 and m.content.isalpha()
  953.  
  954. try:
  955. # Wait for the player's response with a timeout of 30 seconds
  956. guess_message = await bot.wait_for('message', check=check, timeout=60)
  957. # Get the guessed letter from the message content
  958. guessed_letter = guess_message.content.strip().lower()
  959. # Check if the guessed letter has already been guessed
  960. if guessed_letter in guessed_letters:
  961. await message.channel.send('This letter has already been guessed! Skipping your turn.')
  962. # Move on to the next player
  963. current_player = next_player()
  964. for player in players.keys():
  965. players[player]['spun'] = False
  966. if current_player is not None:
  967. await message.channel.send(f'It\'s {current_player.mention}\'s turn to spin! use !spin')
  968. return # Skip the rest of the handling for this guess
  969. if guessed_letter not in guessed_letters:
  970. guessed_letters.append(guessed_letter)
  971. # Check if the guessed letter is in the puzzle
  972. if guessed_letter in current_puzzle.lower():
  973. for i, char in enumerate(current_puzzle):
  974. if char.lower() == guessed_letter:
  975. revealed_letters[i] = char
  976.  
  977. # Update the scoreboard with the points from the spin
  978. if outcome.isdigit():
  979. # Calculate points based on the occurrence of the guessed letter
  980. if guessed_letter in current_puzzle.lower():
  981. points = int(outcome)
  982. scoreboard[current_player] += points
  983. # Display the current scoreboard
  984. await message.channel.send('Turn ended! Scores:')
  985. for player, score in scoreboard.items():
  986. await message.channel.send(f'{player.mention}: {score}')
  987. # Check if all letters have been guessed correctly
  988. guessed_correctly = all(char.isalpha() or char == ' ' for char in revealed_letters)
  989. players[current_player]['spun'] = False
  990. # If outcome was "Spin Again", prompt the player to spin again
  991. if outcome == "Spin Again":
  992. await message.channel.send('Use !spin to spin again.')
  993. else:
  994. # Remind the player to spin again
  995. if current_player is not None:
  996. await message.channel.send(
  997. f'{current_player.mention}, it\'s your turn to spin again! use !spin')
  998.  
  999. # Display guessed letters
  1000. guessed_letters_display = ', '.join(guessed_letters)
  1001. await message.channel.send(f'Letters Already Guessed: {guessed_letters_display}')
  1002.  
  1003. else:
  1004. await message.channel.send('Sorry, the guessed letter is not in the puzzle.')
  1005. # Move on to the next player
  1006. current_player = next_player()
  1007. for player in players.keys():
  1008. players[player]['spun'] = False
  1009. if current_player is not None:
  1010. await message.channel.send(f'It\'s {current_player.mention}\'s turn to spin! use !spin')
  1011.  
  1012. # Check if all letters have been guessed correctly and prompt the player to solve the puzzle
  1013. if '-' not in revealed_letters:
  1014. await message.channel.send(
  1015. 'All letters have been guessed correctly! Use !spin then !solve to solve the puzzle.')
  1016.  
  1017. except asyncio.TimeoutError:
  1018. await message.channel.send('You took too long to guess.')
  1019. # Move on to the next player
  1020. current_player = next_player()
  1021. for player in players.keys():
  1022. players[player]['spun'] = False
  1023. if current_player is not None:
  1024. await message.channel.send(f'It\'s {current_player.mention}\'s turn to spin! use !spin')
  1025. else:
  1026. await message.channel.send('It\'s not your turn!')
  1027.  
  1028.  
  1029.  
  1030. elif message.content == '!solve':
  1031. # Handle solving the puzzle
  1032. # Handle solving the puzzle
  1033. if current_player and message.author == current_player and players[current_player]['spun']:
  1034. await message.channel.send('Type the puzzle to solve it.')
  1035.  
  1036. def check_solution(m):
  1037. return m.author == current_player
  1038.  
  1039. try:
  1040. # Wait for the player's response with a timeout of 90 seconds
  1041. solve_message = await bot.wait_for('message', check=check_solution, timeout=120)
  1042. # Check if the solution matches the current puzzle (case-insensitive comparison)
  1043. if solve_message.content.strip().lower() == current_puzzle.lower():
  1044. # Award the player their current wheel outcome
  1045. if outcome.isdigit():
  1046. points = int(outcome)
  1047. scoreboard[current_player] += points
  1048. await message.channel.send(
  1049. f'Congratulations! You solved the puzzle and earned {points} points!')
  1050. # Display the current scoreboard
  1051. await message.channel.send('Final Scores:')
  1052. for player, score in scoreboard.items():
  1053. await message.channel.send(f'{player.mention}: {score}')
  1054. await end_game(message.channel)
  1055. else:
  1056. await message.channel.send('You cannot earn points for a non-numeric wheel outcome.')
  1057. # Move on to the next player
  1058. current_player = next_player()
  1059. if current_player is not None:
  1060. await message.channel.send(f'It\'s {current_player.mention}\'s turn to spin! use !spin')
  1061. # Reset solve_attempted flag
  1062. solve_attempted = False
  1063. else:
  1064. await message.channel.send(
  1065. 'Sorry, that is not the correct solution. It\'s now the next player\'s turn.')
  1066. # Move on to the next player
  1067. current_player = next_player()
  1068. for player in players.keys():
  1069. players[player]['spun'] = False
  1070. if current_player is not None:
  1071. await message.channel.send(f'It\'s {current_player.mention}\'s turn to spin! use !spin')
  1072. solve_attempted = False # Reset the solve_attempted flag
  1073. except asyncio.TimeoutError:
  1074. await message.channel.send('You took too long to solve the puzzle.')
  1075. # Move on to the next player
  1076. current_player = next_player()
  1077. for player in players.keys():
  1078. players[player]['spun'] = False
  1079. if current_player is not None:
  1080. await message.channel.send(f'It\'s {current_player.mention}\'s turn to spin! use !spin')
  1081. elif current_player and message.author == current_player and not players[current_player]['spun']:
  1082. await message.channel.send('Please spin before solving.')
  1083. else:
  1084. await message.channel.send('It\'s not your turn!')
  1085.  
  1086. elif solve_attempted:
  1087. # Check if the solve_attempted flag is True
  1088. if current_player and message.author == current_player and players[current_player]['spun']:
  1089. # Skip the player's turn if they attempted to solve the puzzle but provided an incorrect solution
  1090. await message.channel.send('That is incorrect. It\'s now the next player\'s turn.')
  1091. current_player = next_player()
  1092. for player in players.keys():
  1093. players[player]['spun'] = False
  1094. if current_player is not None:
  1095. await message.channel.send(f'It\'s {current_player.mention}\'s turn to spin! use !spin')
  1096. solve_attempted = False # Reset the solve_attempted flag
  1097.  
  1098. # Handle the !reset command
  1099. elif message.content == '!reset':
  1100. # Check if the user who sent the command is authorized to reset the game
  1101. if message.author == game_initiator:
  1102. # Call the reset_game function to end the current game
  1103. reset_game()
  1104. await message.channel.send('Game reset! You can start a new game using !ssw.')
  1105. else:
  1106. await message.channel.send('You are not authorized to reset the game.')
  1107.  
  1108.  
  1109. # Function to update win count for a player
  1110. def update_win_count(player_id):
  1111. wincount_file = "wincount.txt"
  1112. if os.path.exists(wincount_file):
  1113. with open(wincount_file, "r") as file:
  1114. lines = file.readlines()
  1115. win_counts = {}
  1116. for line in lines:
  1117. parts = line.split()
  1118. if len(parts) >= 2:
  1119. player = parts[0]
  1120. wins = int(parts[1])
  1121. win_counts[player] = wins
  1122.  
  1123. if str(player_id) in win_counts:
  1124. win_counts[str(player_id)] += 1
  1125. else:
  1126. win_counts[str(player_id)] = 1
  1127.  
  1128. with open(wincount_file, "w") as file:
  1129. for player, wins in win_counts.items():
  1130. file.write(f"{player} {wins}\n")
  1131.  
  1132.  
  1133. def read_win_counts():
  1134. win_counts = {}
  1135. with open('wincount.txt', 'r') as file:
  1136. for line in file:
  1137. player_id, win_count = line.strip().split()
  1138. win_counts[player_id] = int(win_count)
  1139. return win_counts
  1140.  
  1141.  
  1142. # Function to end the game
  1143. async def end_game(channel):
  1144. global game_created, game_started, current_player, current_puzzle, revealed_letters, scoreboard, \
  1145. guessed_correctly, outcome, solve_attempted, game_initiator, current_category
  1146.  
  1147. # Determine the winner based on the scores
  1148. winner = max(scoreboard, key=scoreboard.get) if scoreboard else None
  1149.  
  1150. # Display the winner if there is one
  1151. if winner:
  1152. # Update win count
  1153. update_win_count(winner.id) # Assuming winner is a Discord Member object
  1154. # Read win count from file
  1155. with open("wincount.txt", "r") as file:
  1156. win_counts = {line.split()[0]: int(line.split()[1]) for line in file.readlines()}
  1157. # Display the winner and their win count
  1158. await channel.send(
  1159. f'Congratulations to {winner.mention} for winning with a score of {scoreboard[winner]} points! ')
  1160. await channel.send(f'Total win count: {win_counts.get(str(winner.id), 0)}')
  1161. else:
  1162. await channel.send('Thank you for playing!')
  1163.  
  1164. # Reset game state
  1165. game_created = False
  1166. game_started = False
  1167. current_player = None
  1168. current_puzzle = ""
  1169. revealed_letters = []
  1170. scoreboard = {}
  1171. guessed_correctly = False
  1172. outcome = None
  1173. solve_attempted = False
  1174. game_initiator = None
  1175. current_category = None
  1176.  
  1177.  
  1178. # Function to switch to the next player
  1179. def next_player():
  1180. global players, current_player
  1181. if current_player is not None:
  1182. players_list = list(players.keys())
  1183. current_index = players_list.index(current_player)
  1184. next_index = (current_index + 1) % len(players_list)
  1185. return players_list[next_index]
  1186. else:
  1187. return None
  1188.  
  1189.  
  1190. # Run the bot
  1191. bot.run('')
Add Comment
Please, Sign In to add comment