Skip to content

Commit

Permalink
更新到V0.1&加入設定檔支援
Browse files Browse the repository at this point in the history
  • Loading branch information
kirbyloco committed Mar 27, 2019
1 parent da48ec1 commit e871ee2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
2 changes: 1 addition & 1 deletion config.sample.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
id =

[contect] #請按照需求修改
state = "歡迎到kltw.ml坐坐喔"
details = "我真的沒有玩蘿莉"
state = "歡迎到kltw.ml坐坐喔"
large_image = "44307593_p0"
large_text = "我是耀風在測試的BOT喔"
small_image = "44307593_p0"
Expand Down
42 changes: 22 additions & 20 deletions discordrpc.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
import pypresence
import toml
import os
configfile = os.path.join('.','config.toml')

try:
config = toml.load(configfile)
print('成功載入' + configfile)
except:
print(f"無法載入{configfile}")
input()

def menu():
print('如要退出請輸入"exit"或按右上角X')
a = input()
if a == 'exit':
exit()
else:
test()
menu()

rpc = pypresence.Presence(ClientID)
rpc.connect()
rpc.update(state="",
details="",
large_image="",
large_text="",
small_image="",
small_text="")
def rpc():
rpc = pypresence.Presence(config['rpcid']['id'])
rpc.connect()
rpc.update(state=config['contect']['state'],
details=config['contect']['details'],
large_image=config['contect']['large_image'],
large_text=config['contect']['large_text'],
small_image=config['contect']['small_image'],
small_text=config['contect']['small_text'])

rpc()
print('RPC已啟動請查看Discord遊戲狀態')
menu()

'''
rpc.update(state=format_state(data),
details=format_details(data),
start=format_start(data),
large_image=format_large_image(data),
large_text=format_large_text(data),
small_image=format_small_image(data),
small_text=format_small_text(data),
party_size=format_party_size(data))'''
menu()
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pypresence
toml
sys
os

0 comments on commit e871ee2

Please sign in to comment.