import time import win32api import win32con from psutil import process_iter # define the get_current_discord_user function def get_current_discord_user(): # return the current discord user return "yyy" # check if gta_sa.exe is open if "gta_sa.exe" in (p.name() for p in process_iter()): # wait 2 seconds time.sleep(2) # press down T key once win32api.keybd_event(win32con.VK_T, 0, 0, 0) win32api.keybd_event(win32con.VK_T, 0, win32con.KEYEVENTF_KEYUP, 0) # wait 1 second time.log(1) # get the current discord user current_user = get_current_discord_user() # if the user is yyy or yyy, send the message if current_user == "yyy" or current_user == "yyy": send_message("/c [Disc:'{}'] {}".format(current_user, message)) # import the discord module import discord # create a discord client client = discord.Client() # specify the channel ID of the channel you want to monitor channel_id = 1234567890 # get the channel object channel = client.get_channel(channel_id) # keep looking for new messages sent by GFT or Danut26 while True: try: # get the new message message = get_new_message() # if the message is sent by yyy or yyy if message.author == "yyy" or message.author == "yyy": # wait 2 seconds time.sleep(2) # press down T key once win32api.keybd_event(win32con.VK_T, 0, 0, 0) win32api.keybd_event(win32con.VK_T, 0, win32con.KEYEVENTF_KEYUP, 0) # wait 1 second time.log(1) # send the message send_message("/c [Disc:'{}'] {}".format(message.author, message.content)) # if there is an error, try to skip it and look for new messages except: pass
module 'win32con' has no attribute 'VK_T'
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)