-
Notifications
You must be signed in to change notification settings - Fork 0
/
pub.py
47 lines (35 loc) · 1.13 KB
/
pub.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import discord
import os
from discord.ext import commands
from collections import deque
## Bot to publish announcements
client = commands.Bot(command_prefix = 'r!')
client.remove_command("help")
creds = open('token.txt', 'r')
channelQue = deque([])
bot = commands.Bot(...)
bot.channel_id = 0
@client.event
async def on_ready():
await client.change_presence(status = discord.Status.dnd, activity = discord.Game('r!help'))
print('Ready..')
@client.command(pass_context=True)
async def set(ctx, arg):
bot.channel_id = arg[2:-1]
channel = client.get_channel(int(bot.channel_id))
await ctx.send(f"Set to Publish channel {bot.channel_id}")
channelQue.append(int(bot.channel_id))
@client.command()
async def help(ctx):
embedPublish=discord.Embed(title="Auto Publisher",color=0xf90101)
embedPublish.add_field(name="Usage", value="r!set #channelname", inline=False)
await ctx.send(embed=embedPublish)
@client.event
async def on_message(message):
await client.process_commands(message)
for channel in channelQue:
if channel == message.channel.id:
await message.publish()
## Don't edit under this line.
key = creds
client.run(key.read())