This repository has been archived by the owner on May 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAttempt 3
47 lines (43 loc) · 1.8 KB
/
Attempt 3
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
#.....Prototype 2 (Date: Nov. 3, 2020).....
#...........Nickolas Rodriguez.............
#...........Adam Pena......................
#...........Jermeiah Garcia................
#...........Alec Villareal.................
#...........Ricky Owkara...................
import discord
from discord.ext import commands
import requests
from selenium import webdriver
''' DiscordClass contains all of the logic needed to interface with discord '''
class DiscordClass:
#global variable in DiscordClass for Discord bot access
TOKEN = 'insert bot token'
#global variable in DiscordClass for setting command prefix
client = commands.Bot(command_prefix = '$')
#client event that displays when bot is ready
@client.event
async def on_ready():
print('Bot is ready')
#client command that will take Blackboard course information
@client.command(aliasas = ['Courses', 'courses'])
async def courses(ctx):
User = "insert Blackboard username"
Pass = "insert Blackboard password"
browser = webdriver.Chrome(executable_path =r'C:/path/to/chromedriver.exe')
type(browser)
browser.get("https://jnet.tamuk.edu/")
username = browser.find_element_by_id('username')
username.send_keys(User)
password = browser.find_element_by_id('password')
password.send_keys(Pass)
password.submit()
URL = "https://blackboard.tamuk.edu/webapps/bb-auth-provider-cas-bb_bb60/execute/casLogin?cmd=login&authProviderId=_107_1&redirectUrl=https%3A%2F%2Fblackboard.tamuk.edu%2Fultra"
page = requests.get(URL)
temp = page.content
temp2 = page.text
print(page)
print(temp)
print(temp2)
await ctx.send('Here are your courses!')
#turns on and runs the discord bot
client.run(TOKEN)