-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
41 lines (30 loc) · 1.01 KB
/
Copy pathbot.py
File metadata and controls
41 lines (30 loc) · 1.01 KB
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
import os
import discord
from dotenv import load_dotenv
from discord.ext import commands
from scrape_data import *
load_dotenv()
# GET TOKEN FROM .ENV FILE
TOKEN = os.getenv('DISCORD_TOKEN')
# GET GUILD FROM .ENV FILE
GUILD = os.getenv('DISCORD_GUILD')
bot = commands.Bot(command_prefix='!')
@bot.event
async def on_ready():
# A bot user can be connected to many guilds.
for guild in bot.guilds:
if guild.name == GUILD:
break
print("{} has connected to Discord\nGuild: name:{}(id:{})".format(
bot.user, guild.name, guild.id))
members = '\n - '.join([member.name for member in guild.members])
print("Guild Members:\n - {}".format(members))
@bot.command(name='flutter', help='Display the latest version of Flutter and Dart SDKs')
async def call_version(ctx):
f_program = FlutterVersion()
f_result = f_program.get_response()
d_program = DartVersion()
d_result = d_program.get_response()
msg = f_result + "\n" + d_result
await ctx.send(msg)
bot.run(TOKEN)