-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 67a2c5a
Showing
5 changed files
with
305 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# 定义Channel分组 | ||
# guild_id:discord群的编号 | ||
# channel_id:discord频道的编号 | ||
[channel] | ||
guild_id=792971113080291328 | ||
channel_id=933291634093858836 | ||
|
||
# 定义bots分组 | ||
# bots_1:机器人1的Auth | ||
# bots_2:机器人2的Auth | ||
[bots] | ||
bots_1=ODM2xxxxxxxxxxxxxxxxxx | ||
bots_2=ODgxuuuuuuuuuuuuuuuuuu | ||
|
||
# 定义time分组 | ||
# bot_delay:前一个bot发言后,后一个bot等待若干秒后再回复 | ||
[time] | ||
bot_delay=15 | ||
|
||
# 定义proxy分组 | ||
# True(使用),False(不用) | ||
[proxy] | ||
use_proxy=True | ||
http=127.0.0.1:19180 | ||
https=127.0.0.1:19180 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
import sys | ||
import threading | ||
import tkinter as tk | ||
|
||
import requests | ||
import json | ||
import random | ||
import time | ||
import traceback | ||
import configparser | ||
|
||
|
||
config = configparser.ConfigParser() | ||
config.read('botConfig.ini', encoding="utf-8-sig") | ||
|
||
authorization_list = [config.get('bots', 'bots_1'),config.get('bots', 'bots_2')] | ||
guild_id = config.get('channel', 'guild_id') | ||
channel_id = config.get('channel', 'channel_id') | ||
bot_delay = config.getint('time', 'bot_delay') | ||
|
||
useProxy = config.getboolean('proxy', 'use_proxy') | ||
proxies={ | ||
'http': config.get('proxy', 'http'), | ||
'https':config.get('proxy', 'https') | ||
} | ||
|
||
message_id = 0 | ||
talk_counter = 0 | ||
talk_pause = 0 | ||
talk_list = [] | ||
|
||
with open("talk_list_1.txt", "r",encoding='utf-8') as f: | ||
for line in f.readlines(): | ||
line = line.strip('\n') | ||
talk_list.append(line) | ||
print("语料读取完毕,共" + str(len(talk_list)) + "条") | ||
|
||
def chat(): | ||
|
||
global message_id | ||
global talk_counter | ||
|
||
for authorization in authorization_list: | ||
header = { | ||
"Authorization":authorization, | ||
"Content-Type":"application/json", | ||
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36" | ||
} | ||
|
||
msg_say = { | ||
"content": talk_list[talk_counter], | ||
"nonce": "82329451214{}33232234".format(random.randrange(0, 1000)), | ||
"tts": False | ||
} | ||
msg_respone = { | ||
"content": talk_list[talk_counter], | ||
"nonce": "82329451214{}33232234".format(random.randrange(0, 1000)), | ||
"tts": False, | ||
"message_reference":{"guild_id":guild_id,"channel_id":channel_id,"message_id":message_id} | ||
} | ||
|
||
if message_id == 0: | ||
msg = msg_say | ||
else: | ||
msg = msg_respone | ||
|
||
talk_counter += 1 | ||
if talk_counter >= len(talk_list) -1 : | ||
talk_counter = 0 | ||
|
||
|
||
url = 'https://discord.com/api/v9/channels/{}/messages'.format(channel_id) | ||
try: | ||
if useProxy: | ||
res = requests.post(url=url, headers=header, data=json.dumps(msg),proxies=proxies) | ||
else: | ||
res = requests.post(url=url, headers=header, data=json.dumps(msg)) | ||
result= res.json() | ||
print('已发送第'+str(talk_counter)+'句话,内容:',result['content']) | ||
message_id = result['id'] | ||
time.sleep(random.randrange(1,3)) | ||
except: | ||
print(traceback.format_exc()) | ||
break | ||
time.sleep(random.randrange(bot_delay,bot_delay+3)) | ||
|
||
|
||
def exit(): | ||
global talk_pause | ||
talk_pause = 1 | ||
root.destroy | ||
sys.exit() | ||
|
||
|
||
|
||
|
||
|
||
|
||
class App: | ||
def __init__(self, root): | ||
|
||
root.title("Dsicord Talker V2.0") | ||
root.iconbitmap("favicon.ico") | ||
root.geometry("300x260") | ||
root.resizable(0,0)# | ||
frame = tk.Frame(root) | ||
frame.pack() | ||
|
||
label_2 = tk.Label(root, text="2 Bots talk edition || 两人互答版 ", bg="Orange", font=("微软雅黑", 12), ) | ||
label_2.pack(side=tk.TOP) | ||
|
||
label_channel = tk.Label(root, text="灌水频道ID:" + str(channel_id), bg="yellow", font=("微软雅黑", 12), )#width=5, height=2 | ||
label_channel.pack(side=tk.TOP) | ||
|
||
label_1 = tk.Label(root, text="语料读取完毕,共" + str(len(talk_list)) + "条 || bot回复延时" + str(bot_delay) + "秒", bg="CornflowerBlue", font=("微软雅黑", 12), ) | ||
label_1.pack(side=tk.TOP) | ||
|
||
|
||
|
||
label_3 = tk.Label(root, text="如需退出,请直接点击命令行窗口右上[X]", bg="Orange", font=("微软雅黑", 12), ) | ||
label_3.pack(side=tk.TOP) | ||
|
||
if len(talk_list) < 2: | ||
label_3 = tk.Label(root, text="语料太少,请及时添加!", bg="red", font=("微软雅黑", 12), ) | ||
label_3.pack(side=tk.TOP) | ||
|
||
|
||
self.Button_run = tk.Button(frame, text="启动", fg="blue", width = 20,command=self.run) | ||
self.Button_run.pack(side=tk.LEFT) | ||
|
||
self.Button_pause = tk.Button(frame, text="暂停", fg="blue",width = 20, command=self.pause) | ||
self.Button_pause.pack(side=tk.LEFT) | ||
self.Button_pause.configure(state='disable') | ||
|
||
|
||
|
||
|
||
def run(self): | ||
self.Button_run.configure(state='disable') | ||
self.Button_pause.configure(state='normal') | ||
|
||
insert_data = threading.Thread(target=self.talk_loop) | ||
insert_data.start() | ||
|
||
def talk_loop(self): | ||
global talk_pause | ||
talk_pause = 0 | ||
print("RUN!") | ||
while talk_pause == 0: | ||
try: | ||
chat() | ||
except: | ||
print(traceback.format_exc()) | ||
break | ||
|
||
|
||
def pause(self): | ||
self.Button_run.configure(state='normal') | ||
self.Button_pause.configure(state='disable') | ||
print("PAUSE...") | ||
global talk_pause | ||
talk_pause = 1 | ||
|
||
|
||
|
||
root = tk.Tk() | ||
app = App(root) | ||
logo = tk.PhotoImage(file="logo.png") | ||
explanation = """ | ||
discord.gg/ | ||
cryptochasers | ||
@0xNalakuvara | ||
""" | ||
tk.Label(root,compound=tk.CENTER,text=explanation, fg="Blue",font=("微软雅黑", 15,"bold"),image=logo).pack(side="right") | ||
|
||
root.protocol('WM_DELETE_WINDOW', exit) | ||
root.mainloop() |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
别急,一起到月球。冲呀 | ||
你两天睡4个小时 你试试别急? 用嘴说的别急嘛? | ||
现在是活跃百吗!? | ||
唉 想容易一点,白都不容易啦 | ||
对呀 怕错过就白费了 | ||
最近有啥好项目嘛 | ||
你说的也对 | ||
你们的白。好羡慕 | ||
千万不能放弃啊 | ||
上班都没这么努力 | ||
盯手机盯的眼睛疼 | ||
我已经快用脚来打了 | ||
现在人还好 以后还要多呢 | ||
你都几级了 | ||
兄弟们这个项目很好啊都这么肝 | ||
不知道要聊多久 | ||
总要变白的 | ||
大家一起聊天吧 最重要质量起来 | ||
机会永远是留给有准备的人 | ||
时间好快啊 | ||
我出门了,不在家。 | ||
你不早说,我出门按摩去了。要过来一起吗? | ||
那晚点过来嘛,泡完茶我们一起去泡温泉啊。 | ||
现在还是继续聊水吧,要不然要被mod打死。 | ||
都是兄弟! 互相带带是正常的 | ||
继续聊呀,不要怕 | ||
你只管努力 剩下的交给天意!! | ||
两个单身汉在对聊 也是够了。 | ||
我看抖音相亲的都是那个老有意思了 | ||
我也觉得 | ||
再努把力,争取今天拿白。点个外卖。 | ||
现在的外卖真的很贵,它的配送费都是三块,而且还有打包费! | ||
我还挺喜欢青菜瘦肉粥什么的,之前没喝的时候感觉不咋地,喝了就喜欢上了 | ||
喝点热乎的,要不身上都是冰凉凉的。 | ||
年纪大了,保温杯里泡枸杞了 | ||
人到中年不得已 | ||
不吃点枸杞我感觉都不行了,晚上太累了。 | ||
家里人还喜欢把枸杞放稀饭里煮。 | ||
还行吧 老年人了 没那么讲究了 养生就好 | ||
我现在每天都吃护肝片 | ||
还行吧,感觉舒服多了 | ||
没问题,养生3件套搞起来 | ||
哈哈哈 没办法咯 | ||
先定个小目标,先赚上一个亿。 | ||
一亿韩元是多少人民币啊 | ||
我感觉我的尬聊技能已经点满了 | ||
我看大家都有点虚啊。吃点华莱士补补吧 | ||
我怎么不会啊 | ||
你可以试下,味美价廉效果好,你值得拥有 | ||
麦当劳比较干净一点,而且做工也行。 | ||
吃德克士,手枪腿套餐不错 | ||
这个确实。 | ||
肯定有啊,现在大学生不是无处不在吗? | ||
都拼命搞 为了生活费可能是 | ||
现在大学生放假了好多来做这个了 | ||
我准备去看下我多少级了 | ||
今天自言自语的 人好像没多少了 | ||
现在聊项目就是要开心 | ||
你现在开心的聊着天? | ||
哈哈哈哈哈哈,我也很开心,兄弟。 | ||
别喊我大佬,打工人有的选择吗? | ||
打工人有什么选择,能吃饱肚子就不错了 | ||
看着还行,但是这年头,资金都要流转不便了。 | ||
对啊,亲戚朋友,现在开口讨要,都讨不回,这年头大家都难。 | ||
现在这波年轻人难吧,现在社会竞争压力太大了。 | ||
都需要富婆哈 | ||
少奋斗几年啊哈哈哈 | ||
年轻人多闯闯。 | ||
现在抖音的资源、商机挺多的 | ||
抖音里没有自己的老婆 | ||
抖音里的美女还是很多的 | ||
抖音还会猜你的喜好 给你推送 可怕不 | ||
抖音太容易上瘾了,一刷就是好几个小时,自己都浑然不觉 | ||
抖音太浪费时间了 | ||
上班上厕所蹲着刷抖音 | ||
刷抖音时间过的快 | ||
我经常在抖音看剧,哈哈哈省时间 | ||
你有娱乐圈最喜欢的明星吗 | ||
明星日进斗金 | ||
对,香港的明星才叫明星 | ||
你可以永远相信港台明星 | ||
那肯定,他们的一些方面是走在前面的 | ||
现在国家在整顿综艺 哈哈 | ||
湖南卫视都不太行了 | ||
基本上动不动就是情感剧 也就前面几集好看,到后面就没意思了 | ||
看动漫吧 | ||
现在动漫很强的 | ||
斗罗 斗破 完美世界啊好有很多 | ||
一周 | ||
凡人修仙传,灵龙也不错 | ||
看过 这么好看的国产动漫必须支持的 | ||
仙逆啥时候也能制作成动漫 | ||
国漫有看过元龙吗? | ||
斗破苍穹动漫还是可以的 | ||
国产动漫在慢慢兴起 | ||
一念永恒 也可以 有出动漫了 | ||
秦时明月看过没有 | ||
老了 看过这几部的小说动漫,年纪都算小了 | ||
好了 好了 换个话题吧,我们两尬聊了这么久 | ||
那就先休息一下吧,晚点继续 |