-
Notifications
You must be signed in to change notification settings - Fork 7
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 4ab4100
Showing
4 changed files
with
111 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,10 @@ | ||
{ | ||
"Config": [ | ||
{ | ||
"token": "", | ||
"channelids": [channelids], | ||
"message": "hello! this message is sent every 2 mins :)", | ||
"web": "true" | ||
} | ||
] | ||
} |
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,31 @@ | ||
import os | ||
try: | ||
import flask | ||
except ImportError: | ||
print("Flask Not Found...\nInstalling...") | ||
os.system("pip install flask") | ||
print("Flask Installed") | ||
|
||
from flask import Flask | ||
from threading import Thread | ||
import random | ||
|
||
|
||
app = Flask('') | ||
|
||
@app.route('/') | ||
def home(): | ||
return 'Sub To The Gamer3514' | ||
|
||
def run(): | ||
app.run( | ||
host='0.0.0.0', | ||
port=random.randint(2000,9000) | ||
) | ||
|
||
def keep_alive(): | ||
''' | ||
Creates and starts new thread that runs the function run. | ||
''' | ||
t = Thread(target=run) | ||
t.start() |
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,58 @@ | ||
#Import Modules | ||
from http.client import HTTPSConnection | ||
from sys import stderr | ||
from json import dumps | ||
from time import sleep | ||
import json | ||
#Load Config | ||
with open('./config.json') as f: | ||
data = json.load(f) | ||
for c in data['Config']: | ||
print('Loading...') | ||
channelids = c['channelids'] #modify this in config.json | ||
token = c['token'] #modify this in config.json | ||
message = c['message'] #modify this in config.json | ||
web = c['web'] #modify this in config.json | ||
header_data = { | ||
"content-type": "application/json", | ||
"user-agent": "discordapp.com", | ||
"authorization": token | ||
} | ||
|
||
def get_connection(): | ||
return HTTPSConnection("discordapp.com", 443) | ||
|
||
def send_message(conn, channel_id, message_data): | ||
try: | ||
conn.request("POST", f"/api/v7/channels/{channel_id}/messages", message_data, header_data) | ||
resp = conn.getresponse() | ||
|
||
if 199 < resp.status < 300: | ||
print("Message Sent") | ||
pass | ||
|
||
else: | ||
stderr.write(f"HTTP {resp.status}: {resp.reason}\n") | ||
pass | ||
|
||
except: | ||
stderr.write("Error\n") | ||
|
||
def main(): | ||
message_data = { | ||
"content": message, | ||
"tts": "false" | ||
} | ||
for channelid in channelids: | ||
send_message(get_connection(), channelid, dumps(message_data)) | ||
#Keep Alive | ||
if web == "true": | ||
from keepalive import keep_alive | ||
keep_alive() | ||
else: | ||
print("Web Server Disabled") | ||
#Start The Sender | ||
if __name__ == '__main__': | ||
while True: | ||
main() | ||
sleep(120) #How often the message should be sent (in seconds), every 1 hour = 3600 |
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,12 @@ | ||
# AutoSendDiscordMessage | ||
A simple Python code to send a message with your discord account every set amount of time, without having to be online. | ||
|
||
- Support: https://discord.gg/3qvpkgWSbF | ||
# Setup | ||
1. Fill Out The Config In `config.json` | ||
2. Run `python main.py` | ||
3. Done! If you want to change more then that is fine! | ||
# How To Get Discord Token | ||
1. Go on [Discord Web](https://discord.com/app) and open [Console](https://www.youtube.com/watch?v=nFFKnWw-_Ys&ab_channel=MDTechVideos) | ||
2. In console paste the following command: `webpackChunkdiscord_app.push([[""],{},req=>copy(Object.values(req.c).find(x => x?.exports?.default?.getToken).exports.default.getToken())])` | ||
3. Now your token should be coppied to your clipboard! |