Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
UCC
Discord Bot
Commits
6c8335ed
Commit
6c8335ed
authored
Jan 30, 2020
by
Timothy du Heaume
Browse files
load discord_token at runtime
parent
9664d0e1
Changes
2
Show whitespace changes
Inline
Side-by-side
src/config.rs
View file @
6c8335ed
...
@@ -11,8 +11,6 @@ lazy_static! {
...
@@ -11,8 +11,6 @@ lazy_static! {
pub
static
ref
CONFIG
:
UccbotConfig
=
toml
::
from_str
(
&
CONFIG_FILE
)
.unwrap
();
pub
static
ref
CONFIG
:
UccbotConfig
=
toml
::
from_str
(
&
CONFIG_FILE
)
.unwrap
();
}
}
pub
static
DISCORD_TOKEN
:
&
str
=
include_str!
(
"discord_token"
);
#[derive(Deserialize)]
#[derive(Deserialize)]
pub
struct
UccbotConfig
{
pub
struct
UccbotConfig
{
pub
server_id
:
u64
,
pub
server_id
:
u64
,
...
...
src/main.rs
View file @
6c8335ed
...
@@ -5,7 +5,7 @@ extern crate lazy_static;
...
@@ -5,7 +5,7 @@ extern crate lazy_static;
extern
crate
log
;
extern
crate
log
;
extern
crate
simplelog
;
extern
crate
simplelog
;
use
simplelog
::
*
;
use
simplelog
::
*
;
use
std
::
fs
::
File
;
use
std
::
fs
::
{
File
,
read_to_string
}
;
use
serenity
::{
use
serenity
::{
model
::{
channel
,
channel
::
Message
,
gateway
::
Ready
,
guild
::
Member
},
model
::{
channel
,
channel
::
Message
,
gateway
::
Ready
,
guild
::
Member
},
...
@@ -155,7 +155,7 @@ fn main() {
...
@@ -155,7 +155,7 @@ fn main() {
// Configure the client with your Discord bot token in the environment.
// Configure the client with your Discord bot token in the environment.
let
token
=
config
::
DISCORD_TOKEN
;
let
token
=
read_to_string
(
"discord_token"
)
.unwrap
()
;
// Create a new instance of the Client, logging in as a bot. This will
// Create a new instance of the Client, logging in as a bot. This will
// automatically prepend your bot token with "Bot ", which is a requirement
// automatically prepend your bot token with "Bot ", which is a requirement
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment