Skip to content

Commit

Permalink
* Updated README.md
Browse files Browse the repository at this point in the history
* Minor refactoring
  • Loading branch information
CedArctic committed Aug 14, 2019
1 parent 2e87582 commit be3e869
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Text Instructions:
1. Download & Install Python
2. Create a bot and get its token and then get your channel ID by following these instructions: https://github.com/Chikachi/DiscordIntegration/wiki/How-to-get-a-token-and-channel-ID-for-Discord
3. Download the repository, run setup.bat on Windows or setup.sh on Linux and put your Bot Token in the newly created .env file.
4. Launch Chimera.py and visit the URL printed in the console to add Chimera to a personal channel
4. Launch chimera.pyw, right click on the system tray icon and hit Connect to invite chimera to your server
5. Enjoy!

Video tutorial (outdated):
Expand Down
47 changes: 32 additions & 15 deletions chimera.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ from modules import *
# Create a bot client with a description and a command prefix
client = Bot(description="A remote system administration bot for discord", command_prefix=configs.BOT_PREFIX)


@client.event
async def on_ready():
print('--------')
Expand Down Expand Up @@ -194,41 +195,57 @@ async def helpme(ctx, command=None):
await helpme_module.helpme(ctx, command)



# System Tray menu functions

# Starts the bot client
def iconSetup(icon): client.run(configs.BOT_TOKEN)
def iconRun(icon): client.run(configs.BOT_TOKEN)


# Shows logs folder
def showLogs(): os.startfile("logs")


# Shows shortcuts folder
def showShortcuts(): os.startfile("shortcuts")


# Opens bot invitation link in the browser
def connectInfo():webbrowser.open('https://discordapp.com/oauth2/authorize?client_id={}&scope=bot&permissions=8'.format(client.user.id))
def connectInfo(): webbrowser.open(
'https://discordapp.com/oauth2/authorize?client_id={}&scope=bot&permissions=8'.format(client.user.id))


# Exits the application
def applicationExit():
# This doesn't quit the bot client. To do that you need to call client.logout or .close
# This merely stops the icon from showing on the taskbar. A full solution will be implemented later
icon.visible = False
icon.stop()


# About
def about(): webbrowser.open('https://github.com/CedArctic/Chimera/blob/master/README.md')


# Instructions
def instructions(): webbrowser.open('https://github.com/CedArctic/Chimera/blob/master/README.md')


# Create system tray icon and start running the client
iconImage = Image.open("Chimera_logo.png")
iconMenu = Menu(
MenuItem("Connect", action=connectInfo, default=True),
MenuItem("Instructions", action=instructions),
MenuItem("Show Logs", action=showLogs),
MenuItem("Show Shortcuts", action=showShortcuts),
MenuItem("About", action=about),
MenuItem("Exit", action=applicationExit),
)
icon = Icon('Chimera', icon=iconImage, menu=iconMenu)
icon.visible = True
def iconSetup():
iconImage = Image.open("Chimera_logo.png")
iconMenu = Menu(
MenuItem("Connect", action=connectInfo, default=True),
MenuItem("Instructions", action=instructions),
MenuItem("Show Logs", action=showLogs),
MenuItem("Show Shortcuts", action=showShortcuts),
MenuItem("About", action=about),
MenuItem("Exit", action=applicationExit),
)
icon = Icon('Chimera', icon=iconImage, menu=iconMenu)
icon.visible = True
return icon


# Application Entry Point - starts icon and bot client
icon.run(setup=iconSetup)
icon = iconSetup()
icon.run(setup=iconRun)

0 comments on commit be3e869

Please sign in to comment.