izuemon commited on
Commit
3c5ef20
·
verified ·
1 Parent(s): 052ac2c

Update join.py

Browse files
Files changed (1) hide show
  1. join.py +13 -6
join.py CHANGED
@@ -13,7 +13,7 @@ if not X_ACCOUNT:
13
 
14
  BASE = "https://desk-api.channel.io/desk/channels/200605"
15
  GROUP_ID = 463667
16
- CHECK_PERSON_ID = "599642"
17
 
18
  HEADERS = {
19
  "accept": "application/json",
@@ -28,16 +28,16 @@ GET_PARAMS = {
28
  "logFolded": "false",
29
  }
30
 
31
- WELCOME_TEXT = """ようこそ
32
  こんにちは。ITRSAにようこそ。
33
  自動でいくつかの部屋に招待しています。
34
 
35
  <b>使い方:</b>
36
  左側のメニューから、部屋(グループ)を開くことができます。
37
- Youtubeダウンローダーは、URLを送ると自動でYoutubeをダウンロードしてくれる部屋
38
- ・チャッピーは、ChatGPTと話せる部屋
 
39
  ・幹部と裁判所からの報告はここを管理する幹部や裁判所から通知が来る部屋です。
40
-
41
  """
42
 
43
  INVITE_GROUPS = [
@@ -57,17 +57,24 @@ def get_messages() -> List[Dict[str, Any]]:
57
 
58
 
59
  def post_welcome_message() -> None:
 
 
 
 
 
 
60
  url = f"{BASE}/groups/{GROUP_ID}/messages"
61
  payload = {
62
  "requestId": f"desk-web-{int(time.time() * 1000)}",
63
  "blocks": [
64
- {"type": "text", "value": WELCOME_TEXT}
65
  ]
66
  }
67
  requests.post(url, headers=HEADERS, json=payload, timeout=20).raise_for_status()
68
  print("[INFO] 歓迎メッセージを送信しました")
69
 
70
 
 
71
  def invite_person(group_id: int, person_id: str) -> None:
72
  url = f"{BASE}/groups/{group_id}/invite"
73
  params = {"managerIds": person_id}
 
13
 
14
  BASE = "https://desk-api.channel.io/desk/channels/200605"
15
  GROUP_ID = 463667
16
+ CHECK_PERSON_ID = "604730"
17
 
18
  HEADERS = {
19
  "accept": "application/json",
 
28
  "logFolded": "false",
29
  }
30
 
31
+ WELCOME_TEMPLATE = """
32
  こんにちは。ITRSAにようこそ。
33
  自動でいくつかの部屋に招待しています。
34
 
35
  <b>使い方:</b>
36
  左側のメニューから、部屋(グループ)を開くことができます。
37
+ {hq}は本部で、雑談などをする部屋です。
38
+ ・Youtubeダウンローダーは、URLを送ると自動でYoutubeをダウンロードしてくれる部屋です。
39
+ ・チャッピーは、ChatGPTと話せる部屋です。
40
  ・幹部と裁判所からの報告はここを管理する幹部や裁判所から通知が来る部屋です。
 
41
  """
42
 
43
  INVITE_GROUPS = [
 
57
 
58
 
59
  def post_welcome_message() -> None:
60
+ TITLES = get_group_titles() # {group_id: title}
61
+
62
+ welcome_text = WELCOME_TEMPLATE.format(
63
+ hq=TITLES.get(532214, "本部")
64
+ )
65
+
66
  url = f"{BASE}/groups/{GROUP_ID}/messages"
67
  payload = {
68
  "requestId": f"desk-web-{int(time.time() * 1000)}",
69
  "blocks": [
70
+ {"type": "text", "value": welcome_text}
71
  ]
72
  }
73
  requests.post(url, headers=HEADERS, json=payload, timeout=20).raise_for_status()
74
  print("[INFO] 歓迎メッセージを送信しました")
75
 
76
 
77
+
78
  def invite_person(group_id: int, person_id: str) -> None:
79
  url = f"{BASE}/groups/{group_id}/invite"
80
  params = {"managerIds": person_id}