-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDiscordbot.py
76 lines (52 loc) · 1.67 KB
/
Discordbot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#imports all needed libraries
import discord
import os
import keyboard
import time
import mouse
#sets up the bot
intents = discord.Intents(messages=True, guilds=True, message_content =True)
bot = discord.Client(intents=intents)
channel = 1021230533654618204
#confrims connection
print("Intialized In 1 seconds")
#functions for keyboard
def my_forward():
keyboard.press("w")
def my_backward():
keyboard.press("s")
def my_left():
keyboard.press("a")
def my_right():
keyboard.press("d")
def my_click():
for i in range(100): mouse.click(button= "left")
def my_rightclick():
for i in range(100): mouse.right_click()
def my_e():
keyboard.press("e")
def my_q():
keyboard.press("q")
def my_1():
keyboard.press("1")
def my_2():
keyboard.press("2")
async def firstroll():
await bot.send_file(message.channel, 'my_file.png')
response = 1
# Trigger the functions
@bot.event
async def on_message(message):
if message.content == "w": my_forward()
if message.content == "s": my_backward()
if message.content == "a": my_left()
if message.content == "d": my_right()
if message.content == "c": my_click()
if message.content == "rc": my_rightclick()
if message.content == "e": my_e()
if message.content == "q": my_q()
if message.content == "1": my_1()
if message.content == "2": my_2()
if message.content == "4": firstroll()
#runs code with bot token
bot.run("API KEY HERE")