Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d7133d699f | |||
| 1a0328abda | |||
| 6a004c3fbf | |||
| 4a042694d1 | |||
| fc12a74681 | |||
| fe38dec195 |
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
|||||||
python-version: 3.7
|
python-version: 3.7
|
||||||
- name: Update Version
|
- name: Update Version
|
||||||
id: semver
|
id: semver
|
||||||
uses: RightBrain-Networks/semver-action@1.0.0
|
uses: RightBrain-Networks/semver-action@master
|
||||||
with:
|
with:
|
||||||
mode: get
|
mode: get
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
|||||||
2
.github/workflows/version.yml
vendored
2
.github/workflows/version.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
|||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v1
|
||||||
- name: Run Auto-Semver
|
- name: Run Auto-Semver
|
||||||
id: semver
|
id: semver
|
||||||
uses: RightBrain-Networks/semver-action@1.0.0
|
uses: RightBrain-Networks/semver-action@master
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
id: create_release
|
id: create_release
|
||||||
uses: actions/create-release@v1
|
uses: actions/create-release@v1
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import discord, boto3, configparser, os, sys
|
import discord, boto3, configparser, os, sys
|
||||||
|
|
||||||
version = "0.0.0"
|
version = "0.0.3"
|
||||||
|
|
||||||
# Get token at: https://discord.com/developers/applications/
|
# Get token at: https://discord.com/developers/applications/
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
@@ -26,6 +26,9 @@ if sns == None:
|
|||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
class Notifier(discord.Client):
|
class Notifier(discord.Client):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self.enabled = True
|
||||||
async def on_ready(self):
|
async def on_ready(self):
|
||||||
print(f"Logged in as {self.user}")
|
print(f"Logged in as {self.user}")
|
||||||
|
|
||||||
@@ -39,15 +42,36 @@ class Notifier(discord.Client):
|
|||||||
print(f"I see {message.author}")
|
print(f"I see {message.author}")
|
||||||
await message.channel.send(":eye: You have been seen! :eye:")
|
await message.channel.send(":eye: You have been seen! :eye:")
|
||||||
|
|
||||||
if str(message.author) in [str(self.user), "The Genuine Wonder#2859"]:
|
if str(message.author) == config["discord"]["ignore_user"]:
|
||||||
|
if str(message.channel).lower() == f"direct message with {config['discord']['ignore_user']}".lower():
|
||||||
|
if message.content.lower() == "start":
|
||||||
|
self.enabled = True
|
||||||
|
print("Notifications were enabled")
|
||||||
|
await message.channel.send("Notifications were enabled")
|
||||||
|
elif message.content.lower() == "stop":
|
||||||
|
self.enabled = False
|
||||||
|
print("Notifications were disabled")
|
||||||
|
await message.channel.send("Notifications were disabled")
|
||||||
|
elif message.content.lower() == "status":
|
||||||
|
if self.enabled:
|
||||||
|
await message.channel.send("Notifications are currently enabled!")
|
||||||
|
else:
|
||||||
|
await message.channel.send("Notifications are currently disabled!")
|
||||||
|
else:
|
||||||
|
await message.channel.send("Valid commands are 'START', 'STATUS', and 'STOP'")
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
if str(message.author) in [str(self.user), config["discord"]["ignore_user"]]:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Format and print mesage
|
if self.enabled:
|
||||||
formatted_message = f"<{message.author}> \"{message.content}\" from #{message.channel} on {message.guild}"
|
# Format and print mesage
|
||||||
print(formatted_message)
|
formatted_message = f"<{message.author}> \"{message.content}\" from #{message.channel} on {message.guild}"
|
||||||
|
print(formatted_message)
|
||||||
|
|
||||||
# Send notification to SNS
|
# Send notification to SNS
|
||||||
sns.publish(Message=formatted_message)
|
sns.publish(Message=formatted_message)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
Reference in New Issue
Block a user