discord 自动水群脚本

news/2025/3/29 5:32:21/

原理:从你加入的channel里获取到历史消息随机选择一条发送至目标channel
需要先登录网页版获取authorization

# -*- coding: utf-8 -*-
"""
@Time : 2021/10/3 19:18
@Auth : d1rrick@scientistDAO
@File :autochat.py
@IDE :PyCharm"""
import requests
import json
import random
import time
import redef gen_context():context_list = ["hello bro","let's go !","to the moon!","nice","project","have a good day","good","luck","how's going","so do i","yeah","same to me","1","cool","so far so good","hi~","of course","really","cool~","ok","what?","why?","not bad","well done","great","perferct","thanks","ture","yes","no","here","interesting","it's funny","i am tired"]text = random.choice(context_list)return textdef get_context():chanel_list = []headr = {"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"}chanel_id = random.choice(chanel_list)url = "https://discord.com/api/v9/channels/{}/messages?limit=100".format(chanel_id)res = requests.get(url=url, headers=headr)result = json.loads(res.content)result_list = []for context in result:if ('<') not in context['content'] :if ('@') not in context['content'] :if ('http') not in context['content']:if ('?') not in context['content']:result_list.append(context['content'])return random.choice(result_list)def chat():chanel_list = ['']authorization_list = ['']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"}for chanel_id in chanel_list:msg = {"content": get_context(),"nonce": "82329451214{}33232234".format(random.randrange(0, 1000)),"tts": False}url = 'https://discord.com/api/v9/channels/{}/messages'.format(chanel_id)try:res = requests.post(url=url, headers=header, data=json.dumps(msg))print(res.content)except:passcontinuetime.sleep(random.randrange(30,50))if __name__ == '__main__':while True:try:chat()sleeptime = random.randrange(180, 240)time.sleep(sleeptime)except:passcontinue

http://www.ppmy.cn/news/970216.html

相关文章

Discord bot从聊天框获取文件并转发

在做discord bot开发时&#xff0c;有将discord聊天框中的图片下载袭来&#xff0c;并通过http转发出去的需求&#xff0c;以下是对应的代码&#xff0c;需要注意的是&#xff0c;因为是在国内网&#xff0c;通过http消息下载国外网络需要设置代理&#xff1a; func uploadFil…

Discord教程:Discord账号注册、Discord多账号登录和管理

Discord最初是为游戏玩家在群聊和交流而创建的。但自疫情爆发以来&#xff0c;许多企业、公司和初创公司发现&#xff0c;居家办公时使用Discord进行日常沟通非常便捷。 Discord不再是仅限于游戏玩家&#xff0c;平台建立了不同于其他任何社交空间的新空间&#xff0c;封闭又开…

PHP discord 第三方登录

成为discord开发者 成为discord开发者创建应用APPLICATION ID 应用ID, PUBLIC KEY 暂时无用(随时可以看)在OAuth2中 CLIENT ID, CLIENT SECRET 是需要的, 第一打开需要生成secret, 保存填写回调地址URL Generator 中可以生成你的登录跳转地址, 选择identify和email 就可以 $ur…

第三方应用接入discord midjourney

背景 目前midjourney没有对外开放api&#xff0c;想体验他们的服务只能在discord中进入他们的频道进行体验或者把他们的机器人拉入自己创建的服务器中Midjourney Quick Start Guide&#xff08;目前免费的已经无法体验了&#xff0c;需要使用就订阅&#x1f606;&#xff0c;后…

简单使用discord.com教程

1. 访问 discord.com , 选在您的浏览器中打开 2. 注册并登录成功后&#xff0c;创建自己的服务器 3. 今日自己的服务器,点击“添加您的首个APP”&#xff0c;APP很多&#xff0c;如音乐、图片类 4. 选个APP进入&#xff0c;然后“添加至服务器”进行授权&#xff0c;之后回自己…

chatgpt赋能python:Python操作Word文档:让文档操作更加便利

Python 操作 Word 文档&#xff1a;让文档操作更加便利 在绝大多数办公场合&#xff0c;Word 文档的使用都是必不可少的&#xff0c;因为它不仅可以用来撰写文档&#xff0c;还可以用来制作演示文稿和制作书籍等。如果您想要提高工作效率&#xff0c;那么掌握 Python 操作 Wor…

chatgpt赋能python:Python创建Word文档指南

Python创建Word文档指南 在今天的数字时代&#xff0c;Word文档仍然是最常见和使用的文档类型之一。Python是一个强大的编程语言&#xff0c;可以用于自动化创建各种类型的文档&#xff0c;包括Word文档。在本篇文章中&#xff0c;我们将介绍如何使用Python创建Word文档&#…

chatgpt赋能python:Python处理Word文档

Python处理Word文档 介绍 Microsoft Word是业界最流行的办公文档编辑工具之一。对于文档处理工作&#xff0c;Word是必不可少的工具之一。然而&#xff0c;尽管Word是十分强大的&#xff0c;但在处理大量数据时&#xff0c;手动处理每个文件是费时费力的。幸运的是&#xff0…